From 0cfef63376a04d7200aaece50fddc27dd13d3e36 Mon Sep 17 00:00:00 2001 From: MattBDev Date: Sat, 11 Jun 2016 19:25:13 -0400 Subject: [PATCH] Fix backwards compatibility --- .../bukkit/object/entity/ArmorStandStats.java | 3 +- .../bukkit/object/entity/EntityBaseStats.java | 6 +-- .../bukkit/object/entity/EntityWrapper.java | 41 +++++++++++-------- .../object/entity/LivingEntityStats.java | 6 +-- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/ArmorStandStats.java b/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/ArmorStandStats.java index b75feb488..e6331436c 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/ArmorStandStats.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/ArmorStandStats.java @@ -9,8 +9,7 @@ class ArmorStandStats { final float[] leftArm = new float[3]; final float[] rightArm = new float[3]; boolean arms; - boolean noplate; - boolean nogravity; + boolean noPlate; boolean invisible; boolean small; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityBaseStats.java b/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityBaseStats.java index 10623cc76..5a26d675f 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityBaseStats.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityBaseStats.java @@ -7,7 +7,7 @@ class EntityBaseStats { float fall; short fire; int age; - double v_z; - double v_y; - double v_x; + double vZ; + double vY; + double vX; } diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java b/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java index de86897e7..f8c3590e6 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java @@ -80,14 +80,16 @@ public class EntityWrapper { this.base.fire = (short) entity.getFireTicks(); this.base.age = entity.getTicksLived(); Vector velocity = entity.getVelocity(); - this.base.v_x = velocity.getX(); - this.base.v_y = velocity.getY(); - this.base.v_z = velocity.getZ(); + this.base.vX = velocity.getX(); + this.base.vY = velocity.getY(); + this.base.vZ = velocity.getZ(); if (depth == 1) { return; } - if (!entity.hasGravity()) { - this.noGravity = true; + if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 10, 0) || entity instanceof ArmorStand) { + if (!entity.hasGravity()) { + this.noGravity = true; + } } switch (entity.getType()) { case ARROW: @@ -202,6 +204,7 @@ public class EntityWrapper { case COW: case MUSHROOM_COW: case PIG: + case POLAR_BEAR: storeAgeable((Ageable) entity); storeLiving((LivingEntity) entity); return; @@ -260,7 +263,7 @@ public class EntityWrapper { this.stand.arms = true; } if (!stand.hasBasePlate()) { - this.stand.noplate = true; + this.stand.noPlate = true; } if (!stand.isVisible()) { this.stand.invisible = true; @@ -342,8 +345,8 @@ public class EntityWrapper { if (this.lived.leashed) { // TODO leashes // World world = entity.getWorld(); - // Entity leash = world.spawnEntity(new Location(world, Math.floor(x) + lived.leash_x, Math.floor(y) + lived.leash_y, Math - // .floor(z) + lived.leash_z), EntityType.LEASH_HITCH); + // Entity leash = world.spawnEntity(new Location(world, Math.floor(x) + lived.leashX, Math.floor(y) + lived.leashY, Math + // .floor(z) + lived.leashZ), EntityType.LEASH_HITCH); // entity.setLeashHolder(leash); } } @@ -378,9 +381,9 @@ public class EntityWrapper { this.lived.leashed = lived.isLeashed(); if (this.lived.leashed) { Location location = lived.getLeashHolder().getLocation(); - this.lived.leash_x = (short) (this.x - location.getBlockX()); - this.lived.leash_y = (short) (this.y - location.getBlockY()); - this.lived.leash_z = (short) (this.z - location.getBlockZ()); + this.lived.leashX = (short) (this.x - location.getBlockX()); + this.lived.leashY = (short) (this.y - location.getBlockY()); + this.lived.leashZ = (short) (this.z - location.getBlockZ()); } EntityEquipment equipment = lived.getEquipment(); this.lived.equipped = equipment != null; @@ -435,8 +438,8 @@ public class EntityWrapper { this.tamed.tamed = tamed.isTamed(); } - public Entity spawn(World world, int x_offset, int z_offset) { - Location location = new Location(world, this.x + x_offset, this.y, this.z + z_offset); + public Entity spawn(World world, int xOffset, int zOffset) { + Location location = new Location(world, this.x + xOffset, this.y, this.z + zOffset); location.setYaw(this.yaw); location.setPitch(this.pitch); if (!this.type.isSpawnable()) { @@ -464,7 +467,7 @@ public class EntityWrapper { } if (this.base.passenger != null) { try { - entity.setPassenger(this.base.passenger.spawn(world, x_offset, z_offset)); + entity.setPassenger(this.base.passenger.spawn(world, xOffset, zOffset)); } catch (Exception ignored) { } } if (this.base.fall != 0) { @@ -476,12 +479,14 @@ public class EntityWrapper { if (this.base.age != 0) { entity.setTicksLived(this.base.age); } - entity.setVelocity(new Vector(this.base.v_x, this.base.v_y, this.base.v_z)); + entity.setVelocity(new Vector(this.base.vX, this.base.vY, this.base.vZ)); if (this.depth == 1) { return entity; } - if (this.noGravity) { - entity.setGravity(false); + if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 10, 0) || entity instanceof ArmorStand) { + if (this.noGravity) { + entity.setGravity(false); + } } switch (entity.getType()) { case ARROW: @@ -661,7 +666,7 @@ public class EntityWrapper { if (this.stand.arms) { stand.setArms(true); } - if (this.stand.noplate) { + if (this.stand.noPlate) { stand.setBasePlate(false); } if (this.stand.small) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/LivingEntityStats.java b/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/LivingEntityStats.java index fef2558c1..39e79c2b0 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/LivingEntityStats.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/object/entity/LivingEntityStats.java @@ -14,9 +14,9 @@ class LivingEntityStats { short air; boolean persistent; boolean leashed; - short leash_x; - short leash_y; - short leash_z; + short leashX; + short leashY; + short leashZ; boolean equipped; ItemStack mainHand; ItemStack helmet;