Posted March 28, 201510 yr I am making ammo for my gun, and I want it to render like the item used as ammo(like the egg renders when thrown). It crashes when it is fired, and it appears to be because of the rendering code. Here is what I have: RenderCoal.java public class RenderCoal extends RenderEntity { private EnumAmmo ammo; public RenderCoal(RenderManager p_i46185_1_, EnumAmmo ammo) { super(p_i46185_1_); this.ammo = ammo; } protected ResourceLocation getEntityTexture(Entity entity) { if(this.ammo == EnumAmmo.COAL) return new ResourceLocation("minecraft:items/coal"); else if(this.ammo == EnumAmmo.CHARGED_COAL) return new ResourceLocation("unlogicii:items/charged_coal"); else if(this.ammo == EnumAmmo.DESTABILIZED_COAL) return new ResourceLocation("unlogicii:items/destabilized_coal"); else if(this.ammo == EnumAmmo.SEMIREFINED_COAL) return new ResourceLocation("unlogicii:items/semirefined_coal"); else if(this.ammo == EnumAmmo.REFINED_COAL) return new ResourceLocation("unlogicii:items/refined_coal"); else return new ResourceLocation("minecraft:items/coal"); } } ClientProxy.java public class ClientProxy extends CommonProxy { @Override public void registerRenderers(){ RenderingRegistry.registerEntityRenderingHandler(EntityCoal.class, new RenderCoal(Minecraft.getMinecraft().getRenderManager(), EnumAmmo.COAL)); } } EntityCoal.java public class EntityCoal extends EntityThrowable { public EntityCoal(World worldIn) { super(worldIn); } public EntityCoal(World worldIn, EntityLivingBase p_i1780_2_) { super(worldIn, p_i1780_2_); } public EntityCoal(World worldIn, double p_i1781_2_, double p_i1781_4_, double p_i1781_6_) { super(worldIn, p_i1781_2_, p_i1781_4_, p_i1781_6_); } @Override protected void onImpact(MovingObjectPosition p_70184_1_) { if (p_70184_1_.entityHit != null) { p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 1.0F); } if (!this.worldObj.isRemote) { this.setDead(); } } } In my Pre-Init in the main class registerEntity(EntityCoal.class, "ammo_coal"); proxy.registerRenderers(); And the registerEntity code(also in the main class) public static void registerEntity(Class entityClass, String name){ int entityID = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerGlobalEntityID(entityClass, name, entityID); EntityRegistry.registerModEntity(entityClass, name, entityID, instance, 32, 1, true); } And lastly, the crash report [11:04:51] [Client thread/FATAL]: Reported exception thrown! net.minecraft.util.ReportedException: Post-rendering entity in world at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:425) ~[RenderManager.class:?] at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334) ~[RenderManager.class:?] at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301) ~[RenderManager.class:?] at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657) ~[RenderGlobal.class:?] at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088) ~[EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1107) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_25] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_25] at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?] at GradleStart.main(Unknown Source) [start/:?] Caused by: java.lang.NullPointerException at net.minecraft.client.renderer.entity.Render.doRenderShadowAndFire(Render.java:307) ~[Render.class:?] at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:388) ~[RenderManager.class:?] ... 17 more [11:04:51] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:660]: ---- Minecraft Crash Report ---- // Oops. Time: 3/28/15 11:04 AM Description: Post-rendering entity in world java.lang.NullPointerException: Post-rendering entity in world at net.minecraft.client.renderer.entity.Render.doRenderShadowAndFire(Render.java:307) at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:388) at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334) at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301) at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657) at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1107) at net.minecraft.client.Minecraft.run(Minecraft.java:376) at net.minecraft.client.main.Main.main(Main.java:117) 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.entity.Render.doRenderShadowAndFire(Render.java:307) -- Entity being rendered -- Details: Entity Type: ammo_coal (the_fireplace.unlogicii.entity.coal.EntityCoal) Entity ID: 95638 Entity Name: entity.ammo_coal.name Entity's Exact location: 235.84, 6.15, 35.80 Entity's Block location: 235.00,6.00,35.00 - World: (235,6,35), Chunk: (at 11,0,3 in 14,2; contains blocks 224,0,32 to 239,255,47), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: 0.63, 0.59, -1.18 Entity's Rider: ~~ERROR~~ NullPointerException: null Entity's Vehicle: ~~ERROR~~ NullPointerException: null -- Renderer details -- Details: Assigned renderer: the_fireplace.unlogicii.renderers.RenderCoal@e75a138 Location: 0.37,1.75,-0.35 - World: (0,1,-1), Chunk: (at 0,0,15 in 0,-1; contains blocks 0,0,-16 to 15,255,-1), Region: (0,-1; contains chunks 0,-32 to 31,-1, blocks 0,0,-512 to 511,255,-1) Rotation: 151.85417 Delta: 0.36080897 Stacktrace: at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:388) at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334) at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301) at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657) at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350) at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityPlayerSP['Player5'/61, l='MpServer', x=235.06, y=4.00, z=36.92]] Chunk stats: MultiplayerChunkCache: 289, 289 Level seed: 0 Level generator: ID 01 - flat, ver 0. Features enabled: false Level generator options: Level spawn location: 249.00,4.00,64.00 - World: (249,4,64), Chunk: (at 9,0,0 in 15,4; contains blocks 240,0,64 to 255,255,79), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 28133 game time, 28133 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: 16 total; [EntityPig['Pig'/37, l='MpServer', x=284.63, y=4.00, z=-7.25], EntityPig['Pig'/39, l='MpServer', x=300.78, y=4.00, z=-19.06], EntityPlayerSP['Player5'/61, l='MpServer', x=235.06, y=4.00, z=36.92], EntityPig['Pig'/40, l='MpServer', x=300.91, y=4.00, z=-6.03], EntitySheep['Sheep'/41, l='MpServer', x=295.97, y=4.00, z=104.06], EntityHorse['Horse'/42, l='MpServer', x=302.66, y=4.00, z=112.06], EntityChicken['Chicken'/10, l='MpServer', x=156.66, y=4.00, z=95.56], EntityPig['Pig'/48, l='MpServer', x=308.41, y=4.00, z=-8.78], EntityHorse['Horse'/49, l='MpServer', x=306.97, y=4.00, z=105.34], EntitySheep['Sheep'/19, l='MpServer', x=166.94, y=4.00, z=-40.97], EntitySheep['Sheep'/20, l='MpServer', x=171.88, y=4.00, z=-23.06], EntitySheep['Sheep'/21, l='MpServer', x=160.84, y=4.00, z=-18.91], EntitySheep['Sheep'/22, l='MpServer', x=166.06, y=4.00, z=-14.03], EntityCoal['entity.ammo_coal.name'/95638, l='MpServer', x=235.84, y=6.15, z=35.80], EntitySheep['Sheep'/28, l='MpServer', x=205.19, y=4.00, z=-42.72], EntitySheep['Sheep'/29, l='MpServer', x=221.88, y=4.00, z=-42.94]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:392) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2600) at net.minecraft.client.Minecraft.run(Minecraft.java:398) at net.minecraft.client.main.Main.main(Main.java:117) 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.8 Operating System: Windows 7 (amd64) version 6.1 Java Version: 1.8.0_25, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 831594088 bytes (793 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP v9.10 FML v8.0.42.1338 Minecraft Forge 11.14.1.1338 5 mods loaded, 5 mods active mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available FML{8.0.42.1338} [Forge Mod Loader] (forgeSrc-1.8-11.14.1.1338.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Forge{11.14.1.1338} [Minecraft Forge] (forgeSrc-1.8-11.14.1.1338.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available fireplacecore{2.1.3.0} [Fireplace Core] (fireplacecore-deobf.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available unlogicii{2.0.0.1} [unLogic II] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available Loaded coremods (and transformers): Launched Version: 1.8 LWJGL: 2.9.1 OpenGL: Intel® HD Graphics GL version 3.1.0 - Build 9.17.10.3347, Intel GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: No 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) [11:04:51] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:660]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Lance\Documents\unlogic-ii\eclipse\.\crash-reports\crash-2015-03-28_11.04.51-client.txt 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 If anyone knows how to fix the crash(and make it render correctly), your help would be appreciated. If I helped please press the Thank You button. Check out my mods at http://www.curse.com/users/The_Fireplace/projects
April 1, 201510 yr Author Looking back at it, it is probably that I didn't tell the game how to render the texture... Still, I don't know how to fix it. Anyone know? If I helped please press the Thank You button. Check out my mods at http://www.curse.com/users/The_Fireplace/projects
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.