SPIGOT-2060: Method to control whether entities collide
Dieser Commit ist enthalten in:
Ursprung
1ea1adc10f
Commit
cd36f6f257
@ -22,7 +22,7 @@
|
|||||||
public abstract class EntityLiving extends Entity {
|
public abstract class EntityLiving extends Entity {
|
||||||
|
|
||||||
private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
|
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 bn;
|
||||||
protected int bo;
|
protected int bo;
|
||||||
private BlockPosition bC;
|
private BlockPosition bC;
|
||||||
@ -32,11 +32,12 @@
|
|||||||
+ boolean forceDrops;
|
+ boolean forceDrops;
|
||||||
+ ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
|
+ ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||||
+ public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
|
+ public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
|
||||||
|
+ public boolean collides = true;
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
|
|
||||||
public void Q() {
|
public void Q() {
|
||||||
this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
|
this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
|
||||||
@@ -88,7 +110,8 @@
|
@@ -88,7 +111,8 @@
|
||||||
public EntityLiving(World world) {
|
public EntityLiving(World world) {
|
||||||
super(world);
|
super(world);
|
||||||
this.initAttributes();
|
this.initAttributes();
|
||||||
@ -46,7 +47,7 @@
|
|||||||
this.i = true;
|
this.i = true;
|
||||||
this.aL = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
this.aL = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||||
this.setPosition(this.locX, this.locY, this.locZ);
|
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);
|
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||||
int i = (int) (150.0D * d1);
|
int i = (int) (150.0D * d1);
|
||||||
|
|
||||||
@ -61,7 +62,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +212,11 @@
|
@@ -183,7 +213,11 @@
|
||||||
this.stopRiding();
|
this.stopRiding();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -74,7 +75,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
@@ -240,6 +273,18 @@
|
@@ -240,6 +274,18 @@
|
||||||
this.world.methodProfiler.b();
|
this.world.methodProfiler.b();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +94,7 @@
|
|||||||
protected void b(BlockPosition blockposition) {
|
protected void b(BlockPosition blockposition) {
|
||||||
int i = EnchantmentManager.a(Enchantments.j, this);
|
int i = EnchantmentManager.a(Enchantments.j, this);
|
||||||
|
|
||||||
@@ -255,19 +300,19 @@
|
@@ -255,19 +301,19 @@
|
||||||
|
|
||||||
protected void bC() {
|
protected void bC() {
|
||||||
++this.deathTicks;
|
++this.deathTicks;
|
||||||
@ -122,7 +123,7 @@
|
|||||||
|
|
||||||
this.die();
|
this.die();
|
||||||
|
|
||||||
@@ -421,6 +466,17 @@
|
@@ -421,6 +467,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +141,7 @@
|
|||||||
if (nbttagcompound.hasKeyOfType("Health", 99)) {
|
if (nbttagcompound.hasKeyOfType("Health", 99)) {
|
||||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||||
}
|
}
|
||||||
@@ -436,9 +492,15 @@
|
@@ -436,9 +493,15 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +157,7 @@
|
|||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
||||||
MobEffect mobeffect = (MobEffect) this.effects.get(mobeffectlist);
|
MobEffect mobeffect = (MobEffect) this.effects.get(mobeffectlist);
|
||||||
@@ -452,6 +514,16 @@
|
@@ -452,6 +515,16 @@
|
||||||
this.a(mobeffect, false);
|
this.a(mobeffect, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +174,7 @@
|
|||||||
|
|
||||||
if (this.updateEffects) {
|
if (this.updateEffects) {
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
@@ -548,6 +620,12 @@
|
@@ -548,6 +621,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEffect(MobEffect mobeffect) {
|
public void addEffect(MobEffect mobeffect) {
|
||||||
@ -186,7 +187,7 @@
|
|||||||
if (this.d(mobeffect)) {
|
if (this.d(mobeffect)) {
|
||||||
MobEffect mobeffect1 = (MobEffect) this.effects.get(mobeffect.getMobEffect());
|
MobEffect mobeffect1 = (MobEffect) this.effects.get(mobeffect.getMobEffect());
|
||||||
|
|
||||||
@@ -579,6 +657,12 @@
|
@@ -579,6 +658,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
public MobEffect c(MobEffectList mobeffectlist) {
|
public MobEffect c(MobEffectList mobeffectlist) {
|
||||||
@ -199,7 +200,7 @@
|
|||||||
return (MobEffect) this.effects.remove(mobeffectlist);
|
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())));
|
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)) {
|
} else if (damagesource.o() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -272,7 +273,7 @@
|
|||||||
this.k(f);
|
this.k(f);
|
||||||
if (damagesource.a()) {
|
if (damagesource.a()) {
|
||||||
f = 0.0F;
|
f = 0.0F;
|
||||||
@@ -673,19 +791,38 @@
|
@@ -673,19 +792,38 @@
|
||||||
|
|
||||||
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
|
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
|
||||||
if (f <= this.lastDamage) {
|
if (f <= this.lastDamage) {
|
||||||
@ -313,7 +314,7 @@
|
|||||||
this.az = 0.0F;
|
this.az = 0.0F;
|
||||||
Entity entity = damagesource.getEntity();
|
Entity entity = damagesource.getEntity();
|
||||||
|
|
||||||
@@ -825,6 +962,12 @@
|
@@ -825,6 +963,12 @@
|
||||||
boolean flag = this.lastDamageByPlayerTime > 0;
|
boolean flag = this.lastDamageByPlayerTime > 0;
|
||||||
|
|
||||||
this.a(flag, i, damagesource);
|
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);
|
int i = MathHelper.f((f - 3.0F - f2) * f1);
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -341,7 +342,7 @@
|
|||||||
int j = MathHelper.floor(this.locX);
|
int j = MathHelper.floor(this.locX);
|
||||||
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
|
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
|
||||||
int l = MathHelper.floor(this.locZ);
|
int l = MathHelper.floor(this.locZ);
|
||||||
@@ -940,20 +1088,20 @@
|
@@ -940,20 +1089,20 @@
|
||||||
|
|
||||||
protected float applyArmorModifier(DamageSource damagesource, float f) {
|
protected float applyArmorModifier(DamageSource damagesource, float f) {
|
||||||
if (!damagesource.ignoresArmor()) {
|
if (!damagesource.ignoresArmor()) {
|
||||||
@ -365,7 +366,7 @@
|
|||||||
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
|
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
|
||||||
int j = 25 - i;
|
int j = 25 - i;
|
||||||
float f1 = f * (float) j;
|
float f1 = f * (float) j;
|
||||||
@@ -974,22 +1122,127 @@
|
@@ -974,22 +1123,127 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,7 +504,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CombatTracker getCombatTracker() {
|
public CombatTracker getCombatTracker() {
|
||||||
@@ -1055,6 +1308,7 @@
|
@@ -1055,6 +1309,7 @@
|
||||||
public AttributeMapBase getAttributeMap() {
|
public AttributeMapBase getAttributeMap() {
|
||||||
if (this.bp == null) {
|
if (this.bp == null) {
|
||||||
this.bp = new AttributeMapServer();
|
this.bp = new AttributeMapServer();
|
||||||
@ -511,7 +512,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.bp;
|
return this.bp;
|
||||||
@@ -1329,6 +1583,7 @@
|
@@ -1329,6 +1584,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.onGround && !this.world.isClientSide) {
|
if (this.onGround && !this.world.isClientSide) {
|
||||||
@ -519,7 +520,7 @@
|
|||||||
this.setFlag(7, false);
|
this.setFlag(7, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1689,6 +1944,7 @@
|
@@ -1689,6 +1945,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.world.isClientSide) {
|
if (!this.world.isClientSide) {
|
||||||
@ -527,7 +528,7 @@
|
|||||||
this.setFlag(7, flag);
|
this.setFlag(7, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1702,6 +1958,13 @@
|
@@ -1702,6 +1959,13 @@
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
for (int i = 0; i < list.size(); ++i) {
|
for (int i = 0; i < list.size(); ++i) {
|
||||||
Entity entity = (Entity) list.get(i);
|
Entity entity = (Entity) list.get(i);
|
||||||
@ -541,7 +542,16 @@
|
|||||||
|
|
||||||
this.C(entity);
|
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() {
|
protected void v() {
|
||||||
if (this.bm != null && this.cs()) {
|
if (this.bm != null && this.cs()) {
|
||||||
this.a(this.bm, 16);
|
this.a(this.bm, 16);
|
||||||
|
@ -540,4 +540,14 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|||||||
public boolean hasAI() {
|
public boolean hasAI() {
|
||||||
return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).cR() : false; // PAIL: rename
|
return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).cR() : false; // PAIL: rename
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCollidable(boolean collidable) {
|
||||||
|
getHandle().collides = collidable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCollidable() {
|
||||||
|
return getHandle().collides;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren