From 7814f6c819be2f335fc1fcc0e110d612063ef34c Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Tue, 5 Dec 2023 15:32:41 -0700 Subject: [PATCH] patches up to anti x ray --- ...d-option-to-disable-pillager-patrols.patch | 0 ...Chunks-from-Hoppers-and-other-things.patch | 2 +- .../Dont-send-unnecessary-sign-update.patch | 0 .../Duplicate-UUID-Resolve-Option.patch | 0 .../server/Entity-Activation-Range-2.0.patch | 6 ++-- .../server/Fix-MC-158900.patch | 0 .../Fix-items-not-falling-correctly.patch | 0 ...x-items-vanishing-through-end-portal.patch | 2 +- ...k-in-stack-not-having-effects-when-d.patch | 0 .../Flat-bedrock-generator-settings.patch | 0 ...rializing-mismatching-chunk-coordina.patch | 0 ...lement-alternative-item-despawn-rate.patch | 0 ...5656-Fix-Follow-Range-Initial-Target.patch | 0 ...ptimise-EntityGetter-getPlayerByUUID.patch | 0 ...mize-call-to-getFluid-for-explosions.patch | 0 ...layerDeathEvent-shouldDropExperience.patch | 0 ...oading-chunks-checking-hive-position.patch | 0 ...revent-consuming-the-wrong-itemstack.patch | 0 ...nk-loads-when-villagers-try-to-find-.patch | 0 .../server/Tracking-Range-Improvements.patch | 0 ...ement-optional-per-player-mob-spawns.patch | 35 ++++++++++--------- 21 files changed, 23 insertions(+), 22 deletions(-) rename patches/{unapplied => }/server/Add-option-to-disable-pillager-patrols.patch (100%) rename patches/{unapplied => }/server/Don-t-load-Chunks-from-Hoppers-and-other-things.patch (95%) rename patches/{unapplied => }/server/Dont-send-unnecessary-sign-update.patch (100%) rename patches/{unapplied => }/server/Duplicate-UUID-Resolve-Option.patch (100%) rename patches/{unapplied => }/server/Entity-Activation-Range-2.0.patch (99%) rename patches/{unapplied => }/server/Fix-MC-158900.patch (100%) rename patches/{unapplied => }/server/Fix-items-not-falling-correctly.patch (100%) rename patches/{unapplied => }/server/Fix-items-vanishing-through-end-portal.patch (97%) rename patches/{unapplied => }/server/Fix-last-firework-in-stack-not-having-effects-when-d.patch (100%) rename patches/{unapplied => }/server/Flat-bedrock-generator-settings.patch (100%) rename patches/{unapplied => }/server/Guard-against-serializing-mismatching-chunk-coordina.patch (100%) rename patches/{unapplied => }/server/Implement-alternative-item-despawn-rate.patch (100%) rename patches/{unapplied => }/server/MC-145656-Fix-Follow-Range-Initial-Target.patch (100%) rename patches/{unapplied => }/server/Optimise-EntityGetter-getPlayerByUUID.patch (100%) rename patches/{unapplied => }/server/Optimize-call-to-getFluid-for-explosions.patch (100%) rename patches/{unapplied => }/server/PlayerDeathEvent-shouldDropExperience.patch (100%) rename patches/{unapplied => }/server/Prevent-bees-loading-chunks-checking-hive-position.patch (100%) rename patches/{unapplied => }/server/Prevent-consuming-the-wrong-itemstack.patch (100%) rename patches/{unapplied => }/server/Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch (100%) rename patches/{unapplied => }/server/Tracking-Range-Improvements.patch (100%) rename patches/{unapplied => }/server/implement-optional-per-player-mob-spawns.patch (89%) diff --git a/patches/unapplied/server/Add-option-to-disable-pillager-patrols.patch b/patches/server/Add-option-to-disable-pillager-patrols.patch similarity index 100% rename from patches/unapplied/server/Add-option-to-disable-pillager-patrols.patch rename to patches/server/Add-option-to-disable-pillager-patrols.patch diff --git a/patches/unapplied/server/Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/patches/server/Don-t-load-Chunks-from-Hoppers-and-other-things.patch similarity index 95% rename from patches/unapplied/server/Don-t-load-Chunks-from-Hoppers-and-other-things.patch rename to patches/server/Don-t-load-Chunks-from-Hoppers-and-other-things.patch index c5b316e61c..74a793ce71 100644 --- a/patches/unapplied/server/Don-t-load-Chunks-from-Hoppers-and-other-things.patch +++ b/patches/server/Don-t-load-Chunks-from-Hoppers-and-other-things.patch @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class DoubleBlockCombiner { return new DoubleBlockCombiner.NeighborCombineResult.Single<>(blockEntity); } else { - BlockPos blockPos = pos.relative(function.apply(state)); + BlockPos blockPos = pos.relative(directionMapper.apply(state)); - BlockState blockState = world.getBlockState(blockPos); + // Paper start + BlockState blockState = world.getBlockStateIfLoaded(blockPos); diff --git a/patches/unapplied/server/Dont-send-unnecessary-sign-update.patch b/patches/server/Dont-send-unnecessary-sign-update.patch similarity index 100% rename from patches/unapplied/server/Dont-send-unnecessary-sign-update.patch rename to patches/server/Dont-send-unnecessary-sign-update.patch diff --git a/patches/unapplied/server/Duplicate-UUID-Resolve-Option.patch b/patches/server/Duplicate-UUID-Resolve-Option.patch similarity index 100% rename from patches/unapplied/server/Duplicate-UUID-Resolve-Option.patch rename to patches/server/Duplicate-UUID-Resolve-Option.patch diff --git a/patches/unapplied/server/Entity-Activation-Range-2.0.patch b/patches/server/Entity-Activation-Range-2.0.patch similarity index 99% rename from patches/unapplied/server/Entity-Activation-Range-2.0.patch rename to patches/server/Entity-Activation-Range-2.0.patch index b08bc1377b..889eb0a6aa 100644 --- a/patches/unapplied/server/Entity-Activation-Range-2.0.patch +++ b/patches/server/Entity-Activation-Range-2.0.patch @@ -115,7 +115,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S public void inactiveTick() { } // Spigot end // Paper start @@ -124,7 +124,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected int numCollisions = 0; // Paper public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @javax.annotation.Nullable -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S } else { this.wasOnFire = this.isOnFire(); if (movementType == MoverType.PISTON) { @@ -133,7 +133,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 movement = this.limitPistonMovement(movement); if (movement.equals(Vec3.ZERO)) { return; -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S this.stuckSpeedMultiplier = Vec3.ZERO; this.setDeltaMovement(Vec3.ZERO); } diff --git a/patches/unapplied/server/Fix-MC-158900.patch b/patches/server/Fix-MC-158900.patch similarity index 100% rename from patches/unapplied/server/Fix-MC-158900.patch rename to patches/server/Fix-MC-158900.patch diff --git a/patches/unapplied/server/Fix-items-not-falling-correctly.patch b/patches/server/Fix-items-not-falling-correctly.patch similarity index 100% rename from patches/unapplied/server/Fix-items-not-falling-correctly.patch rename to patches/server/Fix-items-not-falling-correctly.patch diff --git a/patches/unapplied/server/Fix-items-vanishing-through-end-portal.patch b/patches/server/Fix-items-vanishing-through-end-portal.patch similarity index 97% rename from patches/unapplied/server/Fix-items-vanishing-through-end-portal.patch rename to patches/server/Fix-items-vanishing-through-end-portal.patch index 611a12ea9c..c9fd72509d 100644 --- a/patches/unapplied/server/Fix-items-vanishing-through-end-portal.patch +++ b/patches/server/Fix-items-vanishing-through-end-portal.patch @@ -16,7 +16,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S if (flag1) { blockposition1 = ServerLevel.END_SPAWN_POINT; } else { diff --git a/patches/unapplied/server/Fix-last-firework-in-stack-not-having-effects-when-d.patch b/patches/server/Fix-last-firework-in-stack-not-having-effects-when-d.patch similarity index 100% rename from patches/unapplied/server/Fix-last-firework-in-stack-not-having-effects-when-d.patch rename to patches/server/Fix-last-firework-in-stack-not-having-effects-when-d.patch diff --git a/patches/unapplied/server/Flat-bedrock-generator-settings.patch b/patches/server/Flat-bedrock-generator-settings.patch similarity index 100% rename from patches/unapplied/server/Flat-bedrock-generator-settings.patch rename to patches/server/Flat-bedrock-generator-settings.patch diff --git a/patches/unapplied/server/Guard-against-serializing-mismatching-chunk-coordina.patch b/patches/server/Guard-against-serializing-mismatching-chunk-coordina.patch similarity index 100% rename from patches/unapplied/server/Guard-against-serializing-mismatching-chunk-coordina.patch rename to patches/server/Guard-against-serializing-mismatching-chunk-coordina.patch diff --git a/patches/unapplied/server/Implement-alternative-item-despawn-rate.patch b/patches/server/Implement-alternative-item-despawn-rate.patch similarity index 100% rename from patches/unapplied/server/Implement-alternative-item-despawn-rate.patch rename to patches/server/Implement-alternative-item-despawn-rate.patch diff --git a/patches/unapplied/server/MC-145656-Fix-Follow-Range-Initial-Target.patch b/patches/server/MC-145656-Fix-Follow-Range-Initial-Target.patch similarity index 100% rename from patches/unapplied/server/MC-145656-Fix-Follow-Range-Initial-Target.patch rename to patches/server/MC-145656-Fix-Follow-Range-Initial-Target.patch diff --git a/patches/unapplied/server/Optimise-EntityGetter-getPlayerByUUID.patch b/patches/server/Optimise-EntityGetter-getPlayerByUUID.patch similarity index 100% rename from patches/unapplied/server/Optimise-EntityGetter-getPlayerByUUID.patch rename to patches/server/Optimise-EntityGetter-getPlayerByUUID.patch diff --git a/patches/unapplied/server/Optimize-call-to-getFluid-for-explosions.patch b/patches/server/Optimize-call-to-getFluid-for-explosions.patch similarity index 100% rename from patches/unapplied/server/Optimize-call-to-getFluid-for-explosions.patch rename to patches/server/Optimize-call-to-getFluid-for-explosions.patch diff --git a/patches/unapplied/server/PlayerDeathEvent-shouldDropExperience.patch b/patches/server/PlayerDeathEvent-shouldDropExperience.patch similarity index 100% rename from patches/unapplied/server/PlayerDeathEvent-shouldDropExperience.patch rename to patches/server/PlayerDeathEvent-shouldDropExperience.patch diff --git a/patches/unapplied/server/Prevent-bees-loading-chunks-checking-hive-position.patch b/patches/server/Prevent-bees-loading-chunks-checking-hive-position.patch similarity index 100% rename from patches/unapplied/server/Prevent-bees-loading-chunks-checking-hive-position.patch rename to patches/server/Prevent-bees-loading-chunks-checking-hive-position.patch diff --git a/patches/unapplied/server/Prevent-consuming-the-wrong-itemstack.patch b/patches/server/Prevent-consuming-the-wrong-itemstack.patch similarity index 100% rename from patches/unapplied/server/Prevent-consuming-the-wrong-itemstack.patch rename to patches/server/Prevent-consuming-the-wrong-itemstack.patch diff --git a/patches/unapplied/server/Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/patches/server/Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch similarity index 100% rename from patches/unapplied/server/Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch rename to patches/server/Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch diff --git a/patches/unapplied/server/Tracking-Range-Improvements.patch b/patches/server/Tracking-Range-Improvements.patch similarity index 100% rename from patches/unapplied/server/Tracking-Range-Improvements.patch rename to patches/server/Tracking-Range-Improvements.patch diff --git a/patches/unapplied/server/implement-optional-per-player-mob-spawns.patch b/patches/server/implement-optional-per-player-mob-spawns.patch similarity index 89% rename from patches/unapplied/server/implement-optional-per-player-mob-spawns.patch rename to patches/server/implement-optional-per-player-mob-spawns.patch index d1d4f6a11f..69b6a318b8 100644 --- a/patches/unapplied/server/implement-optional-per-player-mob-spawns.patch +++ b/patches/server/implement-optional-per-player-mob-spawns.patch @@ -43,25 +43,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java @@ -0,0 +0,0 @@ public class ServerChunkCache extends ChunkSource { - gameprofilerfiller.push("naturalSpawnCount"); - this.level.timings.countNaturalMobs.startTiming(); // Paper - timings - int l = this.distanceManager.getNaturalSpawnChunkCount(); -- NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap)); -+ // Paper start - per player mob spawning -+ NaturalSpawner.SpawnState spawnercreature_d; // moved down -+ if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled -+ // re-set mob counts -+ for (ServerPlayer player : this.level.players) { -+ Arrays.fill(player.mobCounts, 0); + gameprofilerfiller.popPush("naturalSpawnCount"); + this.level.timings.countNaturalMobs.startTiming(); // Paper - timings + int k = this.distanceManager.getNaturalSpawnChunkCount(); +- NaturalSpawner.SpawnState spawnercreature_d = NaturalSpawner.createState(k, this.level.getAllEntities(), this::getFullChunk, new LocalMobCapCalculator(this.chunkMap)); ++ // Paper start - per player mob spawning ++ int naturalSpawnChunkCount = k; ++ NaturalSpawner.SpawnState spawnercreature_d; // moved down ++ if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled ++ // re-set mob counts ++ for (ServerPlayer player : this.level.players) { ++ Arrays.fill(player.mobCounts, 0); ++ } ++ spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true); ++ } else { ++ spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); + } -+ spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, null, true); -+ } else { -+ spawnercreature_d = NaturalSpawner.createState(l, this.level.getAllEntities(), this::getFullChunk, !this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new LocalMobCapCalculator(this.chunkMap) : null, false); -+ } -+ // Paper end - this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings ++ // Paper end + this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings - this.lastSpawnState = spawnercreature_d; + this.lastSpawnState = spawnercreature_d; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java