Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Can't render painting entity!


Recommended Posts


I am working on a painting mod. I copied all the files from Minecraft.

It shows the icon in my inventory but when I place it my Minecraft crashes.

Eclipse gave me this error:

2012-12-21 14:39:23 [iNFO] [ForgeModLoader] Forge Mod Loader version for Minecraft 1.4.5 loading
2012-12-21 14:39:30 [iNFO] [sTDOUT] 27 achievements
2012-12-21 14:39:30 [iNFO] [sTDOUT] 208 recipes
2012-12-21 14:39:30 [iNFO] [sTDOUT] Setting user: Player933, -
2012-12-21 14:39:30 [iNFO] [sTDERR] Client asked for parameter: server
2012-12-21 14:39:30 [iNFO] [sTDOUT] LWJGL Version: 2.4.2
2012-12-21 14:39:33 [iNFO] [ForgeModLoader] Attempting early MinecraftForge initialization
2012-12-21 14:39:33 [iNFO] [sTDOUT] MinecraftForge v6.4.2.445 Initialized
2012-12-21 14:39:33 [iNFO] [ForgeModLoader] MinecraftForge v6.4.2.445 Initialized
2012-12-21 14:39:33 [iNFO] [sTDOUT] Replaced 84 ore recipies
2012-12-21 14:39:33 [iNFO] [ForgeModLoader] Completed early MinecraftForge initialization
2012-12-21 14:39:34 [iNFO] [ForgeModLoader] Searching C:\Users\Michiel en Maarten\Desktop\mcp\jars\mods for mods
2012-12-21 14:39:37 [iNFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load
2012-12-21 14:39:37 [WARNING] [ForgeModLoader] The mod id TRGPaintingmod2 attempted to register channels without specifying a packet handler
2012-12-21 14:39:37 [iNFO] [ForgeModLoader] Configured a dormant chunk cache size of 0
2012-12-21 14:39:38 [iNFO] [sTDOUT] Starting up SoundSystem...
2012-12-21 14:39:38 [iNFO] [sTDOUT] Initializing LWJGL OpenAL
2012-12-21 14:39:38 [iNFO] [sTDOUT]     (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
2012-12-21 14:39:38 [iNFO] [sTDOUT] OpenAL initialized.
2012-12-21 14:39:39 [WARNING] [ForgeModLoader] The mod TRGPaintingmod2 tried to register the entity class class TRG.WhizZz.Paintingmod2.EntityPainting2 which was already registered - if you wish to override default naming for FML mod entities, register it here first
2012-12-21 14:39:39 [iNFO] [ForgeModLoader] Forge Mod Loader has successfully loaded 4 mods
2012-12-21 14:39:47 [iNFO] [ForgeModLoader] Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@1073c45f)
2012-12-21 14:39:47 [iNFO] [ForgeModLoader] Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@1073c45f)
2012-12-21 14:39:47 [iNFO] [ForgeModLoader] Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@1073c45f)
2012-12-21 14:40:17 [iNFO] [ForgeModLoader] Unloading dimension 0
2012-12-21 14:40:17 [iNFO] [ForgeModLoader] Unloading dimension -1
2012-12-21 14:40:17 [iNFO] [ForgeModLoader] Unloading dimension 1
2012-12-21 14:40:17 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Rendering entity in world
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:327)
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.entity.RenderManager.renderEntity(RenderManager.java:269)
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:489)
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1128)
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:971)
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:878)
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:773)
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)
2012-12-21 14:40:17 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at TRG.WhizZz.Paintingmod2.RenderPainting2.renderThePainting2(RenderPainting2.java:28)
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at TRG.WhizZz.Paintingmod2.RenderPainting2.doRender(RenderPainting2.java:142)
2012-12-21 14:40:17 [iNFO] [sTDERR] 	at net.minecraft.client.renderer.entity.RenderManager.renderEntityWithPosYaw(RenderManager.java:300)
2012-12-21 14:40:17 [iNFO] [sTDERR] 	... 7 more
2012-12-21 14:40:28 [iNFO] [sTDOUT] Stopping!
2012-12-21 14:40:28 [iNFO] [sTDOUT] SoundSystem shutting down...
2012-12-21 14:40:28 [iNFO] [sTDOUT]     Author: Paul Lamb, www.paulscode.com


this is my TRGpaintingmod2:


package TRG.WhizZz.Paintingmod2;

import java.util.Map;

import net.minecraft.entity.item.EntityPainting;
import net.minecraft.item.Item;
import net.minecraft.src.ModLoader;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

