Hello all! I have my Mob all ready to go and on my server my friends pointed out a bug to me. Upon further investigation, i found that looking at my mob causes a "Stack underflow" making water and other things like chests disappear. I do have a scale mechanic in my Render file just like the Giant Zombie
package com.lecapria.entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILeapAtTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class EntityFenrir extends EntityMob
{
public EntityFenrir(World par1World)
{
super(par1World);
this.experienceValue = 10;
this.yOffset *= 3.0F;
this.setSize(this.width * 2.0F, this.height);
//this.moveSpeed = 3.8F;
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAILeapAtTarget(this, 0.38F));
this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 0.38F, true));
this.tasks.addTask(4, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
this.tasks.addTask(5, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true));
this.tasks.addTask(6, new EntityAIMoveTowardsRestriction(this, 1.0D));
this.tasks.addTask(7, new EntityAIWander(this, 0.6F));
this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(9, new EntityAILookIdle(this));
this.targetTasks.addTask(11, new EntityAIHurtByTarget(this, true));
this.targetTasks.addTask(12, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
this.targetTasks.addTask(13, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false));
}
@Override
protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(200.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(2.2D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(25.0D);
}
@Override
public boolean isAIEnabled()
{
return true;
}
@Override
public void onLivingUpdate()
{
super.onLivingUpdate();
}
@Override
public void writeEntityToNBT(NBTTagCompound par1NGTTagCompound)
{
super.writeEntityToNBT(par1NGTTagCompound);
}
@Override
public void readEntityFromNBT(NBTTagCompound par1NGTTagCompound)
{
super.readEntityFromNBT(par1NGTTagCompound);
}
@Override
protected boolean canDespawn()
{
return true;
}
@Override
protected String getLivingSound()
{
return "mob.wolf.growl";
}
@Override
protected String getHurtSound()
{
return "mob.wolf.hurt";
}
@Override
protected String getDeathSound()
{
return "mob.wolf.death";
}
protected void playStepSound(int par1, int par2, int par3, int par4)
{
this.playSound("mod.wolf.step", par2, par3);
}
/*protected int getDropItemId()
{
return modMain.celsiusTear.blockID;
}*/
}
Render class
package com.lecapria.entity;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityGiantZombie;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class RenderFenrir extends RenderLiving {
public static final ResourceLocation fenrirTexture = new ResourceLocation("lecapria:textures/mobs/fenrir.png");
private float scale;
private static final String __OBFID = "CL_00000998";
public RenderFenrir(ModelBase p_i1255_1_, float p_i1255_2_, float p_i1255_3_)
{
super(p_i1255_1_, p_i1255_2_ * p_i1255_3_);
this.scale = p_i1255_3_;
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityFenrir p_77041_1_, float p_77041_2_)
{
GL11.glScalef(this.scale, this.scale, this.scale);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(EntityFenrir p_110775_1_)
{
return fenrirTexture;
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_)
{
this.preRenderCallback((EntityFenrir)p_77041_1_, p_77041_2_);
}
/**
* 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((EntityFenrir)p_110775_1_);
}
}
Model class
package com.lecapria.entity;
import java.util.Random;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
public class ModelFenrir extends ModelBase
{
public ModelRenderer wolfHeadMain;
public ModelRenderer wolfBody;
public ModelRenderer wolfLeg1;
public ModelRenderer wolfLeg2;
public ModelRenderer wolfLeg3;
public ModelRenderer wolfLeg4;
ModelRenderer wolfTail;
ModelRenderer wolfMane;
public ModelFenrir()
{
float f = 0.0F;
float f1 = 13.5F;
this.wolfHeadMain = new ModelRenderer(this, 0, 0);
this.wolfHeadMain.addBox(-3F, -3F, -2F, 6, 6, 4, f);
this.wolfHeadMain.setRotationPoint(-1F, f1, -7F);
this.wolfBody = new ModelRenderer(this, 18, 14);
this.wolfBody.addBox(-4F, -2F, -3F, 6, 9, 6, f);
this.wolfBody.setRotationPoint(0.0F, 14F, 2.0F);
this.wolfMane = new ModelRenderer(this, 21, 0);
this.wolfMane.addBox(-4F, -3F, -3F, 8, 6, 7, f);
this.wolfMane.setRotationPoint(-1F, 14F, 2.0F);
this.wolfLeg1 = new ModelRenderer(this, 0, 18);
this.wolfLeg1.addBox(-1F, 0.0F, -1F, 2, 8, 2, f);
this.wolfLeg1.setRotationPoint(-2.5F, 16F, 7F);
this.wolfLeg2 = new ModelRenderer(this, 0, 18);
this.wolfLeg2.addBox(-1F, 0.0F, -1F, 2, 8, 2, f);
this.wolfLeg2.setRotationPoint(0.5F, 16F, 7F);
this.wolfLeg3 = new ModelRenderer(this, 0, 18);
this.wolfLeg3.addBox(-1F, 0.0F, -1F, 2, 8, 2, f);
this.wolfLeg3.setRotationPoint(-2.5F, 16F, -4F);
this.wolfLeg4 = new ModelRenderer(this, 0, 18);
this.wolfLeg4.addBox(-1F, 0.0F, -1F, 2, 8, 2, f);
this.wolfLeg4.setRotationPoint(0.5F, 16F, -4F);
this.wolfTail = new ModelRenderer(this, 9, 18);
this.wolfTail.addBox(-1F, 0.0F, -1F, 2, 8, 2, f);
this.wolfTail.setRotationPoint(-1F, 12F, 8F);
this.wolfHeadMain.setTextureOffset(16, 14).addBox(-3F, -5F, 0.0F, 2, 2, 1, f);
this.wolfHeadMain.setTextureOffset(16, 14).addBox(1.0F, -5F, 0.0F, 2, 2, 1, f);
this.wolfHeadMain.setTextureOffset(0, 10).addBox(-1.5F, 0.0F, -5F, 3, 3, 4, f);
}
/**
* Sets the models various rotation angles then renders the model.
*/
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
super.render(par1Entity, par2, par3, par4, par5, par6, par7);
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
this.wolfHeadMain.renderWithRotation(par7);
this.wolfBody.render(par7);
this.wolfLeg1.render(par7);
this.wolfLeg2.render(par7);
this.wolfLeg3.render(par7);
this.wolfLeg4.render(par7);
this.wolfTail.renderWithRotation(par7);
this.wolfMane.render(par7);
GL11.glPopMatrix();
}
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
{
EntityFenrir entityfenrir = (EntityFenrir)par1EntityLivingBase;
this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F);
this.wolfBody.rotateAngleX = ((float)Math.PI / 2F);
this.wolfMane.setRotationPoint(-1.0F, 14.0F, -3.0F);
this.wolfMane.rotateAngleX = this.wolfBody.rotateAngleX;
this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F);
this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F);
this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F);
this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F);
this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F);
this.wolfLeg1.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
this.wolfLeg2.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3;
this.wolfLeg3.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3;
this.wolfLeg4.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
}
/**
* Sets the models various rotation angles.
*/
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
{
super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
this.wolfHeadMain.rotateAngleX = par5 / (180F / (float)Math.PI);
this.wolfHeadMain.rotateAngleY = par4 / (180F / (float)Math.PI);
this.wolfTail.rotateAngleX = 45;
}
}
@ Post render
[17:00:16] [Client thread/ERROR]: 1284: Stack underflow
[17:00:16] [Client thread/ERROR]: ########## GL ERROR ##########
Entity Class
Render class
Model class
My Planetminecraft Page