Jump to content

Recommended Posts

Posted

Hi,

I made a custom item act like the painting item and spawn paintings, however it is still using the pictures from the vanilla minecraft texture png instead of the png from my mod's texture's file, can someone take a look at my rendering class to see what I missed? Much thanks!  :)

 

Rendering Class

import java.util.Iterator;
import java.util.List;

import java.util.Iterator;
import java.util.List;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import com.tiger.lib.RefStrings;

import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderPainting;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityHanging;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Direction;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;


public class PapPapRender extends RenderPainting {
    private static final ResourceLocation field_110807_a = new ResourceLocation(RefStrings.MODID, "textures/painting/paintings_egypt.png");

    protected ResourceLocation getEntityTexture(EntityPainting derp){
        return field_110807_a;
    }

/**
 * 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 func_76986_a(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(EntityPainting p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_){
	GL11.glPushMatrix();
	GL11.glTranslated(p_76986_2_, p_76986_4_, p_76986_6_);
	GL11.glRotatef(p_76986_8_, 0.0F, 1.0F, 0.0F);
	GL11.glEnable(GL12.GL_RESCALE_NORMAL);
	this.bindEntityTexture(p_76986_1_);
	EntityPainting.EnumArt enumart = p_76986_1_.art;
	float f2 = 0.0625F;
	GL11.glScalef(f2, f2, f2);
	this.func_77010_a(p_76986_1_, 16, 16, 0, 0);
	GL11.glDisable(GL12.GL_RESCALE_NORMAL);
	GL11.glPopMatrix();
}

private void func_77010_a(EntityPainting p_77010_1_, int sizeX, int sizeY, int p_77010_4_, int p_77010_5_){
	float f = (float)(-sizeX) / 2.0F;
	float f1 = (float)(-sizeY) / 2.0F;
	float f2 = 0.5F;
	float f3 = 0.75F;
	float f4 = 0.8125F;
	float f5 = 0.0F;
	float f6 = 0.0625F;
	float f7 = 0.75F;
	float f8 = 0.8125F;
	float f9 = 0.001953125F;
	float f10 = 0.001953125F;
	float f11 = 0.7519531F;
	float f12 = 0.7519531F;
	float f13 = 0.0F;
	float f14 = 0.0625F;

	for (int i1 = 0; i1 < sizeX / 16; ++i1){
		for (int j1 = 0; j1 < sizeY / 16; ++j1){
			float f15 = f + (float)((i1 + 1) * 16);
			float f16 = f + (float)(i1 * 16);
			float f17 = f1 + (float)((j1 + 1) * 16);
			float f18 = f1 + (float)(j1 * 16);
			this.lighting(p_77010_1_, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F);
			float f19 = (float)(p_77010_4_ + sizeX - i1 * 16) / 256.0F;
			float f20 = (float)(p_77010_4_ + sizeX - (i1 + 1) * 16) / 256.0F;
			float f21 = (float)(p_77010_5_ + sizeY - j1 * 16) / 256.0F;
			float f22 = (float)(p_77010_5_ + sizeY - (j1 + 1) * 16) / 256.0F;
			Tessellator tessellator = Tessellator.instance;
			tessellator.startDrawingQuads();
			tessellator.setNormal(0.0F, 0.0F, -1.0F);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22);
			tessellator.setNormal(0.0F, 0.0F, 1.0F);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6);
			tessellator.setNormal(0.0F, 1.0F, 0.0F);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10);
			tessellator.setNormal(0.0F, -1.0F, 0.0F);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10);
			tessellator.setNormal(-1.0F, 0.0F, 0.0F);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14);
			tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14);
			tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13);
			tessellator.setNormal(1.0F, 0.0F, 0.0F);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14);
			tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14);
			tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13);
			tessellator.draw();
		}
	}
}

private void lighting(EntityPainting p_77008_1_, float p_77008_2_, float p_77008_3_){
	int i = MathHelper.floor_double(p_77008_1_.posX);
	int j = MathHelper.floor_double(p_77008_1_.posY + (double)(p_77008_3_ / 16.0F));
	int k = MathHelper.floor_double(p_77008_1_.posZ);

	if (p_77008_1_.hangingDirection == 2){
		i = MathHelper.floor_double(p_77008_1_.posX + (double)(p_77008_2_ / 16.0F));
	}

	if (p_77008_1_.hangingDirection == 1){
		k = MathHelper.floor_double(p_77008_1_.posZ - (double)(p_77008_2_ / 16.0F));
	}

	if (p_77008_1_.hangingDirection == 0){
		i = MathHelper.floor_double(p_77008_1_.posX - (double)(p_77008_2_ / 16.0F));
	}

	if (p_77008_1_.hangingDirection == 3){
		k = MathHelper.floor_double(p_77008_1_.posZ + (double)(p_77008_2_ / 16.0F));
	}

	int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0);
	int i1 = l % 65536;
	int j1 = l / 65536;
	OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
	GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
protected ResourceLocation getEntityTexture(Entity derp){
	return this.getEntityTexture((EntityPainting)derp);
}

/**
 * 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 func_76986_a(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 p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_){
	this.doRender((PapPapEntity)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
}

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Posted

The ResourceLocation should probably be

new ResourceLocation(modId, "textures/painting/paintings_egpyt.png")

 

The issue may be that not including the modid is causing the path to not be found, and it's defaulting to the vanilla textures.  I had it do that with my armor textures before.

Posted

Oh yeah good catch! Unfortunately that didn't seem to work, but it should help after finding the other problem, is there any other classes I should be looking at to find the possible error?

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Posted

Is the console showing any missing texture errors?

 

 

PS Might also have to do with the EnumArt being used, since you didn't change that call, it'd still be using the vanilla enums and handling them based on that?

Posted

I tried deleting the function with enumart and checked console, there's no missing textures for the paintings, interesting, I wonder if there is something else that must be put in ResourceLocation?

 

Edit: I tried removing all the functions in the rendering class except for:

protected ResourceLocation getEntityTexture(Entity painting) {
	return new ResourceLocation(RefStrings.MODID + ":textures/painting/paintings_egypt.png");
}

however the pictures still render, but just as their vanilla counterparts

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Posted

This just makes me think there's something else you need to override and change.  With Minecraft's pseudo-C style spaghetti logic, I couldn't say what though. :x

 

Edit: I believe the ResourceLocation takes care of adding the : itself in the toString function, so that'd be modid::path.

Posted

Tried that, boy whatever this is, it is being stubborn :/, I am still going through the RenderPainting source code and see what is wrong, perhaps if I don't extend this and just paste all of that code in my class?

 

Edit: Nope. It must be how I am trying to pull up the png file, but none of the names are wrong.

unless it is how I am tying the entity to the item, is this a problem?

PapPap = new PapPapHanging(PapPapEntity.class).setCreativeTab(TigerCreativeTabs.tabItems).setUnlocalizedName("PapPap").setTextureName(RefStrings.MODID + ":ppap");

PapPap is the custom item, aka Papyrus Paper, it's not just a silly name haha

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Posted

I've been looking at it for the last 8ish hours and I am truly stumped, here are my other classes if anybody wants to scan those for problems or missing functions.

 

ItemHangingEntity class

package com.tiger.entitiy;

import com.tiger.CreativeTabs.TigerCreativeTabs;
import com.tiger.item.TigerItems;

import net.minecraft.entity.EntityHanging;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemHangingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.world.World;

public class PapPapHanging extends ItemHangingEntity{

public PapPapHanging(Class p_i45342_1_) {
	super(p_i45342_1_);
	this.setCreativeTab(TigerCreativeTabs.tabItems);
	}


/**
* Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
* True if something happen and false if it don't. This is for ITEMS, not BLOCKS
*/
@Override
public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_){
	if (p_77648_7_ == 0){
		return false;
	}
	else if (p_77648_7_ == 1){
		return false;
	}
	else{
		int i1 = Direction.facingToDirection[p_77648_7_];
		EntityHanging entityhanging = this.createHangingEntity(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, i1);

			if (!p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_)){
				return false;
			}
			else{
				if (entityhanging != null && entityhanging.onValidSurface()){
					if (!p_77648_3_.isRemote){
						p_77648_3_.spawnEntityInWorld(entityhanging);
					}

					--p_77648_1_.stackSize;
				}

				return true;
			}
	}
}

