Jump to content

Recommended Posts

Posted

I'm currently trying to make my mob use the biped model. Every time I spawn it, it has the right texture, and the right model. But when I hit it, it just starts stuttering everywhere. Am I doing something wrong?

 

DarkOriginsEntities

 

 

package assets.darkorigins;

 

import net.minecraft.client.model.ModelBiped;

import assets.darkorigins.entity.EntityDroneI;

import assets.darkorigins.registry.RegistryBase;

import assets.darkorigins.render.RenderEntity;

 

public class DarkOriginsEntities

{

 

public static void init()

{

 

RegistryBase.registerEntity(EntityDroneI.class, "droneI", "Drone I", 10, 0xC0C0C0, 0x00FFFF);

RegistryBase.registerEntityRender(EntityDroneI.class, new RenderEntity(new ModelBiped(), 0.25F, "droneI"));

 

}

 

}

 

 

 

EntityDroneI

 

 

package assets.darkorigins.entity;

 

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.SharedMonsterAttributes;

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.monster.EntityIronGolem;

import net.minecraft.entity.monster.EntityMob;

import net.minecraft.entity.passive.EntityBat;

import net.minecraft.entity.passive.EntityChicken;

import net.minecraft.entity.passive.EntityCow;

import net.minecraft.entity.passive.EntityHorse;

import net.minecraft.entity.passive.EntityMooshroom;

import net.minecraft.entity.passive.EntityOcelot;

import net.minecraft.entity.passive.EntityPig;

import net.minecraft.entity.passive.EntitySheep;

import net.minecraft.entity.passive.EntitySquid;

import net.minecraft.entity.passive.EntityVillager;

import net.minecraft.entity.passive.EntityWolf;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.util.DamageSource;

import net.minecraft.world.World;

 

public class EntityDroneI extends EntityMob

{

 

public EntityDroneI(World world)

{

 

super(world);

 

        this.getNavigator().setBreakDoors(true);

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

        this.tasks.addTask(1, new EntityAIBreakDoor(this));

        this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));

        this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true));

        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.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));

        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));

        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false));

 

}

 

    protected void applyEntityAttributes()

    {

   

        super.applyEntityAttributes();

        this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(20.0D);

        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D);

        this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(5.0D);

        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(40.0D);

       

    }

 

    public void onLivingUpdate()

    {

   

    if(!this.worldObj.isRemote)

    {

   

            if (this.isWet())

            {

           

                this.attackEntityFrom(DamageSource.drown, 1.0F);

               

            }

   

    }

   

    }

   

    public int getTotalArmorValue()

    {

   

    return 20;

   

    }

   

    protected String getLivingSound()

    {

   

    return "mob.blaze.breathe";

       

    }

   

    protected String getHurtSound()

    {

   

        return "mob.irongolem.hit";

       

    }

   

    protected String getDeathSound()

    {

   

        return "mob.irongolem.death";

       

    }

   

    protected void playStepSound(int par1, int par2, int par3, int par4)

    {

   

        this.playSound("mob.irongolem.walk", 1.0F, 1.0F);

       

    }

   

    public float getBrightness(float par1)

    {

   

        return 1.0F;

       

    }

   

}

 

 

 

 

RegistryBase

 

 

package assets.darkorigins.registry;

 

import net.minecraft.block.Block;

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

import net.minecraft.entity.Entity;

import net.minecraft.item.Item;

import cpw.mods.fml.client.registry.RenderingRegistry;

import cpw.mods.fml.common.registry.EntityRegistry;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.common.registry.LanguageRegistry;

 

public class RegistryBase

{

 

public static LanguageRegistry LR = LanguageRegistry.instance();

 

public static void registerBlock(Block block)

{

 

GameRegistry.registerBlock(block, block.getUnlocalizedName());

 

}

 

public static void registerItem(Item item)

{

 

GameRegistry.registerItem(item, item.getUnlocalizedName(), "darkorigins");

 

}

 

public static void registerEntity(Class<? extends Entity> entity, String name1, String name2, int id, int backColor, int foreColor)

{

 

EntityRegistry.registerGlobalEntityID(entity, name1, id, backColor, foreColor);

 

LR.addStringLocalization("entity." + name1 + ".name", name2);

 

}

 

public static void registerEntityRender(Class<? extends Entity> entity, Render renderer)

{

 

RenderingRegistry.registerEntityRenderingHandler(entity, renderer);

 

}

 

}

 

 

Kain

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.