Jump to content

Mobs getting hurt in blocks


Alesimula

Recommended Posts

How i said, my mobs are getting hurt in blocks, and when they do, they stay there till they die;

 

here is an example of my mobs

 

EntityRudolph

package net.minecraft.src;

 

import net.minecraft.entity.ai.EntityAIAttackOnCollide;

import net.minecraft.entity.ai.EntityAIBreakDoor;

import net.minecraft.entity.ai.EntityAIHurtByTarget;

import net.minecraft.entity.ai.EntityAILookIdle;

import net.minecraft.entity.ai.EntityAIMoveThroughVillage;

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.ai.EntityAIFollowParent;

import net.minecraft.entity.ai.EntityAIMate;

import net.minecraft.entity.monster.EntityMob;

import net.minecraft.entity.passive.EntityVillager;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.World;

import net.minecraft.entity.Entity;

import net.minecraft.util.DamageSource;

import net.minecraft.entity.passive.EntityVillager;

import net.minecraft.block.Block;

import net.minecraft.entity.EntityAgeable;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.pathfinding.PathEntity;

import net.minecraft.entity.EntityLivingData;

import net.minecraft.item.ItemFood;

import java.util.Random;

 

public class EntityRudolph extends EntityGlacialAnimal{

 

    public EntityRudolph(World var1)

    {

        super(var1);

this.getNavigator().setAvoidsWater(true);

        this.tasks.addTask(0, new EntityAISwimming(this));

        this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D));

        this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, 1.0D, false));

        this.tasks.addTask(6, new EntityAIWander(this, 1.0D));

        this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));

        this.tasks.addTask(7, new EntityAILookIdle(this));

this.tasks.addTask(2, new EntityAIMate(this, 1.0D));

        this.tasks.addTask(4, new EntityAIFollowParent(this, 1.0D));

        this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));

this.setSize(2F, 0.6F);

    }

 

public boolean isAIEnabled()

    {

        return true;

    }

 

public boolean isChild()

    {

        return this.getGrowingAge() < 0;

    }

   

    //PERKS

  protected void func_110147_ax()

  {

  super.func_110147_ax();

  // HEALTH - default 20.0D - min 0.0D - max Double.MAX_VALUE

  this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(20.0D);

  // KNOCKBACK RESISTANCE - default 0.0D - min 0.0D - max 1.0D

  this.func_110148_a(SharedMonsterAttributes.field_111266_c).func_111128_a(0.0D);

  // SPEED - default 0.699D - min 0.0D - max Double.MAX_VALUE

  this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(1.0D);

  }

 

public static Random Rgender =new Random();

 

//GENDER (0=MALE; 1=FEMALE)

public int gender = Rgender.nextInt(2-0) + 0;

 

    /**

    * Drop 0-2 items of this living's type

    */

    protected void dropFewItems(boolean var1, int var2)

    {

        this.entityDropItem(new ItemStack(mod_Glacia.SaberToothedCatMeat.itemID, 1, 0), 0.0F);

    }

 

    /**

    * Returns the sound this mob makes while it's alive.

    */

    public String getLivingSound()

    {

        return "";

    }

 

    /**

    * Returns the sound this mob makes when it is hurt.

    */

    public String getHurtSound()

    {

        return "";

    }

 

    /**

    * Returns the sound this mob makes on death.

    */

    public String getDeathSound()

    {

        return "";

    }

 

    /**

    * Determines if an entity can be despawned, used on idle far away entities

    */

    protected boolean canDespawn()

    {

        return false;

    }

 

public EntityAgeable createChild(EntityAgeable par1EntityAgeable)

    {

        return this.spawnBabyAnimal(par1EntityAgeable);

    }

 

public EntityRudolph spawnBabyAnimal(EntityAgeable par1EntityAgeable)

    {

        return new EntityRudolph(this.worldObj);

    }

 

public EntityLivingData func_110161_a(EntityLivingData par1EntityLivingData)

    {

        par1EntityLivingData = super.func_110161_a(par1EntityLivingData);

 

        if (this.worldObj.rand.nextInt(7) == 0)

        {

            for (int i = 0; i < 2; ++i)

            {

                EntityRudolph entityrudolph = new EntityRudolph(this.worldObj);

                entityrudolph.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);

                entityrudolph.setGrowingAge(-24000);

                this.worldObj.spawnEntityInWorld(entityrudolph);

            }

        }

 

        return par1EntityLivingData;

    }

}

 

RenderRudolph

package net.minecraft.src;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.client.model.ModelBase;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.passive.EntitySheep;

import net.minecraft.entity.passive.EntityWolf;

import net.minecraft.util.ResourceLocation;

import net.minecraft.client.renderer.entity.RenderLiving;

import net.minecraft.entity.EntityLivingBase;

import org.lwjgl.opengl.GL11;

 

@SideOnly(Side.CLIENT)

public class RenderRudolph extends RenderLiving

{

public static final ResourceLocation RainDeer = new ResourceLocation("textures/entity/Glacia/Rudolph.png");

 

    public RenderRudolph(ModelBase par1ModelBase, float par3)

    {

        super(par1ModelBase, par3);

    }

 

    protected ResourceLocation func_110856_a(EntityLiving par1EntityLiving)

    {

        return RainDeer;

    }

 

    protected ResourceLocation func_110775_a(Entity par1Entity)

    {

        return this.func_110856_a((EntityLiving)par1Entity);

    }

}

 

 

ModelRudolph

package net.minecraft.src;

 

import net.minecraft.util.MathHelper;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.entity.Entity;

import java.util.Random;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.client.model.ModelBase;

import org.lwjgl.opengl.GL11;

 

public class ModelRudolph extends ModelBase

{

  //fields

  public ModelRenderer BodyMale;

  public ModelRenderer Neck;

  public ModelRenderer Head;

  public ModelRenderer Head2;

  public ModelRenderer Nose;

  public ModelRenderer Corn;

  public ModelRenderer Corn2;

  public ModelRenderer Tail;

  public ModelRenderer Corn3;

  public ModelRenderer Corn4;

  public ModelRenderer Leg1;

  public ModelRenderer Foot1p1;

  public ModelRenderer Foot1p2;

  public ModelRenderer Foot1p3;

  public ModelRenderer Leg2;

  public ModelRenderer Foot2p1;

  public ModelRenderer Foot2p2;

  public ModelRenderer Leg3;

  public ModelRenderer Leg4;

  public ModelRenderer Foot3p1;

  public ModelRenderer Foot2p3;

  public ModelRenderer Foot3p2;

  public ModelRenderer Foot3p3;

  public ModelRenderer Foot4p1;

  public ModelRenderer Foot4p2;

  public ModelRenderer Foot4p3;

  public ModelRenderer Ear1;

  public ModelRenderer Ear2;

  public ModelRenderer Corn5;

  public ModelRenderer Corn6;

  public ModelRenderer BodyFemale;

 

  public ModelRudolph()

