summaryrefslogtreecommitdiffstats
path: root/nms-patches/World.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/World.patch')
-rw-r--r--nms-patches/World.patch81
1 files changed, 24 insertions, 57 deletions
diff --git a/nms-patches/World.patch b/nms-patches/World.patch
index 19dc116c..8d5309bb 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,49 @@
+@@ -649,6 +854,16 @@
}
public boolean addEntity(Entity entity) {
@@ -305,40 +305,7 @@
+ }
+
+ public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason
-+ if (entity == null) return false;
-+
-+ org.bukkit.event.Cancellable event = null;
-+ if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) {
-+ boolean isAnimal = entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal || entity instanceof EntityGolem;
-+ boolean isMonster = entity instanceof EntityMonster || entity instanceof EntityGhast || entity instanceof EntitySlime;
-+ boolean isNpc = entity instanceof NPC;
-+
-+ if (spawnReason != SpawnReason.CUSTOM) {
-+ if (isAnimal && !allowAnimals || isMonster && !allowMonsters || isNpc && !getServer().getServer().getSpawnNPCs()) {
-+ entity.dead = true;
-+ return false;
-+ }
-+ }
-+
-+ event = CraftEventFactory.callCreatureSpawnEvent((EntityLiving) entity, spawnReason);
-+ } else if (entity instanceof EntityItem) {
-+ event = CraftEventFactory.callItemSpawnEvent((EntityItem) entity);
-+ } else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Projectile) {
-+ // Not all projectiles extend EntityProjectile, so check for Bukkit interface instead
-+ event = CraftEventFactory.callProjectileLaunchEvent(entity);
-+ } else if (entity.getBukkitEntity() instanceof org.bukkit.entity.Vehicle){
-+ event = CraftEventFactory.callVehicleCreateEvent(entity);
-+ }
-+
-+ if (event != null && (event.isCancelled() || entity.dead)) {
-+ Entity vehicle = entity.getVehicle();
-+ if (vehicle != null) {
-+ vehicle.dead = true;
-+ }
-+ for (Entity passenger : entity.getAllPassengers()) {
-+ passenger.dead = true;
-+ }
-+ entity.dead = true;
++ if (!CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
+ return false;
+ }
+ // CraftBukkit end
@@ -346,7 +313,7 @@
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
boolean flag = entity.attachedToPlayer;
-@@ -679,6 +927,7 @@
+@@ -679,6 +894,7 @@
((IWorldAccess) this.v.get(i)).a(entity);
}
@@ -354,7 +321,7 @@
}
protected void c(Entity entity) {
-@@ -686,6 +935,7 @@
+@@ -686,6 +902,7 @@
((IWorldAccess) this.v.get(i)).b(entity);
}
@@ -362,7 +329,7 @@
}
public void kill(Entity entity) {
-@@ -721,7 +971,15 @@
+@@ -721,7 +938,15 @@
this.getChunkAt(i, j).b(entity);
}
@@ -379,7 +346,7 @@
this.c(entity);
}
-@@ -756,6 +1014,11 @@
+@@ -756,6 +981,11 @@
for (i = 0; i < this.k.size(); ++i) {
entity = (Entity) this.k.get(i);
@@ -391,7 +358,7 @@
try {
++entity.ticksLived;
-@@ -804,8 +1067,10 @@
+@@ -804,8 +1034,10 @@
CrashReport crashreport1;
CrashReportSystemDetails crashreportsystemdetails1;
@@ -404,7 +371,7 @@
Entity entity1 = entity.getVehicle();
if (entity1 != null) {
-@@ -838,7 +1103,7 @@
+@@ -838,7 +1070,7 @@
this.getChunkAt(j, l).b(entity);
}
@@ -413,7 +380,7 @@
this.c(entity);
}
-@@ -893,9 +1158,11 @@
+@@ -893,9 +1125,11 @@
TileEntity tileentity1 = (TileEntity) this.c.get(i1);
if (!tileentity1.x()) {
@@ -425,7 +392,7 @@
if (this.isLoaded(tileentity1.getPosition())) {
Chunk chunk = this.getChunkAtWorldCoords(tileentity1.getPosition());
-@@ -903,6 +1170,12 @@
+@@ -903,6 +1137,12 @@
chunk.a(tileentity1.getPosition(), tileentity1);
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
@@ -438,7 +405,7 @@
}
}
}
-@@ -956,15 +1229,13 @@
+@@ -956,15 +1196,13 @@
int i;
int j;
@@ -460,7 +427,7 @@
entity.N = entity.locX;
entity.O = entity.locY;
-@@ -980,6 +1251,7 @@
+@@ -980,6 +1218,7 @@
return IRegistry.ENTITY_TYPE.getKey(entity.P()).toString();
});
entity.tick();
@@ -468,7 +435,7 @@
this.methodProfiler.exit();
}
}
-@@ -1310,11 +1582,18 @@
+@@ -1310,11 +1549,18 @@
}
}
@@ -487,7 +454,7 @@
TileEntity tileentity = null;
if (this.J) {
-@@ -1349,6 +1628,14 @@
+@@ -1349,6 +1595,14 @@
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
if (!k(blockposition)) {
if (tileentity != null && !tileentity.x()) {
@@ -502,7 +469,7 @@
if (this.J) {
tileentity.setPosition(blockposition);
Iterator iterator = this.c.iterator();
-@@ -1509,6 +1796,14 @@
+@@ -1509,6 +1763,14 @@
}
this.p = MathHelper.a(this.p, 0.0F, 1.0F);
@@ -517,7 +484,7 @@
}
}
}
-@@ -1594,7 +1889,10 @@
+@@ -1594,7 +1856,10 @@
}
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
@@ -529,7 +496,7 @@
return false;
} else {
int i = 0;
-@@ -1737,7 +2035,7 @@
+@@ -1737,7 +2002,7 @@
}
public Stream<VoxelShape> a(@Nullable Entity entity, VoxelShape voxelshape, VoxelShape voxelshape1, Set<Entity> set) {
@@ -538,7 +505,7 @@
return entity == null ? stream : Stream.concat(stream, this.a(entity, voxelshape, set));
}
-@@ -1767,7 +2065,7 @@
+@@ -1767,7 +2032,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -547,7 +514,7 @@
arraylist.add(entity);
}
}
-@@ -1782,7 +2080,7 @@
+@@ -1782,7 +2047,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -556,7 +523,7 @@
arraylist.add(entity);
}
}
-@@ -1831,7 +2129,7 @@
+@@ -1831,7 +2096,7 @@
}
}
@@ -565,7 +532,7 @@
}
@Nullable
-@@ -1852,8 +2150,16 @@
+@@ -1852,8 +2117,16 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@@ -583,7 +550,7 @@
if (oclass.isAssignableFrom(entity.getClass())) {
++j;
}
-@@ -1972,6 +2278,11 @@
+@@ -1972,6 +2245,11 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@@ -595,7 +562,7 @@
if (predicate.test(entityhuman1)) {
double d5 = entityhuman1.d(d0, d1, d2);
-@@ -2185,6 +2496,16 @@
+@@ -2185,6 +2463,16 @@
public void everyoneSleeping() {}
@@ -612,7 +579,7 @@
public float g(float f) {
return (this.q + (this.r - this.q) * f) * this.i(f);
}
-@@ -2346,7 +2667,7 @@
+@@ -2346,7 +2634,7 @@
int l = j * 16 + 8 - blockposition.getZ();
boolean flag = true;