/**
* Create the hanging entity associated to this item.
*/
private EntityHanging createHangingEntity(World p_82810_1_, int p_82810_2_, int p_82810_3_, int p_82810_4_, int p_82810_5_){
		return (EntityHanging) new PapPapEntity(p_82810_1_, p_82810_2_, p_82810_3_, p_82810_4_, p_82810_5_);
	}

}

 

EntityPainting class

package com.tiger.entitiy;


import java.util.ArrayList;

import com.tiger.item.TigerItems;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityHanging;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;

public class PapPapEntity extends EntityPainting {

public PapPapEntity(World world) {
	super(world);
}

public PapPapEntity(World p_i1600_1_, int p_i1600_2_, int p_i1600_3_, int p_i1600_4_, int p_i1600_5_) {
	super(p_i1600_1_, p_i1600_2_, p_i1600_3_, p_i1600_4_, p_i1600_5_);
}
public void onBroken(Entity p_110128_1_)
    {
        if (p_110128_1_ instanceof EntityPlayer)
        {
            EntityPlayer entityplayer = (EntityPlayer)p_110128_1_;

            if (entityplayer.capabilities.isCreativeMode)
            {
                return;
            }
        }

        this.entityDropItem(new ItemStack(TigerItems.PapPap), 0.0F);
    }
}

 

RenderPainting Class

package com.tiger.entitiy;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.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.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import com.tiger.lib.RefStrings;

@SideOnly(Side.CLIENT)
public class PapPapRender extends Render{
    private static final ResourceLocation field_110807_a = new ResourceLocation(RefStrings.MODID + "textures/painting/papy_egypt.png");
    private static final String __OBFID = "CL_00001018";

