Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChunkCreationHook.setBlockData() causing ArrayIndexOutOfBoundsException #124

Open
caHarkness opened this issue Jun 4, 2015 · 1 comment

Comments

@caHarkness
Copy link

When adding a hook handler like so:

    @SuppressWarnings("unused")
    @HookHandler
    public void onChunkCreate(ChunkCreationHook hook)
    {   

Calling hook.setBlockData(new int[32768]); causes an ArrayIndexOutOfBoundsException. One thing I would like to mention is that 16 * 16 * 256, the suggested chunk size, does not add up to 32768. It adds up to 65536. Attempting to setBlockData with either size does not work.

Update

Apparently, initializing the array with 65536 and setting all the integers in the array to 0 leads to another problem:

[18:01:33] [net.minecraft.server.MinecraftServer] [ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Exception initializing level
    at net.minecraft.world.WorldServer.a(WorldServer.java:670) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.server.MinecraftServer.initWorld(MinecraftServer.java:282) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.server.dedicated.DedicatedServer.i(DedicatedServer.java:340) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:450) [canary.jar:1.8.0-1.2.0]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_25]
Caused by: java.lang.IllegalArgumentException: bound must be positive
    at java.util.Random.nextInt(Unknown Source) ~[?:1.8.0_25]
    at net.minecraft.world.biome.BiomeDecorator.a(BiomeDecorator.java:190) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.biome.BiomeDecorator.a(BiomeDecorator.java:114) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.biome.BiomeGenBase.a(BiomeGenBase.java:278) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.gen.ChunkProviderGenerate.a(ChunkProviderGenerate.java:401) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.gen.ChunkProviderServer.a(ChunkProviderServer.java:233) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.chunk.Chunk.a(Chunk.java:893) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.gen.ChunkProviderServer.c(ChunkProviderServer.java:163) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.gen.ChunkProviderServer.d(ChunkProviderServer.java:172) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.World.a(World.java:261) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.World.f(World.java:257) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.World.p(World.java:619) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.World.d(World.java:195) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.World.c(World.java:182) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.WorldProvider.a(WorldProvider.java:95) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.WorldServer.b(WorldServer.java:723) ~[canary.jar:1.8.0-1.2.0]
    at net.minecraft.world.WorldServer.a(WorldServer.java:653) ~[canary.jar:1.8.0-1.2.0]
    ... 4 more

An IllegalArgumentException is thrown instead. bound must be positive.

@darkdiplomat
Copy link
Member

This should actually be a new byte[256] (I got biomes stuck in the head for some reason...) int[65536], at one time it was set internally as an array of 32768 (even though the height had a change)

Its also not implemented properly with 1.8 right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants