From fc5c0dae7f3f44ef8d78cd85eb51731c3c520efc Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:59:51 -0700 Subject: [PATCH] 683 --- ...674-Reset-placed-block-on-exception.patch} | 7 ++-- ...configurable-height-for-slime-spawn.patch} | 6 ++-- ...0676-Fix-xp-reward-for-baby-zombies.patch} | 4 +-- ...lti-Block-Change-API-Implementation.patch} | 12 +++---- .../0678-Fix-NotePlayEvent.patch} | 12 +++---- .../0679-Freeze-Tick-Lock-API.patch} | 16 ++++----- .../0680-More-PotionEffectType-API.patch} | 4 +-- ...for-StructureTemplate.Pallete-cache.patch} | 4 +-- ...command-sender-which-forwards-feedb.patch} | 4 +-- ...-missing-structure-set-seed-configs.patch} | 33 ++++++++++++------- 10 files changed, 56 insertions(+), 46 deletions(-) rename patches/{unapplied/server/0701-Reset-placed-block-on-exception.patch => server/0674-Reset-placed-block-on-exception.patch} (88%) rename patches/{unapplied/server/0702-Add-configurable-height-for-slime-spawn.patch => server/0675-Add-configurable-height-for-slime-spawn.patch} (92%) rename patches/{unapplied/server/0703-Fix-xp-reward-for-baby-zombies.patch => server/0676-Fix-xp-reward-for-baby-zombies.patch} (89%) rename patches/{unapplied/server/0704-Multi-Block-Change-API-Implementation.patch => server/0677-Multi-Block-Change-API-Implementation.patch} (88%) rename patches/{unapplied/server/0705-Fix-NotePlayEvent.patch => server/0678-Fix-NotePlayEvent.patch} (87%) rename patches/{unapplied/server/0706-Freeze-Tick-Lock-API.patch => server/0679-Freeze-Tick-Lock-API.patch} (81%) rename patches/{unapplied/server/0707-More-PotionEffectType-API.patch => server/0680-More-PotionEffectType-API.patch} (96%) rename patches/{unapplied/server/0708-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch => server/0681-Use-a-CHM-for-StructureTemplate.Pallete-cache.patch} (89%) rename patches/{unapplied/server/0709-API-for-creating-command-sender-which-forwards-feedb.patch => server/0682-API-for-creating-command-sender-which-forwards-feedb.patch} (97%) rename patches/{unapplied/server/0710-Add-missing-structure-set-seed-configs.patch => server/0683-Add-missing-structure-set-seed-configs.patch} (92%) diff --git a/patches/unapplied/server/0701-Reset-placed-block-on-exception.patch b/patches/server/0674-Reset-placed-block-on-exception.patch similarity index 88% rename from patches/unapplied/server/0701-Reset-placed-block-on-exception.patch rename to patches/server/0674-Reset-placed-block-on-exception.patch index b6bf08780c..c5b6f9f135 100644 --- a/patches/unapplied/server/0701-Reset-placed-block-on-exception.patch +++ b/patches/server/0674-Reset-placed-block-on-exception.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reset placed block on exception diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java -index c19069f65a9ecbc9000ea4333417a2df4ace1007..1ac739c92031e80c35e1af4417e6358346079580 100644 +index cee3f1200af602b5dfd0b27d05eb01826c5bbb1d..7d76cdc59984b156628273c8357485eb10046007 100644 --- a/src/main/java/net/minecraft/world/item/BlockItem.java +++ b/src/main/java/net/minecraft/world/item/BlockItem.java -@@ -80,6 +80,7 @@ public class BlockItem extends Item { +@@ -77,6 +77,7 @@ public class BlockItem extends Item { if (this instanceof PlaceOnWaterBlockItem || this instanceof SolidBucketItem) { blockstate = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); } @@ -16,13 +16,14 @@ index c19069f65a9ecbc9000ea4333417a2df4ace1007..1ac739c92031e80c35e1af4417e63583 // CraftBukkit end if (iblockdata == null) { -@@ -95,7 +96,19 @@ public class BlockItem extends Item { +@@ -92,8 +93,20 @@ public class BlockItem extends Item { if (iblockdata1.is(iblockdata.getBlock())) { iblockdata1 = this.updateBlockStateFromTag(blockposition, world, itemstack, iblockdata1); + // Paper start - Reset placed block on exception + try { this.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata1); + BlockItem.updateBlockEntityComponents(world, blockposition, itemstack); + } catch (Exception e) { + oldBlockstate.update(true, false); + if (entityhuman instanceof ServerPlayer player) { diff --git a/patches/unapplied/server/0702-Add-configurable-height-for-slime-spawn.patch b/patches/server/0675-Add-configurable-height-for-slime-spawn.patch similarity index 92% rename from patches/unapplied/server/0702-Add-configurable-height-for-slime-spawn.patch rename to patches/server/0675-Add-configurable-height-for-slime-spawn.patch index 08dbacd3f1..04458eb176 100644 --- a/patches/unapplied/server/0702-Add-configurable-height-for-slime-spawn.patch +++ b/patches/server/0675-Add-configurable-height-for-slime-spawn.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add configurable height for slime spawn diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index 0b8bcf9fc13ec6645c9e11cf52047272cdfce68c..3d9107d2c19a09215445aa0e0aacc32f9f82a536 100644 +index b32213c5a3a1ecaf602cf34bed44c537521c2846..f223e78eb1204bbf5f2de38a7ce5b663800f7dc4 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java -@@ -344,7 +344,11 @@ public class Slime extends Mob implements Enemy { +@@ -340,7 +340,11 @@ public class Slime extends Mob implements Enemy { return checkMobSpawnRules(type, world, spawnReason, pos, random); } @@ -21,7 +21,7 @@ index 0b8bcf9fc13ec6645c9e11cf52047272cdfce68c..3d9107d2c19a09215445aa0e0aacc32f return checkMobSpawnRules(type, world, spawnReason, pos, random); } -@@ -355,7 +359,10 @@ public class Slime extends Mob implements Enemy { +@@ -351,7 +355,10 @@ public class Slime extends Mob implements Enemy { ChunkPos chunkcoordintpair = new ChunkPos(pos); boolean flag = world.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper diff --git a/patches/unapplied/server/0703-Fix-xp-reward-for-baby-zombies.patch b/patches/server/0676-Fix-xp-reward-for-baby-zombies.patch similarity index 89% rename from patches/unapplied/server/0703-Fix-xp-reward-for-baby-zombies.patch rename to patches/server/0676-Fix-xp-reward-for-baby-zombies.patch index f3c6e8841b..bd691e7ae9 100644 --- a/patches/unapplied/server/0703-Fix-xp-reward-for-baby-zombies.patch +++ b/patches/server/0676-Fix-xp-reward-for-baby-zombies.patch @@ -9,10 +9,10 @@ so this resets it after each call to Zombie#getExperienceReward diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index a41a2ffe3b0af5c244a513c839829da3f86e5ed3..5c40e994007dbf46ebc12c1e6a6ca90379471b74 100644 +index e4fc7f96aac9cc2ed5b4158b6663de397ee1162f..d22464521f41c6a13d6c33f0a361497a3e04197f 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -175,11 +175,16 @@ public class Zombie extends Monster { +@@ -172,11 +172,16 @@ public class Zombie extends Monster { @Override public int getExperienceReward() { diff --git a/patches/unapplied/server/0704-Multi-Block-Change-API-Implementation.patch b/patches/server/0677-Multi-Block-Change-API-Implementation.patch similarity index 88% rename from patches/unapplied/server/0704-Multi-Block-Change-API-Implementation.patch rename to patches/server/0677-Multi-Block-Change-API-Implementation.patch index e9e18ae9c7..e8074defa0 100644 --- a/patches/unapplied/server/0704-Multi-Block-Change-API-Implementation.patch +++ b/patches/server/0677-Multi-Block-Change-API-Implementation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Multi Block Change API Implementation diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java -index f96d61bdeb556665d6e6e5023f9d77fd82204e89..ccdc2345465313991f065e1176b58fb7d5e8722f 100644 +index 926ff9be3d9e3f5d620e4c7ccb22b9f64865ff8c..1a37654aff9a9c86c9f7af10a1cf721371f0c5ec 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java -@@ -59,6 +59,14 @@ public class ClientboundSectionBlocksUpdatePacket implements Packet blocks; diff --git a/patches/unapplied/server/0709-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/server/0682-API-for-creating-command-sender-which-forwards-feedb.patch similarity index 97% rename from patches/unapplied/server/0709-API-for-creating-command-sender-which-forwards-feedb.patch rename to patches/server/0682-API-for-creating-command-sender-which-forwards-feedb.patch index cceecc25ea..3d56f3f0f1 100644 --- a/patches/unapplied/server/0709-API-for-creating-command-sender-which-forwards-feedb.patch +++ b/patches/server/0682-API-for-creating-command-sender-which-forwards-feedb.patch @@ -122,10 +122,10 @@ index 0000000000000000000000000000000000000000..e3a5f1ec376319bdfda87fa27ae217bf + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b3e1f987d31ef5a8f90bc366e248de86e93b9634..76b9f6c0c754be69c1369aa3c13f7ca1f56e9e13 100644 +index 6348f452a437c10f8291148e9bd4642b5fb09ec2..ab031edcac3865b85637cc9d5b8a939acdc904e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2117,6 +2117,13 @@ public final class CraftServer implements Server { +@@ -2129,6 +2129,13 @@ public final class CraftServer implements Server { return this.console.console; } diff --git a/patches/unapplied/server/0710-Add-missing-structure-set-seed-configs.patch b/patches/server/0683-Add-missing-structure-set-seed-configs.patch similarity index 92% rename from patches/unapplied/server/0710-Add-missing-structure-set-seed-configs.patch rename to patches/server/0683-Add-missing-structure-set-seed-configs.patch index 0cc4a490fe..3118eb5fb7 100644 --- a/patches/unapplied/server/0710-Add-missing-structure-set-seed-configs.patch +++ b/patches/server/0683-Add-missing-structure-set-seed-configs.patch @@ -20,10 +20,10 @@ seeds/salts to the frequency reducer which has a similar effect. Co-authored-by: William Blake Galbreath diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index d09d5192f0a571e9758e95dd5e1392a9caa88bde..a7ac9a0c4966c2f9d2b325fa59e8792850d376e8 100644 +index 748caca458eb4eec6ece22d8362e36de252f07dd..c4972e5767488878f7929226258c41c1cc30a47f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -568,7 +568,7 @@ public abstract class ChunkGenerator { +@@ -574,7 +574,7 @@ public abstract class ChunkGenerator { } } @@ -33,7 +33,7 @@ index d09d5192f0a571e9758e95dd5e1392a9caa88bde..a7ac9a0c4966c2f9d2b325fa59e87928 this.tryGenerateStructure((StructureSet.StructureSelectionEntry) list.get(0), structureAccessor, registryManager, randomstate, structureTemplateManager, placementCalculator.getLevelSeed(), chunk, chunkcoordintpair, sectionposition); } else { diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java -index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..798e22fb4d685b5845ebf687e8004e94f13a9751 100644 +index e6c59f986ae89022bd76463209dfa550a3d4fb59..a6b6e5ea191c0e2cd7a2e4f01b89d8af40a83c1b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java @@ -50,13 +50,14 @@ public class ChunkGeneratorStructureState { @@ -135,7 +135,7 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..798e22fb4d685b5845ebf687e8004e94 + // Paper end - Add missing structure set seed configs randomsource.setSeed(this.concentricRingsSeed); + } // Paper - Add missing structure set seed configs - double d0 = randomsource.nextDouble() * 3.141592653589793D * 2.0D; + double d0 = randomsource.nextDouble() * Math.PI * 2.0D; int l = 0; int i1 = 0; @@ -275,7 +309,7 @@ public class ChunkGeneratorStructureState { @@ -148,10 +148,10 @@ index a310bfbf0d08187375ea17f4b04b276a0b7d0b9f..798e22fb4d685b5845ebf687e8004e94 } } diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java b/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -index 5e7c0d5a31156b75ac4895bd13c8b7138894a576..dc44ae806dc2779e5f0ec0de3fdb4b53da806a5b 100644 +index a4c34e9415632354d33668a38d06453ada4d3c77..cbf13e4f2da6a27619e9bc9a7cd73bb6e69cad2a 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -@@ -79,9 +79,23 @@ public abstract class StructurePlacement { +@@ -79,14 +79,30 @@ public abstract class StructurePlacement { return this.exclusionZone; } @@ -171,12 +171,21 @@ index 5e7c0d5a31156b75ac4895bd13c8b7138894a576..dc44ae806dc2779e5f0ec0de3fdb4b53 + } + // Paper end - Add missing structure set seed configs return this.isPlacementChunk(calculator, chunkX, chunkZ) -- && (!(this.frequency < 1.0F) || this.frequencyReductionMethod.shouldGenerate(calculator.getLevelSeed(), this.salt, chunkX, chunkZ, this.frequency)) -+ && (!(this.frequency < 1.0F) || this.frequencyReductionMethod.shouldGenerate(calculator.getLevelSeed(), this.salt, chunkX, chunkZ, this.frequency, saltOverride)) // Paper - Add missing structure set seed configs - && (!this.exclusionZone.isPresent() || !this.exclusionZone.get().isPlacementForbidden(calculator, chunkX, chunkZ)); +- && this.applyAdditionalChunkRestrictions(chunkX, chunkZ, calculator.getLevelSeed()) ++ && this.applyAdditionalChunkRestrictions(chunkX, chunkZ, calculator.getLevelSeed(), saltOverride) // Paper - Add missing structure set seed configs + && this.applyInteractionsWithOtherStructures(calculator, chunkX, chunkZ); } -@@ -93,25 +107,31 @@ public abstract class StructurePlacement { +- public boolean applyAdditionalChunkRestrictions(int chunkX, int chunkZ, long seed) { +- return !(this.frequency < 1.0F) || this.frequencyReductionMethod.shouldGenerate(seed, this.salt, chunkX, chunkZ, this.frequency); ++ // Paper start - Add missing structure set seed configs ++ public boolean applyAdditionalChunkRestrictions(int chunkX, int chunkZ, long seed, @org.jetbrains.annotations.Nullable Integer saltOverride) { ++ return !(this.frequency < 1.0F) || this.frequencyReductionMethod.shouldGenerate(seed, this.salt, chunkX, chunkZ, this.frequency, saltOverride); ++ // Paper end - Add missing structure set seed configs + } + + public boolean applyInteractionsWithOtherStructures(ChunkGeneratorStructureState calculator, int centerChunkX, int centerChunkZ) { +@@ -101,25 +117,31 @@ public abstract class StructurePlacement { public abstract StructurePlacementType type(); @@ -213,7 +222,7 @@ index 5e7c0d5a31156b75ac4895bd13c8b7138894a576..dc44ae806dc2779e5f0ec0de3fdb4b53 int i = chunkX >> 4; int j = chunkZ >> 4; WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); -@@ -139,7 +159,7 @@ public abstract class StructurePlacement { +@@ -147,7 +169,7 @@ public abstract class StructurePlacement { @FunctionalInterface public interface FrequencyReducer { @@ -222,7 +231,7 @@ index 5e7c0d5a31156b75ac4895bd13c8b7138894a576..dc44ae806dc2779e5f0ec0de3fdb4b53 } public static enum FrequencyReductionMethod implements StringRepresentable { -@@ -159,8 +179,8 @@ public abstract class StructurePlacement { +@@ -167,8 +189,8 @@ public abstract class StructurePlacement { this.reducer = generationPredicate; }