    /**
     * 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 func_76986_a(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(EntityPainting p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
    {
        GL11.glPushMatrix();
        GL11.glTranslated(p_76986_2_, p_76986_4_, p_76986_6_);
        GL11.glRotatef(p_76986_8_, 0.0F, 1.0F, 0.0F);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        this.bindEntityTexture(p_76986_1_);
        EntityPainting.EnumArt enumart = p_76986_1_.art;
        float f2 = 0.0625F;
        GL11.glScalef(f2, f2, f2);
        this.func_77010_a(p_76986_1_, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }

    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    protected ResourceLocation getEntityTexture(EntityPainting p_110775_1_)
    {
        return field_110807_a;
    }

    private void func_77010_a(EntityPainting p_77010_1_, int p_77010_2_, int p_77010_3_, int p_77010_4_, int p_77010_5_)
    {
        float f = (float)(-p_77010_2_) / 2.0F;
        float f1 = (float)(-p_77010_3_) / 2.0F;
        float f2 = 0.5F;
        float f3 = 0.75F;
        float f4 = 0.8125F;
        float f5 = 0.0F;
        float f6 = 0.0625F;
        float f7 = 0.75F;
        float f8 = 0.8125F;
        float f9 = 0.001953125F;
        float f10 = 0.001953125F;
        float f11 = 0.7519531F;
        float f12 = 0.7519531F;
        float f13 = 0.0F;
        float f14 = 0.0625F;

        for (int i1 = 0; i1 < p_77010_2_ / 16; ++i1)
        {
            for (int j1 = 0; j1 < p_77010_3_ / 16; ++j1)
            {
                float f15 = f + (float)((i1 + 1) * 16);
                float f16 = f + (float)(i1 * 16);
                float f17 = f1 + (float)((j1 + 1) * 16);
                float f18 = f1 + (float)(j1 * 16);
                this.func_77008_a(p_77010_1_, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F);
                float f19 = (float)(p_77010_4_ + p_77010_2_ - i1 * 16) / 256.0F;
                float f20 = (float)(p_77010_4_ + p_77010_2_ - (i1 + 1) * 16) / 256.0F;
                float f21 = (float)(p_77010_5_ + p_77010_3_ - j1 * 16) / 256.0F;
                float f22 = (float)(p_77010_5_ + p_77010_3_ - (j1 + 1) * 16) / 256.0F;
                Tessellator tessellator = Tessellator.instance;
                tessellator.startDrawingQuads();
                tessellator.setNormal(0.0F, 0.0F, -1.0F);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22);
                tessellator.setNormal(0.0F, 0.0F, 1.0F);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6);
                tessellator.setNormal(0.0F, 1.0F, 0.0F);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10);
                tessellator.setNormal(0.0F, -1.0F, 0.0F);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10);
                tessellator.setNormal(-1.0F, 0.0F, 0.0F);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13);
                tessellator.setNormal(1.0F, 0.0F, 0.0F);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13);
                tessellator.draw();
            }
        }
    }

    private void func_77008_a(EntityPainting p_77008_1_, float p_77008_2_, float p_77008_3_)
    {
        int i = MathHelper.floor_double(p_77008_1_.posX);
        int j = MathHelper.floor_double(p_77008_1_.posY + (double)(p_77008_3_ / 16.0F));
        int k = MathHelper.floor_double(p_77008_1_.posZ);

        if (p_77008_1_.hangingDirection == 2)
        {
            i = MathHelper.floor_double(p_77008_1_.posX + (double)(p_77008_2_ / 16.0F));
        }

        if (p_77008_1_.hangingDirection == 1)
        {
            k = MathHelper.floor_double(p_77008_1_.posZ - (double)(p_77008_2_ / 16.0F));
        }

        if (p_77008_1_.hangingDirection == 0)
        {
            i = MathHelper.floor_double(p_77008_1_.posX - (double)(p_77008_2_ / 16.0F));
        }

        if (p_77008_1_.hangingDirection == 3)
        {
            k = MathHelper.floor_double(p_77008_1_.posZ + (double)(p_77008_2_ / 16.0F));
        }

        int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0);
        int i1 = l % 65536;
        int j1 = l / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
    }

    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    protected ResourceLocation getEntityTexture(Entity p_110775_1_)
    {
        return this.getEntityTexture((EntityPainting)p_110775_1_);
    }

    /**
     * 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 func_76986_a(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 p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
    {
        this.doRender((EntityPainting)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
    }
}

 

Entity registration code

int randomId =EntityRegistry.findGlobalUniqueEntityId();

	EntityRegistry.registerModEntity(PapPapEntity.class, "PapPapEntity", randomId, MainRegistry.modInstance, 128, 1, true);

 

ClientProxy code

public void registerRenderInformation(){

	RenderingRegistry.registerEntityRenderingHandler(PapPapEntity.class, new PapPapRender());
}

 

Item Creation code

public static Item PapPap;
PapPap = new PapPapHanging(PapPapEntity.class).setCreativeTab(TigerCreativeTabs.tabItems).setUnlocalizedName("PapPap").setTextureName(RefStrings.MODID + ":ppap");
GameRegistry.registerItem(PapPap, PapPap.getUnlocalizedName());

Thank you for going through my code and trying to help!

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Posted

As unchangeable EntityPainting.EnumArt plays important role on the render class, you should get rid of that.

+ Do not copy paste the code unless you understand what it does.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

I updated the code, defiantly refactored the variables (that was annoying to read haha), got rid of EnumArt, still didn't work, I even tried making my own enum for the art in my Entity class, however my version of .art wouldn't carry over to the Render class, so I deleted that. Thanks guys for your help though, I am really starting to understand Minecraft's code more and I appreciate it, although apparently not enough yet to fix this texture thing X(

 

Anyways here is my updated Render class:

package com.tiger.entitiy;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.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.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;

import com.tiger.lib.RefStrings;


public class PapPapRender extends Render{

    private static final ResourceLocation local = new ResourceLocation(RefStrings.MODID, "textures/painting/papy_egypt.png");

    public void doRender(EntityPainting entity, double douba, double doubb, double doubc, float flota, float flotb){
        GL11.glPushMatrix();
        GL11.glTranslated(douba, doubb, doubc);
        GL11.glRotatef(flota, 0.0F, 1.0F, 0.0F);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        this.bindEntityTexture(entity);
        float f2 = 0.0625F;
        GL11.glScalef(f2, f2, f2);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }

    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    protected ResourceLocation getEntityTexture(EntityPainting texture){
        return local;
    }

    /**
     * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
     */
    @Override
    protected ResourceLocation getEntityTexture(Entity texture){
        return this.getEntityTexture((EntityPainting)texture);
    }

    public void doRender(Entity entity, double douba, double doubb, double doubc, float flota, float flotb){
        this.doRender((EntityPainting)entity, douba, doubb, doubc, flota, flotb);
    }
}

I'm curious though, why are there two doRenders?

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Posted

You are not drawing anything in the PapPapRender class. You have to understand what RenderPainting#func_77010_a does, and write the similar code for rendering.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • 1 month later...
Posted

Hello again! I am sorry for the 2 month silence, I had a lack of internet until this week, although I have been periodically working on my code and better understand it. Now when I try to spawn the entity the game crashes (Which to me seems more like progress than the just getting the original paintings). I figured out why I was getting the original paintings on spawn, I was telling it to in the rendering class to doRender(EntityPainting) instead of doRender(PapPapEntity), now I just need to figure out what is causing the game to crash when trying to spawn my paintings. I have tried many many different things on my own, and hope I can get some experienced input here. Many thanks!

 

Here is the most recent render class

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderPainting;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.tiger.lib.RefStrings;

@SideOnly(Side.CLIENT)
public class PapPapRender extends Render{

private static final String __OBFID = "CL_00001018";
    private static final ResourceLocation local = new ResourceLocation(RefStrings.MODID + ":textures/painting/papy_egypt.png");

    public void doRender(EntityPainting entity, double douba, double doubb, double doubc, float flota, float flotb){
        GL11.glPushMatrix();
        GL11.glTranslated(douba, doubb, doubc);
        GL11.glRotatef(flota, 0.0F, 1.0F, 0.0F);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        this.bindEntityTexture(entity);
        EntityPainting.EnumArt enumart = entity.art;
        float f2 = 0.0625F;
        GL11.glScalef(f2, f2, f2);
        this.funca(entity, enumart.sizeX, enumart.sizeY, enumart.offsetX, enumart.offsetY);
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }

    protected ResourceLocation getEntityTexture(PapPapEntity texture){
        return local;
    }
    private void funca(EntityPainting entity2, int inta, int intb, int intc, int intd){
        float f = (float)(-inta) / 2.0F;
        float f1 = (float)(-intb) / 2.0F;
        float f2 = 0.5F;
        float f3 = 0.75F;
        float f4 = 0.8125F;
        float f5 = 0.0F;
        float f6 = 0.0625F;
        float f7 = 0.75F;
        float f8 = 0.8125F;
        float f9 = 0.001953125F;
        float f10 = 0.001953125F;
        float f11 = 0.7519531F;
        float f12 = 0.7519531F;
        float f13 = 0.0F;
        float f14 = 0.0625F;

        for (int i1 = 0; i1 < inta / 16; ++i1) {
            for (int j1 = 0; j1 < intb / 16; ++j1){
                float f15 = f + (float)((i1 + 1) * 16);
                float f16 = f + (float)(i1 * 16);
                float f17 = f1 + (float)((j1 + 1) * 16);
                float f18 = f1 + (float)(j1 * 16);
                this.funcb(entity2, (f15 + f16) / 2.0F, (f17 + f18) / 2.0F);
                float f19 = (float)(intc + inta - i1 * 16) / 256.0F;
                float f20 = (float)(intc + inta - (i1 + 1) * 16) / 256.0F;
                float f21 = (float)(intd + intb - j1 * 16) / 256.0F;
                float f22 = (float)(intd + intb - (j1 + 1) * 16) / 256.0F;
                Tessellator tessellator = Tessellator.instance;
                tessellator.startDrawingQuads();
                tessellator.setNormal(0.0F, 0.0F, -1.0F);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f20, (double)f21);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f19, (double)f21);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f19, (double)f22);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f20, (double)f22);
                tessellator.setNormal(0.0F, 0.0F, 1.0F);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f3, (double)f5);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f4, (double)f5);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f4, (double)f6);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f3, (double)f6);
                tessellator.setNormal(0.0F, 1.0F, 0.0F);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f7, (double)f9);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f8, (double)f9);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f8, (double)f10);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f7, (double)f10);
                tessellator.setNormal(0.0F, -1.0F, 0.0F);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f7, (double)f9);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f8, (double)f9);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f8, (double)f10);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f7, (double)f10);
                tessellator.setNormal(-1.0F, 0.0F, 0.0F);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)f2, (double)f12, (double)f13);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)f2, (double)f12, (double)f14);
                tessellator.addVertexWithUV((double)f15, (double)f18, (double)(-f2), (double)f11, (double)f14);
                tessellator.addVertexWithUV((double)f15, (double)f17, (double)(-f2), (double)f11, (double)f13);
                tessellator.setNormal(1.0F, 0.0F, 0.0F);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)(-f2), (double)f12, (double)f13);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)(-f2), (double)f12, (double)f14);
                tessellator.addVertexWithUV((double)f16, (double)f18, (double)f2, (double)f11, (double)f14);
                tessellator.addVertexWithUV((double)f16, (double)f17, (double)f2, (double)f11, (double)f13);
                tessellator.draw();
          }
        }
     }
    private void funcb(EntityPainting entity3, float flot1, float flot2)
    {
        int i = MathHelper.floor_double(entity3.posX);
        int j = MathHelper.floor_double(entity3.posY + (double)(flot2 / 16.0F));
        int k = MathHelper.floor_double(entity3.posZ);

        if (entity3.hangingDirection == 2)
        {
            i = MathHelper.floor_double(entity3.posX + (double)(flot1 / 16.0F));
        }

        if (entity3.hangingDirection == 1)
        {
            k = MathHelper.floor_double(entity3.posZ - (double)(flot1 / 16.0F));
        }

        if (entity3.hangingDirection == 0)
        {
            i = MathHelper.floor_double(entity3.posX - (double)(flot1 / 16.0F));
        }

        if (entity3.hangingDirection == 3)
        {
            k = MathHelper.floor_double(entity3.posZ + (double)(flot1 / 16.0F));
        }

        int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0);
        int i1 = l % 65536;
        int j1 = l / 65536;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1);
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
    }

    @Override
    protected ResourceLocation getEntityTexture(Entity texture){
        return this.getEntityTexture((PapPapEntity)texture);
    }

    public void doRender(Entity entity, double douba, double doubb, double doubc, float flota, float flotb){
        this.doRender((PapPapEntity)entity, douba, doubb, doubc, flota, flotb);
    }
}

 

Here is the most recent entity class

import java.util.ArrayList;

import com.tiger.item.TigerItems;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityHanging;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;

public class PapPapEntity extends EntityPainting {
public PapPapEntity.EnumArt art;
private static final String __OBFID = "CL_00001018";

public PapPapEntity(World world) {
	super(world);
}

public PapPapEntity(World p_i1600_1_, int p_i1600_2_, int p_i1600_3_, int p_i1600_4_, int p_i1600_5_) {
	super(p_i1600_1_, p_i1600_2_, p_i1600_3_, p_i1600_4_, p_i1600_5_);
	ArrayList arraylist = new ArrayList();
    PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values();
    int i1 = aenumart.length;

    for (int j1 = 0; j1 < i1; ++j1){
    	PapPapEntity.EnumArt enumart = aenumart[j1];
        this.art = enumart;
        this.setDirection(p_i1600_5_);

        if (this.onValidSurface()){
        	arraylist.add(enumart);
        }
    }

    if (!arraylist.isEmpty()){
    	this.art = (PapPapEntity.EnumArt)arraylist.get(this.rand.nextInt(arraylist.size()));
    }

    this.setDirection(p_i1600_5_);
}
@SideOnly(Side.CLIENT)
    public PapPapEntity(World p_i1601_1_, int p_i1601_2_, int p_i1601_3_, int p_i1601_4_, int p_i1601_5_, String p_i1601_6_){
        this(p_i1601_1_, p_i1601_2_, p_i1601_3_, p_i1601_4_, p_i1601_5_);
        PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values();
        int i1 = aenumart.length;

        for (int j1 = 0; j1 < i1; ++j1){
            PapPapEntity.EnumArt enumart = aenumart[j1];

            if (enumart.title.equals(p_i1601_6_)){
                this.art = enumart;
                break;
            }
        }

        this.setDirection(p_i1601_5_);
    }
/**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
    public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
        p_70014_1_.setString("Motive", this.art.title);
        super.writeEntityToNBT(p_70014_1_);
    }

    /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
    public void readEntityFromNBT(NBTTagCompound p_70037_1_){
        String s = p_70037_1_.getString("Motive");
        PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values();
        int i = aenumart.length;

        for (int j = 0; j < i; ++j){
            PapPapEntity.EnumArt enumart = aenumart[j];

            if (enumart.title.equals(s)){
                this.art = enumart;
            }
        }

        if (this.art == null){
            this.art = PapPapEntity.EnumArt.Kebab;
        }

        super.readEntityFromNBT(p_70037_1_);
    }

    public int getWidthPixels(){
        return this.art.sizeX;
    }

    public int getHeightPixels(){
        return this.art.sizeY;
    }
public void onBroken(Entity p_110128_1_){
        if (p_110128_1_ instanceof EntityPlayer){
            EntityPlayer entityplayer = (EntityPlayer)p_110128_1_;

            if (entityplayer.capabilities.isCreativeMode){
                return;
            }
        }

        this.entityDropItem(new ItemStack(TigerItems.PapPap), 0.0F);
    }

    public static enum EnumArt{
        Kebab("Kebab", 16, 16, 0, 0),
        Aztec("Aztec", 16, 16, 16, 0),
        Alban("Alban", 16, 16, 32, 0),
        Aztec2("Aztec2", 16, 16, 48, 0),
        Bomb("Bomb", 16, 16, 64, 0),
        Plant("Plant", 16, 16, 80, 0),
        Wasteland("Wasteland", 16, 16, 96, 0),
        Pool("Pool", 32, 16, 0, 32),
        Courbet("Courbet", 32, 16, 32, 32),
        Sea("Sea", 32, 16, 64, 32),
        Sunset("Sunset", 32, 16, 96, 32),
        Creebet("Creebet", 32, 16, 128, 32),
        Wanderer("Wanderer", 16, 32, 0, 64),
        Graham("Graham", 16, 32, 16, 64),
        Match("Match", 32, 32, 0, 128),
        Bust("Bust", 32, 32, 32, 128),
        Stage("Stage", 32, 32, 64, 128),
        Void("Void", 32, 32, 96, 128),
        SkullAndRoses("SkullAndRoses", 32, 32, 128, 128),
        Wither("Wither", 32, 32, 160, 128),
        Fighters("Fighters", 64, 32, 0, 96),
        Pointer("Pointer", 64, 64, 0, 192),
        Pigscene("Pigscene", 64, 64, 64, 192),
        BurningSkull("BurningSkull", 64, 64, 128, 192),
        Skeleton("Skeleton", 64, 48, 192, 64),
        DonkeyKong("DonkeyKong", 64, 48, 192, 112);
        /** Holds the maximum length of paintings art title. */
        public static final int maxArtTitleLength = "SkullAndRoses".length();
        /** Painting Title. */
        public final String title;
        public final int sizeX;
        public final int sizeY;
        public final int offsetX;
        public final int offsetY;


