Jump to content

[1.8] Crash when attempting to render entity


Ferrettomato

Recommended Posts

I'm in the process of cleaning up my code, and something I've done in that process has broken my once-functional mob. Can anyone make sense of my ineptitude?

 

Crash:

[23:53:01] [Client thread/FATAL]: Reported exception thrown!
net.minecraft.util.ReportedException: Rendering entity in world
at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:425) ~[RenderManager.class:?]
at net.minecraft.client.renderer.entity.RenderManager.renderEntityStatic(RenderManager.java:334) ~[RenderManager.class:?]
at net.minecraft.client.renderer.entity.RenderManager.renderEntitySimple(RenderManager.java:301) ~[RenderManager.class:?]
at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:657) ~[RenderGlobal.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorldPass(EntityRenderer.java:1350) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1263) ~[EntityRenderer.class:?]
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1088) ~[EntityRenderer.class:?]
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1107) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:376) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_45]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.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(Unknown Source) [start/:?]
at GradleStart.main(Unknown Source) [start/:?]
Caused by: java.lang.NullPointerException
at net.minecraft.client.renderer.entity.RendererLivingEntity.canRenderName(RendererLivingEntity.java:599) ~[RendererLivingEntity.class:?]
at net.minecraft.client.renderer.entity.RenderLiving.canRenderName(RenderLiving.java:31) ~[RenderLiving.class:?]
at net.minecraft.client.renderer.entity.RenderLiving.canRenderName(RenderLiving.java:172) ~[RenderLiving.class:?]
at net.minecraft.client.renderer.entity.RendererLivingEntity.passSpecialRender(RendererLivingEntity.java:514) ~[RendererLivingEntity.class:?]
at net.minecraft.client.renderer.entity.RendererLivingEntity.renderName(RendererLivingEntity.java:614) ~[RendererLivingEntity.class:?]
at net.minecraft.client.renderer.entity.Render.doRender(Render.java:53) ~[Render.class:?]
at net.minecraft.client.renderer.entity.RendererLivingEntity.doRender(RendererLivingEntity.java:209) ~[RendererLivingEntity.class:?]
at net.minecraft.client.renderer.entity.RenderLiving.doRender(RenderLiving.java:59) ~[RenderLiving.class:?]
at net.minecraft.client.renderer.entity.RenderLiving.doRender(RenderLiving.java:199) ~[RenderLiving.class:?]
at net.minecraft.client.renderer.entity.RenderManager.doRenderEntity(RenderManager.java:377) ~[RenderManager.class:?]
... 17 more

 

Mod class:

package com.ferret.myfirstmod;

import com.ferret.myfirstmod.blocks.BlockBethanysViolet;
import com.ferret.myfirstmod.blocks.BlockBlightPlant;
import com.ferret.myfirstmod.blocks.BlockFerretTE;
import com.ferret.myfirstmod.blocks.BlockLightStone;
import com.ferret.myfirstmod.entity.EntityBlockThrowable;
import com.ferret.myfirstmod.entity.EntityHusk;
import com.ferret.myfirstmod.handlers.FerretEventHandler;
import com.ferret.myfirstmod.items.ItemBerry;
import com.ferret.myfirstmod.items.ItemBlightSeed;
import com.ferret.myfirstmod.items.ItemBlightSpore;
import com.ferret.myfirstmod.items.ItemCheckeredBand;
import com.ferret.myfirstmod.items.ItemCube;
import com.ferret.myfirstmod.items.ItemDeath;
import com.ferret.myfirstmod.items.ItemKey;
import com.ferret.myfirstmod.items.ItemLightArmor;
import com.ferret.myfirstmod.items.ItemLightIngot;
import com.ferret.myfirstmod.items.ItemRainStaff;
import com.ferret.myfirstmod.items.tools.ItemLightAxe;
import com.ferret.myfirstmod.items.tools.ItemLightHoe;
import com.ferret.myfirstmod.items.tools.ItemLightPaxel;
import com.ferret.myfirstmod.items.tools.ItemLightPickaxe;
import com.ferret.myfirstmod.items.tools.ItemLightShovel;
import com.ferret.myfirstmod.items.tools.ItemLightStone;
import com.ferret.myfirstmod.items.tools.ItemLightSword;
import com.ferret.myfirstmod.proxies.ClientProxyFerret;
import com.ferret.myfirstmod.proxies.CommonProxyFerret;
import com.ferret.myfirstmod.tileentities.TileEntityFerret;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.model.ModelBakery;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.DungeonHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;

