Jump to content

[1.8] [SOLVED] Rendering Custom TNT


coolawesomeme

Recommended Posts

Hi,

I am attempting to code a variation of TNT that is less powerful and the explosion and everything is working, with the only problem being rendering the TNT. As soon as the entity is spawned, the game crashes and throws this exception:

 

[18:49:32] [Client thread/FATAL]: Reported exception thrown!
net.minecraft.util.ReportedException: Rendering entity in world
at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:418) ~[RenderManager.class:?]
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:327) ~[RenderManager.class:?]
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:294) ~[RenderManager.class:?]
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:631) ~[RenderGlobal.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1294) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1207) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1032) ~[EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1048) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:345) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]
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(GradleStartCommon.java:78) [start/:?]
at GradleStart.main(GradleStart.java:45) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.renderer.entity.Render.bindTexture(Render.java:86) ~[Render.class:?]
at net.minecraft.client.renderer.entity.Render.bindEntityTexture(Render.java:79) ~[Render.class:?]
at net.minecraftplus.render.RenderMinerPrimed.doRender(RenderMinerPrimed.java:49) ~[RenderMinerPrimed.class:?]
at net.minecraftplus.render.RenderMinerPrimed.doRender(RenderMinerPrimed.java:85) ~[RenderMinerPrimed.class:?]
at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:370) ~[RenderManager.class:?]
... 17 more
[18:49:32] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: ---- Minecraft Crash Report ----
// Ouch. That hurt 

Time: 1/26/15 6:49 PM
Description: Rendering entity in world

java.lang.NullPointerException: Rendering entity in world
at net.minecraft.client.renderer.entity.Render.bindTexture(Render.java:86)
at net.minecraft.client.renderer.entity.Render.bindEntityTexture(Render.java:79)
at net.minecraftplus.render.RenderMinerPrimed.doRender(RenderMinerPrimed.java:49)
at net.minecraftplus.render.RenderMinerPrimed.doRender(RenderMinerPrimed.java:85)
at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:370)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:327)
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:294)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:631)
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1294)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1207)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1032)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1048)
at net.minecraft.client.Minecraft.run(Minecraft.java:345)
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(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)


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.bindTexture(Render.java:86)
at net.minecraft.client.renderer.entity.Render.bindEntityTexture(Render.java:79)
at net.minecraftplus.render.RenderMinerPrimed.doRender(RenderMinerPrimed.java:49)
at net.minecraftplus.render.RenderMinerPrimed.doRender(RenderMinerPrimed.java:85)

-- Entity being rendered --
Details:
Entity Type: minecraftplus.primedMiner (net.minecraftplus.entity.EntityMinerPrimed)
Entity ID: 328
Entity Name: entity.minecraftplus.primedMiner.name
Entity's Exact location: -181.72, 62.00, 7.50
Entity's Block location: -182.00,62.00,7.00 - World: (-182,62,7), Chunk: (at 10,3,7 in -12,0; contains blocks -192,0,0 to -177,255,15), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
Entity's Momentum: 0.00, 0.00, 0.00
Entity's Rider: ~~ERROR~~ NullPointerException: null
Entity's Vehicle: ~~ERROR~~ NullPointerException: null

