From 03e6d60b6ac992d560d2a404e3eae2f63085edda Mon Sep 17 00:00:00 2001 From: Shaun Bennett Date: Tue, 21 Apr 2015 19:12:35 -0400 Subject: [PATCH] Mineplex - Entity Changes diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index d6bef0b..c683d78 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -124,6 +124,20 @@ public abstract class Entity implements ICommandListener { public void inactiveTick() { } // Spigot end + // Mineplex + private boolean _silent; + private boolean _invisible; + + public boolean isSilent() + { + return _silent; + } + + public void setSilent(boolean silent) + { + _silent = silent; + } + public int getId() { return this.id; } @@ -683,7 +697,9 @@ public abstract class Entity implements ICommandListener { this.makeSound(this.P(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); } - this.a(blockposition, block); + if (!isSilent()) + this.a(blockposition, block); + block.a(this.world, blockposition, this); // CraftBukkit moved from above } } @@ -785,7 +801,7 @@ public abstract class Entity implements ICommandListener { } public void makeSound(String s, float f, float f1) { - if (!this.R()) { + if (!isSilent() || !this.R()) { this.world.makeSound(this, s, f, f1); } @@ -1536,8 +1552,8 @@ public abstract class Entity implements ICommandListener { if (entity == null) { if (this.vehicle != null) { // CraftBukkit start - if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) { - VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); + if (this.bukkitEntity instanceof LivingEntity) { + VehicleExitEvent event = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); pluginManager.callEvent(event); if (event.isCancelled() || vehicle != originalVehicle) { @@ -1553,11 +1569,11 @@ public abstract class Entity implements ICommandListener { this.vehicle = null; } else { // CraftBukkit start - if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) { + if ((this.bukkitEntity instanceof LivingEntity) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) { // It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are. VehicleExitEvent exitEvent = null; - if (this.vehicle != null && this.vehicle.getBukkitEntity() instanceof Vehicle) { - exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); + if (this.vehicle != null) { + exitEvent = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); pluginManager.callEvent(exitEvent); if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) { @@ -1679,9 +1695,20 @@ public abstract class Entity implements ICommandListener { } public void setInvisible(boolean flag) { + if (isMineplexInvisible() && !flag) + return; + this.b(5, flag); } + public boolean isMineplexInvisible() { + return _invisible; + } + + public void setMineplexInvisible(boolean flag) { + _invisible = flag; + } + public void f(boolean flag) { this.b(4, flag); } diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java new file mode 100644 index 0000000..bffd3dc --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityBat.java @@ -0,0 +1,206 @@ +package net.minecraft.server; + +import java.util.Calendar; + +public class EntityBat extends EntityAmbient { + + private BlockPosition a; + private boolean _vegetated; + + public EntityBat(World world) { + super(world); + this.setSize(0.5F, 0.9F); + this.setAsleep(true); + + _vegetated = false; + } + + public void setVegetated(boolean flag) { + _vegetated = flag; + } + + public boolean isVegetated() { + return _vegetated; + } + + protected void h() { + super.h(); + this.datawatcher.a(16, new Byte((byte) 0)); + } + + protected float bB() { + return 0.1F; + } + + protected float bC() { + return super.bC() * 0.95F; + } + + protected String z() { + return this.isAsleep() && this.random.nextInt(4) != 0 ? null : "mob.bat.idle"; + } + + protected String bo() { + return "mob.bat.hurt"; + } + + protected String bp() { + return "mob.bat.death"; + } + + public boolean ae() { + return false; + } + + protected void s(Entity entity) {} + + protected void bL() {} + + protected void initAttributes() + { + super.initAttributes(); + this.getAttributeInstance(GenericAttributes.maxHealth).setValue(6.0D); + } + + public boolean isAsleep() { + return (this.datawatcher.getByte(16) & 1) != 0; + } + + public void setAsleep(boolean flag) { + byte b0 = this.datawatcher.getByte(16); + + if (flag) { + this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1))); + } else { + this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2))); + } + + } + + public void t_() { + super.t_(); + + if (isVegetated()) + return; + + if (this.isAsleep()) { + this.motX = this.motY = this.motZ = 0.0D; + this.locY = (double) MathHelper.floor(this.locY) + 1.0D - (double) this.length; + } else { + this.motY *= 0.6000000238418579D; + } + + } + + protected void E() { + super.E(); + + if (isVegetated()) + return; + + BlockPosition blockposition = new BlockPosition(this); + BlockPosition blockposition1 = blockposition.up(); + + if (this.isAsleep()) { + if (!this.world.getType(blockposition1).getBlock().isOccluding()) { + this.setAsleep(false); + this.world.a((EntityHuman) null, 1015, blockposition, 0); + } else { + if (this.random.nextInt(200) == 0) { + this.aK = (float) this.random.nextInt(360); + } + + if (this.world.findNearbyPlayer(this, 4.0D) != null) { + this.setAsleep(false); + this.world.a((EntityHuman) null, 1015, blockposition, 0); + } + } + } else { + if (this.a != null && (!this.world.isEmpty(this.a) || this.a.getY() < 1)) { + this.a = null; + } + + if (this.a == null || this.random.nextInt(30) == 0 || this.a.c((double) ((int) this.locX), (double) ((int) this.locY), (double) ((int) this.locZ)) < 4.0D) { + this.a = new BlockPosition((int) this.locX + this.random.nextInt(7) - this.random.nextInt(7), (int) this.locY + this.random.nextInt(6) - 2, (int) this.locZ + this.random.nextInt(7) - this.random.nextInt(7)); + } + + double d0 = (double) this.a.getX() + 0.5D - this.locX; + double d1 = (double) this.a.getY() + 0.1D - this.locY; + double d2 = (double) this.a.getZ() + 0.5D - this.locZ; + + this.motX += (Math.signum(d0) * 0.5D - this.motX) * 0.10000000149011612D; + this.motY += (Math.signum(d1) * 0.699999988079071D - this.motY) * 0.10000000149011612D; + this.motZ += (Math.signum(d2) * 0.5D - this.motZ) * 0.10000000149011612D; + float f = (float) (MathHelper.b(this.motZ, this.motX) * 180.0D / 3.1415927410125732D) - 90.0F; + float f1 = MathHelper.g(f - this.yaw); + + this.ba = 0.5F; + this.yaw += f1; + if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).getBlock().isOccluding()) { + this.setAsleep(true); + } + } + + } + + protected boolean s_() { + return false; + } + + public void e(float f, float f1) {} + + protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {} + + public boolean aI() { + return true; + } + + public boolean damageEntity(DamageSource damagesource, float f) { + if (this.isInvulnerable(damagesource)) { + return false; + } else { + if (!this.world.isClientSide && this.isAsleep()) { + this.setAsleep(false); + } + + return super.damageEntity(damagesource, f); + } + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + this.datawatcher.watch(16, Byte.valueOf(nbttagcompound.getByte("BatFlags"))); + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + nbttagcompound.setByte("BatFlags", this.datawatcher.getByte(16)); + } + + public boolean bR() { + BlockPosition blockposition = new BlockPosition(this.locX, this.getBoundingBox().b, this.locZ); + + if (blockposition.getY() >= this.world.F()) { + return false; + } else { + int i = this.world.getLightLevel(blockposition); + byte b0 = 4; + + if (this.a(this.world.Y())) { + b0 = 7; + } else if (this.random.nextBoolean()) { + return false; + } + + return i > this.random.nextInt(b0) ? false : super.bR(); + } + } + + private boolean a(Calendar calendar) { + return calendar.get(2) + 1 == 10 && calendar.get(5) >= 20 || calendar.get(2) + 1 == 11 && calendar.get(5) <= 3; + } + + public float getHeadHeight() { + return this.length / 2.0F; + } +} diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java new file mode 100644 index 0000000..53da5c2 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityBlaze.java @@ -0,0 +1,207 @@ +package net.minecraft.server; + +public class EntityBlaze extends EntityMonster { + + private float a = 0.5F; + private int b; + + public EntityBlaze(World world) { + super(world); + this.fireProof = true; + this.b_ = 10; + this.goalSelector.a(4, new EntityBlaze.PathfinderGoalBlazeFireball(this)); + this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D)); + this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); + this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); + this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); + this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[0])); + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true)); + } + + protected void initAttributes() { + super.initAttributes(); + this.getAttributeInstance(GenericAttributes.e).setValue(6.0D); + this.getAttributeInstance(GenericAttributes.d).setValue(0.23000000417232513D); + this.getAttributeInstance(GenericAttributes.b).setValue(48.0D); + } + + protected void h() { + super.h(); + this.datawatcher.a(16, new Byte((byte) 0)); + } + + protected String z() { + return "mob.blaze.breathe"; + } + + protected String bo() { + return "mob.blaze.hit"; + } + + protected String bp() { + return "mob.blaze.death"; + } + + public float c(float f) { + return 1.0F; + } + + public void m() { + if (!isVegetated() && !this.onGround && this.motY < 0.0D) { + this.motY *= 0.6D; + } + + if (this.world.isClientSide) { + if (this.random.nextInt(24) == 0 && !this.R()) { + this.world.a(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.fire", 1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F, false); + } + + for (int i = 0; i < 2; ++i) { + this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D, new int[0]); + } + } + + super.m(); + } + + protected void E() { + if (this.U()) { + this.damageEntity(DamageSource.DROWN, 1.0F); + } + + --this.b; + if (this.b <= 0) { + this.b = 100; + this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F; + } + + EntityLiving entityliving = this.getGoalTarget(); + + if (!isVegetated() && entityliving != null && entityliving.locY + (double) entityliving.getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.a) { + this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D; + this.ai = true; + } + + super.E(); + } + + public void e(float f, float f1) {} + + protected Item getLoot() { + return Items.BLAZE_ROD; + } + + public boolean isBurning() { + return this.n(); + } + + protected void dropDeathLoot(boolean flag, int i) { + if (flag) { + int j = this.random.nextInt(2 + i); + + for (int k = 0; k < j; ++k) { + this.a(Items.BLAZE_ROD, 1); + } + } + + } + + public boolean n() { + return (this.datawatcher.getByte(16) & 1) != 0; + } + + public void a(boolean flag) { + byte b0 = this.datawatcher.getByte(16); + + if (flag) { + b0 = (byte) (b0 | 1); + } else { + b0 &= -2; + } + + this.datawatcher.watch(16, Byte.valueOf(b0)); + } + + protected boolean n_() { + return true; + } + + static class PathfinderGoalBlazeFireball extends PathfinderGoal { + + private EntityBlaze a; + private int b; + private int c; + + public PathfinderGoalBlazeFireball(EntityBlaze entityblaze) { + this.a = entityblaze; + this.a(3); + } + + public boolean a() { + EntityLiving entityliving = this.a.getGoalTarget(); + + return entityliving != null && entityliving.isAlive(); + } + + public void c() { + this.b = 0; + } + + public void d() { + this.a.a(false); + } + + public void e() { + --this.c; + EntityLiving entityliving = this.a.getGoalTarget(); + double d0 = this.a.h(entityliving); + + if (d0 < 4.0D) { + if (this.c <= 0) { + this.c = 20; + this.a.r(entityliving); + } + + this.a.getControllerMove().a(entityliving.locX, entityliving.locY, entityliving.locZ, 1.0D); + } else if (d0 < 256.0D) { + double d1 = entityliving.locX - this.a.locX; + double d2 = entityliving.getBoundingBox().b + (double) (entityliving.length / 2.0F) - (this.a.locY + (double) (this.a.length / 2.0F)); + double d3 = entityliving.locZ - this.a.locZ; + + if (this.c <= 0) { + ++this.b; + if (this.b == 1) { + this.c = 60; + this.a.a(true); + } else if (this.b <= 4) { + this.c = 6; + } else { + this.c = 100; + this.b = 0; + this.a.a(false); + } + + if (this.b > 1) { + float f = MathHelper.c(MathHelper.sqrt(d0)) * 0.5F; + + this.a.world.a((EntityHuman) null, 1009, new BlockPosition((int) this.a.locX, (int) this.a.locY, (int) this.a.locZ), 0); + + for (int i = 0; i < 1; ++i) { + EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.a.world, this.a, d1 + this.a.bc().nextGaussian() * (double) f, d2, d3 + this.a.bc().nextGaussian() * (double) f); + + entitysmallfireball.locY = this.a.locY + (double) (this.a.length / 2.0F) + 0.5D; + this.a.world.addEntity(entitysmallfireball); + } + } + } + + this.a.getControllerLook().a(entityliving, 10.0F, 10.0F); + } else { + this.a.getNavigation().n(); + this.a.getControllerMove().a(entityliving.locX, entityliving.locY, entityliving.locZ, 1.0D); + } + + super.e(); + } + } +} diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java index 4bdcfc6..9539b66 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -60,6 +60,18 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo super.h(); } + public void setTargetBlock(int x, int y, int z) { + // Mineplex + this.a = x; + this.b = y; + this.c = z; + this.bA = null; + } + + public void setTargetEntity(Entity e) { + this.bA = e; + } + public double[] b(int i, float f) { if (this.getHealth() <= 0.0F) { f = 0.0F; @@ -170,7 +182,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo this.c += this.random.nextGaussian() * 2.0D; } - if (this.bw || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E) { + if (!isVegetated() && (this.bw || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E)) { this.cf(); } @@ -253,7 +265,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo this.bs.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F); this.bt.t_(); this.bt.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F); - if (!this.world.isClientSide && this.hurtTicks == 0) { + if (!this.world.isClientSide && this.hurtTicks == 0 && !isGhost()) { this.a(this.world.getEntities(this, this.bs.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D))); this.a(this.world.getEntities(this, this.bt.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D))); this.b(this.world.getEntities(this, this.bn.getBoundingBox().grow(1.0D, 1.0D, 1.0D))); diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java index ce91553..59ada33 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -17,6 +17,8 @@ public class EntityFallingBlock extends Entity { private float fallHurtAmount = 2.0F; public NBTTagCompound tileEntityData; + public boolean spectating; + public EntityFallingBlock(World world) { super(world); } @@ -42,7 +44,7 @@ public class EntityFallingBlock extends Entity { protected void h() {} public boolean ad() { - return !this.dead; + return !this.dead && !spectating; } public void t_() { @@ -219,6 +221,14 @@ public class EntityFallingBlock extends Entity { } + @Override + public boolean damageEntity(DamageSource damagesource, float f) + { + CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f); + + return true; + } + public void a(boolean flag) { this.hurtEntities = flag; } diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java index 688099f..404dda2 100644 --- a/src/main/java/net/minecraft/server/EntityHorse.java +++ b/src/main/java/net/minecraft/server/EntityHorse.java @@ -125,6 +125,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { private void c(int i, boolean flag) { int j = this.datawatcher.getInt(16); + if (isVegetated()) + return; + if (flag) { this.datawatcher.watch(16, Integer.valueOf(j | i)); } else { diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index d73395a..7a9eacb 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -133,7 +133,7 @@ public abstract class EntityHuman extends EntityLiving { if (this.g != null) { ItemStack itemstack = this.inventory.getItemInHand(); - if (itemstack == this.g) { + if (ItemStack.equals(itemstack, this.g)) { if (this.h <= 25 && this.h % 4 == 0) { this.b(itemstack, 5); } diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java index 9621ce0..463d578 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -35,6 +35,10 @@ public abstract class EntityInsentient extends EntityLiving { private Entity bp; private NBTTagCompound bq; + private boolean _vegetated; + private boolean _shouldBreakLeash; + private boolean _pullWhileLeashed; + public EntityInsentient(World world) { super(world); this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null); @@ -53,6 +57,11 @@ public abstract class EntityInsentient extends EntityLiving { // CraftBukkit start - default persistance to type's persistance value this.persistent = !isTypeNotPersistent(); // CraftBukkit end + + // Mineplex + _vegetated = false; + _shouldBreakLeash = true; + _pullWhileLeashed = true; } protected void initAttributes() { @@ -149,7 +158,7 @@ public abstract class EntityInsentient extends EntityLiving { public void K() { super.K(); this.world.methodProfiler.a("mobBaseTick"); - if (this.isAlive() && this.random.nextInt(1000) < this.a_++) { + if (this.isAlive() && !isSilent() && this.random.nextInt(1000) < this.a_++) { this.a_ = -this.w(); this.x(); } @@ -771,7 +780,7 @@ public abstract class EntityInsentient extends EntityLiving { } public final boolean e(EntityHuman entityhuman) { - if (this.cc() && this.getLeashHolder() == entityhuman) { + if (this.cc() && this.getLeashHolder() == entityhuman && _shouldBreakLeash) { // CraftBukkit start - fire PlayerUnleashEntityEvent if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) { ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder())); @@ -836,7 +845,7 @@ public abstract class EntityInsentient extends EntityLiving { } public void unleash(boolean flag, boolean flag1) { - if (this.bo) { + if (this.bo && _shouldBreakLeash) { this.bo = false; this.bp = null; if (!this.world.isClientSide && flag1) { @@ -936,6 +945,32 @@ public abstract class EntityInsentient extends EntityLiving { return this.datawatcher.getByte(15) != 0; } + public void setVegetated(boolean flag) { + _vegetated = flag; + } + + public void setShouldBreakLeash(boolean shouldBreakLeash) + { + _shouldBreakLeash = shouldBreakLeash; + } + + public void setPullWhileLeashed(boolean pullWhileLeashed) + { + _pullWhileLeashed = pullWhileLeashed; + } + + public boolean isVegetated() { + return _vegetated; + } + + public boolean shouldBreakLeash() { + return shouldBreakLeash(); + } + + public boolean shouldPullWhileLeashed() { + return _pullWhileLeashed; + } + public static enum EnumEntityPositionType { ON_GROUND, IN_AIR, IN_WATER; diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 99b120a..12d735d 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -97,6 +97,8 @@ public abstract class EntityLiving extends Entity { } // Spigot end + private boolean _ghost; + public void G() { this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE); } @@ -1782,7 +1784,7 @@ public abstract class EntityLiving extends Entity { } public boolean ad() { - return !this.dead; + return !isGhost() && !this.dead; } public boolean ae() { @@ -1836,4 +1838,12 @@ public abstract class EntityLiving extends Entity { protected void bP() { this.updateEffects = true; } + + public boolean isGhost() { + return _ghost; + } + + public void setGhost(boolean ghost) { + _ghost = ghost; + } } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 3854edf..c52d591 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -65,10 +65,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // Spigot start public boolean collidesWithEntities = true; + // Mineplex + public boolean spectating; + @Override public boolean ad() { - return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) + return !spectating && this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving) } @Override diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java index 2d22327..3aa9467 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -9,6 +9,9 @@ public class EntityTNTPrimed extends Entity { public float yield = 4; // CraftBukkit - add field public boolean isIncendiary = false; // CraftBukkit - add field + // Mineplex + public boolean spectating; + public EntityTNTPrimed(World world) { super(world); this.k = true; @@ -37,7 +40,7 @@ public class EntityTNTPrimed extends Entity { } public boolean ad() { - return !this.dead; + return !spectating && !this.dead; } public void t_() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 5317cff..3ab939f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -461,6 +461,54 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return true; } + @Override + public boolean shouldBreakLeash() + { + return ((EntityInsentient) getHandle()).shouldBreakLeash(); + } + + @Override + public void setShouldBreakLeash(boolean shouldBreakLeash) + { + ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash); + } + + @Override + public boolean shouldPullWhileLeashed() + { + return ((EntityInsentient) getHandle()).shouldPullWhileLeashed(); + } + + @Override + public void setPullWhileLeashed(boolean pullWhileLeashed) + { + ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed); + } + + @Override + public boolean isVegetated() + { + return ((EntityInsentient) getHandle()).isVegetated(); + } + + @Override + public void setVegetated(boolean vegetated) + { + ((EntityInsentient) getHandle()).setVegetated(vegetated); + } + + @Override + public boolean isGhost() + { + return getHandle().isGhost(); + } + + @Override + public void setGhost(boolean ghost) + { + getHandle().setGhost(ghost); + } + @Deprecated public int _INVALID_getLastDamage() { return NumberConversions.ceil(getLastDamage()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 06e014c..0adc2a9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -874,10 +874,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void hidePlayer(Player player) { + hidePlayer(player, false, true); + } + + public void hidePlayer(Player player, boolean override, boolean hideList) { Validate.notNull(player, "hidden player cannot be null"); if (getHandle().playerConnection == null) return; if (equals(player)) return; - if (hiddenPlayers.contains(player.getUniqueId())) return; + if (!override && hiddenPlayers.contains(player.getUniqueId())) return; hiddenPlayers.add(player.getUniqueId()); //remove this player from the hidden player's EntityTrackerEntry @@ -889,7 +893,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } //remove the hidden player from this player user list - getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other)); + if (hideList) + getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other)); } @Override @@ -1336,13 +1341,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public boolean getCollidesWithEntities() { - return getHandle().collidesWithEntities; + return !getHandle().spectating; +// return getHandle().collidesWithEntities; } @Override public void setCollidesWithEntities(boolean collides) { - getHandle().collidesWithEntities = collides; + getHandle().spectating = !collides; getHandle().k = collides; // First boolean of Entity } -- 2.3.5