Jump to content

[SOLVED!] [1.7.2/1.7.10] Bound must be positive Error


Recommended Posts

Posted

When I try to cross over to my custom dimension, I get this error:

 

[18:55:11] [server thread/ERROR]: Encountered an unexpected exception

net.minecraft.util.ReportedException: Exception getting block type in world

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:198) ~[NetworkSystem.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736) ~[MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624) ~[MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762) [MinecraftServer$2.class:?]

Caused by: java.lang.IllegalArgumentException: bound must be positive

at java.util.Random.nextInt(Unknown Source) ~[?:1.8.0_11]

at net.minecraft.world.SpawnerAnimals.performWorldGenSpawning(SpawnerAnimals.java:248) ~[spawnerAnimals.class:?]

at common.zeroquest.world.gen.ChunkProviderNillax.populate(ChunkProviderNillax.java:467) ~[ChunkProviderNillax.class:?]

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:315) ~[ChunkProviderServer.class:?]

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1163) ~[Chunk.class:?]

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:210) ~[ChunkProviderServer.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151) ~[ChunkProviderServer.class:?]

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121) ~[ChunkProviderServer.class:?]

at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:223) ~[ChunkProviderServer.class:?]

at net.minecraft.world.World.getChunkFromChunkCoords(World.java:485) ~[World.class:?]

at net.minecraft.world.World.getBlock(World.java:390) ~[World.class:?]

at common.zeroquest.dimension.TeleporterNillax.placeInExistingPortal(TeleporterNillax.java:117) ~[TeleporterNillax.class:?]

at common.zeroquest.dimension.TeleporterNillax.placeInPortal(TeleporterNillax.java:45) ~[TeleporterNillax.class:?]

at net.minecraft.server.management.ServerConfigurationManager.transferEntityToWorld(ServerConfigurationManager.java:629) ~[serverConfigurationManager.class:?]

at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:533) ~[serverConfigurationManager.class:?]

at common.zeroquest.block.portal.BlockPortalNillax.onEntityCollidedWithBlock(BlockPortalNillax.java:31) ~[blockPortalNillax.class:?]

at net.minecraft.entity.Entity.func_145775_I(Entity.java:988) ~[Entity.class:?]

at net.minecraft.entity.Entity.moveEntity(Entity.java:921) ~[Entity.class:?]

at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:367) ~[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:247) ~[NetworkManager.class:?]

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) ~[NetworkSystem.class:?]

... 5 more

[18:55:11] [server thread/ERROR]: This crash report has been saved to: C:\Users\Ilise Leary\Desktop\ModStuff\forge-1.7.10-10.13.0.1180-src\eclipse\.\crash-reports\crash-2014-07-31_18.55.11-server.txt

[18:55:11] [server thread/INFO]: Stopping server

[18:55:11] [server thread/INFO]: Saving players

---- Minecraft Crash Report ----

// Don't be sad, have a hug! <3

 

Time: 7/31/14 6:55 PM

Description: Exception getting block type in world

 

java.lang.IllegalArgumentException: bound must be positive

at java.util.Random.nextInt(Unknown Source)

at net.minecraft.world.SpawnerAnimals.performWorldGenSpawning(SpawnerAnimals.java:248)

at common.zeroquest.world.gen.ChunkProviderNillax.populate(ChunkProviderNillax.java:467)

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:315)

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1163)

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:210)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121)

at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:223)

at net.minecraft.world.World.getChunkFromChunkCoords(World.java:485)

at net.minecraft.world.World.getBlock(World.java:390)

at common.zeroquest.dimension.TeleporterNillax.placeInExistingPortal(TeleporterNillax.java:117)

at common.zeroquest.dimension.TeleporterNillax.placeInPortal(TeleporterNillax.java:45)

at net.minecraft.server.management.ServerConfigurationManager.transferEntityToWorld(ServerConfigurationManager.java:629)

at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:533)

at common.zeroquest.block.portal.BlockPortalNillax.onEntityCollidedWithBlock(BlockPortalNillax.java:31)

at net.minecraft.entity.Entity.func_145775_I(Entity.java:988)

at net.minecraft.entity.Entity.moveEntity(Entity.java:921)

at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:367)

at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37)

at net.minecraft.network.play.client.C03PacketPlayer$C04PacketPlayerPosition.processPacket(C03PacketPlayer.java:163)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247)

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762)

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at java.util.Random.nextInt(Unknown Source)

at net.minecraft.world.SpawnerAnimals.performWorldGenSpawning(SpawnerAnimals.java:248)

at common.zeroquest.world.gen.ChunkProviderNillax.populate(ChunkProviderNillax.java:467)

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:315)

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1163)

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:210)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:151)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:121)

at net.minecraft.world.gen.ChunkProviderServer.provideChunk(ChunkProviderServer.java:223)

at net.minecraft.world.World.getChunkFromChunkCoords(World.java:485)

 

-- Requested block coordinates --

Details:

Found chunk: true

Location: World: (-80,255,-64), Chunk: (at 0,15,0 in -5,-4; contains blocks -80,0,-64 to -65,255,-49), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)

Stacktrace:

at net.minecraft.world.World.getBlock(World.java:390)

at common.zeroquest.dimension.TeleporterNillax.placeInExistingPortal(TeleporterNillax.java:117)

at common.zeroquest.dimension.TeleporterNillax.placeInPortal(TeleporterNillax.java:45)

at net.minecraft.server.management.ServerConfigurationManager.transferEntityToWorld(ServerConfigurationManager.java:629)