        private EnumArt(String p_i1598_3_, int p_i1598_4_, int p_i1598_5_, int p_i1598_6_, int p_i1598_7_){
            this.title = p_i1598_3_;
            this.sizeX = p_i1598_4_;
            this.sizeY = p_i1598_5_;
            this.offsetX = p_i1598_6_;
            this.offsetY = p_i1598_7_;
        }
    }

}

 

Here is the error, it seems to have started at getWidthPixels but I have no clue why

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at com.tiger.entitiy.PapPapEntity.getWidthPixels(PapPapEntity.java:98)

at net.minecraft.entity.EntityHanging.setDirection(EntityHanging.java:43)

at net.minecraft.entity.item.EntityPainting.<init>(EntityPainting.java:35)

at com.tiger.entitiy.PapPapEntity.<init>(PapPapEntity.java:28)

at com.tiger.entitiy.PapPapHanging.createHangingEntity(PapPapHanging.java:58)

at com.tiger.entitiy.PapPapHanging.onItemUse(PapPapHanging.java:35)

at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:143)

at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:403)

at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1518)

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityClientPlayerMP['Player426'/326, l='MpServer', x=-24.80, y=76.62, z=-88.30]]

Chunk stats: MultiplayerChunkCache: 625, 625

Level seed: 0

Level generator: ID 00 - default, ver 1. Features enabled: false

Level generator options:

Level spawn location: World: (-60,64,286), Chunk: (at 4,4,14 in -4,17; contains blocks -64,0,272 to -49,255,287), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)