@Mod(modid = MyFirstMod.MODID, version = MyFirstMod.VERSION)
public class MyFirstMod
{
    public static final String MODID = "ferret_myfirstmod";
    public static final String VERSION = "1.0";
    
    
FerretEventHandler handler = new FerretEventHandler();

    @SidedProxy(clientSide = "com.ferret.myfirstmod.proxies.ClientProxyFerret", serverSide = "com.ferret.myfirstmod.proxies.CommonProxyFerret")
    public static CommonProxyFerret proxy;

    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
    	proxy.registerRendering();
    	
    	ModBlocks.loadBlocks();
    	
    	GameRegistry.registerTileEntity(TileEntityFerret.class, "TE_ferretTE");
    	
    	ModItems.loadItems();
    	
    	proxy.registerItemRenders();
    	
    	ModEntities.loadEntities(this);
    	
    	GameRegistry.registerWorldGenerator(handler, 0);
    	
    	MinecraftForge.EVENT_BUS.register(handler);
    	
    	OreDictionary.registerOre("ingotLight", new ItemStack(ModItems.lightingot));
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	//Block models
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.lightstone), 0, new ModelResourceLocation("ferret_myfirstmod:lightstone", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.lightstone), 1, new ModelResourceLocation("ferret_myfirstmod:lightwall", "inventory"));
    	ModelBakery.addVariantName(Item.getItemFromBlock(ModBlocks.lightstone), new String[]{"ferret_myfirstmod:lightstone", "ferret_myfirstmod:lightwall"});
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.blightplant), 0, new ModelResourceLocation("ferret_myfirstmod:blightplant", "inventory"));
    	ModelBakery.addVariantName(Item.getItemFromBlock(ModBlocks.blightplant), new String[]{"ferret_myfirstmod:blightplant1", "ferret_myfirstmod:blightplant2", "ferret_myfirstmod:blightplant3", "ferret_myfirstmod:blightplant4"});
      	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.ferretTE), 0, new ModelResourceLocation("ferret_myfirstmod:zero", "inventory"));
    	ModelBakery.addVariantName(Item.getItemFromBlock(ModBlocks.ferretTE), new String[]{"ferret_myfirstmod:zero"});
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(ModBlocks.bethanysviolet), 0, new ModelResourceLocation("ferret_myfirstmod:bethanysviolet", "inventory"));
    	
    	//Item models
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.key, 0, new ModelResourceLocation("ferret_myfirstmod:greykey", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.key, 1, new ModelResourceLocation("ferret_myfirstmod:redkey", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.key, 2, new ModelResourceLocation("ferret_myfirstmod:greenkey", "inventory"));
    	ModelBakery.addVariantName(ModItems.key, new String[]{"ferret_myfirstmod:greykey", "ferret_myfirstmod:redkey", "ferret_myfirstmod:greenkey"});
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.cube, 0, new ModelResourceLocation("ferret_myfirstmod:cube", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.berry, 0, new ModelResourceLocation("ferret_myfirstmod:berry", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lightingot, 0, new ModelResourceLocation("ferret_myfirstmod:lightingot", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.death, 0, new ModelResourceLocation("ferret_myfirstmod:death", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.rainstaff, 0, new ModelResourceLocation("ferret_myfirstmod:rainstaff", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.blightseed, 0, new ModelResourceLocation("ferret_myfirstmod:blightseed", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.blightspore, 0, new ModelResourceLocation("ferret_myfirstmod:blightspore", "inventory"));
    	
    	//Tool models
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lightpickaxe, 0, new ModelResourceLocation("ferret_myfirstmod:lightpickaxe", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lightsword, 0, new ModelResourceLocation("ferret_myfirstmod:lightsword", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lightaxe, 0, new ModelResourceLocation("ferret_myfirstmod:lightaxe", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lightshovel, 0, new ModelResourceLocation("ferret_myfirstmod:lightshovel", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lighthoe, 0, new ModelResourceLocation("ferret_myfirstmod:lighthoe", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lightpaxel, 0, new ModelResourceLocation("ferret_myfirstmod:lightpaxel", "inventory"));
    	
    	//Armor models
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lighthelmet, 0, new ModelResourceLocation("ferret_myfirstmod:lighthelmet", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lightchestplate, 0, new ModelResourceLocation("ferret_myfirstmod:lightchestplate", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lightleggings, 0, new ModelResourceLocation("ferret_myfirstmod:lightleggings", "inventory"));
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.lightboots, 0, new ModelResourceLocation("ferret_myfirstmod:lightboots", "inventory"));
    	ModelBakery.addVariantName(ModItems.lighthelmet, new String[]{"ferret_myfirstmod:lighthelmet", "ferret_myfirstmod:lightchestplate", "ferret_myfirstmod:lightleggings", "ferret_myfirstmod:lightboots"});
    	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.checkeredband, 0, new ModelResourceLocation("ferret_myfirstmod:checkeredband", "inventory"));
    	ModelBakery.addVariantName(ModItems.checkeredband, new String[]{"ferret_myfirstmod:checkeredband"});
    	

    	
    	//Recipes
    	GameRegistry.addSmelting(new ItemStack(ModBlocks.lightstone, 1, 0), new ItemStack(ModItems.lightingot), 0.1F);
    	
        GameRegistry.addRecipe(new ShapedOreRecipe(ModItems.lightsword,
        		" X ",
        		" X ",
        		" Y ",
        		'X', "ingotLight", 'Y', Items.stick
        ));
        
        GameRegistry.addRecipe(new ShapedOreRecipe(ModItems.lightpickaxe,
        		"XXX",
        		" Y ",
        		" Y ",
        		'X', "ingotLight", 'Y', Items.stick
        ));
        
        GameRegistry.addRecipe(new ShapedOreRecipe(ModItems.lightaxe,
        		" XX",
        		" YX",
        		" Y ",
        		'X', "ingotLight", 'Y', Items.stick
        ));
        
        GameRegistry.addRecipe(new ShapedOreRecipe(ModItems.lightshovel,
        		" X ",
        		" Y ",
        		" Y ",
        		'X', "ingotLight", 'Y', Items.stick
        ));
        
        GameRegistry.addRecipe(new ShapedOreRecipe(ModItems.lighthoe,
        		" XX",
        		" Y ",
        		" Y ",
        		'X', "ingotLight", 'Y', Items.stick
        ));
        
        GameRegistry.addRecipe(new ShapedOreRecipe(ModItems.lightpaxel,
        		"YXZ",
        		'X', "ingotLight", 'Y', ModItems.lightpickaxe, 'Z', ModItems.lightaxe
        ));
        
        GameRegistry.addShapelessRecipe(new ItemStack(Items.dye, 2, 5),
        	ModBlocks.bethanysviolet
        );      
        
        GameRegistry.addSmelting(Blocks.stone, new ItemStack(Blocks.stonebrick), 0.1F);
        
        ItemStack enchantedSwordItemStack = new ItemStack(Items.stone_sword);
        enchantedSwordItemStack.addEnchantment(Enchantment.sharpness, 1);
        GameRegistry.addShapelessRecipe(enchantedSwordItemStack,
        		Items.flint, Items.stone_sword
        );
        
        //Dungeon changes
        DungeonHooks.removeDungeonMob("Spider");
        DungeonHooks.addDungeonMob("Blaze", 100);
        ChestGenHooks.addItem(ChestGenHooks.BONUS_CHEST, new WeightedRandomChestContent(new ItemStack(Blocks.cobblestone), 25, 50, 10));
    }
}

 

ModEntities class:

package com.ferret.myfirstmod;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.fml.common.registry.EntityRegistry;

import com.ferret.myfirstmod.entity.EntityBlockThrowable;
import com.ferret.myfirstmod.entity.EntityHusk;

public class ModEntities 
{
static int startEntityId = 300;

public static void loadEntities(MyFirstMod mod)
{
	EntityRegistry.registerModEntity(EntityHusk.class, "husk", 0, mod, 80, 3, true);
    	EntityRegistry.registerModEntity(EntityBlockThrowable.class, "blockthrow", 1, mod, 80, 3, true);
    	
    	for(int i = 0; i < BiomeGenBase.getBiomeGenArray().length; i++)
    	{
    		if(BiomeGenBase.getBiomeGenArray()[i] != null)
    		{
    			EntityRegistry.addSpawn(EntityHusk.class, 10, 1, 3, EnumCreatureType.MONSTER, BiomeGenBase.getBiomeGenArray()[i]);
    		}
    	}
    	
    	registerEntityEgg(EntityHusk.class, 0xd8bb9d, 0xa63c1a);
}

	@SuppressWarnings("unchecked")
	public static void registerEntityEgg(Class<? extends Entity> entity, int primaryColor, int secondaryColor)
	{
		int id = getUniqueEntityId();
		EntityList.idToClassMapping.put(id, entity);
		EntityList.entityEggs.put(id, new EntityList.EntityEggInfo(id, primaryColor, secondaryColor));
	}

	public static int getUniqueEntityId()
	{
		do
		{
			startEntityId++;
		}
		while(EntityList.getStringFromID(startEntityId) != null);

		return startEntityId;
	}
}

 

Entity class:

package com.ferret.myfirstmod.entity;

import com.ferret.myfirstmod.ModBlocks;
import com.ferret.myfirstmod.ModItems;
import com.ferret.myfirstmod.MyFirstMod;

import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.*;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;

public class EntityHusk extends EntityMob {

public EntityHusk(World par1World)
{
	super(par1World);
	//this.getNavigator().setBreakDoors(true);
	this.tasks.addTask(0, new EntityAISwimming(this));
	this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
	this.tasks.addTask(3, new EntityAIWander(this, 1.0D));
	this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	this.tasks.addTask(4, new EntityAILookIdle(this));
	this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
	this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
}

protected void applyEntityAttributes()
{
	super.applyEntityAttributes();
	this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D);
	this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D);
}

protected Item getDropItem()
{
	return ModItems.death;
}

protected void getRareDrop(int par1)
{
	switch (this.rand.nextInt(2))
	{
	case 0:
		this.dropItem(ModItems.blightseed, 1);
		break;
	case 1:
		this.dropItem(Item.getItemFromBlock(ModBlocks.ferretTE), 1);
	}
}
}

 

Render class:

package com.ferret.myfirstmod.render;

import com.ferret.myfirstmod.MyFirstMod;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class RenderHusk extends RenderLiving {

public RenderHusk(RenderManager renderManager, ModelBase par1ModelBase, float par2) 
{
	super(renderManager, par1ModelBase, par2);
}

@Override
protected ResourceLocation getEntityTexture(Entity entity) 
{
	return new ResourceLocation(MyFirstMod.MODID, "textures/textures/models/husk.png");
}

}

Link to comment
Share on other sites

ClientProxy:

package com.ferret.myfirstmod.proxies;

import com.ferret.myfirstmod.ModBlocks;
import com.ferret.myfirstmod.MyFirstMod;
import com.ferret.myfirstmod.entity.EntityBlockThrowable;
import com.ferret.myfirstmod.entity.EntityHusk;
import com.ferret.myfirstmod.entity.EntityToxicThrowable;
import com.ferret.myfirstmod.render.ModelHusk;
import com.ferret.myfirstmod.render.RenderBlockThrowable;
import com.ferret.myfirstmod.render.RenderHusk;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraftforge.fml.client.registry.RenderingRegistry;

public class ClientProxyFerret extends CommonProxyFerret 
{
@Override
public void registerRendering()
{
	RenderingRegistry.registerEntityRenderingHandler(EntityHusk.class, new RenderHusk(Minecraft.getMinecraft().getRenderManager(), new ModelHusk(), 0.5F));
}

public void registerItemRenders()
{
	RenderingRegistry.registerEntityRenderingHandler(EntityToxicThrowable.class, new RenderSnowball(Minecraft.getMinecraft().getRenderManager(), Item.getItemFromBlock(ModBlocks.lightstone), Minecraft.getMinecraft().getRenderItem()));
	RenderingRegistry.registerEntityRenderingHandler(EntityBlockThrowable.class, new RenderBlockThrowable(Minecraft.getMinecraft().getRenderManager(), Item.getItemFromBlock(Blocks.sand), Minecraft.getMinecraft().getRenderItem()));
}
}

The CommonProxy is empty.

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.

Announcements



×
×
  • Create New...

Important Information

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