  {

    textureWidth = 64;

    textureHeight = 64;

   

      BodyMale = new ModelRenderer(this, 0, 0);

      BodyMale.addBox(0F, 0F, 0F, 8, 5, 15);

      BodyMale.setRotationPoint(-4F, 10F, -8F);

      BodyMale.setTextureSize(64, 64);

      BodyMale.mirror = true;

      setRotation(BodyMale, 0F, 0F, 0F);

      Neck = new ModelRenderer(this, 20, 20);

      Neck.addBox(0F, 0F, 0F, 4, 7, 4);

      Neck.setRotationPoint(-2F, 5F, -8.5F);

      Neck.setTextureSize(64, 64);

      Neck.mirror = true;

      setRotation(Neck, 0F, 0F, 0F);

      Head = new ModelRenderer(this, 0, 20);

      Head.addBox(0F, 0F, 0F, 5, 4, 5);

      Head.setRotationPoint(-2.5F, 2F, -9.4F);

      Head.setTextureSize(64, 64);

      Head.mirror = true;

      setRotation(Head, 0F, 0F, 0F);

      Head2 = new ModelRenderer(this, 36, 20);

      Head2.addBox(0F, 0F, 0F, 3, 2, 2);

      Head2.setRotationPoint(-1.5F, 3.9F, -11F);

      Head2.setTextureSize(64, 64);

      Head2.mirror = true;

      setRotation(Head2, 0F, 0F, 0F);

      Nose = new ModelRenderer(this, 39, 24);

      Nose.addBox(0F, 0F, 0F, 1, 1, 1);

      Nose.setRotationPoint(-0.5F, 3.8F, -11.5F);

      Nose.setTextureSize(64, 64);

      Nose.mirror = true;

      setRotation(Nose, 0F, 0F, 0F);

      Corn = new ModelRenderer(this, 46, 20);

      Corn.addBox(0F, 0F, 0F, 1, 8, 1);

      Corn.setRotationPoint(-3F, -4F, -6.5F);

      Corn.setTextureSize(64, 64);

      Corn.mirror = true;

      setRotation(Corn, 0F, 0.6320361F, -0.1289891F);

      Corn2 = new ModelRenderer(this, 46, 20);

      Corn2.addBox(0F, 0F, 0F, 1, 8, 1);

      Corn2.setRotationPoint(2F, -4F, -7.1F);

      Corn2.setTextureSize(64, 64);

      Corn2.mirror = true;

      setRotation(Corn2, 0F, -0.642054F, 0.1289973F);

  Tail = new ModelRenderer(this, 54, 0);

      Tail.addBox(0F, -0.5F, -1F, 1, 2, 2);

      Tail.setRotationPoint(0F, 11F, 7F);

      Tail.setTextureSize(64, 64);

      Tail.mirror = true;

      setRotation(Tail, 0F, 1.570796F, 3.149738F);

      Corn3 = new ModelRenderer(this, 44, 29);

      Corn3.addBox(0F, 0F, 0F, 3, 1, 1);

      Corn3.setRotationPoint(-4.9F, -3F, -5.7F);

      Corn3.setTextureSize(64, 64);

      Corn3.mirror = true;

      setRotation(Corn3, 0F, 0.4014257F, 0.3141593F);

      Corn4 = new ModelRenderer(this, 44, 29);

      Corn4.addBox(0F, 0F, 0F, 3, 1, 1);

      Corn4.setRotationPoint(1.8F, -2F, -7F);

      Corn4.setTextureSize(64, 64);

      Corn4.mirror = true;

      setRotation(Corn4, 0F, -0.4014257F, -0.2792527F);

      Foot1p1 = new ModelRenderer(this, 54, 13);

      Foot1p1.addBox(0F, 0F, 0F, 1, 2, 3);

      Foot1p1.setRotationPoint(-0.5F, 8F, -0.3F);

      Foot1p1.setTextureSize(64, 64);

      Foot1p1.mirror = true;

      setRotation(Foot1p1, 0F, 0.1745329F, 0F);

      Foot1p2 = new ModelRenderer(this, 46, 13);

      Foot1p2.addBox(0F, 0F, 0F, 1, 2, 3);

      Foot1p2.setRotationPoint(1.5F, 8F, -0.5F);

      Foot1p2.setTextureSize(64, 64);

      Foot1p2.mirror = true;

      setRotation(Foot1p2, 0F, -0.1745329F, 0F);

      Foot1p3 = new ModelRenderer(this, 51, 18);

      Foot1p3.addBox(0F, 0F, 0F, 2, 2, 1);

      Foot1p3.setRotationPoint(0F, 8F, 1.6F);

      Foot1p3.setTextureSize(64, 64);

      Foot1p3.mirror = true;

      setRotation(Foot1p3, 0F, 0F, 0F);

      Foot2p1 = new ModelRenderer(this, 46, 13);

      Foot2p1.addBox(0F, 0F, 0F, 1, 2, 3);

      Foot2p1.setRotationPoint(1.5F, 8F, -0.5F);

      Foot2p1.setTextureSize(64, 64);

      Foot2p1.mirror = true;

      setRotation(Foot2p1, 0F, -0.1745329F, 0F);

      Foot2p2 = new ModelRenderer(this, 51, 18);

      Foot2p2.addBox(0F, 0F, 0F, 2, 2, 1);

      Foot2p2.setRotationPoint(0F, 8F, 1.6F);

      Foot2p2.setTextureSize(64, 64);

      Foot2p2.mirror = true;

      setRotation(Foot2p2, 0F, 0F, 0F);

      Foot3p1 = new ModelRenderer(this, 46, 13);

      Foot3p1.addBox(0F, 0F, 0F, 1, 2, 3);

      Foot3p1.setRotationPoint(1.5F, 8F, -0.5F);

      Foot3p1.setTextureSize(64, 64);

      Foot3p1.mirror = true;

      setRotation(Foot3p1, 0F, -0.1745329F, 0F);

      Foot2p3 = new ModelRenderer(this, 54, 13);

      Foot2p3.addBox(0F, 0F, 0F, 1, 2, 3);

      Foot2p3.setRotationPoint(-0.5F, 8F, -0.3F);

      Foot2p3.setTextureSize(64, 64);

      Foot2p3.mirror = true;

      setRotation(Foot2p3, 0F, 0.1745329F, 0F);

      Foot3p2 = new ModelRenderer(this, 54, 13);

      Foot3p2.addBox(0F, 0F, 0F, 1, 2, 3);

      Foot3p2.setRotationPoint(-0.5F, 8F, -0.3F);

      Foot3p2.setTextureSize(64, 64);

      Foot3p2.mirror = true;

      setRotation(Foot3p2, 0F, 0.1745329F, 0F);

      Foot3p3 = new ModelRenderer(this, 51, 18);

      Foot3p3.addBox(0F, 0F, 0F, 2, 2, 1);

      Foot3p3.setRotationPoint(0F, 8F, 1.6F);

      Foot3p3.setTextureSize(64, 64);

      Foot3p3.mirror = true;

      setRotation(Foot3p3, 0F, 0F, 0F);

      Foot4p1 = new ModelRenderer(this, 46, 13);

      Foot4p1.addBox(0F, 0F, 0F, 1, 2, 3);

      Foot4p1.setRotationPoint(1.5F, 8F, -0.5F);

      Foot4p1.setTextureSize(64, 64);

      Foot4p1.mirror = true;

      setRotation(Foot4p1, 0F, -0.1745329F, 0F);

      Foot4p2 = new ModelRenderer(this, 54, 13);

      Foot4p2.addBox(0F, 0F, 0F, 1, 2, 3);

      Foot4p2.setRotationPoint(-0.5F, 8F, -0.3F);

      Foot4p2.setTextureSize(64, 64);

      Foot4p2.mirror = true;

      setRotation(Foot4p2, 0F, 0.1745329F, 0F);

      Foot4p3 = new ModelRenderer(this, 51, 18);

      Foot4p3.addBox(0F, 0F, 0F, 2, 2, 1);

      Foot4p3.setRotationPoint(0F, 8F, 1.6F);

      Foot4p3.setTextureSize(64, 64);

      Foot4p3.mirror = true;

      setRotation(Foot4p3, 0F, 0F, 0F);

      Ear1 = new ModelRenderer(this, 36, 26);

      Ear1.addBox(0F, 0F, 0F, 1, 2, 1);

      Ear1.setRotationPoint(-2.6F, 1.1F, -5.5F);

      Ear1.setTextureSize(64, 64);

      Ear1.mirror = true;

      setRotation(Ear1, -0.2602503F, 0F, 0F);

      Ear2 = new ModelRenderer(this, 42, 26);

      Ear2.addBox(0F, 0F, 0F, 1, 2, 1);

      Ear2.setRotationPoint(1.6F, 1.1F, -5.5F);

      Ear2.setTextureSize(64, 64);

      Ear2.mirror = true;

      setRotation(Ear2, -0.2602503F, 0F, 0F);

  Leg1 = new ModelRenderer(this, 46, 0);

      Leg1.addBox(0F, 0F, 0F, 2, 10, 2);

      Leg1.setRotationPoint(1.5F, 14F, -7.5F);

      Leg1.setTextureSize(64, 64);

      Leg1.mirror = true;

  Leg1.addChild(Foot1p1);

  Leg1.addChild(Foot1p2);

  Leg1.addChild(Foot1p3);

      setRotation(Leg1, 0F, 0F, 0F);

  Leg2 = new ModelRenderer(this, 46, 0);

      Leg2.addBox(0F, 0F, 0F, 2, 10, 2);

      Leg2.setRotationPoint(-3.5F, 14F, -7.5F);

      Leg2.setTextureSize(64, 64);

      Leg2.mirror = true;

  Leg2.addChild(Foot2p1);

  Leg2.addChild(Foot2p2);

  Leg2.addChild(Foot2p3);

      setRotation(Leg2, 0F, 0F, 0F);

  Leg3 = new ModelRenderer(this, 46, 0);

      Leg3.addBox(0F, 0F, 0F, 2, 10, 2);

      Leg3.setRotationPoint(1.5F, 14F, 4.5F);

      Leg3.setTextureSize(64, 64);

      Leg3.mirror = true;

  Leg3.addChild(Foot3p1);

  Leg3.addChild(Foot3p2);

  Leg3.addChild(Foot3p3);

      setRotation(Leg3, 0F, 0F, 0F);

      Leg4 = new ModelRenderer(this, 46, 0);

      Leg4.addBox(0F, 0F, 0F, 2, 10, 2);

      Leg4.setRotationPoint(-3.5F, 14F, 4.5F);

      Leg4.setTextureSize(64, 64);

      Leg4.mirror = true;

  Leg4.addChild(Foot4p1);

  Leg4.addChild(Foot4p2);

  Leg4.addChild(Foot4p3);

      setRotation(Leg4, 0F, 0F, 0F);

  Corn5 = new ModelRenderer(this, 46, 20);

      Corn5.addBox(0F, 0F, 0F, 1, 1, 1);

      Corn5.setRotationPoint(-2F, 1.5F, -7F);

      Corn5.setTextureSize(64, 64);

      Corn5.mirror = true;

      setRotation(Corn5, 0F, 0F, 0F);

      Corn6 = new ModelRenderer(this, 46, 20);

      Corn6.addBox(0F, 0F, 0F, 1, 1, 1);

      Corn6.setRotationPoint(1F, 1.5F, -7F);

      Corn6.setTextureSize(64, 64);

      Corn6.mirror = true;

      setRotation(Corn6, 0F, 0F, 0F);

  BodyFemale = new ModelRenderer(this, 0, 31);

      BodyFemale.addBox(0F, 0F, 0F, 8, 5, 15);

      BodyFemale.setRotationPoint(-4F, 10F, -8F);

      BodyFemale.setTextureSize(64, 64);

      BodyFemale.mirror = true;

      setRotation(BodyFemale, 0F, 0F, 0F);

  }

 