at net.minecraft.server.management.ServerConfigurationManager.transferPlayerToDimension(ServerConfigurationManager.java:533)

at common.zeroquest.block.portal.BlockPortalNillax.onEntityCollidedWithBlock(BlockPortalNillax.java:31)

 

-- Block being collided with --

Details:

Block type: ID #183 (tile.portalNillax // common.zeroquest.block.portal.BlockPortalNillax)

Block data value: 0 / 0x0 / 0b0000

Block location: World: (232,68,220), Chunk: (at 8,4,12 in 14,13; contains blocks 224,0,208 to 239,255,223), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

Stacktrace:

at net.minecraft.entity.Entity.func_145775_I(Entity.java:988)

 

-- Entity being checked for collision --

Details:

Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)

Entity ID: 191

Entity Name: ForgeDevName

Entity's Exact location: 23.00, 68.00, 22.00

Entity's Block location: World: (23,68,22), Chunk: (at 7,4,6 in 1,1; contains blocks 16,0,16 to 31,255,31), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)

Entity's Momentum: 0.00, -0.08, 0.00

Stacktrace:

at net.minecraft.entity.Entity.moveEntity(Entity.java:921)

at net.minecraft.network.NetHandlerPlayServer.processPlayer(NetHandlerPlayServer.java:367)

at net.minecraft.network.play.client.C03PacketPlayer.processPacket(C03PacketPlayer.java:37)

at net.minecraft.network.play.client.C03PacketPlayer$C04PacketPlayerPosition.processPacket(C03PacketPlayer.java:163)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:247)

 

-- Ticking connection --

Details:

Connection: net.minecraft.network.NetworkManager@4296490f

Stacktrace:

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:736)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:624)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:495)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:762)

 

-- System Details --

Details:

Minecraft Version: 1.7.10

Operating System: Windows 7 (amd64) version 6.1

Java Version: 1.8.0_11, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 896930120 bytes (855 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 1, tallocated: 14

FML: MCP v9.05 FML v7.10.18.1180 Minecraft Forge 10.13.0.1180 4 mods loaded, 4 mods active

mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

FML{7.10.18.1180} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.13.0.1180} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1180.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

zero_quest{v0.0.1} [Zero Quest] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Profiler Position: N/A (disabled)

Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

Player Count: 1 / 8; [EntityPlayerMP['ForgeDevName'/191, l='New World', x=23.00, y=68.00, z=22.00]]

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

#@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2014-07-31_18.55.11-server.txt

[18:55:11] [Client thread/INFO] [FML]: Waiting for the server to terminate/save.

[18:55:11] [server thread/INFO]: Saving worlds

[18:55:11] [server thread/INFO]: Saving chunks for level 'New World'/Overworld

[18:55:11] [server thread/INFO]: Saving chunks for level 'New World'/Nether

[18:55:11] [server thread/INFO]: Saving chunks for level 'New World'/The End

[18:55:11] [server thread/INFO]: Saving chunks for level 'New World'/Nillax

[18:55:12] [server thread/INFO] [FML]: Unloading dimension 0

[18:55:12] [server thread/INFO] [FML]: Unloading dimension -1

[18:55:12] [server thread/INFO] [FML]: Unloading dimension 1

[18:55:12] [server thread/INFO] [FML]: Unloading dimension 2

[18:55:12] [server thread/INFO] [FML]: Applying holder lookups

[18:55:12] [server thread/INFO] [FML]: Holder lookups applied