* @author WhizZz
@Mod( modid = "TRGPaintingmod2", name="The Rich Guards - Paintings", version="The start of something big!")
(clientSideRequired = true, serverSideRequired = false, channels = {"Paintingmod2"})
public class TRGPaintingmod2 {
public static Item Painting;
@SidedProxy(clientSide = "TRG.WhizZz.Paintingmod2.ClientProxy", serverSide = "TRG.WhizZz.Paintingmod2.CommonProxy")
public static CommonProxy proxy;
public static TRGPaintingmod2 instance;
public void load(FMLInitializationEvent evt)
	Painting = (new ItemPaintingEntity(5000, EntityPainting.class)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/WhizZz/itemPainting.png")).setItemName("Painting");
  	LanguageRegistry.addName(Painting, "Painting");
  	ModLoader.registerEntityID(EntityPainting.class, "Painting",  ModLoader.getUniqueEntityId());  
  		  RenderingRegistry.registerEntityRenderingHandler(EntityPainting.class, new RenderPainting());


and my RenderPainting:

package TRG.WhizZz.Paintingmod2;

import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.util.EnumArt;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

public class RenderPainting extends Render
    public void renderThePainting(EntityPainting par1EntityPainting, double par2, double par4, double par6, float par8, float par9)
        GL11.glTranslatef((float)par2, (float)par4, (float)par6);
        GL11.glRotatef(par8, 0.0F, 1.0F, 0.0F);
        EnumPainting var10 = par1EntityPainting.painting;
        float var11 = 0.0625F;
        GL11.glScalef(var11, var11, var11);
        /*line 28*/ this.func_77010_a(par1EntityPainting, var10.sizeX, var10.sizeY, var10.offsetX, var10.offsetY);

    private void func_77010_a(EntityPainting par1EntityPainting, int par2, int par3, int par4, int par5)
        float var6 = (float)(-par2) / 2.0F;
        float var7 = (float)(-par3) / 2.0F;
        float var8 = 0.5F;
        float var9 = 0.75F;
        float var10 = 0.8125F;
        float var11 = 0.0F;
        float var12 = 0.0625F;
        float var13 = 0.75F;
        float var14 = 0.8125F;
        float var15 = 0.001953125F;
        float var16 = 0.001953125F;
        float var17 = 0.7519531F;
        float var18 = 0.7519531F;
        float var19 = 0.0F;
        float var20 = 0.0625F;

        for (int var21 = 0; var21 < par2 / 16; ++var21)
            for (int var22 = 0; var22 < par3 / 16; ++var22)
                float var23 = var6 + (float)((var21 + 1) * 16);
                float var24 = var6 + (float)(var21 * 16);
                float var25 = var7 + (float)((var22 + 1) * 16);
                float var26 = var7 + (float)(var22 * 16);
                this.func_77008_a(par1EntityPainting, (var23 + var24) / 2.0F, (var25 + var26) / 2.0F);
                float var27 = (float)(par4 + par2 - var21 * 16) / 256.0F;
                float var28 = (float)(par4 + par2 - (var21 + 1) * 16) / 256.0F;
                float var29 = (float)(par5 + par3 - var22 * 16) / 256.0F;
                float var30 = (float)(par5 + par3 - (var22 + 1) * 16) / 256.0F;
                Tessellator var31 = Tessellator.instance;
                var31.setNormal(0.0F, 0.0F, -1.0F);
                var31.addVertexWithUV((double)var23, (double)var26, (double)(-var8), (double)var28, (double)var29);
                var31.addVertexWithUV((double)var24, (double)var26, (double)(-var8), (double)var27, (double)var29);
                var31.addVertexWithUV((double)var24, (double)var25, (double)(-var8), (double)var27, (double)var30);
                var31.addVertexWithUV((double)var23, (double)var25, (double)(-var8), (double)var28, (double)var30);
                var31.setNormal(0.0F, 0.0F, 1.0F);
                var31.addVertexWithUV((double)var23, (double)var25, (double)var8, (double)var9, (double)var11);
                var31.addVertexWithUV((double)var24, (double)var25, (double)var8, (double)var10, (double)var11);
                var31.addVertexWithUV((double)var24, (double)var26, (double)var8, (double)var10, (double)var12);
                var31.addVertexWithUV((double)var23, (double)var26, (double)var8, (double)var9, (double)var12);
                var31.setNormal(0.0F, 1.0F, 0.0F);
                var31.addVertexWithUV((double)var23, (double)var25, (double)(-var8), (double)var13, (double)var15);
                var31.addVertexWithUV((double)var24, (double)var25, (double)(-var8), (double)var14, (double)var15);
                var31.addVertexWithUV((double)var24, (double)var25, (double)var8, (double)var14, (double)var16);
                var31.addVertexWithUV((double)var23, (double)var25, (double)var8, (double)var13, (double)var16);
                var31.setNormal(0.0F, -1.0F, 0.0F);
                var31.addVertexWithUV((double)var23, (double)var26, (double)var8, (double)var13, (double)var15);
                var31.addVertexWithUV((double)var24, (double)var26, (double)var8, (double)var14, (double)var15);
                var31.addVertexWithUV((double)var24, (double)var26, (double)(-var8), (double)var14, (double)var16);
                var31.addVertexWithUV((double)var23, (double)var26, (double)(-var8), (double)var13, (double)var16);
                var31.setNormal(-1.0F, 0.0F, 0.0F);
                var31.addVertexWithUV((double)var23, (double)var25, (double)var8, (double)var18, (double)var19);
                var31.addVertexWithUV((double)var23, (double)var26, (double)var8, (double)var18, (double)var20);
                var31.addVertexWithUV((double)var23, (double)var26, (double)(-var8), (double)var17, (double)var20);
                var31.addVertexWithUV((double)var23, (double)var25, (double)(-var8), (double)var17, (double)var19);
                var31.setNormal(1.0F, 0.0F, 0.0F);
                var31.addVertexWithUV((double)var24, (double)var25, (double)(-var8), (double)var18, (double)var19);
                var31.addVertexWithUV((double)var24, (double)var26, (double)(-var8), (double)var18, (double)var20);
                var31.addVertexWithUV((double)var24, (double)var26, (double)var8, (double)var17, (double)var20);
                var31.addVertexWithUV((double)var24, (double)var25, (double)var8, (double)var17, (double)var19);

    private void func_77008_a(EntityPainting par1EntityPainting, float par2, float par3)
        int var4 = MathHelper.floor_double(par1EntityPainting.posX);
        int var5 = MathHelper.floor_double(par1EntityPainting.posY + (double)(par3 / 16.0F));
        int var6 = MathHelper.floor_double(par1EntityPainting.posZ);

        if (par1EntityPainting.hangingDirection == 2)
            var4 = MathHelper.floor_double(par1EntityPainting.posX + (double)(par2 / 16.0F));

        if (par1EntityPainting.hangingDirection == 1)
            var6 = MathHelper.floor_double(par1EntityPainting.posZ - (double)(par2 / 16.0F));

        if (par1EntityPainting.hangingDirection == 0)
            var4 = MathHelper.floor_double(par1EntityPainting.posX - (double)(par2 / 16.0F));

        if (par1EntityPainting.hangingDirection == 3)
            var6 = MathHelper.floor_double(par1EntityPainting.posZ + (double)(par2 / 16.0F));

        int var7 = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(var4, var5, var6, 0);
        int var8 = var7 % 65536;
        int var9 = var7 / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)var8, (float)var9);
        GL11.glColor3f(1.0F, 1.0F, 1.0F);

     * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
     * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
     * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
     * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
/*line 142*/        this.renderThePainting((EntityPainting)par1Entity, par2, par4, par6, par8, par9);


I followed this tutorial http://www.minecraftforge.net/wiki/Tutorials/Upgrading_To_Forge_for_1.3.1 to render my file

and I googled a bit but can't find a solution. Is there something I do wrong or is this just a bug?


Kind Regards,


Link to comment
Share on other sites

EnumPainting var10 = par1EntityPainting.painting;


Is nothing. And why are you copying the whole painting class?

I want to play around with the painting :P

Something like animations or 512x512 pictures without changing the texture pack.

But first I need to get my own painting. So I copied the Minecraft painting and put them in my package.

I changed the names but when I start Minecraft and I place my entity my Minecraft crashes.

And everytime I go into the same world it crash again.

I can see the item and I can hold it but I can't place it.

They say there is something wrong with line 28 but I don't know what?

It is an exact copy from the painting in Minecraft.


Also what do you mean with

EnumPainting var10 = par1EntityPainting.painting;


Is nothing


It needs my var10 for

this.func_77010_a(par1EntityPainting, var10.sizeX, var10.sizeY, var10.offsetX, var10.offsetY);
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.

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.