  public static Random Rgender =new Random();

  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

  {

EntityRudolph entityraindeer = (EntityRudolph)entity;

int randgender = Rgender.nextInt(2-0) + 0;

 

if (this.isChild)

    {

if (entityraindeer.gender == 0)

{

super.render(entity, f, f1, f2, f3, f4, f5);

setRotationAngles(f, f1, f2, f3, f4, f5);

float f6 = 2.0F;

GL11.glPushMatrix();

GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);

GL11.glTranslatef(0.0F, 24.0F * f5, 0.0F);

Neck.render(f5);

Head.render(f5);

Head2.render(f5);

Nose.render(f5);

Ear1.render(f5);

Ear2.render(f5);

BodyMale.render(f5);

Tail.render(f5);

Leg1.render(f5);

Leg2.render(f5);

Leg3.render(f5);

Leg4.render(f5);

GL11.glPopMatrix();

}

else

{

super.render(entity, f, f1, f2, f3, f4, f5);

setRotationAngles(f, f1, f2, f3, f4, f5);

float f6 = 2.0F;

GL11.glPushMatrix();

GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);

GL11.glTranslatef(0.0F, 24.0F * f5, 0.0F);

Neck.render(f5);

Head.render(f5);

Head2.render(f5);

Nose.render(f5);

Ear1.render(f5);

Ear2.render(f5);

BodyFemale.render(f5);

Tail.render(f5);

Leg1.render(f5);

Leg2.render(f5);

Leg3.render(f5);

Leg4.render(f5);

GL11.glPopMatrix();

}

    }

    else