[18:55:12] [server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.

[18:55:12] [Client thread/INFO] [FML]: Server terminated.

AL lib: (EE) alc_cleanup: 1 device not closed

Java HotSpot 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

 

Here is my ChunkProvider:

 

public class ChunkProviderNillax implements IChunkProvider

{

    /** RNG. */

    private Random rand;

    private NoiseGeneratorOctaves field_147431_j;

    private NoiseGeneratorOctaves field_147432_k;

    private NoiseGeneratorOctaves field_147429_l;

    private NoiseGeneratorPerlin field_147430_m;

    /** A NoiseGeneratorOctaves used in generating terrain */

    public NoiseGeneratorOctaves noiseGen5;

    /** A NoiseGeneratorOctaves used in generating terrain */

    public NoiseGeneratorOctaves noiseGen6;

    public NoiseGeneratorOctaves mobSpawnerNoise;

    /** Reference to the World object. */

    private World worldObj;

    /** are map structures going to be generated (e.g. strongholds) */

    private final boolean mapFeaturesEnabled;

    private WorldType field_147435_p;

    private final double[] field_147434_q;

    private final float[] parabolicField;

    private double[] stoneNoise = new double[256];

    private MapGenBase caveGenerator = new MapGenCaves();

    /** Holds Stronghold Generator */

    //private MapGenStronghold strongholdGenerator = new MapGenStronghold(); TODO

    /** Holds Village Generator */

    private MapGenVillage villageGenerator = new MapGenVillage();

    /** Holds Mineshaft Generator */

    private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();

    private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();

    /** Holds ravine generator */

    private MapGenBase ravineGenerator = new MapGenRavine();

    /** The biomes that are used to generate the chunk */

    private BiomeGenBase[] biomesForGeneration;

    double[] field_147427_d;

    double[] field_147428_e;

    double[] field_147425_f;

    double[] field_147426_g;

    int[][] field_73219_j = new int[32][32];

    private static final String __OBFID = "CL_00000396";

 

    {

        caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);

        //strongholdGenerator = (MapGenStronghold) TerrainGen.getModdedMapGen(strongholdGenerator, STRONGHOLD);

        villageGenerator = (MapGenVillage) TerrainGen.getModdedMapGen(villageGenerator, VILLAGE);

        mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT);

        scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE);

        ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE);

    }

 

    public ChunkProviderNillax(World p_i2006_1_, long p_i2006_2_, boolean p_i2006_4_)

    {

        this.worldObj = p_i2006_1_;

        this.mapFeaturesEnabled = p_i2006_4_;

        this.field_147435_p = p_i2006_1_.getWorldInfo().getTerrainType();

        this.rand = new Random(p_i2006_2_);

        this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16);

        this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16);

        this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8);

        this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4);

        this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);

        this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);

        this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);

        this.field_147434_q = new double[825];

        this.parabolicField = new float[25];

 

        for (int j = -2; j <= 2; ++j)

        {

            for (int k = -2; k <= 2; ++k)

            {

                float f = 10.0F / MathHelper.sqrt_float((float)(j * j + k * k) + 0.2F);

                this.parabolicField[j + 2 + (k + 2) * 5] = f;

            }

        }

 

        NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise};

        noiseGens = TerrainGen.getModdedNoiseGenerators(p_i2006_1_, this.rand, noiseGens);

        this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0];

        this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1];

        this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2];

        this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3];

        this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4];

        this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5];

        this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6];

    }

 

    public void func_147424_a(int p_147424_1_, int p_147424_2_, Block[] p_147424_3_)

    {

        byte b0 = 63;

        this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, p_147424_1_ * 4 - 2, p_147424_2_ * 4 - 2, 10, 10);

        this.func_147423_a(p_147424_1_ * 4, 0, p_147424_2_ * 4);

 

        for (int k = 0; k < 4; ++k)

        {

            int l = k * 5;

            int i1 = (k + 1) * 5;

 

            for (int j1 = 0; j1 < 4; ++j1)

            {

                int k1 = (l + j1) * 33;

                int l1 = (l + j1 + 1) * 33;

                int i2 = (i1 + j1) * 33;

                int j2 = (i1 + j1 + 1) * 33;

 

                for (int k2 = 0; k2 < 32; ++k2)

                {

                    double d0 = 0.125D;

                    double d1 = this.field_147434_q[k1 + k2];

                    double d2 = this.field_147434_q[l1 + k2];

                    double d3 = this.field_147434_q[i2 + k2];

                    double d4 = this.field_147434_q[j2 + k2];

                    double d5 = (this.field_147434_q[k1 + k2 + 1] - d1) * d0;

                    double d6 = (this.field_147434_q[l1 + k2 + 1] - d2) * d0;

                    double d7 = (this.field_147434_q[i2 + k2 + 1] - d3) * d0;

                    double d8 = (this.field_147434_q[j2 + k2 + 1] - d4) * d0;

 

                    for (int l2 = 0; l2 < 8; ++l2)

                    {

                        double d9 = 0.25D;

                        double d10 = d1;

                        double d11 = d2;

                        double d12 = (d3 - d1) * d9;

                        double d13 = (d4 - d2) * d9;

 

                        for (int i3 = 0; i3 < 4; ++i3)

                        {

                            int j3 = i3 + k * 4 << 12 | 0 + j1 * 4 << 8 | k2 * 8 + l2;

                            short short1 = 256;

                            j3 -= short1;

                            double d14 = 0.25D;

                            double d16 = (d11 - d10) * d14;

                            double d15 = d10 - d16;

 

                            for (int k3 = 0; k3 < 4; ++k3)

                            {

                                if ((d15 += d16) > 0.0D)

                                {

                                    p_147424_3_[j3 += short1] = ModBlocks.nileStone;

                                }

                                else if (k2 * 8 + l2 < b0)

                                {

                                    p_147424_3_[j3 += short1] = Blocks.water;

                                }

                                else

                                {

                                    p_147424_3_[j3 += short1] = null;

                                }

                            }

 

                            d10 += d12;

                            d11 += d13;

                        }

 

                        d1 += d5;

                        d2 += d6;

                        d3 += d7;

                        d4 += d8;

                    }

                }

            }

        }

    }

 

    public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_)

    {

        ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_4_, p_147422_5_, this.worldObj);

        MinecraftForge.EVENT_BUS.post(event);

        if (event.getResult() == Result.DENY) return;

 

        double d0 = 0.03125D;

        this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_147422_1_ * 16), (double)(p_147422_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

 

        for (int k = 0; k < 16; ++k)

        {

            for (int l = 0; l < 16; ++l)

            {

                BiomeGenBase biomegenbase = p_147422_5_[l + k * 16];

                biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[l + k * 16]);

            }

        }

    }

 

    /**

    * loads or generates the chunk at the chunk location specified

    */

    public Chunk loadChunk(int p_73158_1_, int p_73158_2_)

    {

        return this.provideChunk(p_73158_1_, p_73158_2_);

    }

 

    /**

    * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the

    * specified chunk from the map seed and chunk seed

    */

    public Chunk provideChunk(int p_73154_1_, int p_73154_2_)

    {

        this.rand.setSeed((long)p_73154_1_ * 341873128712L + (long)p_73154_2_ * 132897987541L);

        Block[] ablock = new Block[65536];

        byte[] abyte = new byte[65536];

        this.func_147424_a(p_73154_1_, p_73154_2_, ablock);

        this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, p_73154_1_ * 16, p_73154_2_ * 16, 16, 16);

        this.replaceBlocksForBiome(p_73154_1_, p_73154_2_, ablock, abyte, this.biomesForGeneration);

        this.caveGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);

        this.ravineGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);

 

        if (this.mapFeaturesEnabled)

        {

            this.mineshaftGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);

            this.villageGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);

            //this.strongholdGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);

            this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, p_73154_1_, p_73154_2_, ablock);

        }

 

        Chunk chunk = new Chunk(this.worldObj, ablock, abyte, p_73154_1_, p_73154_2_);

        byte[] abyte1 = chunk.getBiomeArray();

 

        for (int k = 0; k < abyte1.length; ++k)

        {

            abyte1[k] = (byte)this.biomesForGeneration[k].biomeID;

        }

 

        chunk.generateSkylightMap();

        return chunk;

    }

 

    private void func_147423_a(int p_147423_1_, int p_147423_2_, int p_147423_3_)

    {

        double d0 = 684.412D;

        double d1 = 684.412D;

        double d2 = 512.0D;

        double d3 = 512.0D;

        this.field_147426_g = this.noiseGen6.generateNoiseOctaves(this.field_147426_g, p_147423_1_, p_147423_3_, 5, 5, 200.0D, 200.0D, 0.5D);

        this.field_147427_d = this.field_147429_l.generateNoiseOctaves(this.field_147427_d, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D);

        this.field_147428_e = this.field_147431_j.generateNoiseOctaves(this.field_147428_e, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);

        this.field_147425_f = this.field_147432_k.generateNoiseOctaves(this.field_147425_f, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);

        boolean flag1 = false;

        boolean flag = false;

        int l = 0;

        int i1 = 0;

        double d4 = 8.5D;

 

        for (int j1 = 0; j1 < 5; ++j1)

        {

            for (int k1 = 0; k1 < 5; ++k1)

            {

                float f = 0.0F;

                float f1 = 0.0F;

                float f2 = 0.0F;

                byte b0 = 2;

                BiomeGenBase biomegenbase = this.biomesForGeneration[j1 + 2 + (k1 + 2) * 10];

 

                for (int l1 = -b0; l1 <= b0; ++l1)

                {

                    for (int i2 = -b0; i2 <= b0; ++i2)

                    {

                        BiomeGenBase biomegenbase1 = this.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10];

                        float f3 = biomegenbase1.rootHeight;

                        float f4 = biomegenbase1.heightVariation;

 

                        if (this.field_147435_p == WorldType.AMPLIFIED && f3 > 0.0F)

                        {

                            f3 = 1.0F + f3 * 2.0F;

                            f4 = 1.0F + f4 * 4.0F;

                        }

 

                        float f5 = this.parabolicField[l1 + 2 + (i2 + 2) * 5] / (f3 + 2.0F);

 

                        if (biomegenbase1.rootHeight > biomegenbase.rootHeight)

                        {

                            f5 /= 2.0F;

                        }

 

                        f += f4 * f5;

                        f1 += f3 * f5;

                        f2 += f5;

                    }

                }

 

                f /= f2;

                f1 /= f2;

                f = f * 0.9F + 0.1F;

                f1 = (f1 * 4.0F - 1.0F) / 8.0F;

                double d12 = this.field_147426_g[i1] / 8000.0D;

 

                if (d12 < 0.0D)

                {

                    d12 = -d12 * 0.3D;

                }

 

                d12 = d12 * 3.0D - 2.0D;

 

                if (d12 < 0.0D)

                {

                    d12 /= 2.0D;

 

                    if (d12 < -1.0D)

                    {

                        d12 = -1.0D;

                    }

 

                    d12 /= 1.4D;

                    d12 /= 2.0D;

                }

                else

                {

                    if (d12 > 1.0D)

                    {

                        d12 = 1.0D;

                    }

 

                    d12 /= 8.0D;

                }

 

                ++i1;

                double d13 = (double)f1;

                double d14 = (double)f;

                d13 += d12 * 0.2D;

                d13 = d13 * 8.5D / 8.0D;

                double d5 = 8.5D + d13 * 4.0D;

 

                for (int j2 = 0; j2 < 33; ++j2)

                {

                    double d6 = ((double)j2 - d5) * 12.0D * 128.0D / 256.0D / d14;

 

                    if (d6 < 0.0D)

                    {

                        d6 *= 4.0D;

                    }

 

                    double d7 = this.field_147428_e[l] / 512.0D;

                    double d8 = this.field_147425_f[l] / 512.0D;

                    double d9 = (this.field_147427_d[l] / 10.0D + 1.0D) / 2.0D;

                    double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6;

 

                    if (j2 > 29)

                    {

                        double d11 = (double)((float)(j2 - 29) / 3.0F);

                        d10 = d10 * (1.0D - d11) + -10.0D * d11;

                    }

 

                    this.field_147434_q[l] = d10;

                    ++l;

                }

            }

        }

    }

 

    /**

    * Checks to see if a chunk exists at x, y

    */

    public boolean chunkExists(int p_73149_1_, int p_73149_2_)

    {

        return true;

    }

 

    /**

    * Populates chunk with ores etc etc

    */

    public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_)

    {

        BlockFalling.fallInstantly = true;

        int k = p_73153_2_ * 16;

        int l = p_73153_3_ * 16;

        BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);

        this.rand.setSeed(this.worldObj.getSeed());

        long i1 = this.rand.nextLong() / 2L * 2L + 1L;

        long j1 = this.rand.nextLong() / 2L * 2L + 1L;

        this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed());

        boolean flag = false;

 

        MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));

 

        if (this.mapFeaturesEnabled)

        {

            this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, p_73153_2_, p_73153_3_);

            flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, p_73153_2_, p_73153_3_);

            //this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, p_73153_2_, p_73153_3_);

            this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, p_73153_2_, p_73153_3_);

        }

 

        int k1;

        int l1;

        int i2;

 

        if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0

            && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE))

        {

            k1 = k + this.rand.nextInt(16) + 8;

            l1 = this.rand.nextInt(256);

            i2 = l + this.rand.nextInt(16) + 8;

            (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);

        }

 

        if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.rand.nextInt(8) == 0)

        {

            k1 = k + this.rand.nextInt(16) + 8;

            l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);

            i2 = l + this.rand.nextInt(16) + 8;

 

            if (l1 < 63 || this.rand.nextInt(10) == 0)

            {

                (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);

            }

        }

 

        boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, DUNGEON);

        for (k1 = 0; doGen && k1 < 8; ++k1)

        {

            l1 = k + this.rand.nextInt(16) + 8;

            i2 = this.rand.nextInt(256);

            int j2 = l + this.rand.nextInt(16) + 8;

            (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);

        }

 

        biomegenbase.decorate(this.worldObj, this.rand, k, l);

        if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS))

        {

        SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);

        }

        k += 8;

        l += 8;

 

        doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE);

        for (k1 = 0; doGen && k1 < 16; ++k1)

        {

            for (l1 = 0; l1 < 16; ++l1)

            {

                i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);

 

                if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l))

                {

                    this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2);

                }

 

                if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true))

                {

                    this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2);

                }

            }

        }

 

        MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));

 

        BlockFalling.fallInstantly = false;

    }

 

    /**

    * Two modes of operation: if passed true, save all Chunks in one go.  If passed false, save up to two chunks.

    * Return true if all chunks have been saved.

    */

    public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_)

    {

        return true;

    }

 

    /**

    * Save extra data not associated with any Chunk.  Not saved during autosave, only during world unload.  Currently

    * unimplemented.

    */

    public void saveExtraData() {}

 

    /**

    * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.

    */

    public boolean unloadQueuedChunks()

    {

        return false;

    }

 

    /**

    * Returns if the IChunkProvider supports saving.

    */

    public boolean canSave()

    {

        return true;

    }

 

    /**

    * Converts the instance data to a readable string.

    */

    public String makeString()

    {

        return "RandomLevelSource";

    }

 

    /**

    * Returns a list of creatures of the specified type that can spawn at the given location.

    */

    public List getPossibleCreatures(EnumCreatureType p_73155_1_, int p_73155_2_, int p_73155_3_, int p_73155_4_)

    {

        BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(p_73155_2_, p_73155_4_);

        return p_73155_1_ == EnumCreatureType.monster && this.scatteredFeatureGenerator.func_143030_a(p_73155_2_, p_73155_3_, p_73155_4_) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(p_73155_1_);

    }

 

    public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_)

    {

        return null;//return "Stronghold".equals(p_147416_2_) && this.strongholdGenerator != null ? this.strongholdGenerator.func_151545_a(p_147416_1_, p_147416_3_, p_147416_4_, p_147416_5_) : null;

    }

 

    public int getLoadedChunkCount()

    {

        return 0;

    }

 

    public void recreateStructures(int p_82695_1_, int p_82695_2_)

    {

        if (this.mapFeaturesEnabled)

        {

            this.mineshaftGenerator.func_151539_a(this, this.worldObj, p_82695_1_, p_82695_2_, (Block[])null);

            this.villageGenerator.func_151539_a(this, this.worldObj, p_82695_1_, p_82695_2_, (Block[])null);

            //this.strongholdGenerator.func_151539_a(this, this.worldObj, p_82695_1_, p_82695_2_, (Block[])null);

            this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, p_82695_1_, p_82695_2_, (Block[])null);

        }

    }

}

 

 