Level time: 146993 game time, 10311 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: 135 total; [EntitySheep['Sheep'/521, l='MpServer', x=-94.47, y=66.00, z=-22.47], EntitySheep['Sheep'/524, l='MpServer', x=-88.53, y=68.00, z=-25.28], EntitySheep['Sheep'/526, l='MpServer', x=-91.59, y=67.00, z=-18.53], EntitySheep['Sheep'/537, l='MpServer', x=-104.21, y=66.00, z=-50.53], EntitySheep['Sheep'/539, l='MpServer', x=-96.47, y=67.00, z=-37.63], EntitySlime['Slime'/546, l='MpServer', x=-67.22, y=14.00, z=-167.80], EntityCreeper['Creeper'/548, l='MpServer', x=-74.00, y=29.00, z=-165.44], EntitySpider['Spider'/552, l='MpServer', x=-73.41, y=29.00, z=-159.66], EntityCreeper['Creeper'/557, l='MpServer', x=26.00, y=56.00, z=-160.59], EntitySheep['Sheep'/578, l='MpServer', x=-96.53, y=65.00, z=-18.47], EntityCreeper['Creeper'/581, l='MpServer', x=-83.30, y=13.00, z=-166.30], EntityZombie['Zombie'/582, l='MpServer', x=-84.30, y=13.02, z=-165.30], EntityClientPlayerMP['Player426'/326, l='MpServer', x=-24.80, y=76.62, z=-88.30], EntityCreeper['Creeper'/583, l='MpServer', x=-83.34, y=16.00, z=-163.22], EntityCreeper['Creeper'/584, l='MpServer', x=-81.50, y=26.00, z=-166.63], EntityBat['Bat'/328, l='MpServer', x=-18.69, y=53.10, z=-84.84], EntitySkeleton['Skeleton'/585, l='MpServer', x=-90.06, y=37.00, z=-164.53], EntityCreeper['Creeper'/329, l='MpServer', x=-24.25, y=53.00, z=-84.38], EntitySheep['Sheep'/586, l='MpServer', x=38.31, y=72.00, z=-166.84], EntityZombie['Zombie'/330, l='MpServer', x=-19.06, y=52.00, z=-88.50], EntityItemFrame['entity.ItemFrame.name'/331, l='MpServer', x=-17.06, y=76.50, z=-82.50], EntityItemFrame['entity.ItemFrame.name'/332, l='MpServer', x=-17.06, y=76.50, z=-81.50], EntityItemFrame['entity.ItemFrame.name'/333, l='MpServer', x=-17.06, y=76.50, z=-80.50], EntityItemFrame['entity.ItemFrame.name'/334, l='MpServer', x=-18.06, y=75.50, z=-82.50], EntityItemFrame['entity.ItemFrame.name'/335, l='MpServer', x=-22.50, y=78.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/336, l='MpServer', x=-23.50, y=78.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/337, l='MpServer', x=-24.50, y=78.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/338, l='MpServer', x=-25.50, y=78.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/339, l='MpServer', x=-26.50, y=78.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/340, l='MpServer', x=-22.50, y=77.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/341, l='MpServer', x=-23.50, y=77.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/342, l='MpServer', x=-24.50, y=77.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/343, l='MpServer', x=-22.50, y=76.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/344, l='MpServer', x=-22.50, y=75.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/345, l='MpServer', x=-23.50, y=75.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/346, l='MpServer', x=-24.50, y=75.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/347, l='MpServer', x=-25.50, y=75.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/348, l='MpServer', x=-31.50, y=78.50, z=-92.06], EntityItemFrame['entity.ItemFrame.name'/349, l='MpServer', x=-25.50, y=77.50, z=-92.06], EntityItem['item.item.PapSeed'/350, l='MpServer', x=-22.88, y=73.13, z=-80.47], EntityItemFrame['entity.ItemFrame.name'/351, l='MpServer', x=-32.50, y=78.50, z=-92.06], EntityItem['item.tile.workbench'/352, l='MpServer', x=-32.63, y=74.13, z=-83.41], EntityItem['item.tile.Celest'/353, l='MpServer', x=-35.44, y=74.13, z=-86.50], EntitySquid['Squid'/354, l='MpServer', x=-26.47, y=58.13, z=-107.47], EntitySkeleton['Skeleton'/610, l='MpServer', x=-103.47, y=41.00, z=-8.09], EntityBat['Bat'/355, l='MpServer', x=-12.50, y=54.10, z=-94.75], EntityBat['Bat'/356, l='MpServer', x=-12.84, y=54.10, z=-89.00], EntityBat['Bat'/357, l='MpServer', x=-12.50, y=54.10, z=-94.75], EntityBat['Bat'/358, l='MpServer', x=-13.66, y=53.10, z=-86.41], EntityCreeper['Creeper'/359, l='MpServer', x=-30.94, y=49.00, z=-66.28], EntitySheep['Sheep'/615, l='MpServer', x=-103.72, y=64.00, z=-165.50], EntityCreeper['Creeper'/360, l='MpServer', x=-33.69, y=50.00, z=-68.91], EntityCreeper['Creeper'/361, l='MpServer', x=-33.41, y=51.00, z=-76.47], EntityCreeper['Creeper'/362, l='MpServer', x=-42.50, y=34.00, z=-96.50], EntitySquid['Squid'/363, l='MpServer', x=-40.03, y=59.35, z=-107.53], EntitySquid['Squid'/364, l='MpServer', x=-27.48, y=57.79, z=-107.47], EntitySkeleton['Skeleton'/365, l='MpServer', x=-9.22, y=60.00, z=-105.72], EntityZombie['Zombie'/366, l='MpServer', x=-10.58, y=58.00, z=-70.46], EntitySheep['Sheep'/622, l='MpServer', x=48.66, y=76.00, z=-13.56], EntityItem['item.item.PapSeed'/367, l='MpServer', x=-15.66, y=71.13, z=-75.94], EntityBat['Bat'/368, l='MpServer', x=-51.70, y=18.00, z=-74.83], EntityBat['Bat'/369, l='MpServer', x=-44.86, y=23.08, z=-85.06], EntitySkeleton['Skeleton'/370, l='MpServer', x=-50.84, y=34.00, z=-84.06], EntitySkeleton['Skeleton'/371, l='MpServer', x=-50.34, y=34.00, z=-85.06], EntitySkeleton['Skeleton'/372, l='MpServer', x=-58.28, y=20.13, z=-72.69], EntityBat['Bat'/373, l='MpServer', x=-67.58, y=21.06, z=-106.70], EntityBat['Bat'/374, l='MpServer', x=-45.46, y=27.04, z=-119.53], EntitySkeleton['Skeleton'/375, l='MpServer', x=-5.44, y=44.00, z=-120.06], EntitySpider['Spider'/376, l='MpServer', x=-8.88, y=44.00, z=-115.81], EntityZombie['Zombie'/377, l='MpServer', x=-2.69, y=61.00, z=-121.59], EntityCreeper['Creeper'/378, l='MpServer', x=-2.69, y=61.00, z=-122.69], EntityZombie['Zombie'/379, l='MpServer', x=-2.50, y=61.00, z=-109.97], EntitySquid['Squid'/380, l='MpServer', x=-18.09, y=60.35, z=-114.44], EntitySheep['Sheep'/381, l='MpServer', x=-6.84, y=71.00, z=-133.88], EntityCreeper['Creeper'/382, l='MpServer', x=8.41, y=35.00, z=-99.00], EntityCreeper['Creeper'/383, l='MpServer', x=13.03, y=53.00, z=-105.56], EntitySheep['Sheep'/384, l='MpServer', x=-48.50, y=89.00, z=-58.50], EntitySheep['Sheep'/385, l='MpServer', x=-48.50, y=90.00, z=-60.50], EntitySheep['Sheep'/386, l='MpServer', x=-48.50, y=90.00, z=-60.50], EntitySheep['Sheep'/387, l='MpServer', x=-51.50, y=83.00, z=-59.50], EntityCreeper['Creeper'/388, l='MpServer', x=-54.22, y=38.00, z=-126.13], EntitySheep['Sheep'/389, l='MpServer', x=-49.50, y=77.00, z=-123.50], EntityCreeper['Creeper'/390, l='MpServer', x=-1.59, y=61.00, z=-122.50], EntitySkeleton['Skeleton'/391, l='MpServer', x=15.56, y=51.00, z=-120.06], EntitySheep['Sheep'/392, l='MpServer', x=-72.09, y=65.00, z=-94.75], EntitySheep['Sheep'/393, l='MpServer', x=-24.50, y=64.00, z=-137.56], EntitySheep['Sheep'/394, l='MpServer', x=-19.47, y=65.00, z=-131.06], EntityBat['Bat'/395, l='MpServer', x=-7.65, y=41.55, z=-140.23], EntitySpider['Spider'/396, l='MpServer', x=12.56, y=35.00, z=-104.75], EntityBat['Bat'/397, l='MpServer', x=16.50, y=36.10, z=-98.75], EntitySkeleton['Skeleton'/398, l='MpServer', x=28.50, y=43.00, z=-101.38], EntitySkeleton['Skeleton'/399, l='MpServer', x=26.13, y=42.00, z=-101.50], EntitySkeleton['Skeleton'/400, l='MpServer', x=21.22, y=39.00, z=-101.31], EntityCreeper['Creeper'/401, l='MpServer', x=22.97, y=66.00, z=-105.44], EntityCreeper['Creeper'/402, l='MpServer', x=30.67, y=66.00, z=-108.05], EntityCreeper['Creeper'/403, l='MpServer', x=30.69, y=66.00, z=-105.34], EntitySheep['Sheep'/404, l='MpServer', x=-1.41, y=74.00, z=-37.81], EntitySheep['Sheep'/405, l='MpServer', x=-1.53, y=74.00, z=-36.59], EntitySheep['Sheep'/406, l='MpServer', x=-49.53, y=77.00, z=-38.53], EntitySheep['Sheep'/407, l='MpServer', x=-57.47, y=79.00, z=-41.53], EntityBat['Bat'/408, l='MpServer', x=-71.25, y=36.10, z=-51.50], EntityZombie['Zombie'/409, l='MpServer', x=-79.32, y=36.91, z=-127.50], EntitySheep['Sheep'/410, l='MpServer', x=-82.50, y=67.00, z=-122.38], EntityBat['Bat'/411, l='MpServer', x=-59.75, y=34.10, z=-141.25], EntitySheep['Sheep'/412, l='MpServer', x=-63.94, y=61.78, z=-141.06], EntityCreeper['Creeper'/413, l='MpServer', x=8.97, y=56.00, z=-138.56], EntitySheep['Sheep'/414, l='MpServer', x=6.50, y=71.00, z=-130.50], EntitySkeleton['Skeleton'/415, l='MpServer', x=16.59, y=52.00, z=-120.41], EntitySkeleton['Skeleton'/416, l='MpServer', x=27.62, y=51.00, z=-115.35], EntityCreeper['Creeper'/417, l='MpServer', x=19.53, y=67.00, z=-120.03], EntityZombie['Zombie'/418, l='MpServer', x=-88.25, y=22.00, z=-88.38], EntitySheep['Sheep'/419, l='MpServer', x=41.40, y=79.41, z=-86.51], EntityZombie['Zombie'/420, l='MpServer', x=-94.43, y=42.00, z=-75.00], EntitySheep['Sheep'/421, l='MpServer', x=-94.91, y=71.00, z=-70.59], EntitySheep['Sheep'/422, l='MpServer', x=-85.66, y=80.00, z=-71.84], EntitySkeleton['Skeleton'/423, l='MpServer', x=-92.58, y=23.00, z=-97.97], EntitySkeleton['Skeleton'/424, l='MpServer', x=-92.53, y=20.00, z=-108.03], EntitySheep['Sheep'/425, l='MpServer', x=-76.50, y=78.00, z=-42.50], EntitySkeleton['Skeleton'/426, l='MpServer', x=-70.41, y=36.00, z=-142.97], EntitySlime['Slime'/427, l='MpServer', x=-88.31, y=38.00, z=-125.10], EntitySkeleton['Skeleton'/428, l='MpServer', x=-93.53, y=33.00, z=-112.88], EntitySheep['Sheep'/429, l='MpServer', x=37.50, y=76.00, z=-125.50], EntitySheep['Sheep'/431, l='MpServer', x=35.53, y=75.00, z=-126.50], EntityCreeper['Creeper'/438, l='MpServer', x=-99.84, y=32.00, z=-88.88], EntityZombie['Zombie'/439, l='MpServer', x=-96.50, y=38.00, z=-88.50], EntityZombie['Zombie'/444, l='MpServer', x=-71.50, y=30.00, z=-159.50], EntitySlime['Slime'/446, l='MpServer', x=-69.31, y=36.00, z=-146.69], EntitySkeleton['Skeleton'/450, l='MpServer', x=-20.81, y=38.00, z=-165.50], EntitySkeleton['Skeleton'/452, l='MpServer', x=-23.06, y=38.00, z=-167.56], EntityCreeper['Creeper'/458, l='MpServer', x=22.94, y=53.00, z=-159.63], EntityCreeper['Creeper'/460, l='MpServer', x=18.88, y=56.00, z=-151.00], EntitySheep['Sheep'/465, l='MpServer', x=35.50, y=74.00, z=-129.50], EntitySheep['Sheep'/473, l='MpServer', x=27.50, y=68.00, z=-25.50], EntityBat['Bat'/481, l='MpServer', x=-98.50, y=31.10, z=-78.25], EntitySheep['Sheep'/496, l='MpServer', x=53.47, y=72.00, z=-73.19]]

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:2555)