{

if (entityraindeer.gender == 0)

{

super.render(entity, f, f1, f2, f3, f4, f5);

setRotationAngles(f, f1, f2, f3, f4, f5);

BodyMale.render(f5);

Neck.render(f5);

Head.render(f5);

Head2.render(f5);

Nose.render(f5);

Corn.render(f5);

Corn2.render(f5);

Tail.render(f5);

Corn3.render(f5);

Corn4.render(f5);

Ear1.render(f5);

Ear2.render(f5);

Leg1.render(f5);

Leg2.render(f5);

Leg3.render(f5);

Leg4.render(f5);

}

else

{

super.render(entity, f, f1, f2, f3, f4, f5);

setRotationAngles(f, f1, f2, f3, f4, f5);

BodyFemale.render(f5);

Neck.render(f5);

Head.render(f5);

Head2.render(f5);

Nose.render(f5);

Corn5.render(f5);

Corn6.render(f5);

Tail.render(f5);

Ear1.render(f5);

Ear2.render(f5);

Leg1.render(f5);

Leg2.render(f5);

Leg3.render(f5);

Leg4.render(f5);

}

}

  }

 

  private void setRotation(ModelRenderer model, float x, float y, float z)

  {

    model.rotateAngleX = x;

    model.rotateAngleY = y;

    model.rotateAngleZ = z;

  }

 

  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)

  {

    super.setRotationAngles(f, f1, f2, f3, f4, f5, null);

this.Leg1.rotateAngleX = MathHelper.cos(f * 0.7F) * 1.0F * f1;

this.Leg2.rotateAngleX = MathHelper.cos(f * 0.7F + (float)Math.PI) * 1.0F * f1;

this.Leg3.rotateAngleX = MathHelper.cos(f * 0.7F) * 1.0F * f1;

this.Leg4.rotateAngleX = MathHelper.cos(f * 0.7F + (float)Math.PI) * 1.0F * f1;

this.Tail.rotateAngleX = MathHelper.cos(f * 0.7F + (float)Math.PI) * 1.0F * f1;

  }

 

}

 

Actually i don't know what to write in this signature soooo.... anyway

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.