TeleporterNillax code:

 

public class TeleporterNillax 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.

*/

private final List destinationCoordinateKeys = new ArrayList();

public TeleporterNillax(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;

 

 

/** change this block **/

this.worldServerInstance.setBlock(k1, l1, i2, flag ? ModBlocks.nillaxStone : null);

}

}

}

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.

*/

@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)

{

/** change this block **/

if (this.worldServerInstance.getBlock(k1, i2, l1) == ModBlocks.portalNillax)

{

/** change this block **/

while (this.worldServerInstance.getBlock(k1, i2 - 1, l1) == ModBlocks.portalNillax)

{

--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 NillaxPortalPosition(this, 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;

/** change this block **/

if (this.worldServerInstance.getBlock(i - 1, j, k) == ModBlocks.portalNillax)

{

j2 = 2;

}

/** change this block **/

if (this.worldServerInstance.getBlock(i + 1, j, k) == ModBlocks.portalNillax)

{

j2 = 0;

}

/** change this block **/

if (this.worldServerInstance.getBlock(i, j, k - 1) == ModBlocks.portalNillax)

{

j2 = 3;

}

/** change this block **/

if (this.worldServerInstance.getBlock(i, j, k + 1) == ModBlocks.portalNillax)

{

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;

 

 

/** change this block **/

this.worldServerInstance.setBlock(k3, j3, i4, flag ? ModBlocks.nillaxStone : null);

}

}

}

}

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;

 

 

/** change these blocks **/

this.worldServerInstance.setBlock(k3, j3, i4, flag ? ModBlocks.nillaxStone : ModBlocks.portalNillax, 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.

*/

@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());

}

}

}

}

}

 

 

 