at net.minecraft.client.Minecraft.run(Minecraft.java:980)

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 8.1 (amd64) version 6.3

Java Version: 1.8.0_45, Oracle Corporation

Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation

Memory: 550271336 bytes (524 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used

IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95

FML: MCP v9.05 FML v7.10.85.1230 Minecraft Forge 10.13.2.1230 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{7.10.85.1230} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Forge{10.13.2.1230} [Minecraft Forge] (forgeSrc-1.7.10-10.13.2.1230.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

tigermod{.1} [Tiger Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available

Launched Version: 1.7.10

LWJGL: 2.9.1

OpenGL: GeForce GTX 760/PCIe/SSE2 GL version 4.5.0 NVIDIA 353.06, NVIDIA Corporation

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)

[13:57:35] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:398]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Teddy\Documents\My Games\Minecraft\Mod Making Stuff\My Mod\eclipse\.\crash-reports\crash-2015-06-14_13.57.35-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

 

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

Posted

Update: I have made my entity class a bit easier to read, and changed it to extend entityhanging instead of entitypainting. Minecraft no longer crashes but now just reports "silently" an error while trying to spawn the entity which it does not.

 

Entity class

import java.util.ArrayList;

import com.tiger.item.TigerItems;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityHanging;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;

public class PapPapEntity extends EntityHanging {
public PapPapEntity.EnumArt art;
private static final String __OBFID = "CL_00001018";

public PapPapEntity(World world) {
	super(world);
}

public PapPapEntity(World world2, int int1, int int2, int int3, int int4) {
	super(world2, int1, int2, int3, int4);
	ArrayList arraylist = new ArrayList();
    PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values();
    int i1 = aenumart.length;

    for (int j1 = 0; j1 < i1; ++j1){
    	PapPapEntity.EnumArt enumart = aenumart[j1];
        this.art = enumart;
        this.setDirection(int4);

        if (this.onValidSurface()){
        	arraylist.add(enumart);
        }
    }

    if (!arraylist.isEmpty()){
    	this.art = (PapPapEntity.EnumArt)arraylist.get(this.rand.nextInt(arraylist.size()));
    }

    this.setDirection(int4);
}
@SideOnly(Side.CLIENT)
    public PapPapEntity(World world3, int int5, int int6, int int7, int int8, String strin1){
        this(world3, int5, int6, int7, int8);
        PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values();
        int i1 = aenumart.length;

        for (int j1 = 0; j1 < i1; ++j1){
            PapPapEntity.EnumArt enumart = aenumart[j1];

            if (enumart.title.equals(strin1)){
                this.art = enumart;
                break;
            }
        }

        this.setDirection(int8);
    }
/**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
    public void writeEntityToNBT(NBTTagCompound tagcom) {
        tagcom.setString("Motive", this.art.title);
        super.writeEntityToNBT(tagcom);
    }

    /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
    public void readEntityFromNBT(NBTTagCompound tagcom2){
        String s = tagcom2.getString("Motive");
        PapPapEntity.EnumArt[] aenumart = PapPapEntity.EnumArt.values();
        int i = aenumart.length;

        for (int j = 0; j < i; ++j){
            PapPapEntity.EnumArt enumart = aenumart[j];

            if (enumart.title.equals(s)){
                this.art = enumart;
            }
        }

        if (this.art == null){
            this.art = PapPapEntity.EnumArt.Kebab;
        }

        super.readEntityFromNBT(tagcom2);
    }

    public int getWidthPixels(){
        return this.art.sizeX;
    }

    public int getHeightPixels(){
        return this.art.sizeY;
    }
public void onBroken(Entity entit){
        if (entit instanceof EntityPlayer){
            EntityPlayer entityplayer = (EntityPlayer)entit;

            if (entityplayer.capabilities.isCreativeMode){
                return;
            }
        }

        this.entityDropItem(new ItemStack(TigerItems.PapPap), 0.0F);
    }

    public static enum EnumArt{
        Kebab("Kebab", 16, 16, 0, 0),
        Aztec("Aztec", 16, 16, 16, 0),
        Alban("Alban", 16, 16, 32, 0),
        Aztec2("Aztec2", 16, 16, 48, 0),
        Bomb("Bomb", 16, 16, 64, 0),
        Plant("Plant", 16, 16, 80, 0),
        Wasteland("Wasteland", 16, 16, 96, 0),
        Pool("Pool", 32, 16, 0, 32),
        Courbet("Courbet", 32, 16, 32, 32),
        Sea("Sea", 32, 16, 64, 32),
        Sunset("Sunset", 32, 16, 96, 32),
        Creebet("Creebet", 32, 16, 128, 32),
        Wanderer("Wanderer", 16, 32, 0, 64),
        Graham("Graham", 16, 32, 16, 64),
        Match("Match", 32, 32, 0, 128),
        Bust("Bust", 32, 32, 32, 128),
        Stage("Stage", 32, 32, 64, 128),
        Void("Void", 32, 32, 96, 128),
        SkullAndRoses("SkullAndRoses", 32, 32, 128, 128),
        Wither("Wither", 32, 32, 160, 128),
        Fighters("Fighters", 64, 32, 0, 96),
        Pointer("Pointer", 64, 64, 0, 192),
        Pigscene("Pigscene", 64, 64, 64, 192),
        BurningSkull("BurningSkull", 64, 64, 128, 192),
        Skeleton("Skeleton", 64, 48, 192, 64),
        DonkeyKong("DonkeyKong", 64, 48, 192, 112);
        /** Holds the maximum length of paintings art title. */
        public static final int maxArtTitleLength = "SkullAndRoses".length();
        /** Painting Title. */
        public final String title;
        public final int sizeX;
        public final int sizeY;
        public final int offsetX;
        public final int offsetY;


        private EnumArt(String strin2, int int9, int int10, int int11, int int12){
            this.title = strin2;
            this.sizeX = int9;
            this.sizeY = int10;
            this.offsetX = int11;
            this.offsetY = int12;
        }
    }

}

 

