summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2018-09-15 15:20:20 +1000
committermd_5 <git@md-5.net>2018-09-15 15:25:27 +1000
commitbf1c82731c020d62302a71d07f8b27c8639eb686 (patch)
tree9e7891c6d322373f18b0eda966d467b79216aa9f /nms-patches
parent1cead6280f702aabc1c38f67477876981a583363 (diff)
downloadcraftbukkit-bf1c82731c020d62302a71d07f8b27c8639eb686.tar
craftbukkit-bf1c82731c020d62302a71d07f8b27c8639eb686.tar.gz
craftbukkit-bf1c82731c020d62302a71d07f8b27c8639eb686.tar.lz
craftbukkit-bf1c82731c020d62302a71d07f8b27c8639eb686.tar.xz
craftbukkit-bf1c82731c020d62302a71d07f8b27c8639eb686.zip
SPIGOT-4370: Remove vehicle if its passenger spawn event was cancelled
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/World.patch69
1 files changed, 29 insertions, 40 deletions
diff --git a/nms-patches/World.patch b/nms-patches/World.patch
index 78569d8c..02f82ee7 100644
--- a/nms-patches/World.patch
+++ b/nms-patches/World.patch
@@ -296,7 +296,7 @@
if (k(blockposition)) {
return Blocks.VOID_AIR.getBlockData();
} else {
-@@ -649,6 +854,42 @@
+@@ -649,6 +854,49 @@
}
public boolean addEntity(Entity entity) {
@@ -331,6 +331,13 @@
+ }
+
+ if (event != null && (event.isCancelled() || entity.dead)) {
++ Entity vehicle = entity.getVehicle();
++ if (vehicle != null) {
++ vehicle.dead = true;
++ }
++ for (Entity passenger : entity.bQ()) {
++ passenger.dead = true;
++ }
+ entity.dead = true;
+ return false;
+ }
@@ -339,7 +346,7 @@
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
boolean flag = entity.attachedToPlayer;
-@@ -679,6 +920,7 @@
+@@ -679,6 +927,7 @@
((IWorldAccess) this.v.get(i)).a(entity);
}
@@ -347,7 +354,7 @@
}
protected void c(Entity entity) {
-@@ -686,6 +928,7 @@
+@@ -686,6 +935,7 @@
((IWorldAccess) this.v.get(i)).b(entity);
}
@@ -355,7 +362,7 @@
}
public void kill(Entity entity) {
-@@ -721,7 +964,15 @@
+@@ -721,7 +971,15 @@
this.getChunkAt(i, j).b(entity);
}
@@ -372,7 +379,7 @@
this.c(entity);
}
-@@ -756,6 +1007,11 @@
+@@ -756,6 +1014,11 @@
for (i = 0; i < this.k.size(); ++i) {
entity = (Entity) this.k.get(i);
@@ -384,7 +391,7 @@
try {
++entity.ticksLived;
-@@ -804,8 +1060,10 @@
+@@ -804,8 +1067,10 @@
CrashReportSystemDetails crashreportsystemdetails1;
CrashReport crashreport1;
@@ -397,7 +404,7 @@
Entity entity1 = entity.getVehicle();
if (entity1 != null) {
-@@ -838,7 +1096,7 @@
+@@ -838,7 +1103,7 @@
this.getChunkAt(j, l).b(entity);
}
@@ -406,7 +413,7 @@
this.c(entity);
}
-@@ -893,9 +1151,11 @@
+@@ -893,9 +1158,11 @@
TileEntity tileentity1 = (TileEntity) this.c.get(i1);
if (!tileentity1.x()) {
@@ -418,7 +425,7 @@
if (this.isLoaded(tileentity1.getPosition())) {
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
-@@ -903,6 +1163,12 @@
+@@ -903,6 +1170,12 @@
chunk.a(tileentity1.getPosition(), tileentity1);
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
@@ -431,7 +438,7 @@
}
}
}
-@@ -956,15 +1222,13 @@
+@@ -956,15 +1229,13 @@
int i;
int j;
@@ -453,7 +460,7 @@
entity.N = entity.locX;
entity.O = entity.locY;
-@@ -980,6 +1244,7 @@
+@@ -980,6 +1251,7 @@
return IRegistry.ENTITY_TYPE.getKey(entity.P()).toString();
});
entity.tick();
@@ -461,7 +468,7 @@
this.methodProfiler.e();
}
}
-@@ -1310,11 +1575,18 @@
+@@ -1310,11 +1582,18 @@
}
}
@@ -480,7 +487,7 @@
TileEntity tileentity = null;
if (this.J) {
-@@ -1349,6 +1621,14 @@
+@@ -1349,6 +1628,14 @@
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
if (!k(blockposition)) {
if (tileentity != null && !tileentity.x()) {
@@ -495,7 +502,7 @@
if (this.J) {
tileentity.setPosition(blockposition);
Iterator iterator = this.c.iterator();
-@@ -1509,6 +1789,14 @@
+@@ -1509,6 +1796,14 @@
}
this.p = MathHelper.a(this.p, 0.0F, 1.0F);
@@ -510,7 +517,7 @@
}
}
}
-@@ -1594,7 +1882,10 @@
+@@ -1594,7 +1889,10 @@
}
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
@@ -522,7 +529,7 @@
return false;
} else {
int i = 0;
-@@ -1737,7 +2028,7 @@
+@@ -1737,7 +2035,7 @@
}
public Stream<VoxelShape> a(@Nullable Entity entity, VoxelShape voxelshape, VoxelShape voxelshape1, Set<Entity> set) {
@@ -531,7 +538,7 @@
return entity == null ? stream : Stream.concat(stream, this.a(entity, voxelshape, set));
}
-@@ -1767,7 +2058,7 @@
+@@ -1767,7 +2065,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -540,7 +547,7 @@
arraylist.add(entity);
}
}
-@@ -1782,7 +2073,7 @@
+@@ -1782,7 +2080,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -549,7 +556,7 @@
arraylist.add(entity);
}
}
-@@ -1831,7 +2122,7 @@
+@@ -1831,7 +2129,7 @@
}
}
@@ -558,25 +565,7 @@
}
@Nullable
-@@ -1852,8 +2143,16 @@
-
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
-+ // CraftBukkit start - Split out persistent check, don't apply it to special persistent mobs
-+ if (entity instanceof EntityInsentient) {
-+ EntityInsentient entityinsentient = (EntityInsentient) entity;
-+ if (entityinsentient.isTypeNotPersistent() && entityinsentient.isPersistent()) {
-+ continue;
-+ }
-+ }
-
-- if (!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) {
-+ if (true || !(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) {
-+ // CraftBukkit end
- if (oclass.isAssignableFrom(entity.getClass())) {
- ++j;
- }
-@@ -1972,6 +2271,11 @@
+@@ -1972,6 +2270,11 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@@ -588,7 +577,7 @@
if (predicate.test(entityhuman1)) {
double d5 = entityhuman1.d(d0, d1, d2);
-@@ -2164,6 +2468,16 @@
+@@ -2164,6 +2467,16 @@
public void everyoneSleeping() {}
@@ -605,7 +594,7 @@
public float g(float f) {
return (this.q + (this.r - this.q) * f) * this.i(f);
}
-@@ -2325,7 +2639,7 @@
+@@ -2325,7 +2638,7 @@
int l = j * 16 + 8 - blockposition.getZ();
boolean flag = true;