-- Renderer details --
Details:
Assigned renderer: net.minecraftplus.render.RenderMinerPrimed@5aad0fb9
Location: -1.50,-0.86,-0.07 - World: (-2,-1,-1), Chunk: (at 14,-1,15 in -1,-1; contains blocks -16,0,-16 to -1,255,-1), Region: (-1,-1; contains chunks -32,-32 to -1,-1, blocks -512,0,-512 to -1,255,-1)
Rotation: 0.0
Delta: 0.5301614
Stacktrace:
at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:370)
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:327)
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:294)
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:631)
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1294)
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1207)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['coolawesomeme'/321, l='MpServer', x=-180.22, y=63.00, z=7.57]]
Chunk stats: MultiplayerChunkCache: 81, 81
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options: 
Level spawn location: 16.00,64.00,76.00 - World: (16,64,76), Chunk: (at 0,4,12 in 1,4; contains blocks 16,0,64 to 31,255,79), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 139100 game time, 47095 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: 74 total; [EntityCow['Cow'/0, l='MpServer', x=-160.53, y=71.00, z=-48.09], EntityPig['Pig'/1, l='MpServer', x=-170.88, y=76.00, z=-37.53], EntityPig['Pig'/2, l='MpServer', x=-172.72, y=79.00, z=-26.50], EntityCow['Cow'/3, l='MpServer', x=-175.38, y=64.00, z=-14.38], EntitySquid['Squid'/4, l='MpServer', x=-163.53, y=56.03, z=12.47], EntitySquid['Squid'/5, l='MpServer', x=-160.53, y=60.78, z=20.50], EntityZombie['Zombie'/6, l='MpServer', x=-171.31, y=43.00, z=71.00], EntityPig['Pig'/7, l='MpServer', x=-170.75, y=70.00, z=67.19], EntityCow['Cow'/23, l='MpServer', x=-145.84, y=78.00, z=-50.22], EntityPig['Pig'/25, l='MpServer', x=-158.31, y=65.00, z=-11.44], EntityPig['Pig'/24, l='MpServer', x=-144.97, y=76.00, z=-23.75], EntityCow['Cow'/27, l='MpServer', x=-152.94, y=70.00, z=-12.56], EntityPig['Pig'/26, l='MpServer', x=-147.50, y=71.00, z=-15.72], EntitySquid['Squid'/29, l='MpServer', x=-156.97, y=57.00, z=18.34], EntitySquid['Squid'/28, l='MpServer', x=-154.22, y=61.13, z=14.16], EntityChicken['Chicken'/31, l='MpServer', x=-149.13, y=89.00, z=79.44], EntityCow['Cow'/49, l='MpServer', x=-136.56, y=83.00, z=-9.47], EntitySkeleton['Skeleton'/48, l='MpServer', x=-133.41, y=27.16, z=-44.31], EntityBat['Bat'/59, l='MpServer', x=-125.31, y=25.91, z=-25.44], EntityPig['Pig'/58, l='MpServer', x=-116.25, y=68.00, z=-42.38], EntityPig['Pig'/57, l='MpServer', x=-121.56, y=68.00, z=-32.47], EntitySheep['Sheep'/56, l='MpServer', x=-118.19, y=70.00, z=-63.34], EntityZombie['Zombie'/343, l='MpServer', x=-203.31, y=51.00, z=10.69], EntityZombie['Zombie'/342, l='MpServer', x=-205.28, y=60.00, z=5.34], EntityItem['item.item.egg'/341, l='MpServer', x=-223.56, y=70.42, z=45.88], EntitySquid['Squid'/340, l='MpServer', x=-217.29, y=62.62, z=47.23], EntitySquid['Squid'/339, l='MpServer', x=-217.11, y=58.40, z=45.63], EntitySquid['Squid'/338, l='MpServer', x=-217.42, y=57.14, z=46.94], EntityPig['Pig'/337, l='MpServer', x=-185.34, y=67.00, z=-43.47], EntitySquid['Squid'/336, l='MpServer', x=-209.20, y=56.16, z=28.53], EntityZombie['Zombie'/351, l='MpServer', x=-203.31, y=51.00, z=8.47], EntityZombie['Zombie'/350, l='MpServer', x=-194.94, y=62.56, z=2.69], EntityZombie['Zombie'/349, l='MpServer', x=-205.72, y=50.06, z=9.03], EntityZombie['Zombie'/348, l='MpServer', x=-194.72, y=62.47, z=7.28], EntityZombie['Zombie'/347, l='MpServer', x=-204.88, y=58.00, z=6.41], EntityZombie['Zombie'/346, l='MpServer', x=-205.72, y=50.34, z=9.81], EntityZombie['Zombie'/345, l='MpServer', x=-204.22, y=51.00, z=10.69], EntityZombie['Zombie'/344, l='MpServer', x=-192.78, y=62.00, z=3.16], EntityItem['item.tile.stonebrick'/324, l='MpServer', x=-188.69, y=61.00, z=7.78], EntityCreeper['Creeper'/322, l='MpServer', x=-185.44, y=62.63, z=3.09], EntityItem['item.tile.sand.default'/323, l='MpServer', x=-182.41, y=61.00, z=7.75], EntityPig['Pig'/334, l='MpServer', x=-194.63, y=68.00, z=-25.91], EntityItem['item.tile.sand.default'/454, l='MpServer', x=-181.47, y=61.41, z=6.31], EntityPig['Pig'/335, l='MpServer', x=-176.81, y=65.00, z=38.50], EntityItem['item.tile.sand.default'/453, l='MpServer', x=-180.66, y=61.41, z=5.44], EntityItem['item.item.egg'/332, l='MpServer', x=-237.06, y=75.42, z=14.47], EntityItem['item.tile.dirt.default'/452, l='MpServer', x=-183.72, y=61.56, z=5.47], EntityChicken['Chicken'/333, l='MpServer', x=-237.53, y=75.00, z=9.59], EntityItem['item.tile.sand.default'/451, l='MpServer', x=-179.47, y=62.63, z=8.25], EntityItem['item.tile.sand.default'/450, l='MpServer', x=-180.44, y=61.31, z=8.63], EntitySheep['Sheep'/331, l='MpServer', x=-240.63, y=68.00, z=78.47], EntityItem['item.tile.sand.default'/449, l='MpServer', x=-181.72, y=61.59, z=8.69], EntitySkeleton['Skeleton'/329, l='MpServer', x=-240.50, y=35.00, z=66.50], EntityCow['Cow'/373, l='MpServer', x=-185.63, y=66.00, z=-28.19], EntityPig['Pig'/372, l='MpServer', x=-187.00, y=68.00, z=-18.63], EntityPlayerSP['coolawesomeme'/321, l='MpServer', x=-180.22, y=63.00, z=7.57], EntityPig['Pig'/369, l='MpServer', x=-202.00, y=64.00, z=-42.00], EntityPig['Pig'/368, l='MpServer', x=-196.84, y=64.00, z=-41.41], EntityPig['Pig'/371, l='MpServer', x=-197.63, y=64.00, z=-35.16], EntityCow['Cow'/370, l='MpServer', x=-195.53, y=64.00, z=-47.50], EntityPig['Pig'/356, l='MpServer', x=-195.22, y=63.00, z=-60.72], EntityPig['Pig'/357, l='MpServer', x=-208.00, y=63.00, z=-57.56], EntityCow['Cow'/358, l='MpServer', x=-202.47, y=63.00, z=-58.66], EntityZombie['Zombie'/352, l='MpServer', x=-205.72, y=51.31, z=10.69], EntitySkeleton['Skeleton'/353, l='MpServer', x=-222.09, y=44.00, z=57.56], EntityPig['Pig'/354, l='MpServer', x=-209.97, y=64.00, z=61.94], EntityPig['Pig'/355, l='MpServer', x=-194.97, y=63.00, z=-56.03], EntityCreeper['Creeper'/364, l='MpServer', x=-245.06, y=34.00, z=56.59], EntityItem['item.item.egg'/365, l='MpServer', x=-241.56, y=68.42, z=54.13], EntityChicken['Chicken'/366, l='MpServer', x=-241.59, y=69.00, z=54.66], EntityZombie['Zombie'/367, l='MpServer', x=-213.94, y=55.00, z=11.50], EntityChicken['Chicken'/361, l='MpServer', x=-224.22, y=70.00, z=43.44], EntitySkeleton['Skeleton'/362, l='MpServer', x=-239.50, y=35.00, z=68.50], EntityBat['Bat'/363, l='MpServer', x=-227.44, y=65.47, z=67.28]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:350)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2488)
at net.minecraft.client.Minecraft.run(Minecraft.java:367)
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(GradleStartCommon.java:78)
at GradleStart.main(GradleStart.java:45)