Silent error

 

[16:12:48] [server thread/ERROR]: "Silently" catching entity tracking error.

net.minecraft.util.ReportedException: Adding entity to track

at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:235) [EntityTracker.class:?]

at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:173) [EntityTracker.class:?]

at net.minecraft.world.WorldManager.onEntityCreate(WorldManager.java:37) [WorldManager.class:?]

at net.minecraft.world.World.onEntityAdded(World.java:1516) [World.class:?]

at net.minecraft.world.WorldServer.onEntityAdded(WorldServer.java:903) [WorldServer.class:?]

at net.minecraft.world.World.spawnEntityInWorld(World.java:1507) [World.class:?]

at com.tiger.entitiy.PapPapHanging.onItemUse(PapPapHanging.java:43) [PapPapHanging.class:?]

at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:456) [ForgeHooks.class:?]

at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:142) [itemStack.class:?]

at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:422) [itemInWorldManager.class:?]

at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:593) [NetHandlerPlayServer.class:?]

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:74) [C08PacketPlayerBlockPlacement.class:?]

at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:122) [C08PacketPlayerBlockPlacement.class:?]

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:241) [NetworkManager.class:?]

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:182) [NetworkSystem.class:?]

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614) [MinecraftServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) [integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485) [MinecraftServer.class:?]

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]

Caused by: java.lang.IllegalArgumentException: Don't know how to add class com.tiger.entitiy.PapPapEntity!

at net.minecraft.entity.EntityTrackerEntry.func_151260_c(EntityTrackerEntry.java:625) ~[EntityTrackerEntry.class:?]

at net.minecraft.entity.EntityTrackerEntry.tryStartWachingThis(EntityTrackerEntry.java:376) ~[EntityTrackerEntry.class:?]

at net.minecraft.entity.EntityTrackerEntry.sendEventsToPlayers(EntityTrackerEntry.java:477) ~[EntityTrackerEntry.class:?]

at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:207) ~[EntityTracker.class:?]

... 19 more

 

I'm a novice programmer but I learn from others showing me how to code correctly so thank you for any help you give me! :)

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.

Announcements



×
×
  • Create New...

Important Information

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