aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/util/SpawnUtil.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/util/SpawnUtil.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/util/SpawnUtil.java.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/util/SpawnUtil.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/util/SpawnUtil.java.patch
new file mode 100644
index 0000000000..1dd16178a2
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/util/SpawnUtil.java.patch
@@ -0,0 +1,42 @@
+--- a/net/minecraft/util/SpawnUtil.java
++++ b/net/minecraft/util/SpawnUtil.java
+@@ -20,16 +18,29 @@
+ ) {
+ BlockPos.MutableBlockPos mutableBlockPos = pos.mutable();
+
+- for (int i1 = 0; i1 < attempts; i1++) {
+- int i2 = Mth.randomBetweenInclusive(level.random, -i, i);
+- int i3 = Mth.randomBetweenInclusive(level.random, -i, i);
+- mutableBlockPos.setWithOffset(pos, i2, yOffset, i3);
+- if (level.getWorldBorder().isWithinBounds(mutableBlockPos) && moveToPossibleSpawnPosition(level, yOffset, mutableBlockPos, strategy)) {
+- T mob = (T)entityType.create(level, null, null, mutableBlockPos, spawnType, false, false);
+- if (mob != null) {
+- if (mob.checkSpawnRules(level, spawnType) && mob.checkSpawnObstruction(level)) {
+- level.addFreshEntityWithPassengers(mob);
+- return Optional.of(mob);
++ public SpawnUtil() {}
++
++ public static <T extends Mob> Optional<T> trySpawnMob(EntityType<T> entityType, EnumMobSpawn spawnType, ServerLevel level, BlockPos pos, int attempts, int j, int yOffset, SpawnUtil.Strategy strategy) {
++ // CraftBukkit start
++ return trySpawnMob(entityType, spawnType, level, pos, attempts, j, yOffset, strategy, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
++ }
++
++ public static <T extends Mob> Optional<T> trySpawnMob(EntityType<T> entitytypes, EnumMobSpawn enummobspawn, ServerLevel worldserver, BlockPos blockposition, int i, int j, int k, SpawnUtil.Strategy spawnutil_a, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
++ // CraftBukkit end
++ BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable();
++
++ for (int l = 0; l < i; ++l) {
++ int i1 = Mth.randomBetweenInclusive(worldserver.random, -j, j);
++ int j1 = Mth.randomBetweenInclusive(worldserver.random, -j, j);
++
++ blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1);
++ if (worldserver.getWorldBorder().isWithinBounds((BlockPos) blockposition_mutableblockposition) && moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) {
++ T t0 = entitytypes.create(worldserver, (CompoundTag) null, null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error
++
++ if (t0 != null) {
++ if (t0.checkSpawnRules(worldserver, enummobspawn) && t0.checkSpawnObstruction(worldserver)) {
++ worldserver.addFreshEntityWithPassengers(t0, reason); // CraftBukkit
++ return Optional.of(t0);
+ }
+
+ mob.discard();