From cc3b3eba502268dd3f5a3b44c3266a3a52f15ee7 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 23 Nov 2021 21:44:21 -0800 Subject: [PATCH] a bunch more patches --- build-data/mappings-patch.tiny | 6 - build-data/reobf-mappings-patch.tiny | 6 + ...d-option-to-disable-pillager-patrols.patch | 4 +- ...gurable-projectile-relative-velocity.patch | 10 +- .../Dont-send-unnecessary-sign-update.patch | 0 .../Duplicate-UUID-Resolve-Option.patch | 16 +- ...or-when-player-hand-set-to-empty-typ.patch | 0 .../server/Fix-MC-158900.patch | 0 ...5656-Fix-Follow-Range-Initial-Target.patch | 2 +- ...al-Spawned-mobs-towards-natural-spaw.patch | 2 +- .../server/Optimize-Hoppers.patch | 8 +- ...revent-consuming-the-wrong-itemstack.patch | 23 +-- ...nk-loads-when-villagers-try-to-find-.patch | 0 ...ate-location-if-we-failed-to-read-it.patch | 0 .../server/offset-item-frame-ticking.patch | 0 ...if-we-have-a-custom-Bukkit-generator.patch | 42 ----- patches/unapplied/server/Fix-MC-161754.patch | 23 --- ...-sneak-when-changing-worlds-MC-10657.patch | 32 ---- .../unapplied/server/Generator-Settings.patch | 155 ------------------ 19 files changed, 35 insertions(+), 294 deletions(-) rename patches/{unapplied => }/server/Add-option-to-disable-pillager-patrols.patch (90%) rename patches/{unapplied => }/server/Configurable-projectile-relative-velocity.patch (85%) rename patches/{unapplied => }/server/Dont-send-unnecessary-sign-update.patch (100%) rename patches/{unapplied => }/server/Duplicate-UUID-Resolve-Option.patch (88%) rename patches/{unapplied => }/server/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch (100%) rename patches/{unapplied => }/server/Fix-MC-158900.patch (100%) rename patches/{unapplied => }/server/MC-145656-Fix-Follow-Range-Initial-Target.patch (98%) rename patches/{unapplied => }/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch (94%) rename patches/{unapplied => }/server/Optimize-Hoppers.patch (98%) rename patches/{unapplied => }/server/Prevent-consuming-the-wrong-itemstack.patch (68%) rename patches/{unapplied => }/server/Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch (100%) rename patches/{unapplied => }/server/Show-blockstate-location-if-we-failed-to-read-it.patch (100%) rename patches/{unapplied => }/server/offset-item-frame-ticking.patch (100%) delete mode 100644 patches/unapplied/server/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch delete mode 100644 patches/unapplied/server/Fix-MC-161754.patch delete mode 100644 patches/unapplied/server/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch delete mode 100644 patches/unapplied/server/Generator-Settings.patch diff --git a/build-data/mappings-patch.tiny b/build-data/mappings-patch.tiny index 642acc411c..a8d8c189af 100644 --- a/build-data/mappings-patch.tiny +++ b/build-data/mappings-patch.tiny @@ -5,9 +5,3 @@ tiny 2 0 spigot mojang+yarn # Originally DistanceManager, which also implements DistanceManager, so clashes since the implemented class # is imported and not fully qualified. Easiest fix is to just change the name c net/minecraft/server/level/PlayerChunkMap$a net/minecraft/server/level/ChunkMap$ChunkDistanceManager - -# We add the getLevel method back to Hopper since mojang removed it - we need the method for hooper optimization -# We add the method with this name to match the mojmap method of the same name in BlockEntity -# Since we add the method we need to add the mapping for it so reobf works as expected -#c net/minecraft/world/level/block/entity/IHopper net/minecraft/world/level/block/entity/Hopper -# m ()Lnet/minecraft/world/level/World; getWorld getLevel diff --git a/build-data/reobf-mappings-patch.tiny b/build-data/reobf-mappings-patch.tiny index 050623a519..9064425df0 100644 --- a/build-data/reobf-mappings-patch.tiny +++ b/build-data/reobf-mappings-patch.tiny @@ -24,3 +24,9 @@ tiny 2 0 mojang+yarn spigot # Paper changes type #c net/minecraft/core/MappedRegistry net/minecraft/core/RegistryMaterials # f Lit/unimi/dsi/fastutil/objects/Reference2IntOpenHashMap; toId bw + +# We add the getLevel method back to Hopper since mojang removed it - we need the method for hopper optimization +# We add the method with this name to match the mojmap method of the same name in BlockEntity +# Since we add the method we need to add the mapping for it so reobf works as expected +c net/minecraft/world/level/block/entity/Hopper net/minecraft/world/level/block/entity/IHopper + m ()Lnet/minecraft/world/level/Level; getLevel k 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 90% rename from patches/unapplied/server/Add-option-to-disable-pillager-patrols.patch rename to patches/server/Add-option-to-disable-pillager-patrols.patch index 8b10a00df6..5352553667 100644 --- a/patches/unapplied/server/Add-option-to-disable-pillager-patrols.patch +++ b/patches/server/Add-option-to-disable-pillager-patrols.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - private void generatorSettings() { - generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false); + private void disableRelativeProjectileVelocity() { + disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false); } + + public boolean disablePillagerPatrols = false; diff --git a/patches/unapplied/server/Configurable-projectile-relative-velocity.patch b/patches/server/Configurable-projectile-relative-velocity.patch similarity index 85% rename from patches/unapplied/server/Configurable-projectile-relative-velocity.patch rename to patches/server/Configurable-projectile-relative-velocity.patch index 73a7dffd47..2b3d960cdf 100644 --- a/patches/unapplied/server/Configurable-projectile-relative-velocity.patch +++ b/patches/server/Configurable-projectile-relative-velocity.patch @@ -4,7 +4,7 @@ Date: Tue, 23 Jul 2019 20:29:20 -0500 Subject: [PATCH] Configurable projectile relative velocity This patch adds an option "disable relative projectile velocity", which, when -nabled, will cause projectiles to ignore the shooter's current velocity, +enabled, will cause projectiles to ignore the shooter's current velocity, like they did in Minecraft 1.8 and prior. If a player is falling, for example, their shooting range will be drastically reduced, as a downwards velocity is applied to the projectile. This prevents @@ -44,11 +44,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -0,0 +0,0 @@ public abstract class Projectile extends Entity { - this.shoot((double) f5, (double) f6, (double) f7, modifierZ, modifierXYZ); - Vec3 vec3d = user.getDeltaMovement(); + this.shoot((double) f5, (double) f6, (double) f7, speed, divergence); + Vec3 vec3d = shooter.getDeltaMovement(); -- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, user.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); -+ if (!user.level.paperConfig.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, user.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity +- this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); ++ if (!shooter.level.paperConfig.disableRelativeProjectileVelocity) this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, shooter.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity } // CraftBukkit start - call projectile hit event 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 88% rename from patches/unapplied/server/Duplicate-UUID-Resolve-Option.patch rename to patches/server/Duplicate-UUID-Resolve-Option.patch index 25d5d7e6f1..f469223aa9 100644 --- a/patches/unapplied/server/Duplicate-UUID-Resolve-Option.patch +++ b/patches/server/Duplicate-UUID-Resolve-Option.patch @@ -92,11 +92,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import co.aikar.timings.Timing; // Paper +import com.destroystokyo.paper.PaperWorldConfig; // Paper import com.google.common.collect.ImmutableList; + import com.google.common.collect.ImmutableList.Builder; import com.google.common.collect.Iterables; - import com.google.common.collect.ComparisonChain; // Paper -@@ -0,0 +0,0 @@ import java.io.File; - import java.io.IOException; +@@ -0,0 +0,0 @@ import java.io.IOException; import java.io.Writer; + import java.nio.file.Path; import java.util.BitSet; +import java.util.HashMap; // Paper +import java.util.Collection; @@ -116,7 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity.discard(); needsRemoval = true; } -+ checkDupeUUID(worldserver, entity); // Paper ++ checkDupeUUID(world, entity); // Paper return !needsRemoval; })); // CraftBukkit end @@ -138,7 +138,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + && Objects.equals(other.getEncodeId(), entity.getEncodeId()) + && entity.getBukkitEntity().getLocation().distance(other.getBukkitEntity().getLocation()) < level.paperConfig.duplicateUUIDDeleteRange + ) { -+ if (Level.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (ServerLevel.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + " because it was near the duplicate and likely an actual duplicate. See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + entity.discard(); + return; + } @@ -146,16 +146,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + switch (mode) { + case SAFE_REGEN: { + entity.setUUID(UUID.randomUUID()); -+ if (Level.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (ServerLevel.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", regenerated UUID for " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + break; + } + case DELETE: { -+ if (Level.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (ServerLevel.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", deleted entity " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + entity.discard(); + break; + } + default: -+ if (Level.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); ++ if (ServerLevel.DEBUG_ENTITIES) LOGGER.warn("[DUPE-UUID] Duplicate UUID found used by " + other + ", doing nothing to " + entity + ". See https://github.com/PaperMC/Paper/issues/1223 for discussion on what this is about."); + break; + } + } diff --git a/patches/unapplied/server/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch b/patches/server/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch similarity index 100% rename from patches/unapplied/server/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch rename to patches/server/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch 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/MC-145656-Fix-Follow-Range-Initial-Target.patch b/patches/server/MC-145656-Fix-Follow-Range-Initial-Target.patch similarity index 98% 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 index ba80ddca14..ff089066b2 100644 --- a/patches/unapplied/server/MC-145656-Fix-Follow-Range-Initial-Target.patch +++ b/patches/server/MC-145656-Fix-Follow-Range-Initial-Target.patch @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/NearestAttackableTargetGoal.java @@ -0,0 +0,0 @@ public class NearestAttackableTargetGoal extends TargetG - this.randomInterval = reciprocalChance; + this.randomInterval = reducedTickDelay(reciprocalChance); this.setFlags(EnumSet.of(Goal.Flag.TARGET)); this.targetConditions = TargetingConditions.forCombat().range(this.getFollowDistance()).selector(targetPredicate); + if (mob.level.paperConfig.entitiesTargetWithFollowRange) this.targetConditions.useFollowRange(); // Paper diff --git a/patches/unapplied/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/patches/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch similarity index 94% rename from patches/unapplied/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch rename to patches/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index 149610d8a3..058d0dbd43 100644 --- a/patches/unapplied/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/patches/server/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -52,5 +52,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end BlockPos blockposition = entity.blockPosition(); - long j = ChunkPos.asLong(SectionPos.blockToSectionCoord(blockposition.getX()), SectionPos.blockToSectionCoord(blockposition.getZ())); + chunkSource.query(ChunkPos.asLong(blockposition), (chunk) -> { diff --git a/patches/unapplied/server/Optimize-Hoppers.patch b/patches/server/Optimize-Hoppers.patch similarity index 98% rename from patches/unapplied/server/Optimize-Hoppers.patch rename to patches/server/Optimize-Hoppers.patch index b4e48ec529..26234bdac2 100644 --- a/patches/unapplied/server/Optimize-Hoppers.patch +++ b/patches/server/Optimize-Hoppers.patch @@ -88,7 +88,7 @@ diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -0,0 +0,0 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { +@@ -0,0 +0,0 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject { getMinecraftKey(); // Try to load if it doesn't exists. return tileEntityKeyString; } @@ -96,7 +96,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end @Nullable -@@ -0,0 +0,0 @@ public abstract class BlockEntity implements net.minecraft.server.KeyedObject { +@@ -0,0 +0,0 @@ public abstract class BlockEntity implements io.papermc.paper.util.KeyedObject { public void setChanged() { if (this.level != null) { @@ -297,7 +297,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - private static boolean a(Level world, BlockPos blockposition, BlockState iblockdata, Container iinventory, HopperBlockEntity hopper) { // CraftBukkit + private static boolean ejectItems(Level world, BlockPos blockposition, BlockState iblockdata, Container iinventory, HopperBlockEntity hopper) { // CraftBukkit Container iinventory1 = HopperBlockEntity.getAttachedContainer(world, blockposition, iblockdata); @@ -0,0 +0,0 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen if (HopperBlockEntity.isFullContainer(iinventory1, enumdirection)) { @@ -407,7 +407,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (!itemstack.isEmpty() && HopperBlockEntity.canTakeItemFromContainer(iinventory, itemstack, i, enumdirection)) { // If this logic changes, update above. this is left inused incase reflective plugins + return hopperPull(ihopper, iinventory, itemstack, i); /* // Paper - disable rest ItemStack itemstack1 = itemstack.copy(); - // ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.splitStack(i, 1), (EnumDirection) null); + // ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.removeItem(i, 1), (EnumDirection) null); // CraftBukkit start - Call event on collection of items from inventories into the hopper @@ -0,0 +0,0 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen } diff --git a/patches/unapplied/server/Prevent-consuming-the-wrong-itemstack.patch b/patches/server/Prevent-consuming-the-wrong-itemstack.patch similarity index 68% rename from patches/unapplied/server/Prevent-consuming-the-wrong-itemstack.patch rename to patches/server/Prevent-consuming-the-wrong-itemstack.patch index 08666eaec6..981783a2f9 100644 --- a/patches/unapplied/server/Prevent-consuming-the-wrong-itemstack.patch +++ b/patches/server/Prevent-consuming-the-wrong-itemstack.patch @@ -9,33 +9,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { - this.entityData.set(LivingEntity.DATA_LIVING_ENTITY_FLAGS, (byte) j); } -- public void startUsingItem(InteractionHand hand) { -- ItemStack itemstack = this.getItemInHand(hand); -+ // Paper start -- OBFHELPER and forwarder to method with forceUpdate parameter -+ public void startUsingItem(InteractionHand hand) { this.updateActiveItem(hand, false); } -+ public void updateActiveItem(InteractionHand enumhand, boolean forceUpdate) { -+ // Paper end -+ ItemStack itemstack = this.getItemInHand(enumhand); + public void startUsingItem(InteractionHand hand) { ++ // Paper start - forwarder to method with forceUpdate parameter ++ this.startUsingItem(hand, false); ++ } ++ public void startUsingItem(InteractionHand hand, boolean forceUpdate) { ++ // Paper end + ItemStack itemstack = this.getItemInHand(hand); - if (!itemstack.isEmpty() && !this.isUsingItem()) { + if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag this.useItem = itemstack; this.useItemRemaining = itemstack.getUseDuration(); if (!this.level.isClientSide) { - this.setLivingEntityFlag(1, true); -- this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND); -+ this.setLivingEntityFlag(2, enumhand == InteractionHand.OFF_HAND); - } - - } @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { this.releaseUsingItem(); } else { if (!this.useItem.isEmpty() && this.isUsingItem()) { -+ this.updateActiveItem(this.getUsedItemHand(), true); // Paper ++ this.startUsingItem(this.getUsedItemHand(), true); // Paper this.triggerItemUseEffects(this.useItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; 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/Show-blockstate-location-if-we-failed-to-read-it.patch b/patches/server/Show-blockstate-location-if-we-failed-to-read-it.patch similarity index 100% rename from patches/unapplied/server/Show-blockstate-location-if-we-failed-to-read-it.patch rename to patches/server/Show-blockstate-location-if-we-failed-to-read-it.patch diff --git a/patches/unapplied/server/offset-item-frame-ticking.patch b/patches/server/offset-item-frame-ticking.patch similarity index 100% rename from patches/unapplied/server/offset-item-frame-ticking.patch rename to patches/server/offset-item-frame-ticking.patch diff --git a/patches/unapplied/server/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch b/patches/unapplied/server/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch deleted file mode 100644 index 58b532937e..0000000000 --- a/patches/unapplied/server/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Paul Sauve -Date: Sun, 14 Jul 2019 21:05:03 -0500 -Subject: [PATCH] Do less work if we have a custom Bukkit generator - -If the Bukkit generator already has a spawn, use it immediately instead -of spending time generating one that we won't use - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -- return biomebase.getMobSettings().playerSpawnFriendly(); -- }, random); -- ChunkPos chunkcoordintpair = blockposition == null ? new ChunkPos(0, 0) : new ChunkPos(blockposition); -+ // Paper start - moved down - // CraftBukkit start - if (world.generator != null) { - Random rand = new Random(world.getSeed()); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -+ return biomebase.getMobSettings().playerSpawnFriendly(); -+ }, random); -+ ChunkPos chunkcoordintpair = blockposition == null ? new ChunkPos(0, 0) : new ChunkPos(blockposition); -+ // Paper end - - if (blockposition == null) { - MinecraftServer.LOGGER.warn("Unable to find spawn biome"); diff --git a/patches/unapplied/server/Fix-MC-161754.patch b/patches/unapplied/server/Fix-MC-161754.patch deleted file mode 100644 index 277fd81264..0000000000 --- a/patches/unapplied/server/Fix-MC-161754.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Tue, 24 Sep 2019 16:03:00 -0700 -Subject: [PATCH] Fix MC-161754 - -Fixes https://github.com/PaperMC/Paper/issues/2580 - -We can use an entity valid check since this method is invoked for -each inventory iteraction (thanks to CB) and on player tick (vanilla). - -diff --git a/src/main/java/net/minecraft/world/inventory/HorseInventoryMenu.java b/src/main/java/net/minecraft/world/inventory/HorseInventoryMenu.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/inventory/HorseInventoryMenu.java -+++ b/src/main/java/net/minecraft/world/inventory/HorseInventoryMenu.java -@@ -0,0 +0,0 @@ public class HorseInventoryMenu extends AbstractContainerMenu { - - @Override - public boolean stillValid(Player player) { -- return !this.horse.hasInventoryChanged(this.horseContainer) && this.horseContainer.stillValid(player) && this.horse.isAlive() && this.horse.distanceTo((Entity) player) < 8.0F; -+ return !this.horse.hasInventoryChanged(this.horseContainer) && this.horseContainer.stillValid(player) && (this.horse.isAlive() && this.horse.valid) && this.horse.distanceTo((Entity) player) < 8.0F; // Paper - Fix MC-161754 - } - - private boolean hasChest(AbstractHorse horse) { diff --git a/patches/unapplied/server/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch b/patches/unapplied/server/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch deleted file mode 100644 index 1f2351fb8b..0000000000 --- a/patches/unapplied/server/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: William Blake Galbreath -Date: Wed, 9 Oct 2019 21:51:43 -0500 -Subject: [PATCH] Fix stuck in sneak when changing worlds (MC-10657) - - -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 -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { - this.lastSentHealth = -1.0F; - this.lastSentFood = -1; - -+ setShiftKeyDown(false); // Paper - fix MC-10657 -+ - // CraftBukkit start - PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); - this.level.getCraftServer().getPluginManager().callEvent(changeEvent); -diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/players/PlayerList.java -+++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -0,0 +0,0 @@ public abstract class PlayerList { - entityplayer.connection.send(new ClientboundUpdateMobEffectPacket(entityplayer.getId(), mobEffect)); - } - -+ entityplayer.setShiftKeyDown(false); // Paper - fix MC-10657 -+ - // Fire advancement trigger - entityplayer.triggerDimensionChangeTriggers(((CraftWorld) fromWorld).getHandle()); - diff --git a/patches/unapplied/server/Generator-Settings.patch b/patches/unapplied/server/Generator-Settings.patch deleted file mode 100644 index e50598426d..0000000000 --- a/patches/unapplied/server/Generator-Settings.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Wed, 2 Mar 2016 02:17:54 -0600 -Subject: [PATCH] Generator Settings - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - private void disableRelativeProjectileVelocity() { - disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false); - } -+ -+ public boolean generateFlatBedrock; -+ private void generatorSettings() { -+ generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false); -+ } - } - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - } - - this.markPositionReplaceable(pos); -- return Either.left(new ProtoChunk(pos, UpgradeData.EMPTY, this.level)); -+ return Either.left(new ProtoChunk(pos, UpgradeData.EMPTY, this.level, this.level)); // Paper - add level - // Paper start - Async chunk io - }; - CompletableFuture> ret = new CompletableFuture<>(); -diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -0,0 +0,0 @@ public interface ChunkAccess extends BlockGetter, FeatureAccess { - return GameEventDispatcher.NOOP; - } - -+ // Paper start -+ default boolean generateFlatBedrock() { -+ if (this.getLevel() != null) { -+ return this.getLevel().paperConfig.generateFlatBedrock; -+ } -+ return false; -+ } -+ -+ net.minecraft.world.level.Level getLevel(); -+ // Paper end -+ - BlockState getType(final int x, final int y, final int z); // Paper - @Nullable - BlockState setBlockState(BlockPos pos, BlockState state, boolean moved); -diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -@@ -0,0 +0,0 @@ public class ImposterProtoChunk extends ProtoChunk { - private final LevelChunk wrapped; - - public ImposterProtoChunk(LevelChunk wrapped) { -- super(wrapped.getPos(), UpgradeData.EMPTY, wrapped); -+ super(wrapped.getPos(), UpgradeData.EMPTY, wrapped, wrapped.level); // Paper - add level - this.wrapped = wrapped; - } - -diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -+++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -0,0 +0,0 @@ public class ProtoChunk implements ChunkAccess { - private long inhabitedTime; - private final Map carvingMasks = new Object2ObjectArrayMap<>(); - private volatile boolean isLightCorrect; -+ // Paper start - Add level -+ final net.minecraft.world.level.Level level; -+ @Override -+ public net.minecraft.world.level.Level getLevel() { -+ return this.level; -+ } -+ // Paper end -+ private static boolean PRINTED_OUTDATED_CTOR_MSG = false; // Paper - Add level - -+ @Deprecated // Paper start - add level - public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor world) { -+ // Paper start -+ this(pos, upgradeData, world, null); -+ if (!PRINTED_OUTDATED_CTOR_MSG) { -+ new IllegalArgumentException("Must use ProtoChunk constructor with the ServerLevel parameter").printStackTrace(); -+ PRINTED_OUTDATED_CTOR_MSG = true; -+ } -+ } -+ public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor world, net.minecraft.server.level.ServerLevel level) { -+ // Paper end - this(pos, upgradeData, (LevelChunkSection[])null, new ProtoTickList<>((block) -> { - return block == null || block.defaultBlockState().isAir(); - }, pos, world), new ProtoTickList<>((fluid) -> { - return fluid == null || fluid == Fluids.EMPTY; -- }, pos, world), world); -+ }, pos, world), world, level); // Paper - add level - } - -+ @Deprecated // Paper start - add level - public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, @Nullable LevelChunkSection[] levelChunkSections, ProtoTickList blockTickScheduler, ProtoTickList fluidTickScheduler, LevelHeightAccessor world) { -+ // Paper start -+ this(pos, upgradeData, levelChunkSections, blockTickScheduler, fluidTickScheduler, world, null); -+ if (!PRINTED_OUTDATED_CTOR_MSG) { -+ new IllegalArgumentException("Must use ProtoChunk constructor with the ServerLevel parameter").printStackTrace(); -+ PRINTED_OUTDATED_CTOR_MSG = true; -+ } -+ } -+ public ProtoChunk(ChunkPos pos, UpgradeData upgradeData, @Nullable LevelChunkSection[] levelChunkSections, ProtoTickList blockTickScheduler, ProtoTickList fluidTickScheduler, LevelHeightAccessor world, net.minecraft.server.level.ServerLevel level) { -+ this.level = level; -+ // Paper end - this.chunkPos = pos; - this.upgradeData = upgradeData; - this.blockTicks = blockTickScheduler; -diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -0,0 +0,0 @@ public class ChunkSerializer { - // CraftBukkit end - }); - } else { -- ProtoChunk protochunk = new ProtoChunk(pos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world); -+ ProtoChunk protochunk = new ProtoChunk(pos, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, world, world); // Paper - add level - - protochunk.setBiomes(biomestorage); - object = protochunk; -diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -@@ -0,0 +0,0 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { - - if (flag1) { - for (l1 = 0; l1 < 5; ++l1) { -- if (l1 <= random.nextInt(5)) { -+ if (l1 <= (chunk.generateFlatBedrock() ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock roof - chunk.setBlockState(blockposition_mutableblockposition.set(blockposition.getX(), i1 - l1, blockposition.getZ()), Blocks.BEDROCK.defaultBlockState(), false); - } - } -@@ -0,0 +0,0 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { - - if (flag2) { - for (l1 = 4; l1 >= 0; --l1) { -- if (l1 <= random.nextInt(5)) { -+ if (l1 <= (chunk.generateFlatBedrock() ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock floor{ - chunk.setBlockState(blockposition_mutableblockposition.set(blockposition.getX(), l + l1, blockposition.getZ()), Blocks.BEDROCK.defaultBlockState(), false); - } - }