From cd36f6f2570d8909d691e856eddf49f6b882e784 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 27 Mar 2016 20:19:41 +1100 Subject: SPIGOT-2060: Method to control whether entities collide --- nms-patches/EntityLiving.patch | 56 +++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 23 deletions(-) (limited to 'nms-patches') diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch index a4ed72b2..b4e189a9 100644 --- a/nms-patches/EntityLiving.patch +++ b/nms-patches/EntityLiving.patch @@ -22,7 +22,7 @@ public abstract class EntityLiving extends Entity { private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); -@@ -80,6 +95,13 @@ +@@ -80,6 +95,14 @@ protected int bn; protected int bo; private BlockPosition bC; @@ -32,11 +32,12 @@ + boolean forceDrops; + ArrayList drops = new ArrayList(); + public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes; ++ public boolean collides = true; + // CraftBukkit end public void Q() { this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE); -@@ -88,7 +110,8 @@ +@@ -88,7 +111,8 @@ public EntityLiving(World world) { super(world); this.initAttributes(); @@ -46,7 +47,7 @@ this.i = true; this.aL = (float) ((Math.random() + 1.0D) * 0.009999999776482582D); this.setPosition(this.locX, this.locY, this.locZ); -@@ -125,7 +148,13 @@ +@@ -125,7 +149,13 @@ double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D); int i = (int) (150.0D * d1); @@ -61,7 +62,7 @@ } } -@@ -183,7 +212,11 @@ +@@ -183,7 +213,11 @@ this.stopRiding(); } } else { @@ -74,7 +75,7 @@ } if (!this.world.isClientSide) { -@@ -240,6 +273,18 @@ +@@ -240,6 +274,18 @@ this.world.methodProfiler.b(); } @@ -93,7 +94,7 @@ protected void b(BlockPosition blockposition) { int i = EnchantmentManager.a(Enchantments.j, this); -@@ -255,19 +300,19 @@ +@@ -255,19 +301,19 @@ protected void bC() { ++this.deathTicks; @@ -122,7 +123,7 @@ this.die(); -@@ -421,6 +466,17 @@ +@@ -421,6 +467,17 @@ } } @@ -140,7 +141,7 @@ if (nbttagcompound.hasKeyOfType("Health", 99)) { this.setHealth(nbttagcompound.getFloat("Health")); } -@@ -436,9 +492,15 @@ +@@ -436,9 +493,15 @@ } @@ -156,7 +157,7 @@ while (iterator.hasNext()) { MobEffectList mobeffectlist = (MobEffectList) iterator.next(); MobEffect mobeffect = (MobEffect) this.effects.get(mobeffectlist); -@@ -452,6 +514,16 @@ +@@ -452,6 +515,16 @@ this.a(mobeffect, false); } } @@ -173,7 +174,7 @@ if (this.updateEffects) { if (!this.world.isClientSide) { -@@ -548,6 +620,12 @@ +@@ -548,6 +621,12 @@ } public void addEffect(MobEffect mobeffect) { @@ -186,7 +187,7 @@ if (this.d(mobeffect)) { MobEffect mobeffect1 = (MobEffect) this.effects.get(mobeffect.getMobEffect()); -@@ -579,6 +657,12 @@ +@@ -579,6 +658,12 @@ } public MobEffect c(MobEffectList mobeffectlist) { @@ -199,7 +200,7 @@ return (MobEffect) this.effects.remove(mobeffectlist); } -@@ -618,20 +702,52 @@ +@@ -618,20 +703,52 @@ } @@ -253,7 +254,7 @@ this.datawatcher.set(EntityLiving.HEALTH, Float.valueOf(MathHelper.a(f, 0.0F, this.getMaxHealth()))); } -@@ -647,14 +763,16 @@ +@@ -647,14 +764,16 @@ } else if (damagesource.o() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) { return false; } else { @@ -272,7 +273,7 @@ this.k(f); if (damagesource.a()) { f = 0.0F; -@@ -673,19 +791,38 @@ +@@ -673,19 +792,38 @@ if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) { if (f <= this.lastDamage) { @@ -313,7 +314,7 @@ this.az = 0.0F; Entity entity = damagesource.getEntity(); -@@ -825,6 +962,12 @@ +@@ -825,6 +963,12 @@ boolean flag = this.lastDamageByPlayerTime > 0; this.a(flag, i, damagesource); @@ -326,7 +327,7 @@ } } -@@ -912,8 +1055,13 @@ +@@ -912,8 +1056,13 @@ int i = MathHelper.f((f - 3.0F - f2) * f1); if (i > 0) { @@ -341,7 +342,7 @@ int j = MathHelper.floor(this.locX); int k = MathHelper.floor(this.locY - 0.20000000298023224D); int l = MathHelper.floor(this.locZ); -@@ -940,20 +1088,20 @@ +@@ -940,20 +1089,20 @@ protected float applyArmorModifier(DamageSource damagesource, float f) { if (!damagesource.ignoresArmor()) { @@ -365,7 +366,7 @@ i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5; int j = 25 - i; float f1 = f * (float) j; -@@ -974,22 +1122,127 @@ +@@ -974,22 +1123,127 @@ } } @@ -503,7 +504,7 @@ } public CombatTracker getCombatTracker() { -@@ -1055,6 +1308,7 @@ +@@ -1055,6 +1309,7 @@ public AttributeMapBase getAttributeMap() { if (this.bp == null) { this.bp = new AttributeMapServer(); @@ -511,7 +512,7 @@ } return this.bp; -@@ -1329,6 +1583,7 @@ +@@ -1329,6 +1584,7 @@ } if (this.onGround && !this.world.isClientSide) { @@ -519,7 +520,7 @@ this.setFlag(7, false); } } else { -@@ -1689,6 +1944,7 @@ +@@ -1689,6 +1945,7 @@ } if (!this.world.isClientSide) { @@ -527,7 +528,7 @@ this.setFlag(7, flag); } -@@ -1702,6 +1958,13 @@ +@@ -1702,6 +1959,13 @@ if (!list.isEmpty()) { for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); @@ -541,7 +542,16 @@ this.C(entity); } -@@ -1918,7 +2181,22 @@ +@@ -1781,7 +2045,7 @@ + } + + public boolean isCollidable() { +- return !this.dead; ++ return !this.dead && this.collides; // CraftBukkit + } + + protected void ao() { +@@ -1918,7 +2182,22 @@ protected void v() { if (this.bm != null && this.cs()) { this.a(this.bm, 16); -- cgit v1.2.3