Posted December 4, 201410 yr Hi, I'm new to the forum and I am Italian so sorry for my English. I'm working on a mod for Minecraft 1.7.2 and I have to insert a custom tree. The problem is that as soon as I make the tree grow with bonemeal minecraft crash. The error brings me back to the line 58 of the code (the return of the IIcon function) , what's wrong with that line? package megakron.trees; import java.util.List; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import megakron.Megakron; import net.minecraft.block.BlockLeaves; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; public class TyreLeaf extends BlockLeaves { public static final String[][] leaftypes = new String[][] {{"leaf_TyreOpaque"},{"leaf_Tyre"}}; public static final String[] leaves = new String[] {"Tyre"}; protected void func_150124_c(World world, int x, int y, int z, int side, int meta) { if((side & 3) == 1 && world.rand.nextInt(meta) == 0) { this.dropBlockAsItem(world, x, y, z, new ItemStack(Megakron.tyreSapling, 1, 0)); } } public int damageDropped(int i) { return super.damageDropped(i) + 4; } public int getDamageValue(World world, int x, int y, int z) { return world.getBlockMetadata(x, y, z) & 3; } @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list) { for(int i = 0; i < leaves.length; i++) { list.add(new ItemStack(item, 1, i)); } } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { for(int i = 0; i < leaftypes.length; ++i) { this.field_150129_M[i] = new IIcon[leaftypes[i].length]; for(int j = 0; j < leaftypes[i].length; ++j) { this.field_150129_M[i][j] = iconRegister.registerIcon("megakron:" + leaftypes[i][j]); } } } @Override public IIcon getIcon(int side, int meta) { return (meta & 3) == 1 ? this.field_150129_M[this.field_150127_b][1] : this.field_150129_M[this.field_150127_b][0]; } @Override public String[] func_150125_e() { return leaves; } }
December 4, 201410 yr Well, you didn't tell us what the error is so that makes it harder. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
December 4, 201410 yr Author I am sorry, crash when I try to grow the tree. Now place the crash report: [Client thread/FATAL]: Unreported exception thrown! java.lang.ArrayIndexOutOfBoundsException: 1 at megakron.trees.TyreLeaf.getIcon(TyreLeaf.java:58) ~[TyreLeaf.class:?] at net.minecraft.block.Block.getIcon(Block.java:643) ~[block.class:?] at net.minecraft.client.renderer.RenderBlocks.getBlockIcon(RenderBlocks.java:8417) ~[RenderBlocks.class:?] at net.minecraft.client.renderer.RenderBlocks.renderStandardBlockWithAmbientOcclusion(RenderBlocks.java:4614) ~[RenderBlocks.class:?] at net.minecraft.client.renderer.RenderBlocks.renderStandardBlock(RenderBlocks.java:4416) ~[RenderBlocks.class:?] at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:345) ~[RenderBlocks.class:?] at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) ~[WorldRenderer.class:?] at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1610) ~[RenderGlobal.class:?] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1254) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1087) ~[EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1012) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:900) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] ---- Minecraft Crash Report ---- // I feel sad now Time: 04/12/14 16.06 Description: Unexpected error java.lang.ArrayIndexOutOfBoundsException: 1 at megakron.trees.TyreLeaf.getIcon(TyreLeaf.java:58) at net.minecraft.block.Block.getIcon(Block.java:643) at net.minecraft.client.renderer.RenderBlocks.getBlockIcon(RenderBlocks.java:8417) at net.minecraft.client.renderer.RenderBlocks.renderStandardBlockWithAmbientOcclusion(RenderBlocks.java:4614) at net.minecraft.client.renderer.RenderBlocks.renderStandardBlock(RenderBlocks.java:4416) at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:345) at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1610) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1254) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1087) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1012) at net.minecraft.client.Minecraft.run(Minecraft.java:900) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at megakron.trees.TyreLeaf.getIcon(TyreLeaf.java:58) at net.minecraft.block.Block.getIcon(Block.java:643) at net.minecraft.client.renderer.RenderBlocks.getBlockIcon(RenderBlocks.java:8417) at net.minecraft.client.renderer.RenderBlocks.renderStandardBlockWithAmbientOcclusion(RenderBlocks.java:4614) at net.minecraft.client.renderer.RenderBlocks.renderStandardBlock(RenderBlocks.java:4416) at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:345) at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1610) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1254) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['Player686'/106, l='MpServer', x=163,50, y=67,62, z=246,50]] Chunk stats: MultiplayerChunkCache: 225, 225 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: World: (160,64,256), Chunk: (at 0,4,0 in 10,16; contains blocks 160,0,256 to 175,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 292 game time, 292 day time Level dimension: 0 Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Forced entities: 90 total; [EntityHorse['Horse'/6, l='MpServer', x=92,50, y=67,00, z=263,50], EntityHorse['Horse'/7, l='MpServer', x=94,13, y=67,00, z=262,13], EntityHorse['Horse'/8, l='MpServer', x=139,28, y=65,00, z=178,72], EntityHorse['Horse'/9, l='MpServer', x=141,13, y=65,00, z=180,00], EntityHorse['Horse'/10, l='MpServer', x=143,53, y=64,00, z=180,00], EntityHorse['Horse'/11, l='MpServer', x=135,99, y=66,00, z=177,00], EntitySheep['Sheep'/12, l='MpServer', x=140,50, y=65,00, z=168,50], EntitySheep['Sheep'/13, l='MpServer', x=142,50, y=67,00, z=171,50], EntitySheep['Sheep'/14, l='MpServer', x=144,50, y=67,00, z=169,50], EntitySheep['Sheep'/15, l='MpServer', x=144,50, y=67,00, z=171,50], EntityHorse['Horse'/17, l='MpServer', x=144,50, y=68,00, z=282,50], EntityHorse['Horse'/16, l='MpServer', x=140,50, y=69,00, z=283,50], EntityHorse['Horse'/19, l='MpServer', x=148,50, y=67,00, z=299,50], EntityHorse['Horse'/18, l='MpServer', x=146,13, y=67,00, z=300,13], EntityHorse['Horse'/29, l='MpServer', x=176,14, y=68,00, z=260,02], EntityHorse['Horse'/28, l='MpServer', x=172,56, y=68,00, z=262,22], EntityHorse['Horse'/31, l='MpServer', x=167,81, y=67,00, z=258,81], EntityHorse['Horse'/30, l='MpServer', x=176,13, y=67,00, z=257,13], EntityHorse['Horse'/34, l='MpServer', x=213,84, y=65,00, z=309,04], EntityHorse['Horse'/35, l='MpServer', x=205,75, y=64,00, z=298,25], EntityHorse['Horse'/32, l='MpServer', x=176,13, y=67,00, z=258,13], EntityHorse['Horse'/33, l='MpServer', x=177,83, y=68,00, z=260,71], EntityHorse['Horse'/38, l='MpServer', x=209,50, y=67,00, z=297,50], EntityHorse['Horse'/39, l='MpServer', x=212,13, y=68,00, z=296,13], EntityHorse['Horse'/36, l='MpServer', x=202,72, y=64,00, z=299,13], EntityHorse['Horse'/37, l='MpServer', x=207,88, y=64,00, z=297,72], EntityCreeper['Creeper'/112, l='MpServer', x=91,50, y=14,00, z=167,50], EntityCreeper['Creeper'/2099, l='MpServer', x=124,50, y=13,00, z=265,50], EntitySquid['Squid'/220, l='MpServer', x=104,50, y=60,16, z=192,50], EntitySquid['Squid'/222, l='MpServer', x=108,63, y=58,38, z=186,34], EntitySquid['Squid'/239, l='MpServer', x=133,28, y=55,31, z=202,03], EntitySquid['Squid'/238, l='MpServer', x=132,41, y=54,69, z=196,06], EntitySquid['Squid'/237, l='MpServer', x=131,25, y=55,34, z=207,50], EntitySquid['Squid'/236, l='MpServer', x=129,72, y=53,84, z=202,97], EntitySquid['Squid'/235, l='MpServer', x=136,50, y=54,00, z=199,63], EntitySquid['Squid'/234, l='MpServer', x=129,94, y=55,03, z=200,13], EntitySquid['Squid'/233, l='MpServer', x=136,50, y=54,72, z=200,78], EntitySquid['Squid'/232, l='MpServer', x=135,09, y=53,28, z=202,50], EntitySquid['Squid'/231, l='MpServer', x=109,50, y=59,06, z=188,88], EntitySquid['Squid'/230, l='MpServer', x=112,28, y=60,22, z=188,06], EntitySquid['Squid'/229, l='MpServer', x=114,50, y=57,78, z=183,78], EntitySquid['Squid'/227, l='MpServer', x=114,72, y=57,34, z=197,09], EntitySquid['Squid'/226, l='MpServer', x=114,63, y=57,22, z=190,25], EntitySquid['Squid'/225, l='MpServer', x=113,81, y=59,03, z=193,34], EntitySquid['Squid'/240, l='MpServer', x=135,50, y=54,00, z=198,50], EntityClientPlayerMP['Player686'/106, l='MpServer', x=163,50, y=67,62, z=246,50], EntitySpider['Spider'/312, l='MpServer', x=170,44, y=17,00, z=184,13], EntitySpider['Spider'/315, l='MpServer', x=161,91, y=16,00, z=185,78], EntityCreeper['Creeper'/322, l='MpServer', x=117,50, y=15,00, z=252,50], EntityCreeper['Creeper'/357, l='MpServer', x=106,50, y=30,00, z=229,50], EntityCreeper['Creeper'/358, l='MpServer', x=105,50, y=30,00, z=232,50], EntityBat['Bat'/444, l='MpServer', x=159,66, y=23,07, z=207,96], EntityCreeper['Creeper'/458, l='MpServer', x=156,72, y=21,00, z=217,13], EntityWitch['Witch'/510, l='MpServer', x=110,50, y=54,00, z=210,50], EntityWitch['Witch'/511, l='MpServer', x=110,50, y=54,00, z=209,50], EntityBat['Bat'/561, l='MpServer', x=159,53, y=50,96, z=314,50], EntityZombie['Zombie'/2810, l='MpServer', x=102,50, y=31,00, z=186,50], EntitySpider['Spider'/2814, l='MpServer', x=101,34, y=31,00, z=190,56], EntityZombie['Zombie'/2812, l='MpServer', x=100,31, y=31,00, z=188,88], EntityItem['item.tile.gravel'/2795, l='MpServer', x=190,81, y=23,13, z=200,78], EntitySkeleton['Skeleton'/638, l='MpServer', x=109,44, y=22,00, z=210,16], EntityBat['Bat'/751, l='MpServer', x=223,28, y=34,00, z=246,40], EntityBat['Bat'/830, l='MpServer', x=162,75, y=26,10, z=192,28], EntitySpider['Spider'/800, l='MpServer', x=179,50, y=41,00, z=324,50], EntityBat['Bat'/782, l='MpServer', x=111,94, y=46,00, z=213,51], EntityCreeper['Creeper'/832, l='MpServer', x=239,50, y=41,00, z=176,50], EntityCreeper['Creeper'/833, l='MpServer', x=241,50, y=41,00, z=173,50], EntityZombie['Zombie'/2818, l='MpServer', x=102,84, y=31,00, z=189,28], EntityZombie['Zombie'/2819, l='MpServer', x=104,50, y=31,00, z=188,50], EntitySpider['Spider'/1104, l='MpServer', x=104,30, y=28,00, z=241,70], EntitySkeleton['Skeleton'/1038, l='MpServer', x=117,50, y=47,00, z=234,50], EntityZombie['Zombie'/1175, l='MpServer', x=116,38, y=48,00, z=185,63], EntityZombie['Zombie'/1176, l='MpServer', x=116,00, y=49,00, z=184,22], EntityZombie['Zombie'/1177, l='MpServer', x=113,88, y=48,00, z=184,44], EntitySkeleton['Skeleton'/1206, l='MpServer', x=162,94, y=15,00, z=191,47], EntityZombie['Zombie'/1207, l='MpServer', x=226,50, y=49,00, z=187,50], EntitySkeleton['Skeleton'/1205, l='MpServer', x=167,50, y=17,00, z=183,50], EntityCreeper['Creeper'/1309, l='MpServer', x=164,50, y=26,00, z=184,50], EntityCreeper['Creeper'/1322, l='MpServer', x=113,50, y=43,00, z=175,50], EntitySlime['Slime'/1524, l='MpServer', x=108,78, y=28,18, z=170,78], EntityCreeper['Creeper'/1470, l='MpServer', x=108,50, y=19,00, z=202,50], EntityZombie['Zombie'/1600, l='MpServer', x=196,66, y=43,00, z=199,97], EntityZombie['Zombie'/1599, l='MpServer', x=195,13, y=44,00, z=201,53], EntityZombie['Zombie'/1592, l='MpServer', x=115,50, y=44,00, z=208,50], EntitySpider['Spider'/2017, l='MpServer', x=192,13, y=29,00, z=194,38], EntitySpider['Spider'/2016, l='MpServer', x=191,19, y=28,00, z=194,41], EntityZombie['Zombie'/2019, l='MpServer', x=191,34, y=25,00, z=197,68], EntityZombie['Zombie'/2020, l='MpServer', x=192,47, y=27,00, z=193,44], EntityZombie['Zombie'/2000, l='MpServer', x=105,50, y=31,00, z=187,50], EntityZombie['Zombie'/1999, l='MpServer', x=105,50, y=31,00, z=184,50]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:410) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2509) at net.minecraft.client.Minecraft.run(Minecraft.java:929) at net.minecraft.client.main.Main.main(Main.java:112) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) -- System Details -- Details: Minecraft Version: 1.7.2 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.7.0, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 791221688 bytes (754 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M AABB Pool Size: 9907 (554792 bytes; 0 MB) allocated, 1337 (74872 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.03 FML v7.2.217.1147 Minecraft Forge 10.12.2.1147 4 mods loaded, 4 mods active mcp{9.03} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{7.2.217.1147} [Forge Mod Loader] (forgeSrc-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{10.12.2.1147} [Minecraft Forge] (forgeSrc-1.7.2-10.12.2.1147.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available megakron{1.0} [MegaKron] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Launched Version: 1.6 LWJGL: 2.9.0 OpenGL: GeForce GTX 760/PCIe/SSE2 GL version 4.4.0 NVIDIA 344.60, NVIDIA Corporation Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: ~~ERROR~~ NullPointerException: null Profiler Position: N/A (disabled) Vec3 Pool Size: 3246 (181776 bytes; 0 MB) allocated, 1457 (81592 bytes; 0 MB) used Anisotropic Filtering: Off (1) #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\PC\Desktop\Minecraft mods\1.7.10 MegaKron\eclipse\.\crash-reports\crash-2014-12-04_16.06.48-client.txt 2014-12-04 16:06:48,382 WARN Unable to register shutdown hook due to JVM state AL lib: (EE) alc_cleanup: 1 device not closed[\code]
December 4, 201410 yr for(int j = 0; j < leaftypes[i].length; ++j) public static final String[][] leaftypes = new String[][] {{"leaf_TyreOpaque"},{"leaf_Tyre"}}; Your array of leaftypes is a [2][1] length array. Of course array index [x][1] will be out of range. Try public static final String[][] leaftypes = new String[][] {{"leaf_TyreOpaque","leaf_Tyre"}}; Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.