Updated MCP names, fixed entity movement

This commit is contained in:
Adubbz 2016-03-25 12:19:17 +11:00
parent d739eb966e
commit ab944b9b3f
7 changed files with 20 additions and 21 deletions

View File

@ -1,4 +1,4 @@
minecraft_version=1.9 minecraft_version=1.9
forge_version=12.16.0.1807-1.9 forge_version=12.16.0.1807-1.9
mod_version=4.0.0 mod_version=4.0.0
mappings_version=snapshot_nodoc_20160318 mappings_version=snapshot_nodoc_20160324

View File

@ -18,6 +18,7 @@ import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityMoveHelper; import net.minecraft.entity.ai.EntityMoveHelper;
import net.minecraft.entity.ai.EntityMoveHelper.Action;
import net.minecraft.entity.monster.IMob; import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -54,7 +55,7 @@ public class EntityButterfly extends EntityFlying implements IMob {
protected void entityInit() protected void entityInit()
{ {
super.entityInit(); super.entityInit();
this.dataWatcher.register(TYPE, Byte.valueOf((byte)0)); this.dataManager.register(TYPE, Byte.valueOf((byte)0));
} }
public void writeEntityToNBT(NBTTagCompound tagCompound) public void writeEntityToNBT(NBTTagCompound tagCompound)
@ -92,12 +93,12 @@ public class EntityButterfly extends EntityFlying implements IMob {
public int getButterflyType() public int getButterflyType()
{ {
return (int) this.dataWatcher.get(TYPE); return (int) this.dataManager.get(TYPE);
} }
public void setButterflyType(int butterflyTypeId) public void setButterflyType(int butterflyTypeId)
{ {
this.dataWatcher.set(TYPE, Byte.valueOf((byte)butterflyTypeId)); this.dataManager.set(TYPE, Byte.valueOf((byte)butterflyTypeId));
} }
@Override @Override
@ -225,7 +226,6 @@ public class EntityButterfly extends EntityFlying implements IMob {
private int courseChangeCooldown = 0; private int courseChangeCooldown = 0;
private double closeEnough = 0.3D; private double closeEnough = 0.3D;
private ButterflyMoveTargetPos targetPos = new ButterflyMoveTargetPos(); private ButterflyMoveTargetPos targetPos = new ButterflyMoveTargetPos();
private boolean update;
public ButterflyMoveHelper() public ButterflyMoveHelper()
{ {
@ -243,7 +243,7 @@ public class EntityButterfly extends EntityFlying implements IMob {
public void onUpdateMoveHelper() public void onUpdateMoveHelper()
{ {
// if we have arrived at the previous target, or we have no target to aim for, do nothing // if we have arrived at the previous target, or we have no target to aim for, do nothing
if (!this.update) {return;} if (this.action != Action.MOVE_TO) {return;}
if (this.courseChangeCooldown-- > 0) { if (this.courseChangeCooldown-- > 0) {
// limit the rate at which we change course // limit the rate at which we change course
@ -267,10 +267,10 @@ public class EntityButterfly extends EntityFlying implements IMob {
if (!this.targetPos.isPathClear(5.0D)) if (!this.targetPos.isPathClear(5.0D))
{ {
//System.out.println("Abandoning move target - way is blocked" ); //System.out.println("Abandoning move target - way is blocked" );
this.update = false; this.action = Action.WAIT;
} else if (this.targetPos.dist < this.closeEnough) { } else if (this.targetPos.dist < this.closeEnough) {
//System.out.println("Arrived (close enough) dist:"+this.targetPos.dist); //System.out.println("Arrived (close enough) dist:"+this.targetPos.dist);
this.update = false; this.action = Action.WAIT;
} }
} }

View File

@ -202,7 +202,6 @@ public class EntityPixie extends EntityFlying implements IMob {
private int courseChangeCooldown = 0; private int courseChangeCooldown = 0;
private double closeEnough = 0.3D; private double closeEnough = 0.3D;
private PixieMoveTargetPos targetPos = new PixieMoveTargetPos(); private PixieMoveTargetPos targetPos = new PixieMoveTargetPos();
private boolean update;
public PixieMoveHelper() public PixieMoveHelper()
{ {
@ -220,7 +219,7 @@ public class EntityPixie extends EntityFlying implements IMob {
public void onUpdateMoveHelper() public void onUpdateMoveHelper()
{ {
// if we have arrived at the previous target, or we have no target to aim for, do nothing // if we have arrived at the previous target, or we have no target to aim for, do nothing
if (!this.update) {return;} if (this.action != Action.MOVE_TO) {return;}
if (this.courseChangeCooldown-- > 0) { if (this.courseChangeCooldown-- > 0) {
// limit the rate at which we change course // limit the rate at which we change course
@ -244,10 +243,10 @@ public class EntityPixie extends EntityFlying implements IMob {
if (!this.targetPos.isPathClear(5.0D)) if (!this.targetPos.isPathClear(5.0D))
{ {
//System.out.println("Abandoning move target - way is blocked" ); //System.out.println("Abandoning move target - way is blocked" );
this.update = false; this.action = Action.WAIT;
} else if (this.targetPos.dist < this.closeEnough) { } else if (this.targetPos.dist < this.closeEnough) {
//System.out.println("Arrived (close enough) dist:"+this.targetPos.dist); //System.out.println("Arrived (close enough) dist:"+this.targetPos.dist);
this.update = false; this.action = Action.WAIT;
} }
} }

View File

@ -20,6 +20,7 @@ import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.EntityAIFindEntityNearestPlayer; import net.minecraft.entity.ai.EntityAIFindEntityNearestPlayer;
import net.minecraft.entity.ai.EntityMoveHelper; import net.minecraft.entity.ai.EntityMoveHelper;
import net.minecraft.entity.ai.EntityMoveHelper.Action;
import net.minecraft.entity.monster.IMob; import net.minecraft.entity.monster.IMob;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -151,7 +152,6 @@ public class EntityWasp extends EntityFlying implements IMob {
private int courseChangeCooldown = 0; private int courseChangeCooldown = 0;
private double closeEnough = 0.3D; private double closeEnough = 0.3D;
private WaspMoveTargetPos targetPos = new WaspMoveTargetPos(); private WaspMoveTargetPos targetPos = new WaspMoveTargetPos();
private boolean update;
public WaspMoveHelper() public WaspMoveHelper()
{ {
@ -169,7 +169,7 @@ public class EntityWasp extends EntityFlying implements IMob {
public void onUpdateMoveHelper() public void onUpdateMoveHelper()
{ {
// if we have arrived at the previous target, or we have no target to aim for, do nothing // if we have arrived at the previous target, or we have no target to aim for, do nothing
if (!this.update) {return;} if (this.action != Action.MOVE_TO) {return;}
if (this.courseChangeCooldown-- > 0) { if (this.courseChangeCooldown-- > 0) {
// limit the rate at which we change course // limit the rate at which we change course
@ -201,10 +201,10 @@ public class EntityWasp extends EntityFlying implements IMob {
if (!this.targetPos.isPathClear(5.0D)) if (!this.targetPos.isPathClear(5.0D))
{ {
//System.out.println("Abandoning move target - way is blocked" ); //System.out.println("Abandoning move target - way is blocked" );
this.update = false; this.action = Action.WAIT;
} else if (this.targetPos.dist < this.closeEnough) { } else if (this.targetPos.dist < this.closeEnough) {
//System.out.println("Arrived (close enough) dist:"+this.targetPos.dist); //System.out.println("Arrived (close enough) dist:"+this.targetPos.dist);
this.update = false; this.action = Action.WAIT;
} }
} }

View File

@ -58,17 +58,17 @@ public class EntityDart extends EntityArrow
@Override @Override
protected void entityInit() protected void entityInit()
{ {
this.dataWatcher.register(TYPE, Byte.valueOf((byte)0)); this.dataManager.register(TYPE, Byte.valueOf((byte)0));
} }
public void setDartType(ItemDart.DartType dartType) public void setDartType(ItemDart.DartType dartType)
{ {
dataWatcher.set(TYPE, (byte)dartType.ordinal()); dataManager.set(TYPE, (byte)dartType.ordinal());
} }
public ItemDart.DartType getDartType() public ItemDart.DartType getDartType()
{ {
return ItemDart.DartType.values()[dataWatcher.get(TYPE)]; return ItemDart.DartType.values()[dataManager.get(TYPE)];
} }
// TODO: read/write to NBT? // TODO: read/write to NBT?

View File

@ -70,7 +70,7 @@ public class ItemBOPSpawnEgg extends Item implements IColoredItem
if (entity instanceof EntityLivingBase) if (entity instanceof EntityLivingBase)
{ {
EntityLiving entityliving = (EntityLiving)entity; EntityLiving entityliving = (EntityLiving)entity;
entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F); entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(worldIn.rand.nextFloat() * 360.0F), 0.0F);
entityliving.rotationYawHead = entityliving.rotationYaw; entityliving.rotationYawHead = entityliving.rotationYaw;
entityliving.renderYawOffset = entityliving.rotationYaw; entityliving.renderYawOffset = entityliving.rotationYaw;
entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null); entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);

View File

@ -121,7 +121,7 @@ public class ItemJarFilled extends Item
if (world.provider.isSurfaceWorld()) if (world.provider.isSurfaceWorld())
{ {
EntityPixie pixie = new EntityPixie(world); EntityPixie pixie = new EntityPixie(world);
pixie.setLocationAndAngles(releasePoint.xCoord, releasePoint.yCoord, releasePoint.zCoord, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F); pixie.setLocationAndAngles(releasePoint.xCoord, releasePoint.yCoord, releasePoint.zCoord, MathHelper.wrapDegrees(world.rand.nextFloat() * 360.0F), 0.0F);
world.spawnEntityInWorld(pixie); world.spawnEntityInWorld(pixie);
pixie.playLivingSound(); pixie.playLivingSound();
if (stack.hasDisplayName()) {pixie.setCustomNameTag(stack.getDisplayName());} if (stack.hasDisplayName()) {pixie.setCustomNameTag(stack.getDisplayName());}