Every time I throw the entity now, I still have an invisible texture. However, I also get this error:
net.minecraft.util.ReportedException: Adding entity to track
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:219)
2013-09-23 15:20:38 [iNFO] [sTDERR] at cpw.mods.fml.common.registry.EntityRegistry.tryTrackingEntity(EntityRegistry.java:363)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:64)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.world.WorldManager.onEntityCreate(WorldManager.java:37)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.world.World.onEntityAdded(World.java:1587)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.world.WorldServer.onEntityAdded(WorldServer.java:923)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.world.World.spawnEntityInWorld(World.java:1578)
2013-09-23 15:20:38 [iNFO] [sTDERR] at me.myMod.items.ItemBall.onItemRightClick(ItemBall.java:38)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:176)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.item.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:353)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.handlePlace(NetServerHandler.java:540)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.network.packet.Packet15Place.processPacket(Packet15Place.java:79)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.network.MemoryConnection.processReadPackets(MemoryConnection.java:89)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.network.NetServerHandler.networkTick(NetServerHandler.java:141)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.network.NetworkListenThread.networkTick(NetworkListenThread.java:54)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServerListenThread.networkTick(IntegratedServerListenThread.java:109)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:689)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:585)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:129)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.server.ThreadMinecraftServer.run(ThreadMinecraftServer.java:16)
2013-09-23 15:20:38 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2013-09-23 15:20:38 [iNFO] [sTDERR] at cpw.mods.fml.common.network.EntitySpawnPacket.generatePacket(EntitySpawnPacket.java:75)
2013-09-23 15:20:38 [iNFO] [sTDERR] at cpw.mods.fml.common.network.FMLPacket.makePacket(FMLPacket.java:131)
2013-09-23 15:20:38 [iNFO] [sTDERR] at cpw.mods.fml.common.network.FMLNetworkHandler.getEntitySpawningPacket(FMLNetworkHandler.java:371)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTrackerEntry.getPacketForThisEntity(EntityTrackerEntry.java:495)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTrackerEntry.tryStartWachingThis(EntityTrackerEntry.java:385)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTrackerEntry.sendEventsToPlayers(EntityTrackerEntry.java:484)
2013-09-23 15:20:38 [iNFO] [sTDERR] at net.minecraft.entity.EntityTracker.addEntityToTracker(EntityTracker.java:205)
2013-09-23 15:20:38 [iNFO] [sTDERR] ... 20 more
RenderBall:
@SideOnly(Side.CLIENT)
public class RenderBall extends Render
{
private static final ResourceLocation texture = new ResourceLocation(MyModInfo.ID,"textures/entities/ball.png");
private Item field_94151_a;
private int field_94150_f;
public RenderBall(Item par1Item, int par2)
{
this.field_94151_a = par1Item;
this.field_94150_f = par2;
}
public RenderBall(Item par1Item)
{
this(par1Item, 0);
}
/**
* 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)
{
Icon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f);
if (icon != null)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(0.5F, 0.5F, 0.5F);
this.func_110777_b(par1Entity);
Tessellator tessellator = Tessellator.instance;
if (icon == ItemPotion.func_94589_d("bottle_splash"))
{
int i = PotionHelper.func_77915_a(((EntityPotion)par1Entity).getPotionDamage(), false);
float f2 = (float)(i >> 16 & 255) / 255.0F;
float f3 = (float)(i >> 8 & 255) / 255.0F;
float f4 = (float)(i & 255) / 255.0F;
GL11.glColor3f(f2, f3, f4);
GL11.glPushMatrix();
this.func_77026_a(tessellator, ItemPotion.func_94589_d("overlay"));
GL11.glPopMatrix();
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
this.func_77026_a(tessellator, icon);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
}
@Override
protected ResourceLocation func_110775_a(Entity par1Entity) {
return texture;
}
private void func_77026_a(Tessellator par1Tessellator, Icon par2Icon)
{
float f = par2Icon.getMinU();
float f1 = par2Icon.getMaxU();
float f2 = par2Icon.getMinV();
float f3 = par2Icon.getMaxV();
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
par1Tessellator.startDrawingQuads();
par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);
par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(0.0F - f6), 0.0D, (double)f, (double)f3);
par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6), 0.0D, (double)f1, (double)f3);
par1Tessellator.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6), 0.0D, (double)f1, (double)f2);
par1Tessellator.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6), 0.0D, (double)f, (double)f2);
par1Tessellator.draw();
}
}
Entity Registration (Method in common proxy, called from my load method in my Main Class though)
public void registerEntities() {
EntityRegistry.registerModEntity(EntityBall.class, "Ball", 257, MyMod.instance, 64, 1, true);
}
Rendering Registration and other Entity Registration (Of course this is in the client proxy method registerRenderers and registerEntities:))
@Override
public void registerRenderers() {
RenderingRegistry.registerEntityRenderingHandler(EntityBall.class, new RenderBall(Items.ballItem));
}
@Override
public void registerEntities() {
EntityRegistry.registerGlobalEntityID(EntityBall.class, "Ball",
EntityRegistry.findGlobalUniqueEntityId());
}