From ab944b9b3f69ae1e4ef76e653daef68dd60ec20f Mon Sep 17 00:00:00 2001 From: Adubbz Date: Fri, 25 Mar 2016 12:19:17 +1100 Subject: [PATCH] Updated MCP names, fixed entity movement --- build.properties | 2 +- .../common/entities/EntityButterfly.java | 14 +++++++------- .../biomesoplenty/common/entities/EntityPixie.java | 7 +++---- .../biomesoplenty/common/entities/EntityWasp.java | 8 ++++---- .../common/entities/projectiles/EntityDart.java | 6 +++--- .../biomesoplenty/common/item/ItemBOPSpawnEgg.java | 2 +- .../biomesoplenty/common/item/ItemJarFilled.java | 2 +- 7 files changed, 20 insertions(+), 21 deletions(-) diff --git a/build.properties b/build.properties index c81b3b726..ca0712369 100644 --- a/build.properties +++ b/build.properties @@ -1,4 +1,4 @@ minecraft_version=1.9 forge_version=12.16.0.1807-1.9 mod_version=4.0.0 -mappings_version=snapshot_nodoc_20160318 \ No newline at end of file +mappings_version=snapshot_nodoc_20160324 \ No newline at end of file diff --git a/src/main/java/biomesoplenty/common/entities/EntityButterfly.java b/src/main/java/biomesoplenty/common/entities/EntityButterfly.java index c74d10596..b9a99dbc1 100644 --- a/src/main/java/biomesoplenty/common/entities/EntityButterfly.java +++ b/src/main/java/biomesoplenty/common/entities/EntityButterfly.java @@ -18,6 +18,7 @@ import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityMoveHelper; +import net.minecraft.entity.ai.EntityMoveHelper.Action; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; @@ -54,7 +55,7 @@ public class EntityButterfly extends EntityFlying implements IMob { protected void entityInit() { super.entityInit(); - this.dataWatcher.register(TYPE, Byte.valueOf((byte)0)); + this.dataManager.register(TYPE, Byte.valueOf((byte)0)); } public void writeEntityToNBT(NBTTagCompound tagCompound) @@ -92,12 +93,12 @@ public class EntityButterfly extends EntityFlying implements IMob { public int getButterflyType() { - return (int) this.dataWatcher.get(TYPE); + return (int) this.dataManager.get(TYPE); } public void setButterflyType(int butterflyTypeId) { - this.dataWatcher.set(TYPE, Byte.valueOf((byte)butterflyTypeId)); + this.dataManager.set(TYPE, Byte.valueOf((byte)butterflyTypeId)); } @Override @@ -225,7 +226,6 @@ public class EntityButterfly extends EntityFlying implements IMob { private int courseChangeCooldown = 0; private double closeEnough = 0.3D; private ButterflyMoveTargetPos targetPos = new ButterflyMoveTargetPos(); - private boolean update; public ButterflyMoveHelper() { @@ -243,7 +243,7 @@ public class EntityButterfly extends EntityFlying implements IMob { public void onUpdateMoveHelper() { // 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) { // 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)) { //System.out.println("Abandoning move target - way is blocked" ); - this.update = false; + this.action = Action.WAIT; } else if (this.targetPos.dist < this.closeEnough) { //System.out.println("Arrived (close enough) dist:"+this.targetPos.dist); - this.update = false; + this.action = Action.WAIT; } } diff --git a/src/main/java/biomesoplenty/common/entities/EntityPixie.java b/src/main/java/biomesoplenty/common/entities/EntityPixie.java index 540ad945b..3deb131c6 100644 --- a/src/main/java/biomesoplenty/common/entities/EntityPixie.java +++ b/src/main/java/biomesoplenty/common/entities/EntityPixie.java @@ -202,7 +202,6 @@ public class EntityPixie extends EntityFlying implements IMob { private int courseChangeCooldown = 0; private double closeEnough = 0.3D; private PixieMoveTargetPos targetPos = new PixieMoveTargetPos(); - private boolean update; public PixieMoveHelper() { @@ -220,7 +219,7 @@ public class EntityPixie extends EntityFlying implements IMob { public void onUpdateMoveHelper() { // 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) { // 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)) { //System.out.println("Abandoning move target - way is blocked" ); - this.update = false; + this.action = Action.WAIT; } else if (this.targetPos.dist < this.closeEnough) { //System.out.println("Arrived (close enough) dist:"+this.targetPos.dist); - this.update = false; + this.action = Action.WAIT; } } diff --git a/src/main/java/biomesoplenty/common/entities/EntityWasp.java b/src/main/java/biomesoplenty/common/entities/EntityWasp.java index ae2aefd2e..d54367db8 100644 --- a/src/main/java/biomesoplenty/common/entities/EntityWasp.java +++ b/src/main/java/biomesoplenty/common/entities/EntityWasp.java @@ -20,6 +20,7 @@ import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAIFindEntityNearestPlayer; import net.minecraft.entity.ai.EntityMoveHelper; +import net.minecraft.entity.ai.EntityMoveHelper.Action; import net.minecraft.entity.monster.IMob; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumFacing; @@ -151,7 +152,6 @@ public class EntityWasp extends EntityFlying implements IMob { private int courseChangeCooldown = 0; private double closeEnough = 0.3D; private WaspMoveTargetPos targetPos = new WaspMoveTargetPos(); - private boolean update; public WaspMoveHelper() { @@ -169,7 +169,7 @@ public class EntityWasp extends EntityFlying implements IMob { public void onUpdateMoveHelper() { // 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) { // 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)) { //System.out.println("Abandoning move target - way is blocked" ); - this.update = false; + this.action = Action.WAIT; } else if (this.targetPos.dist < this.closeEnough) { //System.out.println("Arrived (close enough) dist:"+this.targetPos.dist); - this.update = false; + this.action = Action.WAIT; } } diff --git a/src/main/java/biomesoplenty/common/entities/projectiles/EntityDart.java b/src/main/java/biomesoplenty/common/entities/projectiles/EntityDart.java index 75d40bb2e..6ecfebb25 100644 --- a/src/main/java/biomesoplenty/common/entities/projectiles/EntityDart.java +++ b/src/main/java/biomesoplenty/common/entities/projectiles/EntityDart.java @@ -58,17 +58,17 @@ public class EntityDart extends EntityArrow @Override 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) { - dataWatcher.set(TYPE, (byte)dartType.ordinal()); + dataManager.set(TYPE, (byte)dartType.ordinal()); } public ItemDart.DartType getDartType() { - return ItemDart.DartType.values()[dataWatcher.get(TYPE)]; + return ItemDart.DartType.values()[dataManager.get(TYPE)]; } // TODO: read/write to NBT? diff --git a/src/main/java/biomesoplenty/common/item/ItemBOPSpawnEgg.java b/src/main/java/biomesoplenty/common/item/ItemBOPSpawnEgg.java index 5d52b079a..bb5cf752f 100644 --- a/src/main/java/biomesoplenty/common/item/ItemBOPSpawnEgg.java +++ b/src/main/java/biomesoplenty/common/item/ItemBOPSpawnEgg.java @@ -70,7 +70,7 @@ public class ItemBOPSpawnEgg extends Item implements IColoredItem if (entity instanceof EntityLivingBase) { 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.renderYawOffset = entityliving.rotationYaw; entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null); diff --git a/src/main/java/biomesoplenty/common/item/ItemJarFilled.java b/src/main/java/biomesoplenty/common/item/ItemJarFilled.java index eabd79ee7..d5ce46b43 100644 --- a/src/main/java/biomesoplenty/common/item/ItemJarFilled.java +++ b/src/main/java/biomesoplenty/common/item/ItemJarFilled.java @@ -121,7 +121,7 @@ public class ItemJarFilled extends Item if (world.provider.isSurfaceWorld()) { 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); pixie.playLivingSound(); if (stack.hasDisplayName()) {pixie.setCustomNameTag(stack.getDisplayName());}