MrNegaBlox Posted July 6, 2015 Posted July 6, 2015 So I was trying to change my entity from EntityMob to EntityTameable then to EntityAgeable. This suddenly caused it's speed to spike and it practically teleports when it walks. I have absolutely no idea why this is happening as I even set the AI Move speed and the attribute. package io.github.mrnegablox.minefortress.entity; import java.io.Console; import scala.collection.concurrent.Debug; import io.github.mrnegablox.minefortress.ai.EntityAIGoToWaypoint; import io.github.mrnegablox.minefortress.item.ModItems; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIFollowOwner; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveIndoors; import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; import net.minecraft.entity.ai.EntityAIOpenDoor; import net.minecraft.entity.ai.EntityAIRestrictOpenDoor; 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.EntityTameable; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; public class EntityDwarf extends EntityAgeable { private boolean goingToWaypoint; private int targetX; private int targetY; private int targetZ; public EntityDwarf(World par1World) { super(par1World); this.setAIMoveSpeed(0.1F); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5d); this.getNavigator().setEnterDoors(true); this.getNavigator().setBreakDoors(true); this.tasks.addTask(1, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIGoToWaypoint(this)); //this.tasks.addTask(3, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F)); this.tasks.addTask(3, new EntityAIMoveIndoors(this)); this.tasks.addTask(4, new EntityAIRestrictOpenDoor(this)); this.tasks.addTask(5, new EntityAIOpenDoor(this, true)); this.tasks.addTask(6, new EntityAIMoveTowardsRestriction(this, 0.3F)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityDwarf.class, 8.0F)); this.tasks.addTask(9, new EntityAILookIdle(this)); this.setSize(1.0F,0.5F); } @Override public boolean interact(EntityPlayer player) { System.out.println("interact start"); ItemStack cei=player.getCurrentEquippedItem(); if(cei !=null && cei.getItem() == ModItems.staff){ System.out.println("interact called"); if (cei.stackTagCompound == null){ cei.setTagCompound(new NBTTagCompound()); } cei.stackTagCompound.setInteger("target", this.getEntityId()); System.out.println(this.getEntityId()); } return super.interact(player); } public boolean isgoingToWaypoint(){ return goingToWaypoint; } public void setgoingToWaypoint(boolean gotow){ goingToWaypoint = gotow; } public boolean isAIEnabled() { return true; } public int gettargetX(){ return targetX; } public int gettargetY(){ return targetY; } public int gettargetZ(){ return targetZ; } public void setTargetPos(int x, int y,int z){ targetX = x; targetY = y; targetZ = z; } @Override public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); goingToWaypoint = nbt.getBoolean("goingToWaypoint"); targetX = nbt.getInteger("targetX"); targetY = nbt.getInteger("targetY"); targetZ = nbt.getInteger("targetZ"); } @Override public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setBoolean("goingToWaypoint", goingToWaypoint); nbt.setInteger("targetX", targetX); nbt.setInteger("targetY", targetY); nbt.setInteger("targetZ", targetZ); } @Override public EntityAgeable createChild(EntityAgeable p_90011_1_) { // TODO Auto-generated method stub return null; } } Quote
Recommended Posts
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.