mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Fix backwards compatibility
This commit is contained in:
parent
5bdb2263dc
commit
0cfef63376
@ -9,8 +9,7 @@ class ArmorStandStats {
|
|||||||
final float[] leftArm = new float[3];
|
final float[] leftArm = new float[3];
|
||||||
final float[] rightArm = new float[3];
|
final float[] rightArm = new float[3];
|
||||||
boolean arms;
|
boolean arms;
|
||||||
boolean noplate;
|
boolean noPlate;
|
||||||
boolean nogravity;
|
|
||||||
boolean invisible;
|
boolean invisible;
|
||||||
boolean small;
|
boolean small;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ class EntityBaseStats {
|
|||||||
float fall;
|
float fall;
|
||||||
short fire;
|
short fire;
|
||||||
int age;
|
int age;
|
||||||
double v_z;
|
double vZ;
|
||||||
double v_y;
|
double vY;
|
||||||
double v_x;
|
double vX;
|
||||||
}
|
}
|
||||||
|
@ -80,15 +80,17 @@ public class EntityWrapper {
|
|||||||
this.base.fire = (short) entity.getFireTicks();
|
this.base.fire = (short) entity.getFireTicks();
|
||||||
this.base.age = entity.getTicksLived();
|
this.base.age = entity.getTicksLived();
|
||||||
Vector velocity = entity.getVelocity();
|
Vector velocity = entity.getVelocity();
|
||||||
this.base.v_x = velocity.getX();
|
this.base.vX = velocity.getX();
|
||||||
this.base.v_y = velocity.getY();
|
this.base.vY = velocity.getY();
|
||||||
this.base.v_z = velocity.getZ();
|
this.base.vZ = velocity.getZ();
|
||||||
if (depth == 1) {
|
if (depth == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 10, 0) || entity instanceof ArmorStand) {
|
||||||
if (!entity.hasGravity()) {
|
if (!entity.hasGravity()) {
|
||||||
this.noGravity = true;
|
this.noGravity = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
switch (entity.getType()) {
|
switch (entity.getType()) {
|
||||||
case ARROW:
|
case ARROW:
|
||||||
case BOAT:
|
case BOAT:
|
||||||
@ -202,6 +204,7 @@ public class EntityWrapper {
|
|||||||
case COW:
|
case COW:
|
||||||
case MUSHROOM_COW:
|
case MUSHROOM_COW:
|
||||||
case PIG:
|
case PIG:
|
||||||
|
case POLAR_BEAR:
|
||||||
storeAgeable((Ageable) entity);
|
storeAgeable((Ageable) entity);
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return;
|
return;
|
||||||
@ -260,7 +263,7 @@ public class EntityWrapper {
|
|||||||
this.stand.arms = true;
|
this.stand.arms = true;
|
||||||
}
|
}
|
||||||
if (!stand.hasBasePlate()) {
|
if (!stand.hasBasePlate()) {
|
||||||
this.stand.noplate = true;
|
this.stand.noPlate = true;
|
||||||
}
|
}
|
||||||
if (!stand.isVisible()) {
|
if (!stand.isVisible()) {
|
||||||
this.stand.invisible = true;
|
this.stand.invisible = true;
|
||||||
@ -342,8 +345,8 @@ public class EntityWrapper {
|
|||||||
if (this.lived.leashed) {
|
if (this.lived.leashed) {
|
||||||
// TODO leashes
|
// TODO leashes
|
||||||
// World world = entity.getWorld();
|
// World world = entity.getWorld();
|
||||||
// Entity leash = world.spawnEntity(new Location(world, Math.floor(x) + lived.leash_x, Math.floor(y) + lived.leash_y, Math
|
// Entity leash = world.spawnEntity(new Location(world, Math.floor(x) + lived.leashX, Math.floor(y) + lived.leashY, Math
|
||||||
// .floor(z) + lived.leash_z), EntityType.LEASH_HITCH);
|
// .floor(z) + lived.leashZ), EntityType.LEASH_HITCH);
|
||||||
// entity.setLeashHolder(leash);
|
// entity.setLeashHolder(leash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,9 +381,9 @@ public class EntityWrapper {
|
|||||||
this.lived.leashed = lived.isLeashed();
|
this.lived.leashed = lived.isLeashed();
|
||||||
if (this.lived.leashed) {
|
if (this.lived.leashed) {
|
||||||
Location location = lived.getLeashHolder().getLocation();
|
Location location = lived.getLeashHolder().getLocation();
|
||||||
this.lived.leash_x = (short) (this.x - location.getBlockX());
|
this.lived.leashX = (short) (this.x - location.getBlockX());
|
||||||
this.lived.leash_y = (short) (this.y - location.getBlockY());
|
this.lived.leashY = (short) (this.y - location.getBlockY());
|
||||||
this.lived.leash_z = (short) (this.z - location.getBlockZ());
|
this.lived.leashZ = (short) (this.z - location.getBlockZ());
|
||||||
}
|
}
|
||||||
EntityEquipment equipment = lived.getEquipment();
|
EntityEquipment equipment = lived.getEquipment();
|
||||||
this.lived.equipped = equipment != null;
|
this.lived.equipped = equipment != null;
|
||||||
@ -435,8 +438,8 @@ public class EntityWrapper {
|
|||||||
this.tamed.tamed = tamed.isTamed();
|
this.tamed.tamed = tamed.isTamed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity spawn(World world, int x_offset, int z_offset) {
|
public Entity spawn(World world, int xOffset, int zOffset) {
|
||||||
Location location = new Location(world, this.x + x_offset, this.y, this.z + z_offset);
|
Location location = new Location(world, this.x + xOffset, this.y, this.z + zOffset);
|
||||||
location.setYaw(this.yaw);
|
location.setYaw(this.yaw);
|
||||||
location.setPitch(this.pitch);
|
location.setPitch(this.pitch);
|
||||||
if (!this.type.isSpawnable()) {
|
if (!this.type.isSpawnable()) {
|
||||||
@ -464,7 +467,7 @@ public class EntityWrapper {
|
|||||||
}
|
}
|
||||||
if (this.base.passenger != null) {
|
if (this.base.passenger != null) {
|
||||||
try {
|
try {
|
||||||
entity.setPassenger(this.base.passenger.spawn(world, x_offset, z_offset));
|
entity.setPassenger(this.base.passenger.spawn(world, xOffset, zOffset));
|
||||||
} catch (Exception ignored) { }
|
} catch (Exception ignored) { }
|
||||||
}
|
}
|
||||||
if (this.base.fall != 0) {
|
if (this.base.fall != 0) {
|
||||||
@ -476,13 +479,15 @@ public class EntityWrapper {
|
|||||||
if (this.base.age != 0) {
|
if (this.base.age != 0) {
|
||||||
entity.setTicksLived(this.base.age);
|
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) {
|
if (this.depth == 1) {
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 10, 0) || entity instanceof ArmorStand) {
|
||||||
if (this.noGravity) {
|
if (this.noGravity) {
|
||||||
entity.setGravity(false);
|
entity.setGravity(false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
switch (entity.getType()) {
|
switch (entity.getType()) {
|
||||||
case ARROW:
|
case ARROW:
|
||||||
case BOAT:
|
case BOAT:
|
||||||
@ -661,7 +666,7 @@ public class EntityWrapper {
|
|||||||
if (this.stand.arms) {
|
if (this.stand.arms) {
|
||||||
stand.setArms(true);
|
stand.setArms(true);
|
||||||
}
|
}
|
||||||
if (this.stand.noplate) {
|
if (this.stand.noPlate) {
|
||||||
stand.setBasePlate(false);
|
stand.setBasePlate(false);
|
||||||
}
|
}
|
||||||
if (this.stand.small) {
|
if (this.stand.small) {
|
||||||
|
@ -14,9 +14,9 @@ class LivingEntityStats {
|
|||||||
short air;
|
short air;
|
||||||
boolean persistent;
|
boolean persistent;
|
||||||
boolean leashed;
|
boolean leashed;
|
||||||
short leash_x;
|
short leashX;
|
||||||
short leash_y;
|
short leashY;
|
||||||
short leash_z;
|
short leashZ;
|
||||||
boolean equipped;
|
boolean equipped;
|
||||||
ItemStack mainHand;
|
ItemStack mainHand;
|
||||||
ItemStack helmet;
|
ItemStack helmet;
|
||||||
|
Loading…
Reference in New Issue
Block a user