Résolu Problème au tp pour aller dans ma dimension
-
Salut
J’ai créé une nouvelle dimension (id -5). Quand je passe le portal pour y aller, je me retrouve dans cette dimension, mais avec une copie de l’overworld. J’ai cherché dans les codes, sur plusieurs sites (ici, j’ai trouvé un cas similaire au miens : http://www.minecraftforgefrance.fr/showthread.php?tid=680&highlight=dimension , mais il n’y a pas de réponse). Voilà mes classes :
:::This_is_Halloween (la classe principale)
Au début de la classe : public static int dimensionID = -5;
Dans le Init :
BiomeList.BiomeList(); DimensionManager.registerProviderType(dimensionID, WorldProviderNOM.class, false); DimensionManager.registerDimension(dimensionID, dimensionID);
Dans le post Init :
BiomeList.worldTypeNOM = new WorldTypeNOM();
**BiomeList **(rien dedans, pour l’instant)
package This_is_Halloween; public class BiomeList { public static WorldTypeNOM worldTypeNOM; public static void BiomeList() { } }
**WorldType
**package This_is_Halloween; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.GenLayerBiomeEdge; import net.minecraft.world.gen.layer.GenLayerZoom; import net.minecraftforge.common.DimensionManager; public class WorldTypeNOM extends WorldType{ public WorldTypeNOM() { super("nomDeVotreType"); DimensionManager.unregisterProviderType(This_is_Halloween.dimensionID); DimensionManager.registerProviderType(This_is_Halloween.dimensionID, WorldProviderNOM.class, true); } public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer) { GenLayer ret = new BiomeGenLayerNOM(200L, parentLayer); ret = GenLayerZoom.magnify(1000L, ret, 2); ret = new GenLayerBiomeEdge(1000L, ret); return ret; } public WorldChunkManager getChunkManager(World world) { return new WorldChunkManagerNOM(world); } }
**WorldProvider
**package This_is_Halloween; import net.minecraft.init.Blocks; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProviderHell; import net.minecraft.world.WorldProviderSurface; public class WorldProviderNOM extends WorldProvider{ public boolean canCoordinateBeSpawn(int par1, int par2) { return this.worldObj.getTopBlock(par1, par2) == Blocks.grass || this.worldObj.getTopBlock(par1, par2) == Blocks.sand || this.worldObj.getTopBlock(par1, par2) == Blocks.stone || this.worldObj.getTopBlock(par1, par2) == Blocks.snow_layer; } // Blocks where we can spawn public String getDimensionName() { return "NOM"; } // Dimension Name public String getSaveFolder() { return this.getDimensionName(); } // Name of the dimension's folder }
**BiomeGenLayer
**package This_is_Halloween; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; public class BiomeGenLayerNOM extends GenLayer { protected BiomeGenBase[] baseBiomes = {BiomeGenBase.desert}; public BiomeGenLayerNOM(long seed, GenLayer genlayer) { super(seed); this.parent = genlayer; } public BiomeGenLayerNOM(long seed) { super(seed); } @Override public int[] getInts(int x, int z, int width, int depth) { int[] dest = IntCache.getIntCache(width * depth); for(int dz = 0; dz < depth; dz++) { for(int dx = 0; dx < width; dx++) { this.initChunkSeed(dx + x, dz + z); dest[(dx + dz * width)] = this.baseBiomes[nextInt(this.baseBiomes.length)].biomeID; } } return dest; } }
**GenLayer
**package This_is_Halloween; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.GenLayerVoronoiZoom; import net.minecraft.world.gen.layer.GenLayerZoom; public abstract class GenLayerNOM extends GenLayer{ public GenLayerNOM(long seed) { super(seed); } public static GenLayer[] makeTheWorld(long seed) { GenLayer biomes = new BiomeGenLayerNOM(1L); biomes = new GenLayerZoom(1000L, biomes); biomes = new GenLayerZoom(1001L, biomes); biomes = new GenLayerZoom(1002L, biomes); biomes = new GenLayerZoom(1003L, biomes); biomes = new GenLayerZoom(1004L, biomes); biomes = new GenLayerZoom(1005L, biomes); GenLayer genlayervoronoizoom = new GenLayerVoronoiZoom(10L, biomes); biomes.initWorldGenSeed(seed); genlayervoronoizoom.initWorldGenSeed(seed); return new GenLayer[] {biomes, genlayervoronoizoom}; } }
**WorldChunkManager
**package This_is_Halloween; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; public class WorldChunkManagerNOM extends WorldChunkManager { private GenLayer myGenBiomes; private GenLayer myBiomeIndexLayer; private BiomeCache myBiomeCache; private List <biomegenbase>myBiomesToSpawnIn; public WorldChunkManagerNOM() { this.myBiomeCache = new BiomeCache(this); this.myBiomesToSpawnIn = new ArrayList<biomegenbase>(); this.myBiomesToSpawnIn.add(BiomeGenBase.desert); } public WorldChunkManagerNOM(long seed, WorldType worldtype) { this(); GenLayer[] agenlayer = GenLayerNOM.makeTheWorld(seed); this.myGenBiomes = agenlayer[0]; this.myBiomeIndexLayer = agenlayer[1]; } public WorldChunkManagerNOM(World world) { this(world.getSeed(), world.provider.terrainType); } public List <biomegenbase>getBiomesToSpawnIn() { return this.myBiomesToSpawnIn; } public BiomeGenBase getBiomeGenAt(int x, int z) { BiomeGenBase biome = this.myBiomeCache.getBiomeGenAt(x, z); if(biome == null) { return BiomeGenBase.desert; } return biome; } public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) { if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) { par1ArrayOfFloat = new float[par4 * par5]; } Arrays.fill(par1ArrayOfFloat, 0, par4 * par5, 0.0F); return par1ArrayOfFloat; } @SideOnly(Side.CLIENT) public float getTemperatureAtHeight(float par1, int par2) { return par1; } public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { IntCache.resetIntCache(); if(par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } int[] aint = this.myGenBiomes.getInts(par2, par3, par4, par5); for(int i = 0; i < par4 * par5; ++i) { if(aint* >= 0) { par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*); } else { par1ArrayOfBiomeGenBase* = BiomeGenBase.desert; } } return par1ArrayOfBiomeGenBase; } public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true); } public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int x, int y, int width, int length, boolean cacheFlag) { IntCache.resetIntCache(); if(par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < width * length) { par1ArrayOfBiomeGenBase = new BiomeGenBase[width * length]; } if(cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (y & 15) == 0) { BiomeGenBase[] abiomegenbase1 = this.myBiomeCache.getCachedBiomes(x, y); System.arraycopy(abiomegenbase1, 0, par1ArrayOfBiomeGenBase, 0, width * length); return par1ArrayOfBiomeGenBase; } else { int[] aint = this.myBiomeIndexLayer.getInts(x, y, width, length); for(int i = 0; i < width * length; ++i) { if(aint* >= 0) { par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*); } else { par1ArrayOfBiomeGenBase* = BiomeGenBase.desert; } } return par1ArrayOfBiomeGenBase; } } public boolean areBiomesViable(int par1, int par2, int par3, List par4List) { IntCache.resetIntCache(); int l = par1 - par3 >> 2; int i1 = par2 - par3 >> 2; int j1 = par1 + par3 >> 2; int k1 = par2 + par3 >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.myGenBiomes.getInts(l, i1, l1, i2); for(int j2 = 0; j2 < l1 * i2; ++j2) { BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]); if(!par4List.contains(biomegenbase)) { return false; } } return true; } public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random) { IntCache.resetIntCache(); int l = par1 - par3 >> 2; int i1 = par2 - par3 >> 2; int j1 = par1 + par3 >> 2; int k1 = par2 + par3 >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.myGenBiomes.getInts(l, i1, l1, i2); ChunkPosition chunkposition = null; int j2 = 0; for(int k2 = 0; k2 < l1 * i2; ++k2) { int l2 = l + k2 % l1 << 2; int i3 = i1 + k2 / l1 << 2; BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]); if(par4List.contains(biomegenbase) && (chunkposition == null || par5Random.nextInt(j2 + 1) == 0)) { chunkposition = new ChunkPosition(l2, 0, i3); ++j2; } } return chunkposition; } public void cleanupCache() { this.myBiomeCache.cleanupCache(); }
:::
Merci d’avance</biomegenbase></biomegenbase></biomegenbase>
-
:huh:
Je ne sais pas si tout le monde a compris mon problème : la dimension est une copie de l’overworld. Et je ne sais pas comment résoudre, même après mes recherches -
pourquoi tu utilise un world type ? tu peux aussi envoyer le code de ton portail ?
-
Tu as du oublié de réécrire une fonction, regarde les classes pour le Nether.
-
BlockPortal :
package This_is_Halloween; import net.minecraft.block.Block; import net.minecraft.block.BlockPortal; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; public class BlockPortalNOM extends BlockPortal{ public BlockPortalNOM() { super(); this.setCreativeTab(CreativeTabs.tabBlock); } @Override public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { if ((par5Entity.ridingEntity == null) && (par5Entity.riddenByEntity == null) && ((par5Entity instanceof EntityPlayerMP))) { EntityPlayerMP player = (EntityPlayerMP) par5Entity; MinecraftServer mServer = MinecraftServer.getServer(); if (player.timeUntilPortal > 0) { player.timeUntilPortal = 10; } else if (player.dimension != This_is_Halloween.dimensionID) { player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, This_is_Halloween.dimensionID, new TeleporterNOM(mServer.worldServerForDimension(This_is_Halloween.dimensionID))); } else; { player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterNOM(mServer.worldServerForDimension(1))); } } } @Override public boolean func_150000_e(World par1World, int par2, int par3, int par4) { byte b0 = 0; byte b1 = 0; if (par1World.getBlock(par2 - 1, par3, par4) == Blocks.sandstone || par1World.getBlock(par2 + 1, par3, par4) == Blocks.sandstone) { b0 = 1; } if (par1World.getBlock(par2, par3, par4 - 1) == Blocks.sandstone || par1World.getBlock(par2, par3, par4 + 1) == Blocks.sandstone) { b1 = 1; } if (b0 == b1) { return false; } else { if (par1World.isAirBlock(par2 - b0, par3, par4 - b1)) { par2 -= b0; par4 -= b1; } int l; int i1; for (l = -1; l <= 2; ++l) { for (i1 = -1; i1 <= 3; ++i1) { boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3; if (l != -1 && l != 2 || i1 != -1 && i1 != 3) { Block j1 = par1World.getBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l); boolean isAirBlock = par1World.isAirBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l); if (flag) { if (j1 != Blocks.sandstone) { return false; } } else if (!isAirBlock && j1 != Blocks.fire) { return false; } } } } for (l = 0; l < 2; ++l) { for (i1 = 0; i1 < 3; ++i1) { par1World.setBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l, CreateBlocks.PortalNOMBlock, 0, 2); } } return true; } } @Override public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) { byte b0 = 0; byte b1 = 1; if (par1World.getBlock(par2 - 1, par3, par4) == this || par1World.getBlock(par2 + 1, par3, par4) == this) { b0 = 1; b1 = 0; } int i1; for (i1 = par3; par1World.getBlock(par2, i1 - 1, par4) == this; –i1) { ; } if (par1World.getBlock(par2, i1 - 1, par4) != Blocks.sandstone) { par1World.setBlockToAir(par2, par3, par4); } else { int j1; for (j1 = 1; j1 < 4 && par1World.getBlock(par2, i1 + j1, par4) == this; ++j1) { ; } if (j1 == 3 && par1World.getBlock(par2, i1 + j1, par4) == Blocks.sandstone) { boolean flag = par1World.getBlock(par2 - 1, par3, par4) == this || par1World.getBlock(par2 + 1, par3, par4) == this; boolean flag1 = par1World.getBlock(par2, par3, par4 - 1) == this || par1World.getBlock(par2, par3, par4 + 1) == this; if (flag && flag1) { par1World.setBlockToAir(par2, par3, par4); } else { if ((par1World.getBlock(par2 + b0, par3, par4 + b1) != Blocks.sandstone || par1World.getBlock(par2 - b0, par3, par4 - b1) != this) && (par1World.getBlock(par2 - b0, par3, par4 - b1) != Blocks.sandstone || par1World.getBlock(par2 + b0, par3, par4 + b1) != this)) { par1World.setBlockToAir(par2, par3, par4); } } } else { par1World.setBlockToAir(par2, par3, par4); } } } }
Teleporter :
package This_is_Halloween; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.Direction; import net.minecraft.util.LongHashMap; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.Teleporter; import net.minecraft.world.WorldServer; public class TeleporterNOM extends Teleporter { private final WorldServer worldServerInstance; /** A private Random() function in Teleporter */ private final Random random; /** Stores successful portal placement locations for rapid lookup. */ private final LongHashMap destinationCoordinateCache = new LongHashMap(); /** * A list of valid keys for the destinationCoordainteCache. These are based on the X & Z of the players initial * location. */ @SuppressWarnings("rawtypes") private final List destinationCoordinateKeys = new ArrayList(); public TeleporterNOM(WorldServer par1WorldServer) { super(par1WorldServer); this.worldServerInstance = par1WorldServer; this.random = new Random(par1WorldServer.getSeed()); } /** * Place an entity in a nearby portal, creating one if necessary. */ @Override public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) { if (this.worldServerInstance.provider.dimensionId != 1) { if (!this.placeInExistingPortal(par1Entity, par2, par4, par6, par8)) { this.makePortal(par1Entity); this.placeInExistingPortal(par1Entity, par2, par4, par6, par8); } } else { int i = MathHelper.floor_double(par1Entity.posX); int j = MathHelper.floor_double(par1Entity.posY) - 1; int k = MathHelper.floor_double(par1Entity.posZ); byte b0 = 1; byte b1 = 0; for (int l = -2; l <= 2; ++l) { for (int i1 = -2; i1 <= 2; ++i1) { for (int j1 = -1; j1 < 3; ++j1) { int k1 = i + i1 * b0 + l * b1; int l1 = j + j1; int i2 = k + i1 * b1 - l * b0; boolean flag = j1 < 0; this.worldServerInstance.setBlock(k1, l1, i2, flag ? Blocks.sandstone : Blocks.air); } } } par1Entity.setLocationAndAngles((double)i, (double)j, (double)k, par1Entity.rotationYaw, 0.0F); par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D; } } /** * Place an entity in a nearby portal which already exists. */ @SuppressWarnings("unchecked") @Override public boolean placeInExistingPortal(Entity par1Entity, double par2, double par4, double par6, float par8) { short short1 = 128; double d3 = -1.0D; int i = 0; int j = 0; int k = 0; int l = MathHelper.floor_double(par1Entity.posX); int i1 = MathHelper.floor_double(par1Entity.posZ); long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1); boolean flag = true; double d4; int k1; if (this.destinationCoordinateCache.containsItem(j1)) { PortalPosition portalposition = (PortalPosition)this.destinationCoordinateCache.getValueByKey(j1); d3 = 0.0D; i = portalposition.posX; j = portalposition.posY; k = portalposition.posZ; portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime(); flag = false; } else { for (k1 = l - short1; k1 <= l + short1; ++k1) { double d5 = (double)k1 + 0.5D - par1Entity.posX; for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) { double d6 = (double)l1 + 0.5D - par1Entity.posZ; for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) { if (this.worldServerInstance.getBlock(k1, i2, l1) == This_is_Halloween.portalNOMBlock) { while (this.worldServerInstance.getBlock(k1, i2 - 1, l1) == This_is_Halloween.portalNOMBlock) { --i2; } d4 = (double)i2 + 0.5D - par1Entity.posY; double d7 = d5 * d5 + d4 * d4 + d6 * d6; if (d3 < 0.0D || d7 < d3) { d3 = d7; i = k1; j = i2; k = l1; } } } } } } if (d3 >= 0.0D) { if (flag) { this.destinationCoordinateCache.add(j1, new PortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime())); this.destinationCoordinateKeys.add(Long.valueOf(j1)); } double d8 = (double)i + 0.5D; double d9 = (double)j + 0.5D; d4 = (double)k + 0.5D; int j2 = -1; if (this.worldServerInstance.getBlock(i - 1, j, k) == This_is_Halloween.portalNOMBlock) { j2 = 2; } if (this.worldServerInstance.getBlock(i + 1, j, k) == This_is_Halloween.portalNOMBlock) { j2 = 0; } if (this.worldServerInstance.getBlock(i, j, k - 1) == This_is_Halloween.portalNOMBlock) { j2 = 3; } if (this.worldServerInstance.getBlock(i, j, k + 1) == This_is_Halloween.portalNOMBlock) { j2 = 1; } int k2 = par1Entity.getTeleportDirection(); if (j2 > -1) { int l2 = Direction.rotateLeft[j2]; int i3 = Direction.offsetX[j2]; int j3 = Direction.offsetZ[j2]; int k3 = Direction.offsetX[l2]; int l3 = Direction.offsetZ[l2]; boolean flag1 = !this.worldServerInstance.isAirBlock(i + i3 + k3, j, k + j3 + l3) || !this.worldServerInstance.isAirBlock(i + i3 + k3, j + 1, k + j3 + l3); boolean flag2 = !this.worldServerInstance.isAirBlock(i + i3, j, k + j3) || !this.worldServerInstance.isAirBlock(i + i3, j + 1, k + j3); if (flag1 && flag2) { j2 = Direction.rotateOpposite[j2]; l2 = Direction.rotateOpposite[l2]; i3 = Direction.offsetX[j2]; j3 = Direction.offsetZ[j2]; k3 = Direction.offsetX[l2]; l3 = Direction.offsetZ[l2]; k1 = i - k3; d8 -= (double)k3; int i4 = k - l3; d4 -= (double)l3; flag1 = !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j, i4 + j3 + l3) || !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j + 1, i4 + j3 + l3); flag2 = !this.worldServerInstance.isAirBlock(k1 + i3, j, i4 + j3) || !this.worldServerInstance.isAirBlock(k1 + i3, j + 1, i4 + j3); } float f1 = 0.5F; float f2 = 0.5F; if (!flag1 && flag2) { f1 = 1.0F; } else if (flag1 && !flag2) { f1 = 0.0F; } else if (flag1 && flag2) { f2 = 0.0F; } d8 += (double)((float)k3 * f1 + f2 * (float)i3); d4 += (double)((float)l3 * f1 + f2 * (float)j3); float f3 = 0.0F; float f4 = 0.0F; float f5 = 0.0F; float f6 = 0.0F; if (j2 == k2) { f3 = 1.0F; f4 = 1.0F; } else if (j2 == Direction.rotateOpposite[k2]) { f3 = -1.0F; f4 = -1.0F; } else if (j2 == Direction.rotateRight[k2]) { f5 = 1.0F; f6 = -1.0F; } else { f5 = -1.0F; f6 = 1.0F; } double d10 = par1Entity.motionX; double d11 = par1Entity.motionZ; par1Entity.motionX = d10 * (double)f3 + d11 * (double)f6; par1Entity.motionZ = d10 * (double)f5 + d11 * (double)f4; par1Entity.rotationYaw = par8 - (float)(k2 * 90) + (float)(j2 * 90); } else { par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D; } par1Entity.setLocationAndAngles(d8, d9, d4, par1Entity.rotationYaw, par1Entity.rotationPitch); return true; } else { return false; } } @Override public boolean makePortal(Entity par1Entity) { byte b0 = 16; double d0 = -1.0D; int i = MathHelper.floor_double(par1Entity.posX); int j = MathHelper.floor_double(par1Entity.posY); int k = MathHelper.floor_double(par1Entity.posZ); int l = i; int i1 = j; int j1 = k; int k1 = 0; int l1 = this.random.nextInt(4); int i2; double d1; double d2; int j2; int k2; int l2; int i3; int j3; int k3; int l3; int i4; int j4; int k4; double d3; double d4; for (i2 = i - b0; i2 <= i + b0; ++i2) { d1 = (double)i2 + 0.5D - par1Entity.posX; for (j2 = k - b0; j2 <= k + b0; ++j2) { d2 = (double)j2 + 0.5D - par1Entity.posZ; label274: for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; –k2) { if (this.worldServerInstance.isAirBlock(i2, k2, j2)) { while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2)) { --k2; } for (i3 = l1; i3 < l1 + 4; ++i3) { l2 = i3 % 2; k3 = 1 - l2; if (i3 % 4 >= 2) { l2 = -l2; k3 = -k3; } for (j3 = 0; j3 < 3; ++j3) { for (i4 = 0; i4 < 4; ++i4) { for (l3 = -1; l3 < 4; ++l3) { k4 = i2 + (i4 - 1) * l2 + j3 * k3; j4 = k2 + l3; int l4 = j2 + (i4 - 1) * k3 - j3 * l2; if (l3 < 0 && !this.worldServerInstance.getBlock(k4, j4, l4).getMaterial().isSolid() || l3 >= 0 && !this.worldServerInstance.isAirBlock(k4, j4, l4)) { continue label274; } } } } d4 = (double)k2 + 0.5D - par1Entity.posY; d3 = d1 * d1 + d4 * d4 + d2 * d2; if (d0 < 0.0D || d3 < d0) { d0 = d3; l = i2; i1 = k2; j1 = j2; k1 = i3 % 4; } } } } } } if (d0 < 0.0D) { for (i2 = i - b0; i2 <= i + b0; ++i2) { d1 = (double)i2 + 0.5D - par1Entity.posX; for (j2 = k - b0; j2 <= k + b0; ++j2) { d2 = (double)j2 + 0.5D - par1Entity.posZ; label222: for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; --k2) { if (this.worldServerInstance.isAirBlock(i2, k2, j2)) { while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2)) { --k2; } for (i3 = l1; i3 < l1 + 2; ++i3) { l2 = i3 % 2; k3 = 1 - l2; for (j3 = 0; j3 < 4; ++j3) { for (i4 = -1; i4 < 4; ++i4) { l3 = i2 + (j3 - 1) * l2; k4 = k2 + i4; j4 = j2 + (j3 - 1) * k3; if (i4 < 0 && !this.worldServerInstance.getBlock(l3, k4, j4).getMaterial().isSolid() || i4 >= 0 && !this.worldServerInstance.isAirBlock(l3, k4, j4)) { continue label222; } } } d4 = (double)k2 + 0.5D - par1Entity.posY; d3 = d1 * d1 + d4 * d4 + d2 * d2; if (d0 < 0.0D || d3 < d0) { d0 = d3; l = i2; i1 = k2; j1 = j2; k1 = i3 % 2; } } } } } } } int i5 = l; int j5 = i1; j2 = j1; int k5 = k1 % 2; int l5 = 1 - k5; if (k1 % 4 >= 2) { k5 = -k5; l5 = -l5; } boolean flag; if (d0 < 0.0D) { if (i1 < 70) { i1 = 70; } if (i1 > this.worldServerInstance.getActualHeight() - 10) { i1 = this.worldServerInstance.getActualHeight() - 10; } j5 = i1; for (k2 = -1; k2 <= 1; ++k2) { for (i3 = 1; i3 < 3; ++i3) { for (l2 = -1; l2 < 3; ++l2) { k3 = i5 + (i3 - 1) * k5 + k2 * l5; j3 = j5 + l2; i4 = j2 + (i3 - 1) * l5 - k2 * k5; flag = l2 < 0; this.worldServerInstance.setBlock(k3, j3, i4, flag ? Blocks.sandstone : Blocks.air); } } } } for (k2 = 0; k2 < 4; ++k2) { for (i3 = 0; i3 < 4; ++i3) { for (l2 = -1; l2 < 4; ++l2) { k3 = i5 + (i3 - 1) * k5; j3 = j5 + l2; i4 = j2 + (i3 - 1) * l5; flag = i3 == 0 || i3 == 3 || l2 == -1 || l2 == 3; this.worldServerInstance.setBlock(k3, j3, i4, flag ? Blocks.sandstone : CreateBlocks.PortalNOMBlock, 0, 2); } } for (i3 = 0; i3 < 4; ++i3) { for (l2 = -1; l2 < 4; ++l2) { k3 = i5 + (i3 - 1) * k5; j3 = j5 + l2; i4 = j2 + (i3 - 1) * l5; this.worldServerInstance.notifyBlocksOfNeighborChange(k3, j3, i4, this.worldServerInstance.getBlock(k3, j3, i4)); } } } return true; } /** * called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a * WorldServer.getTotalWorldTime() value. */ @SuppressWarnings("rawtypes") @Override public void removeStalePortalLocations(long par1) { if (par1 % 100L == 0L) { Iterator iterator = this.destinationCoordinateKeys.iterator(); long j = par1 - 600L; while (iterator.hasNext()) { Long olong = (Long)iterator.next(); PortalPosition portalposition = (PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue()); if (portalposition == null || portalposition.lastUpdateTime < j) { iterator.remove(); this.destinationCoordinateCache.remove(olong.longValue()); } } } } public class PortalPosition extends ChunkCoordinates { /** The worldtime at which this PortalPosition was last verified */ public long lastUpdateTime; public PortalPosition(int par2, int par3, int par4, long par5) { super(par2, par3, par4); this.lastUpdateTime = par5; } } }
-
Il fait quoi là ce “:” ?
} else; {
-
Salut, désolé pour le temps de la réponse
SCAREX –> je n’ai pas compris
Sinon, je pense avoir trouvé
Dans mon WorldProvider, j’ai ajouté : public void registerWorldChunkManager() { this.worldChunkMgr = new WorldChunkManagerNOM(); this.hasNoSky = true; this.dimensionId = This_is_Halloween.dimensionID; } public boolean isSurfaceWorld() { return false; }
Maintenant, j’ai une erreur dès que je passe le portal:
:::
[19:03:54] [Server thread/ERROR]: Encountered an unexpected exceptionnet.minecraft.util.ReportedException: Exception generating new chunk
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:198) ~[NetworkSystem.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]
Caused by: java.lang.NullPointerException
at This_is_Halloween.WorldChunkManagerNOM.getBiomesForGeneration(WorldChunkManagerNOM.java:87) ~[WorldChunkManagerNOM.class:?]
at net.minecraft.world.gen.ChunkProviderGenerate.func_147424_a(ChunkProviderGenerate.java:119) ~[ChunkProviderGenerate.class:?]
at net.minecraft.world.gen.ChunkProviderGenerate.provideChunk(ChunkProviderGenerate.java:229) ~[ChunkProviderGenerate.class:?]
at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:190) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:149) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:119) ~[ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:221) ~[ChunkProviderServer.class:?]
at net.minecraft.world.World.getChunkFromChunkCoords(World.java:482) ~[World.class:?]
at net.minecraft.world.World.setBlock(World.java:504) ~[World.class:?]
at net.minecraft.world.World.setBlock(World.java:681) ~[World.class:?]
at This_is_Halloween.TeleporterNOM.placeInPortal(TeleporterNOM.java:74) ~[TeleporterNOM.class:?]
at net.minecraft.server.management.ServerConfigurationManager.transferEntityToWorld(ServerConfigurationManager.java:625) ~[ServerConfigurationManager.class:?]
at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:529) ~[ServerConfigurationManager.class:?]
at This_is_Halloween.BlockPortalNOM.onEntityCollidedWithBlock(BlockPortalNOM.java:34) ~[BlockPortalNOM.class:?]
at net.minecraft.entity.Entity.func_145775_I(Entity.java:962) ~[Entity.class:?]
at net.minecraft.entity.Entity.moveEntity(Entity.java:895) ~[Entity.class:?]
at net.minecraft.entity.EntityLivingBase.moveEntityWithHeading(EntityLivingBase.java:1680) ~[EntityLivingBase.class:?]
at net.minecraft.entity.player.EntityPlayer.moveEntityWithHeading(EntityPlayer.java:1862) ~[EntityPlayer.class:?]
at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2023) ~[EntityLivingBase.class:?]
at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:612) ~[EntityPlayer.class:?]
at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1816) ~[EntityLivingBase.class:?]
at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:327) ~[EntityPlayer.class:?]
at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:330) ~[EntityPlayerMP.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:329) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37) ~[C03PacketPlayer.class:?]
at net.minecraft.network.play.client.C03PacketPlayer$C04PacketPlayerPosition.processPacket(C03PacketPlayer.java:163) ~[C03PacketPlayer$C04PacketPlayerPosition.class:?]
at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) ~[NetworkManager.class:?]
at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?]
… 5 more
[19:03:54] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Antonin\Documents\Codage\Minecraft\This_is_Halloween\v1.2\MC1.7\eclipse.\crash-reports\crash-2015-05-19_19.03.54-server.txt
[19:03:54] [Server thread/INFO]: Stopping server
[19:03:54] [Server thread/INFO]: Saving players
[19:03:54] [Server thread/INFO]: Saving worlds
[19:03:54] [Server thread/INFO]: Saving chunks for level ‘New World’/Overworld
[19:03:55] [Server thread/INFO]: Saving chunks for level ‘New World’/Nether
[19:03:55] [Server thread/INFO]: Saving chunks for level ‘New World’/The End
[19:03:55] [Server thread/INFO]: Saving chunks for level ‘New World’/NOM
[19:03:56] [Server thread/INFO] [FML]: Unloading dimension 0
[19:03:56] [Server thread/INFO] [FML]: Unloading dimension -1
[19:03:56] [Server thread/INFO] [FML]: Unloading dimension 1
[19:03:56] [Server thread/INFO] [FML]: Unloading dimension -5
[19:03:56] [Server thread/INFO] [FML]: Applying holder lookups
[19:03:56] [Server thread/INFO] [FML]: Holder lookups applied
[19:03:56] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
[19:03:56] [Client thread/FATAL]: Reported exception thrown!
net.minecraft.util.ReportedException: Getting biome
at net.minecraft.world.World.getBiomeGenForCoordsBody(World.java:191) ~[World.class:?]
at net.minecraft.world.WorldProvider.getBiomeGenForCoords(WorldProvider.java:423) ~[WorldProvider.class:?]
at net.minecraft.world.World.getBiomeGenForCoords(World.java:166) ~[World.class:?]
at net.minecraftforge.client.ForgeHooksClient.getSkyBlendColour(ForgeHooksClient.java:407) ~[ForgeHooksClient.class:?]
at net.minecraft.world.World.getSkyColorBody(World.java:1791) ~[World.class:?]
at net.minecraft.world.WorldProvider.getSkyColor(WorldProvider.java:457) ~[WorldProvider.class:?]
at net.minecraft.world.World.getSkyColor(World.java:1769) ~[World.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateFogColor(EntityRenderer.java:1760) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1230) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1087) ~[EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1057) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:951) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?]
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at This_is_Halloween.WorldChunkManagerNOM.getBiomeGenAt(WorldChunkManagerNOM.java:126) ~[WorldChunkManagerNOM.class:?]
at net.minecraft.world.biome.BiomeCache$Block.<init>(BiomeCache.java:108) ~[BiomeCache$Block.class:?]
at net.minecraft.world.biome.BiomeCache.getBiomeCacheBlock(BiomeCache.java:37) ~[BiomeCache.class:?]
at net.minecraft.world.biome.BiomeCache.getBiomeGenAt(BiomeCache.java:51) ~[BiomeCache.class:?]
at This_is_Halloween.WorldChunkManagerNOM.getBiomeGenAt(WorldChunkManagerNOM.java:53) ~[WorldChunkManagerNOM.class:?]
at net.minecraft.world.chunk.Chunk.getBiomeGenForWorldCoords(Chunk.java:1406) ~[Chunk.class:?]
at net.minecraft.world.World.getBiomeGenForCoordsBody(World.java:177) ~[World.class:?]
… 20 more
:::Mais si j’ai une erreur, ça veut dire que ça veut m’ammener dans ma dimension.
Je vais continuer à chercher pourquoi j’ai une erreur et je vous tient au courant</init>
-
Tu utilises ton propre chunk provider ou pas ?
Envoyé de mon GT-S7390G
-
Il nous faudrait de nouveau les classes, les anciennes ne sont plus à jour.
Pour le message précédent :
tu as mis un “;” (point virgule) après ton else alors qu’il ne devrait pas en avoir, ce qui fait que ton code est exécuté peu importe la condition, exemple :Ce que ton code devrait être:
if (player.timeUntilPortal > 0) { player.timeUntilPortal = 10; } else if (player.dimension != This_is_Halloween.dimensionID) { player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, This_is_Halloween.dimensionID, new TeleporterNOM(mServer.worldServerForDimension(This_is_Halloween.dimensionID))); } else { player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterNOM(mServer.worldServerForDimension(1))); }
Ce que la machine voit en réalité :
if (player.timeUntilPortal > 0) { player.timeUntilPortal = 10; } else if (player.dimension != This_is_Halloween.dimensionID) { player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, This_is_Halloween.dimensionID, new TeleporterNOM(mServer.worldServerForDimension(This_is_Halloween.dimensionID))); } player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterNOM(mServer.worldServerForDimension(1)));
-
Salut
Diangle –> NonVoilà mes classes :
This_is_Halloween
(avant le préinit) public static int dimensionID = -5;
(dans le init)
BiomeList.BiomeList(); DimensionManager.registerProviderType(dimensionID, WorldProviderNOM.class, false); DimensionManager.registerDimension(dimensionID, dimensionID);
(dans le postinit)
BiomeList.worldTypeNOM = new WorldTypeNOM();
**BiomeList **(toujours rien pour l’instant)
package This_is_Halloween; public class BiomeList { public static WorldTypeNOM worldTypeNOM; public static void BiomeList() { } }
WorldType
package This_is_Halloween; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.GenLayerBiomeEdge; import net.minecraft.world.gen.layer.GenLayerZoom; import net.minecraftforge.common.DimensionManager; public class WorldTypeNOM extends WorldType{ public WorldTypeNOM() { super("nomDeVotreType"); } public GenLayer getBiomeLayer(long worldSeed, GenLayer parentLayer) { GenLayer ret = new BiomeGenLayerNOM(200L, parentLayer); ret = GenLayerZoom.magnify(1000L, ret, 2); ret = new GenLayerBiomeEdge(1000L, ret); return ret; } public WorldChunkManager getChunkManager(World world) { return new WorldChunkManagerNOM(world); } }
WorldProvider
package This_is_Halloween; import net.minecraft.init.Blocks; import net.minecraft.world.WorldProvider; import net.minecraft.world.WorldProviderHell; import net.minecraft.world.WorldProviderSurface; import net.minecraft.world.biome.BiomeGenBase; public class WorldProviderNOM extends WorldProvider{ public void registerWorldChunkManager() { this.worldChunkMgr = new WorldChunkManagerNOM(); this.hasNoSky = true; this.dimensionId = This_is_Halloween.dimensionID; } // Blocks where we can spawn public boolean canCoordinateBeSpawn(int par1, int par2) { return this.worldObj.getTopBlock(par1, par2) == Blocks.grass || this.worldObj.getTopBlock(par1, par2) == Blocks.sand || this.worldObj.getTopBlock(par1, par2) == Blocks.stone || this.worldObj.getTopBlock(par1, par2) == Blocks.snow_layer; } // Dimension Name public String getDimensionName() { return "NOM"; } // Name of the dimension's folder public String getSaveFolder() { return this.getDimensionName(); } // Is the Overworld ? public boolean isSurfaceWorld() { return false; } // Can we respawn in this dimension public boolean canRespawnHere() { return false; } }
BiomeGenLayer
package This_is_Halloween; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; public class BiomeGenLayerNOM extends GenLayer { protected BiomeGenBase[] baseBiomes = {BiomeGenBase.desert}; public BiomeGenLayerNOM(long seed, GenLayer genlayer) { super(seed); this.parent = genlayer; } public BiomeGenLayerNOM(long seed) { super(seed); } @Override public int[] getInts(int x, int z, int width, int depth) { int[] dest = IntCache.getIntCache(width * depth); for(int dz = 0; dz < depth; dz++) { for(int dx = 0; dx < width; dx++) { this.initChunkSeed(dx + x, dz + z); dest[(dx + dz * width)] = this.baseBiomes[nextInt(this.baseBiomes.length)].biomeID; } } return dest; } }
GenLayer
package This_is_Halloween; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.GenLayerVoronoiZoom; import net.minecraft.world.gen.layer.GenLayerZoom; public abstract class GenLayerNOM extends GenLayer{ public GenLayerNOM(long seed) { super(seed); } public static GenLayer[] makeTheWorld(long seed) { GenLayer biomes = new BiomeGenLayerNOM(1L); biomes = new GenLayerZoom(1000L, biomes); biomes = new GenLayerZoom(1001L, biomes); biomes = new GenLayerZoom(1002L, biomes); biomes = new GenLayerZoom(1003L, biomes); biomes = new GenLayerZoom(1004L, biomes); biomes = new GenLayerZoom(1005L, biomes); GenLayer genlayervoronoizoom = new GenLayerVoronoiZoom(10L, biomes); biomes.initWorldGenSeed(seed); genlayervoronoizoom.initWorldGenSeed(seed); return new GenLayer[] {biomes, genlayervoronoizoom}; } }
WorldChunkManager
package This_is_Halloween; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.world.ChunkPosition; import net.minecraft.world.World; import net.minecraft.world.WorldType; import net.minecraft.world.biome.BiomeCache; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; import net.minecraft.world.gen.layer.GenLayer; import net.minecraft.world.gen.layer.IntCache; public class WorldChunkManagerNOM extends WorldChunkManager { private GenLayer myGenBiomes; private GenLayer myBiomeIndexLayer; private BiomeCache myBiomeCache; private List <biomegenbase>myBiomesToSpawnIn; public WorldChunkManagerNOM() { this.myBiomeCache = new BiomeCache(this); this.myBiomesToSpawnIn = new ArrayList<biomegenbase>(); this.myBiomesToSpawnIn.add(BiomeGenBase.desert); } public WorldChunkManagerNOM(long seed, WorldType worldtype) { this(); GenLayer[] agenlayer = GenLayerNOM.makeTheWorld(seed); this.myGenBiomes = agenlayer[0]; this.myBiomeIndexLayer = agenlayer[1]; } public WorldChunkManagerNOM(World world) { this(world.getSeed(), world.provider.terrainType); } public List <biomegenbase>getBiomesToSpawnIn() { return this.myBiomesToSpawnIn; } public BiomeGenBase getBiomeGenAt(int x, int z) { BiomeGenBase biome = this.myBiomeCache.getBiomeGenAt(x, z); if(biome == null) { return BiomeGenBase.desert; } return biome; } public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) { if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) { par1ArrayOfFloat = new float[par4 * par5]; } Arrays.fill(par1ArrayOfFloat, 0, par4 * par5, 0.0F); return par1ArrayOfFloat; } @SideOnly(Side.CLIENT) public float getTemperatureAtHeight(float par1, int par2) { return par1; } public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { IntCache.resetIntCache(); if(par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } int[] aint = this.myGenBiomes.getInts(par2, par3, par4, par5); for(int i = 0; i < par4 * par5; ++i) { if(aint* >= 0) { par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*); } else { par1ArrayOfBiomeGenBase* = BiomeGenBase.desert; } } return par1ArrayOfBiomeGenBase; } public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { return this.getBiomeGenAt(par1ArrayOfBiomeGenBase, par2, par3, par4, par5, true); } public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] par1ArrayOfBiomeGenBase, int x, int y, int width, int length, boolean cacheFlag) { IntCache.resetIntCache(); if(par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < width * length) { par1ArrayOfBiomeGenBase = new BiomeGenBase[width * length]; } if(cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (y & 15) == 0) { BiomeGenBase[] abiomegenbase1 = this.myBiomeCache.getCachedBiomes(x, y); System.arraycopy(abiomegenbase1, 0, par1ArrayOfBiomeGenBase, 0, width * length); return par1ArrayOfBiomeGenBase; } else { int[] aint = this.myBiomeIndexLayer.getInts(x, y, width, length); for(int i = 0; i < width * length; ++i) { if(aint* >= 0) { par1ArrayOfBiomeGenBase* = BiomeGenBase.getBiome(aint*); } else { par1ArrayOfBiomeGenBase* = BiomeGenBase.desert; } } return par1ArrayOfBiomeGenBase; } } public boolean areBiomesViable(int par1, int par2, int par3, List par4List) { IntCache.resetIntCache(); int l = par1 - par3 >> 2; int i1 = par2 - par3 >> 2; int j1 = par1 + par3 >> 2; int k1 = par2 + par3 >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.myGenBiomes.getInts(l, i1, l1, i2); for(int j2 = 0; j2 < l1 * i2; ++j2) { BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]); if(!par4List.contains(biomegenbase)) { return false; } } return true; } public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random) { IntCache.resetIntCache(); int l = par1 - par3 >> 2; int i1 = par2 - par3 >> 2; int j1 = par1 + par3 >> 2; int k1 = par2 + par3 >> 2; int l1 = j1 - l + 1; int i2 = k1 - i1 + 1; int[] aint = this.myGenBiomes.getInts(l, i1, l1, i2); ChunkPosition chunkposition = null; int j2 = 0; for(int k2 = 0; k2 < l1 * i2; ++k2) { int l2 = l + k2 % l1 << 2; int i3 = i1 + k2 / l1 << 2; BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]); if(par4List.contains(biomegenbase) && (chunkposition == null || par5Random.nextInt(j2 + 1) == 0)) { chunkposition = new ChunkPosition(l2, 0, i3); ++j2; } } return chunkposition; } public void cleanupCache() { this.myBiomeCache.cleanupCache(); } }
BlockPortal
package This_is_Halloween; import net.minecraft.block.Block; import net.minecraft.block.BlockPortal; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; public class BlockPortalNOM extends BlockPortal{ public BlockPortalNOM() { super(); this.setCreativeTab(CreativeTabs.tabBlock); } @Override public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) { if ((par5Entity.ridingEntity == null) && (par5Entity.riddenByEntity == null) && ((par5Entity instanceof EntityPlayerMP))) { EntityPlayerMP player = (EntityPlayerMP) par5Entity; MinecraftServer mServer = MinecraftServer.getServer(); if (player.timeUntilPortal > 0) { player.timeUntilPortal = 10; } else if (player.dimension != This_is_Halloween.dimensionID) { player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, This_is_Halloween.dimensionID, new TeleporterNOM(mServer.worldServerForDimension(This_is_Halloween.dimensionID))); } else { player.timeUntilPortal = 10; player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterNOM(mServer.worldServerForDimension(1))); } } } @Override public boolean func_150000_e(World par1World, int par2, int par3, int par4) { byte b0 = 0; byte b1 = 0; if (par1World.getBlock(par2 - 1, par3, par4) == Blocks.sandstone || par1World.getBlock(par2 + 1, par3, par4) == Blocks.sandstone) { b0 = 1; } if (par1World.getBlock(par2, par3, par4 - 1) == Blocks.sandstone || par1World.getBlock(par2, par3, par4 + 1) == Blocks.sandstone) { b1 = 1; } if (b0 == b1) { return false; } else { if (par1World.isAirBlock(par2 - b0, par3, par4 - b1)) { par2 -= b0; par4 -= b1; } int l; int i1; for (l = -1; l <= 2; ++l) { for (i1 = -1; i1 <= 3; ++i1) { boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3; if (l != -1 && l != 2 || i1 != -1 && i1 != 3) { Block j1 = par1World.getBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l); boolean isAirBlock = par1World.isAirBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l); if (flag) { if (j1 != Blocks.sandstone) { return false; } } else if (!isAirBlock && j1 != Blocks.fire) { return false; } } } } for (l = 0; l < 2; ++l) { for (i1 = 0; i1 < 3; ++i1) { par1World.setBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l, CreateBlocks.PortalNOMBlock, 0, 2); } } return true; } } @Override public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) { byte b0 = 0; byte b1 = 1; if (par1World.getBlock(par2 - 1, par3, par4) == this || par1World.getBlock(par2 + 1, par3, par4) == this) { b0 = 1; b1 = 0; } int i1; for (i1 = par3; par1World.getBlock(par2, i1 - 1, par4) == this; –i1) { ; } if (par1World.getBlock(par2, i1 - 1, par4) != Blocks.sandstone) { par1World.setBlockToAir(par2, par3, par4); } else { int j1; for (j1 = 1; j1 < 4 && par1World.getBlock(par2, i1 + j1, par4) == this; ++j1) { ; } if (j1 == 3 && par1World.getBlock(par2, i1 + j1, par4) == Blocks.sandstone) { boolean flag = par1World.getBlock(par2 - 1, par3, par4) == this || par1World.getBlock(par2 + 1, par3, par4) == this; boolean flag1 = par1World.getBlock(par2, par3, par4 - 1) == this || par1World.getBlock(par2, par3, par4 + 1) == this; if (flag && flag1) { par1World.setBlockToAir(par2, par3, par4); } else { if ((par1World.getBlock(par2 + b0, par3, par4 + b1) != Blocks.sandstone || par1World.getBlock(par2 - b0, par3, par4 - b1) != this) && (par1World.getBlock(par2 - b0, par3, par4 - b1) != Blocks.sandstone || par1World.getBlock(par2 + b0, par3, par4 + b1) != this)) { par1World.setBlockToAir(par2, par3, par4); } } } else { par1World.setBlockToAir(par2, par3, par4); } } } }
Teleporter
package This_is_Halloween; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Random; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.Direction; import net.minecraft.util.LongHashMap; import net.minecraft.util.MathHelper; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.Teleporter; import net.minecraft.world.WorldServer; public class TeleporterNOM extends Teleporter { private final WorldServer worldServerInstance; /** A private Random() function in Teleporter */ private final Random random; /** Stores successful portal placement locations for rapid lookup. */ private final LongHashMap destinationCoordinateCache = new LongHashMap(); /** * A list of valid keys for the destinationCoordainteCache. These are based on the X & Z of the players initial * location. */ @SuppressWarnings("rawtypes") private final List destinationCoordinateKeys = new ArrayList(); public TeleporterNOM(WorldServer par1WorldServer) { super(par1WorldServer); this.worldServerInstance = par1WorldServer; this.random = new Random(par1WorldServer.getSeed()); } /** * Place an entity in a nearby portal, creating one if necessary. */ @Override public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) { if (this.worldServerInstance.provider.dimensionId != This_is_Halloween.dimensionID) { if (!this.placeInExistingPortal(par1Entity, par2, par4, par6, par8)) { this.makePortal(par1Entity); this.placeInExistingPortal(par1Entity, par2, par4, par6, par8); } } else { int i = MathHelper.floor_double(par1Entity.posX); int j = MathHelper.floor_double(par1Entity.posY) - 1; int k = MathHelper.floor_double(par1Entity.posZ); byte b0 = 1; byte b1 = 0; for (int l = -2; l <= 2; ++l) { for (int i1 = -2; i1 <= 2; ++i1) { for (int j1 = -1; j1 < 3; ++j1) { int k1 = i + i1 * b0 + l * b1; int l1 = j + j1; int i2 = k + i1 * b1 - l * b0; boolean flag = j1 < 0; this.worldServerInstance.setBlock(k1, l1, i2, flag ? Blocks.sandstone : Blocks.air); } } } par1Entity.setLocationAndAngles((double)i, (double)j, (double)k, par1Entity.rotationYaw, 0.0F); par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D; } } /** * Place an entity in a nearby portal which already exists. */ @SuppressWarnings("unchecked") @Override public boolean placeInExistingPortal(Entity par1Entity, double par2, double par4, double par6, float par8) { short short1 = 128; double d3 = -1.0D; int i = 0; int j = 0; int k = 0; int l = MathHelper.floor_double(par1Entity.posX); int i1 = MathHelper.floor_double(par1Entity.posZ); long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1); boolean flag = true; double d4; int k1; if (this.destinationCoordinateCache.containsItem(j1)) { PortalPosition portalposition = (PortalPosition)this.destinationCoordinateCache.getValueByKey(j1); d3 = 0.0D; i = portalposition.posX; j = portalposition.posY; k = portalposition.posZ; portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime(); flag = false; } else { for (k1 = l - short1; k1 <= l + short1; ++k1) { double d5 = (double)k1 + 0.5D - par1Entity.posX; for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) { double d6 = (double)l1 + 0.5D - par1Entity.posZ; for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) { if (this.worldServerInstance.getBlock(k1, i2, l1) == CreateBlocks.PortalNOMBlock) { while (this.worldServerInstance.getBlock(k1, i2 - 1, l1) == CreateBlocks.PortalNOMBlock) { --i2; } d4 = (double)i2 + 0.5D - par1Entity.posY; double d7 = d5 * d5 + d4 * d4 + d6 * d6; if (d3 < 0.0D || d7 < d3) { d3 = d7; i = k1; j = i2; k = l1; } } } } } } if (d3 >= 0.0D) { if (flag) { this.destinationCoordinateCache.add(j1, new PortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime())); this.destinationCoordinateKeys.add(Long.valueOf(j1)); } double d8 = (double)i + 0.5D; double d9 = (double)j + 0.5D; d4 = (double)k + 0.5D; int j2 = -1; if (this.worldServerInstance.getBlock(i - 1, j, k) == CreateBlocks.PortalNOMBlock) { j2 = 2; } if (this.worldServerInstance.getBlock(i + 1, j, k) == CreateBlocks.PortalNOMBlock) { j2 = 0; } if (this.worldServerInstance.getBlock(i, j, k - 1) == CreateBlocks.PortalNOMBlock) { j2 = 3; } if (this.worldServerInstance.getBlock(i, j, k + 1) == CreateBlocks.PortalNOMBlock) { j2 = 1; } int k2 = par1Entity.getTeleportDirection(); if (j2 > -1) { int l2 = Direction.rotateLeft[j2]; int i3 = Direction.offsetX[j2]; int j3 = Direction.offsetZ[j2]; int k3 = Direction.offsetX[l2]; int l3 = Direction.offsetZ[l2]; boolean flag1 = !this.worldServerInstance.isAirBlock(i + i3 + k3, j, k + j3 + l3) || !this.worldServerInstance.isAirBlock(i + i3 + k3, j + 1, k + j3 + l3); boolean flag2 = !this.worldServerInstance.isAirBlock(i + i3, j, k + j3) || !this.worldServerInstance.isAirBlock(i + i3, j + 1, k + j3); if (flag1 && flag2) { j2 = Direction.rotateOpposite[j2]; l2 = Direction.rotateOpposite[l2]; i3 = Direction.offsetX[j2]; j3 = Direction.offsetZ[j2]; k3 = Direction.offsetX[l2]; l3 = Direction.offsetZ[l2]; k1 = i - k3; d8 -= (double)k3; int i4 = k - l3; d4 -= (double)l3; flag1 = !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j, i4 + j3 + l3) || !this.worldServerInstance.isAirBlock(k1 + i3 + k3, j + 1, i4 + j3 + l3); flag2 = !this.worldServerInstance.isAirBlock(k1 + i3, j, i4 + j3) || !this.worldServerInstance.isAirBlock(k1 + i3, j + 1, i4 + j3); } float f1 = 0.5F; float f2 = 0.5F; if (!flag1 && flag2) { f1 = 1.0F; } else if (flag1 && !flag2) { f1 = 0.0F; } else if (flag1 && flag2) { f2 = 0.0F; } d8 += (double)((float)k3 * f1 + f2 * (float)i3); d4 += (double)((float)l3 * f1 + f2 * (float)j3); float f3 = 0.0F; float f4 = 0.0F; float f5 = 0.0F; float f6 = 0.0F; if (j2 == k2) { f3 = 1.0F; f4 = 1.0F; } else if (j2 == Direction.rotateOpposite[k2]) { f3 = -1.0F; f4 = -1.0F; } else if (j2 == Direction.rotateRight[k2]) { f5 = 1.0F; f6 = -1.0F; } else { f5 = -1.0F; f6 = 1.0F; } double d10 = par1Entity.motionX; double d11 = par1Entity.motionZ; par1Entity.motionX = d10 * (double)f3 + d11 * (double)f6; par1Entity.motionZ = d10 * (double)f5 + d11 * (double)f4; par1Entity.rotationYaw = par8 - (float)(k2 * 90) + (float)(j2 * 90); } else { par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D; } par1Entity.setLocationAndAngles(d8, d9, d4, par1Entity.rotationYaw, par1Entity.rotationPitch); return true; } else { return false; } } @Override public boolean makePortal(Entity par1Entity) { byte b0 = 16; double d0 = -1.0D; int i = MathHelper.floor_double(par1Entity.posX); int j = MathHelper.floor_double(par1Entity.posY); int k = MathHelper.floor_double(par1Entity.posZ); int l = i; int i1 = j; int j1 = k; int k1 = 0; int l1 = this.random.nextInt(4); int i2; double d1; double d2; int j2; int k2; int l2; int i3; int j3; int k3; int l3; int i4; int j4; int k4; double d3; double d4; for (i2 = i - b0; i2 <= i + b0; ++i2) { d1 = (double)i2 + 0.5D - par1Entity.posX; for (j2 = k - b0; j2 <= k + b0; ++j2) { d2 = (double)j2 + 0.5D - par1Entity.posZ; label274: for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; –k2) { if (this.worldServerInstance.isAirBlock(i2, k2, j2)) { while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2)) { --k2; } for (i3 = l1; i3 < l1 + 4; ++i3) { l2 = i3 % 2; k3 = 1 - l2; if (i3 % 4 >= 2) { l2 = -l2; k3 = -k3; } for (j3 = 0; j3 < 3; ++j3) { for (i4 = 0; i4 < 4; ++i4) { for (l3 = -1; l3 < 4; ++l3) { k4 = i2 + (i4 - 1) * l2 + j3 * k3; j4 = k2 + l3; int l4 = j2 + (i4 - 1) * k3 - j3 * l2; if (l3 < 0 && !this.worldServerInstance.getBlock(k4, j4, l4).getMaterial().isSolid() || l3 >= 0 && !this.worldServerInstance.isAirBlock(k4, j4, l4)) { continue label274; } } } } d4 = (double)k2 + 0.5D - par1Entity.posY; d3 = d1 * d1 + d4 * d4 + d2 * d2; if (d0 < 0.0D || d3 < d0) { d0 = d3; l = i2; i1 = k2; j1 = j2; k1 = i3 % 4; } } } } } } if (d0 < 0.0D) { for (i2 = i - b0; i2 <= i + b0; ++i2) { d1 = (double)i2 + 0.5D - par1Entity.posX; for (j2 = k - b0; j2 <= k + b0; ++j2) { d2 = (double)j2 + 0.5D - par1Entity.posZ; label222: for (k2 = this.worldServerInstance.getActualHeight() - 1; k2 >= 0; --k2) { if (this.worldServerInstance.isAirBlock(i2, k2, j2)) { while (k2 > 0 && this.worldServerInstance.isAirBlock(i2, k2 - 1, j2)) { --k2; } for (i3 = l1; i3 < l1 + 2; ++i3) { l2 = i3 % 2; k3 = 1 - l2; for (j3 = 0; j3 < 4; ++j3) { for (i4 = -1; i4 < 4; ++i4) { l3 = i2 + (j3 - 1) * l2; k4 = k2 + i4; j4 = j2 + (j3 - 1) * k3; if (i4 < 0 && !this.worldServerInstance.getBlock(l3, k4, j4).getMaterial().isSolid() || i4 >= 0 && !this.worldServerInstance.isAirBlock(l3, k4, j4)) { continue label222; } } } d4 = (double)k2 + 0.5D - par1Entity.posY; d3 = d1 * d1 + d4 * d4 + d2 * d2; if (d0 < 0.0D || d3 < d0) { d0 = d3; l = i2; i1 = k2; j1 = j2; k1 = i3 % 2; } } } } } } } int i5 = l; int j5 = i1; j2 = j1; int k5 = k1 % 2; int l5 = 1 - k5; if (k1 % 4 >= 2) { k5 = -k5; l5 = -l5; } boolean flag; if (d0 < 0.0D) { if (i1 < 70) { i1 = 70; } if (i1 > this.worldServerInstance.getActualHeight() - 10) { i1 = this.worldServerInstance.getActualHeight() - 10; } j5 = i1; for (k2 = -1; k2 <= 1; ++k2) { for (i3 = 1; i3 < 3; ++i3) { for (l2 = -1; l2 < 3; ++l2) { k3 = i5 + (i3 - 1) * k5 + k2 * l5; j3 = j5 + l2; i4 = j2 + (i3 - 1) * l5 - k2 * k5; flag = l2 < 0; this.worldServerInstance.setBlock(k3, j3, i4, flag ? Blocks.sandstone : Blocks.air); } } } } for (k2 = 0; k2 < 4; ++k2) { for (i3 = 0; i3 < 4; ++i3) { for (l2 = -1; l2 < 4; ++l2) { k3 = i5 + (i3 - 1) * k5; j3 = j5 + l2; i4 = j2 + (i3 - 1) * l5; flag = i3 == 0 || i3 == 3 || l2 == -1 || l2 == 3; this.worldServerInstance.setBlock(k3, j3, i4, flag ? Blocks.sandstone : CreateBlocks.PortalNOMBlock, 0, 2); } } for (i3 = 0; i3 < 4; ++i3) { for (l2 = -1; l2 < 4; ++l2) { k3 = i5 + (i3 - 1) * k5; j3 = j5 + l2; i4 = j2 + (i3 - 1) * l5; this.worldServerInstance.notifyBlocksOfNeighborChange(k3, j3, i4, this.worldServerInstance.getBlock(k3, j3, i4)); } } } return true; } /** * called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a * WorldServer.getTotalWorldTime() value. */ @SuppressWarnings("rawtypes") @Override public void removeStalePortalLocations(long par1) { if (par1 % 100L == 0L) { Iterator iterator = this.destinationCoordinateKeys.iterator(); long j = par1 - 600L; while (iterator.hasNext()) { Long olong = (Long)iterator.next(); PortalPosition portalposition = (PortalPosition)this.destinationCoordinateCache.getValueByKey(olong.longValue()); if (portalposition == null || portalposition.lastUpdateTime < j) { iterator.remove(); this.destinationCoordinateCache.remove(olong.longValue()); } } } } public class PortalPosition extends ChunkCoordinates { /** The worldtime at which this PortalPosition was last verified */ public long lastUpdateTime; public PortalPosition(int par2, int par3, int par4, long par5) { super(par2, par3, par4); this.lastUpdateTime = par5; } } }
PS : Si vous vous demandez pourquoi j’ai mis NOM pour ma dimension, c’est que je ne sais pas encore quoi mettre pour le nom</biomegenbase></biomegenbase></biomegenbase>
-
Tu as mal enregistré tes classes car ce sont celles de minecraft qui sont utilisées pour générer ton monde.
-
@‘SCAREX’:
Tu as mal enregistré tes classes car ce sont celles de minecraft qui sont utilisées pour générer ton monde.
non, il utilise le chunk provider de base.
Mais pour le coup, dans la classe chunk manager remplace les BiomeGenBase.desert par : BiomeGenBase.oceanPS:tu peux aller voir le tuto sur les dimensions.
-
@‘Diangle’:
@‘SCAREX’:
Tu as mal enregistré tes classes car ce sont celles de minecraft qui sont utilisées pour générer ton monde.
non, il utilise le chunk provider de base.
Mais pour le coup, dans la classe chunk manager remplace les BiomeGenBase.desert par : BiomeGenBase.oceanPS:tu peux aller voir le tuto sur les dimensions.
Justement, il a créé un provider custom non ?
-
@‘SCAREX’:
@‘Diangle’:
@‘SCAREX’:
Tu as mal enregistré tes classes car ce sont celles de minecraft qui sont utilisées pour générer ton monde.
non, il utilise le chunk provider de base.
Mais pour le coup, dans la classe chunk manager remplace les BiomeGenBase.desert par : BiomeGenBase.oceanPS:tu peux aller voir le tuto sur les dimensions.
Justement, il a créé un provider custom non ?
oui pour le word provider, mais pour le chunk provider tu es pas obliger, si ça dimension est une sorte de réplique de l’overworld, mais oui, en revanche il est recommander de faire son propre chunk provider.
-
Il a son propre provider, c’est juste qu’il est pas correctement enregistré.
-
-
Salut
J’ai testé le tuto dont je vous ai parlé et maintenant ma dimension custom marche. J’ai encore quelques bug avec le portail mais ça devrait se résoudre assez rapidement. Merci à vous tous pour les réponses