BlockPortalNillax:

 

public class BlockPortalNillax extends BlockPortal{

 

public BlockPortalNillax() {

super();

}

 

@Override

public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){

if(entity.ridingEntity == null && entity.riddenByEntity == null && entity instanceof EntityPlayerMP){

EntityPlayerMP player = (EntityPlayerMP) entity;

FMLCommonHandler.instance().getMinecraftServerInstance();

MinecraftServer server = MinecraftServer.getServer();

 

if(player.timeUntilPortal > 0){

player.timeUntilPortal = 10;

}else if(player.dimension != ZeroQuest.NillaxID){

player.timeUntilPortal = 10;

player.mcServer.getConfigurationManager().transferPlayerToDimension(player, ZeroQuest.NillaxID, new TeleporterNillax(server.worldServerForDimension(ZeroQuest.NillaxID)));

}else{

player.timeUntilPortal = 10;

player.mcServer.getConfigurationManager().transferPlayerToDimension(player, 0, new TeleporterNillax(server.worldServerForDimension(0)));

}

}

}

 

 

    @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) == ModBlocks.nillaxStone || par1World.getBlock(par2 + 1, par3, par4) == ModBlocks.nillaxStone)

        {

            b0 = 1;

        }

 

        if (par1World.getBlock(par2, par3, par4 - 1) == ModBlocks.nillaxStone || par1World.getBlock(par2, par3, par4 + 1) == ModBlocks.nillaxStone)

        {

            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 != ModBlocks.nillaxStone)

                            {

                                return false;

                            }

                        }

                        else if (!isAirBlock && j1 != ModBlocks.nileFire)

                        {

                            return false;

                        }

                    }

                }

            }

 

            for (l = 0; l < 2; ++l)

            {

                for (i1 = 0; i1 < 3; ++i1)

                {

                    par1World.setBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l, this, 0, 2);

                }

            }

 

            return true;

        }

    }

 

      @Override

  public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5Block)

    {

        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) != ModBlocks.nillaxStone)

        {

            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) == ModBlocks.nillaxStone)

            {

                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) != ModBlocks.nillaxStone || par1World.getBlock(par2 - b0, par3, par4 - b1) != this) && (par1World.getBlock(par2 - b0, par3, par4 - b1) != ModBlocks.nillaxStone || par1World.getBlock(par2 + b0, par3, par4 + b1) != this))

                    {

                        par1World.setBlockToAir(par2, par3, par4);

                    }

                }

            }

            else

            {

                par1World.setBlockToAir(par2, par3, par4);

            }

        }

    }

}

 

 

 

