Posted July 22, 201510 yr I have made a new block, extending BlockPane. Initially, I had the texture set to the vanilla Iron Bars. This didn't require me to register any textures (obviously), just declare the already registered texture, when initialising the block, like so: public static Block poweredFence = new REFence("iron_bars", "iron_bars", Material.rock, false).setBlockName(Names.Traps.POWEREDFENCE); Now that I have gotten the block functioning as I want it to, I am attempting to add my own texture to it. I tried registering the texture as normal, in the block class - and adjusting the block initialisation: public static Block poweredFence = new REFence("powered_fence", "powered_fence", Material.rock, false).setBlockName(Names.Traps.POWEREDFENCE); @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister icon) { blockIcon = icon.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); } This has worked for everything else I have done, and does retexture the in-hand icon, but when placed in the world the game crashes with a null pointer exception. I know that I need to register the texture file, and the way I have it works, but I am not sure why it causes a crash when the block is placed. I presume I need to register the icon somewhere else, though I am not sure where/how, as registering the icon in my client proxy was unsuccessful and I couldn't find a sufficient tutorial that explained/solved my problem. Here is the crash report too: ---- Minecraft Crash Report ---- // I blame Dinnerbone. Time: 22/07/15 19:45 Description: Unexpected error java.lang.NullPointerException: Unexpected error at net.minecraft.client.renderer.RenderBlocks.renderBlockPane(RenderBlocks.java:3275) at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:378) at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1618) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1091) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1068) at net.minecraft.client.Minecraft.run(Minecraft.java:962) at net.minecraft.client.main.Main.main(Main.java:164) 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:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at net.minecraft.client.renderer.RenderBlocks.renderBlockPane(RenderBlocks.java:3275) at net.minecraft.client.renderer.RenderBlocks.renderBlockByRenderType(RenderBlocks.java:378) at net.minecraft.client.renderer.WorldRenderer.updateRenderer(WorldRenderer.java:207) at net.minecraft.client.renderer.RenderGlobal.updateRenderers(RenderGlobal.java:1618) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityClientPlayerMP['PegBeard'/418, l='MpServer', x=394.15, y=5.62, z=-48.13]] Chunk stats: MultiplayerChunkCache: 70, 70 Level seed: 0 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: Level spawn location: World: (387,4,-56), Chunk: (at 3,0,8 in 24,-4; contains blocks 384,0,-64 to 399,255,-49), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1) Level time: 978 game time, 978 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: 30 total; [EntityClientPlayerMP['PegBeard'/418, l='MpServer', x=394.15, y=5.62, z=-48.13], EntitySlime['Slime'/330, l='MpServer', x=392.25, y=4.00, z=-94.99], EntitySlime['Slime'/331, l='MpServer', x=399.45, y=4.00, z=9.81], EntitySlime['Slime'/332, l='MpServer', x=393.43, y=4.00, z=20.43], EntitySheep['Sheep'/336, l='MpServer', x=429.50, y=4.00, z=-83.50], EntitySheep['Sheep'/337, l='MpServer', x=431.22, y=4.00, z=-82.22], EntityCow['Cow'/338, l='MpServer', x=431.34, y=4.00, z=-84.03], EntityCow['Cow'/339, l='MpServer', x=429.50, y=4.00, z=-85.50], EntityCow['Cow'/340, l='MpServer', x=429.13, y=4.00, z=-87.84], EntitySlime['Slime'/276, l='MpServer', x=329.70, y=4.00, z=30.91], EntityCow['Cow'/341, l='MpServer', x=430.41, y=4.00, z=-87.84], EntitySlime['Slime'/342, l='MpServer', x=430.09, y=4.00, z=-41.19], EntitySlime['Slime'/343, l='MpServer', x=422.66, y=4.00, z=26.34], EntityPig['Pig'/347, l='MpServer', x=437.69, y=4.00, z=-80.41], EntityPig['Pig'/348, l='MpServer', x=436.22, y=4.00, z=-82.66], EntityPig['Pig'/349, l='MpServer', x=441.81, y=4.00, z=-87.19], EntitySheep['Sheep'/350, l='MpServer', x=436.50, y=4.00, z=-81.31], EntitySheep['Sheep'/351, l='MpServer', x=432.75, y=4.00, z=-82.28], EntityPig['Pig'/352, l='MpServer', x=441.47, y=4.00, z=-70.19], EntitySlime['Slime'/353, l='MpServer', x=440.34, y=4.00, z=-69.92], EntitySlime['Slime'/354, l='MpServer', x=440.92, y=4.00, z=-17.69], EntitySlime['Slime'/355, l='MpServer', x=443.21, y=4.00, z=-15.37], EntityCow['Cow'/359, l='MpServer', x=460.22, y=4.00, z=-92.50], EntityCow['Cow'/360, l='MpServer', x=461.81, y=4.00, z=-92.50], EntitySlime['Slime'/297, l='MpServer', x=336.47, y=4.00, z=11.72], EntitySlime['Slime'/361, l='MpServer', x=449.97, y=4.00, z=-31.70], EntitySlime['Slime'/362, l='MpServer', x=464.07, y=4.00, z=-9.12], EntitySheep['Sheep'/307, l='MpServer', x=365.13, y=4.00, z=-31.88], EntitySlime['Slime'/318, l='MpServer', x=373.84, y=4.00, z=-20.43], EntitySlime['Slime'/319, l='MpServer', x=368.66, y=4.00, z=11.81]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2567) at net.minecraft.client.Minecraft.run(Minecraft.java:991) at net.minecraft.client.main.Main.main(Main.java:164) 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:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) at GradleStart.main(Unknown Source) -- System Details -- Details: Minecraft Version: 1.7.10 Operating System: Windows 7 (x86) version 6.1 Java Version: 1.8.0_51, Oracle Corporation Java VM Version: Java HotSpot Client VM (mixed mode, sharing), Oracle Corporation Memory: 56544648 bytes (53 MB) / 173981696 bytes (165 MB) up to 259522560 bytes (247 MB) JVM Flags: 0 total; AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.3.1408 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->Available->Available->Available->Available->Available FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.3.1408-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available Forge{10.13.3.1408} [Minecraft Forge] (forgeSrc-1.7.10-10.13.3.1408-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available RedstoneEngineering{inDev} [RedstoneEngineering] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available->Available->Available->Available->Available->Available GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.2.12422 Compatibility Profile Context 13.152.0.0' Renderer: 'AMD Radeon HD 8670D' Launched Version: 1.7.10 LWJGL: 2.9.1 OpenGL: AMD Radeon HD 8670D GL version 4.2.12422 Compatibility Profile Context 13.152.0.0, ATI Technologies Inc. GL Caps: Using GL 1.3 multitexturing. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Anisotropic filtering is supported and maximum anisotropy is 16. Shaders are available because OpenGL 2.1 is supported. Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: [] Current Language: English (US) Profiler Position: N/A (disabled) Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used Anisotropic Filtering: Off (1)
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.