-- System Details --
Details:
Minecraft Version: 1.8
Operating System: Windows 8 (amd64) version 6.2
Java Version: 1.7.0_45, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 869599800 bytes (829 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.10 FML v8.0.14.1281 Minecraft Forge 11.14.0.1281 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{8.0.14.1281} [Forge Mod Loader] (forgeSrc-1.8-11.14.0.1281-1.8.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{11.14.0.1281} [Minecraft Forge] (forgeSrc-1.8-11.14.0.1281-1.8.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
minecraftplus{2.0.0} [Minecraft+] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.8
LWJGL: 2.9.1
OpenGL: Intel(R) HD Graphics GL version 3.1.0 - Build 9.17.10.3517, 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)

 

And here is the RenderMinerPrimed class:

 

package net.minecraftplus.render;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftplus.MinecraftPlus;
import net.minecraftplus.blocks.PlusBlocks;
import net.minecraftplus.entity.EntityMinerPrimed;

@SideOnly(Side.CLIENT)
public class RenderMinerPrimed extends Render
{
private static final ResourceLocation entityTexture = new ResourceLocation(MinecraftPlus.MODID + ":textures/entity/minerBlock.png");

    public RenderMinerPrimed(RenderManager p_i46134_1_)
    {
        super(p_i46134_1_);
        this.shadowSize = 0.5F;
    }

    public void doRender(EntityMinerPrimed entity, double x, double y, double z, float p_76986_8_, float partialTicks)
    {
    	System.out.println("Rendering");
        BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
        GlStateManager.pushMatrix();
        GlStateManager.translate((float)x, (float)y + 0.5F, (float)z);
        float f2;

        if ((float)entity.fuse - partialTicks + 1.0F < 10.0F)
        {
            f2 = 1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 10.0F;
            f2 = MathHelper.clamp_float(f2, 0.0F, 1.0F);
            f2 *= f2;
            f2 *= f2;
            float f3 = 1.0F + f2 * 0.3F;
            GlStateManager.scale(f3, f3, f3);
        }

        f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
        this.bindEntityTexture(entity);
        GlStateManager.translate(-0.5F, -0.5F, 0.5F);
        blockrendererdispatcher.renderBlockBrightness(PlusBlocks.minerBlock.getDefaultState(), entity.getBrightness(partialTicks));
        GlStateManager.translate(0.0F, 0.0F, 1.0F);

        if (entity.fuse / 5 % 2 == 0)
        {
            GlStateManager.disableTexture2D();
            GlStateManager.disableLighting();
            GlStateManager.enableBlend();
            GlStateManager.blendFunc(770, 772);
            GlStateManager.color(1.0F, 1.0F, 1.0F, f2);
            GlStateManager.doPolygonOffset(-3.0F, -3.0F);
            GlStateManager.enablePolygonOffset();
            blockrendererdispatcher.renderBlockBrightness(PlusBlocks.minerBlock.getDefaultState(), 1.0F);
            GlStateManager.doPolygonOffset(0.0F, 0.0F);
            GlStateManager.disablePolygonOffset();
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            GlStateManager.disableBlend();
            GlStateManager.enableLighting();
            GlStateManager.enableTexture2D();
        }

        GlStateManager.popMatrix();
        super.doRender(entity, x, y, z, p_76986_8_, partialTicks);
    }

    @Override
    protected ResourceLocation getEntityTexture(Entity entity)
    {
        return entityTexture;
    }

    @Override
    public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTicks)
    {
        this.doRender((EntityMinerPrimed)entity, x, y, z, p_76986_8_, partialTicks);
    }
}

 

If I had to guess, I think the game can't find the texture but I'm not sure as there IS a texture located at "assets/minecraftplus/textures/entity/minerBlock.png". Does it have to be a specific size?

 

Thanks for any help.

Link to comment
Share on other sites

Actually, I just figured it out a few minutes ago. I did register the entity and renderer, but I had the renderer being registered in preInit, where I believe the value of Minecraft.getMinecraft().getRenderManager() was null. Moving it to postInit solved the problem. Thanks for the reply though!

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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