WorldGenZQuest:

 

public class WorldGenZQuest implements IWorldGenerator {

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

     

switch(world.provider.dimensionId){

case 0:

generateNether(world, random, chunkX*16, chunkZ*16);

case -1:

generateSurface(world, random, chunkX*16, chunkZ*16);

case 1:

generateEnd(world, random, chunkX*16, chunkZ*16);

case ZeroQuest.NillaxID:

generateNillaxDimension(world, random, chunkX*16, chunkZ*16);

case ZeroQuest.DarkaxID:

if(Constants.DEF_DARKLOAD == true){

generateDarkaxDimension(world, random, chunkX*16, chunkZ*16);

}

}

}

 

private void generateSurface(World world, Random random, int x, int y) {

 

}

 

private void generateNether(World world, Random random, int x, int y) {

 

}

private void generateEnd(World world, Random random, int x, int y) {

 

}

 

private void generateNillaxDimension(World world, Random random, int x, int y) {

this.addOreSpawn(ModBlocks.nileGrainOre, world, random, x, y, 20, 20, 3+random.nextInt(5), 80, 3, 90);

this.addOreSpawn(ModBlocks.nileCoalOre, world, random, x, y, 16, 16, 4+random.nextInt(5), 100, 0, 97);

/*for (int i = 0; i < 50; i++)

{

int xCoord = x + random.nextInt(16);

int yCoord = random.nextInt(128);

int zCoord = y + random.nextInt(16);

new WorldGenMinableZQuest(ModBlocks.nileGrainOre, 15).generate(world, random, xCoord, yCoord, zCoord);

}

for (int i = 0; i < 50; i++)

{

int xCoord = x + random.nextInt(16);

int yCoord = random.nextInt(128);

int zCoord = y + random.nextInt(16);

new WorldGenMinableZQuest(ModBlocks.nileGrainOre, 15).generate(world, random, xCoord, yCoord, zCoord);

}*/

 

}

 

private void generateDarkaxDimension(World world, Random random, int x, int y){

this.addOreSpawn(ModBlocks.darkGrainOre, world, random, x, y, 25, 25, 3+random.nextInt(5), 70, 3, 80);

}

 

public void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY)

{

        assert maxY > minY : "The maximum Y must be greater than the Minimum Y";

        assert maxX > 0 && maxX <= 16 : "addOreSpawn: The Maximum X must be greater than 0 and less than 16";

        assert minY > 0 : "addOreSpawn: The Minimum Y must be greater than 0";

        assert maxY < 256 && maxY > 0 : "addOreSpawn: The Maximum Y must be less than 256 but greater than 0";

        assert maxZ > 0 && maxZ <= 16 : "addOreSpawn: The Maximum Z must be greater than 0 and less than 16";

 

        int diffBtwnMinMaxY = maxY - minY;

        for (int x = 0; x < chancesToSpawn; x++)

        {

            int posX = blockXPos + random.nextInt(maxX);

            int posY = minY + random.nextInt(diffBtwnMinMaxY);

            int posZ = blockZPos + random.nextInt(maxZ);

            (new WorldGenMinableZQuest(block, maxVeinSize)).generate(world, random, posX, posY, posZ);

        }

}

}

 

 

