diff options
author | Jake Potrebic <[email protected]> | 2023-08-13 17:41:18 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2023-08-15 10:04:27 -0700 |
commit | 496156e2eff4ec5a47aaf174cb1a04fd90612fde (patch) | |
tree | 87ddd26d4ed12c8bd8ad3723a70062b69c47110c /patches/server/0172-PreCreatureSpawnEvent.patch | |
parent | 6dc8e30c9275f7a172025b053d4970d1795c6104 (diff) | |
download | Paper-experimental.tar.gz Paper-experimental.zip |
Update with latest upstream changesexperimental
Diffstat (limited to 'patches/server/0172-PreCreatureSpawnEvent.patch')
-rw-r--r-- | patches/server/0172-PreCreatureSpawnEvent.patch | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/patches/server/0172-PreCreatureSpawnEvent.patch b/patches/server/0172-PreCreatureSpawnEvent.patch index 4da8e04bb8..4646aa1ae5 100644 --- a/patches/server/0172-PreCreatureSpawnEvent.patch +++ b/patches/server/0172-PreCreatureSpawnEvent.patch @@ -15,7 +15,7 @@ instead and save a lot of server resources. See: https://github.com/PaperMC/Paper/issues/917 diff --git a/src/main/java/net/minecraft/util/SpawnUtil.java b/src/main/java/net/minecraft/util/SpawnUtil.java -index b77ebe04f1018962b85110258c8a0a2db8612485..028d69907a988e191213a17e072ef22710b5bc83 100644 +index b77ebe04f1018962b85110258c8a0a2db8612485..cde7244f64697e6fdc27a02937f89667ff0e609e 100644 --- a/src/main/java/net/minecraft/util/SpawnUtil.java +++ b/src/main/java/net/minecraft/util/SpawnUtil.java @@ -22,10 +22,10 @@ public class SpawnUtil { @@ -31,13 +31,12 @@ index b77ebe04f1018962b85110258c8a0a2db8612485..028d69907a988e191213a17e072ef227 // CraftBukkit end BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable(); -@@ -35,6 +35,26 @@ public class SpawnUtil { +@@ -35,6 +35,25 @@ public class SpawnUtil { blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1); if (worldserver.getWorldBorder().isWithinBounds((BlockPos) blockposition_mutableblockposition) && SpawnUtil.moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) { + // Paper start -+ String key = EntityType.getKey(entitytypes).getPath(); -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); ++ org.bukkit.entity.EntityType<?> type = org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(entitytypes); + + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; + event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( @@ -59,7 +58,7 @@ index b77ebe04f1018962b85110258c8a0a2db8612485..028d69907a988e191213a17e072ef227 if (t0 != null) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index 93a43ef867d0961b46f9ecadc2c7be6a4b17c72b..c2aafe4e1afec2793735bf7b0bbd6af94ad393f8 100644 +index 93a43ef867d0961b46f9ecadc2c7be6a4b17c72b..539ad181edd4a9ef231cf9110cbb1140b06f8e67 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -413,6 +413,20 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT @@ -67,7 +66,7 @@ index 93a43ef867d0961b46f9ecadc2c7be6a4b17c72b..c2aafe4e1afec2793735bf7b0bbd6af9 public T spawn(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Consumer<T> consumer, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { // CraftBukkit end + // Paper start - Call PreCreatureSpawnEvent -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityType.getKey(this).getPath()); ++ org.bukkit.entity.EntityType<?> type = org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(this); + if (type != null) { + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; + event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( @@ -97,18 +96,15 @@ index 68594d2621267f4b112b4d14d2bec3a0dd6a044a..73a5750dd47cf8869070f92594cfb926 } } diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index 20c39481bcf05e0d43c97b7e841ec9f5f6a0d45d..fc7719d12b5f6011aec2e41a36b4bacd77672b6d 100644 +index 20c39481bcf05e0d43c97b7e841ec9f5f6a0d45d..a53b16b7bc640acfc2c8a5a86ad177d9c076d7b3 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java -@@ -128,6 +128,27 @@ public abstract class BaseSpawner { +@@ -128,6 +128,24 @@ public abstract class BaseSpawner { } else if (!SpawnPlacements.checkSpawnRules((EntityType) optional.get(), world, MobSpawnType.SPAWNER, blockposition1, world.getRandom())) { continue; } + // Paper start -+ EntityType<?> entityType = optional.get(); -+ String key = EntityType.getKey(entityType).getPath(); -+ -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); ++ org.bukkit.entity.EntityType<?> type = org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(optional.get()); + if (type != null) { + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; + event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( @@ -129,7 +125,7 @@ index 20c39481bcf05e0d43c97b7e841ec9f5f6a0d45d..fc7719d12b5f6011aec2e41a36b4bacd Entity entity = EntityType.loadEntityRecursive(nbttagcompound, world, (entity1) -> { entity1.moveTo(d0, d1, d2, entity1.getYRot(), entity1.getXRot()); diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java -index b2bb9bbd3af414c50ec3f8e3e171a679e95ef75e..5338e0e1a67925da0c386735a545bb31096afbb1 100644 +index b2bb9bbd3af414c50ec3f8e3e171a679e95ef75e..44cf7eb6458f5ee9ae55dee479d7847d451d85d1 100644 --- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java +++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java @@ -213,7 +213,13 @@ public final class NaturalSpawner { @@ -157,7 +153,7 @@ index b2bb9bbd3af414c50ec3f8e3e171a679e95ef75e..5338e0e1a67925da0c386735a545bb31 + // Paper start + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityType.getKey(entitytypes).getPath()); ++ org.bukkit.entity.EntityType<?> type = org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(entitytypes); + if (type != null) { + event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( + io.papermc.paper.util.MCUtil.toLocation(world, pos), |