WorldGen MineableZQuest:

 

public class WorldGenMinableZQuest extends WorldGenerator

{

    private Block field_150519_a;

    /** The number of blocks to generate. */

    private int numberOfBlocks;

    private Block field_150518_c;

    private static final String __OBFID = "CL_00000426";

    private int mineableBlockMeta;

 

    public WorldGenMinableZQuest(Block p_i45459_1_, int p_i45459_2_)

    {

        this(p_i45459_1_, p_i45459_2_, ModBlocks.nileStone);

    }

 

    public WorldGenMinableZQuest(Block p_i45460_1_, int p_i45460_2_, Block p_i45460_3_)

    {

        this.field_150519_a = p_i45460_1_;

        this.numberOfBlocks = p_i45460_2_;

        this.field_150518_c = p_i45460_3_;

    }

 

    public WorldGenMinableZQuest(Block block, int meta, int number, Block target)

    {

        this(block, number, target);

        this.mineableBlockMeta = meta;

    }

 

    public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_)

    {

        float f = p_76484_2_.nextFloat() * (float)Math.PI;

        double d0 = (double)((float)(p_76484_3_ + 8) + MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F);

        double d1 = (double)((float)(p_76484_3_ + 8) - MathHelper.sin(f) * (float)this.numberOfBlocks / 8.0F);

        double d2 = (double)((float)(p_76484_5_ + 8) + MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F);

        double d3 = (double)((float)(p_76484_5_ + 8) - MathHelper.cos(f) * (float)this.numberOfBlocks / 8.0F);

        double d4 = (double)(p_76484_4_ + p_76484_2_.nextInt(3) - 2);

        double d5 = (double)(p_76484_4_ + p_76484_2_.nextInt(3) - 2);

 

        for (int l = 0; l <= this.numberOfBlocks; ++l)

        {

            double d6 = d0 + (d1 - d0) * (double)l / (double)this.numberOfBlocks;

            double d7 = d4 + (d5 - d4) * (double)l / (double)this.numberOfBlocks;

            double d8 = d2 + (d3 - d2) * (double)l / (double)this.numberOfBlocks;

            double d9 = p_76484_2_.nextDouble() * (double)this.numberOfBlocks / 16.0D;

            double d10 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * d9 + 1.0D;

            double d11 = (double)(MathHelper.sin((float)l * (float)Math.PI / (float)this.numberOfBlocks) + 1.0F) * d9 + 1.0D;

            int i1 = MathHelper.floor_double(d6 - d10 / 2.0D);

            int j1 = MathHelper.floor_double(d7 - d11 / 2.0D);

            int k1 = MathHelper.floor_double(d8 - d10 / 2.0D);

            int l1 = MathHelper.floor_double(d6 + d10 / 2.0D);

            int i2 = MathHelper.floor_double(d7 + d11 / 2.0D);

            int j2 = MathHelper.floor_double(d8 + d10 / 2.0D);

 

            for (int k2 = i1; k2 <= l1; ++k2)

            {

                double d12 = ((double)k2 + 0.5D - d6) / (d10 / 2.0D);

 

                if (d12 * d12 < 1.0D)

                {

                    for (int l2 = j1; l2 <= i2; ++l2)

                    {

                        double d13 = ((double)l2 + 0.5D - d7) / (d11 / 2.0D);

 

                        if (d12 * d12 + d13 * d13 < 1.0D)

                        {

                            for (int i3 = k1; i3 <= j2; ++i3)

                            {

                                double d14 = ((double)i3 + 0.5D - d8) / (d10 / 2.0D);

 

                                if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && p_76484_1_.getBlock(k2, l2, i3).isReplaceableOreGen(p_76484_1_, k2, l2, i3, field_150518_c))

                                {

                                    p_76484_1_.setBlock(k2, l2, i3, this.field_150519_a, mineableBlockMeta, 2);

                                }

                            }

                        }

                    }

                }

            }

        }

 

        return true;

    }

}

 

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

hi

 

I suggest you place a breakpoint at ChunkProviderNillax.populate(ChunkProviderNillax.java:467 and see why it is trying to generate a random number with an upper bound less than 0.

 

My guess is that you haven't initialised your animal spawning list properly, i.e. maxGroupCount and minGroupCount, assuming my line numbering is the same as yours

 

                int i1 = spawnlistentry.minGroupCount + par6Random.nextInt(1 + spawnlistentry.maxGroupCount - spawnlistentry.minGroupCount);

 

Are you familiar with breakpoints and watches?  If not, try these

http://www.vogella.com/tutorials/EclipseDebugging/article.html

http://www.terryanderson.ca/debugging/run.html

 

-TGG

 

 

 

Posted

Where in your code are you using "Random.nextInt(Unknown Source)" when using nextInt you have to use a postive and greater then 0 value (because it returns a random between 0 and value)

 

that is the only issue, then it crawls up from spawnAnimals to your populate function line 467. What is that line btw, can you just post that segment for me?

Posted

It's somewhere in this part but I dont understand why im getting an error when I got an extact copy of the source (with some changes to the blocks)

 

    public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_)

    {

        BlockFalling.fallInstantly = true;

        int k = p_73153_2_ * 16;

        int l = p_73153_3_ * 16;

        BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);

        this.rand.setSeed(this.worldObj.getSeed());

        long i1 = this.rand.nextLong() / 2L * 2L + 1L;

        long j1 = this.rand.nextLong() / 2L * 2L + 1L;

        this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed());

        boolean flag = false;

 

        MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));

 

        if (this.mapFeaturesEnabled)

        {

            this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, p_73153_2_, p_73153_3_);

            flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, p_73153_2_, p_73153_3_);

            this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, p_73153_2_, p_73153_3_);

            this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, p_73153_2_, p_73153_3_);

        }

 

        int k1;

        int l1;

        int i2;

 

        if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0

            && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE))

        {

            k1 = k + this.rand.nextInt(16) + 8;

            l1 = this.rand.nextInt(256);

            i2 = l + this.rand.nextInt(16) + 8;

            (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);

        }

 

        if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.rand.nextInt(8) == 0)

        {

            k1 = k + this.rand.nextInt(16) + 8;

            l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);

            i2 = l + this.rand.nextInt(16) + 8;

 

            if (l1 < 63 || this.rand.nextInt(10) == 0)

            {

                (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);

            }

        }

 

        boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, DUNGEON);

        for (k1 = 0; doGen && k1 < 8; ++k1)

        {

            l1 = k + this.rand.nextInt(16) + 8;

            i2 = this.rand.nextInt(256);

            int j2 = l + this.rand.nextInt(16) + 8;

            (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);

        }

 

        biomegenbase.decorate(this.worldObj, this.rand, k, l);

        if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS))

        {

        SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, rand);

        }

        k += 8;

        l += 8;

 

        doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE);

        for (k1 = 0; doGen && k1 < 16; ++k1)

        {

            for (l1 = 0; l1 < 16; ++l1)

            {

                i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);

 

                if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l))

                {

                    this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2);

                }

 

                if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true))

                {

                    this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2);

                }

            }

        }

 

        MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));

 

        BlockFalling.fallInstantly = false;

    }

 

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Do you have to tell a dimension what mobs it can spawn? I think when it goes to spawn mobs it gets an empty list when it goes to randomly pick one to spawn "Random.nextInt(value)"

 

...

My guess is that you haven't initialised your animal spawning list properly, i.e. maxGroupCount and minGroupCount, assuming my line numbering is the same as yours

 

                int i1 = spawnlistentry.minGroupCount + par6Random.nextInt(1 + spawnlistentry.maxGroupCount - spawnlistentry.minGroupCount);

...

 

I'm just reading your errorlog and the stacktrace seems to lead to what TGG suggested.

Posted

The problem is that I don't know where to put it at, it was working before and now it suddenly doesn't want to work anymore. I copied exactly from the source code and that still didn't work.

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Posted

Hi

 

This line in vanilla retrieves your list of spawnable creatures

        List list = par1BiomeGenBase.getSpawnableList(EnumCreatureType.creature);

 

1) Place the breakpoint in your code here

SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);

 

2) Step into performWorldGenSpawning

 

When you get to

        List list = par1BiomeGenBase.getSpawnableList(EnumCreatureType.creature);

 

Then inspect the list.  It will have a number of elements in it like this

    public static class SpawnListEntry extends WeightedRandom.Item
        {
            /** Holds the class of the entity to be spawned. */
            public Class entityClass;
            public int minGroupCount;
            public int maxGroupCount;

One of these will have maxGroupCount less than minGroupCount.  This is causing the problem.

 

Use your debugger to print the list item, which will tell you which Entity it is.  That should hopefully give you a clue.

 

If you have no joy with the debugger, you could use ordinary code instead, eg

 

From your code:

 if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS))
{
      List list = biomegenbase.getSpawnableList(EnumCreatureType.creature);
      System.out.println("biomegenbase.getSpawnableList:");
      for (Object entry : list) {
        System.out.println((BiomeGenBase.SpawnListEntry)entry);
      }

  SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
}

 

Run it, wait for it to crash, then look at the debug log and see which entry might have caused the problem.

 

-TGG

Posted

Hi

 

This line in vanilla retrieves your list of spawnable creatures

        List list = par1BiomeGenBase.getSpawnableList(EnumCreatureType.creature);

 

1) Place the breakpoint in your code here

SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);

 

2) Step into performWorldGenSpawning

 

When you get to

        List list = par1BiomeGenBase.getSpawnableList(EnumCreatureType.creature);

 

Then inspect the list.  It will have a number of elements in it like this

    public static class SpawnListEntry extends WeightedRandom.Item
        {
            /** Holds the class of the entity to be spawned. */
            public Class entityClass;
            public int minGroupCount;
            public int maxGroupCount;

One of these will have maxGroupCount less than minGroupCount.  This is causing the problem.

 

Use your debugger to print the list item, which will tell you which Entity it is.  That should hopefully give you a clue.

 

If you have no joy with the debugger, you could use ordinary code instead, eg

 

From your code:

 if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ANIMALS))
{
      List list = biomegenbase.getSpawnableList(EnumCreatureType.creature);
      System.out.println("biomegenbase.getSpawnableList:");
      for (Object entry : list) {
        System.out.println((BiomeGenBase.SpawnListEntry)entry);
      }

  SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
}

 

Run it, wait for it to crash, then look at the debug log and see which entry might have caused the problem.

 

-TGG

Thanks! When you said that the maxGroupCount might be last than the minGroupCount, I started looking through my custom biomes and discovered that I mixed up the two variables. Then I ran it and the dimension travel works perfectly without that error. :D

Main Developer and Owner of Zero Quest

Visit the Wiki for more information

If I helped anyone, please give me a applaud and a thank you!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • It is 1.12.2 - I have no idea if there is a 1.12 pack
    • Okay, but does the modpack works with 1.12 or just with 1.12.2, because I need the Forge client specifically for Minecraft 1.12, not 1.12.2
    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.