diff --git a/patches/api/Allow-setting-the-vex-s-summoner.patch b/patches/api/Allow-setting-the-vex-s-summoner.patch index 6c0da3f34c..c3ef17035f 100644 --- a/patches/api/Allow-setting-the-vex-s-summoner.patch +++ b/patches/api/Allow-setting-the-vex-s-summoner.patch @@ -8,20 +8,12 @@ diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Vex.java +++ b/src/main/java/org/bukkit/entity/Vex.java -@@ -0,0 +0,0 @@ - package org.bukkit.entity; - -+import org.jetbrains.annotations.Nullable; -+ - /** - * Represents a Vex. - */ @@ -0,0 +0,0 @@ public interface Vex extends Monster { - * @param charging new state + * @return true if the entity has limited life */ - void setCharging(boolean charging); -+ + boolean hasLimitedLife(); + // Paper start ++ + /** + * Get the Mob that summoned this vex + * diff --git a/patches/api/Missing-Entity-Behavior-API.patch b/patches/api/Missing-Entity-Behavior-API.patch index 47fd77681f..c6c1f4911d 100644 --- a/patches/api/Missing-Entity-Behavior-API.patch +++ b/patches/api/Missing-Entity-Behavior-API.patch @@ -565,6 +565,37 @@ diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Vex.java +++ b/src/main/java/org/bukkit/entity/Vex.java +@@ -0,0 +0,0 @@ public interface Vex extends Monster { + * Gets the remaining lifespan of this entity. + * + * @return life in ticks ++ * @deprecated This API duplicates existing API which uses the more ++ * preferable name due to mirroring internals better + */ ++ @Deprecated + int getLifeTicks(); + + /** + * Sets the remaining lifespan of this entity. + * + * @param lifeTicks life in ticks, or negative for unlimited lifepan ++ * @deprecated This API duplicates existing API which uses the more ++ * preferable name due to mirroring internals better + */ ++ @Deprecated + void setLifeTicks(int lifeTicks); + + /** + * Gets if the entity has a limited life. + * + * @return true if the entity has limited life ++ * @deprecated This API duplicates existing API which uses the more ++ * preferable name due to mirroring internals better + */ ++ @Deprecated + boolean hasLimitedLife(); + // Paper start + @@ -0,0 +0,0 @@ public interface Vex extends Monster { * @param summoner New summoner */ diff --git a/patches/api/System-prop-for-default-config-comment-parsing.patch b/patches/api/System-prop-for-default-config-comment-parsing.patch index 72fd49e82e..c681e4c14c 100644 --- a/patches/api/System-prop-for-default-config-comment-parsing.patch +++ b/patches/api/System-prop-for-default-config-comment-parsing.patch @@ -22,30 +22,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected FileConfigurationOptions(@NotNull MemoryConfiguration configuration) { super(configuration); -diff --git a/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java b/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java -+++ b/src/main/java/org/bukkit/configuration/file/YamlRepresenter.java -@@ -0,0 +0,0 @@ import org.yaml.snakeyaml.representer.Representer; - public class YamlRepresenter extends Representer { - - public YamlRepresenter() { -+ this.multiRepresenters.put(org.bukkit.configuration.ConfigurationSection.class, new RepresentConfigurationSection()); // Paper - restore old yaml config section representer - this.multiRepresenters.put(ConfigurationSerializable.class, new RepresentConfigurationSerializable()); - // SPIGOT-6234: We could just switch YamlConstructor to extend Constructor rather than SafeConstructor, however there is a very small risk of issues with plugins treating config as untrusted input - // So instead we will just allow future plugins to have their enums extend ConfigurationSerializable - this.multiRepresenters.remove(Enum.class); - } -+ // Paper start - restore old yaml config section representer -+ private class RepresentConfigurationSection extends RepresentMap { -+ -+ @NotNull -+ @Override -+ public Node representData(@NotNull Object data) { -+ return super.representData(((org.bukkit.configuration.ConfigurationSection) data).getValues(false)); -+ } -+ } -+ // Paper end - - private class RepresentConfigurationSerializable extends RepresentMap { - diff --git a/patches/server/Add-villager-reputation-API.patch b/patches/server/Add-villager-reputation-API.patch index 5070f4cd9d..4e416025bb 100644 --- a/patches/server/Add-villager-reputation-API.patch +++ b/patches/server/Add-villager-reputation-API.patch @@ -65,9 +65,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -@@ -0,0 +0,0 @@ import org.bukkit.entity.EntityType; - import org.bukkit.entity.Villager; +@@ -0,0 +0,0 @@ import org.bukkit.entity.Villager; import org.bukkit.entity.ZombieVillager; + import org.bukkit.event.entity.CreatureSpawnEvent; +// Paper start +import com.destroystokyo.paper.entity.villager.Reputation; diff --git a/patches/server/Check-requirement-before-suggesting-root-nodes.patch b/patches/server/Check-requirement-before-suggesting-root-nodes.patch index e5b01aa6bd..b607a78939 100644 --- a/patches/server/Check-requirement-before-suggesting-root-nodes.patch +++ b/patches/server/Check-requirement-before-suggesting-root-nodes.patch @@ -21,7 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - Don't suggest if the requirement isn't met + if (parent != this.root || node.canUse(context.getSource())) { try { - future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, truncatedInputLowerCase, start)); +- if (node.canUse(parse.getContext().getSource())) future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, truncatedInputLowerCase, start)); // CraftBukkit ++ future = node.listSuggestions(context.build(truncatedInput), new SuggestionsBuilder(truncatedInput, truncatedInputLowerCase, start)); // CraftBukkit } catch (final CommandSyntaxException ignored) { } + } diff --git a/patches/server/Don-t-require-FACING-data.patch b/patches/server/Don-t-require-FACING-data.patch index f95cfd341e..8bac4849da 100644 --- a/patches/server/Don-t-require-FACING-data.patch +++ b/patches/server/Don-t-require-FACING-data.patch @@ -14,7 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class DefaultDispenseItemBehavior implements DispenseItemBehavior { + private Direction enumdirection; // Paper - public DefaultDispenseItemBehavior() {} + // CraftBukkit start + private boolean dropper; +@@ -0,0 +0,0 @@ public class DefaultDispenseItemBehavior implements DispenseItemBehavior { @Override public final ItemStack dispense(BlockSource pointer, ItemStack stack) { diff --git a/patches/server/Fix-falling-block-spawn-methods.patch b/patches/server/Fix-falling-block-spawn-methods.patch index 9455197fa1..d1a0e5889e 100644 --- a/patches/server/Fix-falling-block-spawn-methods.patch +++ b/patches/server/Fix-falling-block-spawn-methods.patch @@ -3,6 +3,9 @@ From: Nassim Jahnke Date: Fri, 4 Mar 2022 20:35:19 +0100 Subject: [PATCH] Fix falling block spawn methods +Restores the API behavior from previous versions of the server +- Do not call API events +- Do not replace the existing block in the world diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -25,17 +28,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Validate.notNull(material, "Material cannot be null"); Validate.isTrue(material.isBlock(), "Material must be a block"); -- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState()); +- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), CraftMagicNumbers.getBlock(material).defaultBlockState(), SpawnReason.CUSTOM); ++ // Paper start - restore API behavior for spawning falling blocks + FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), CraftMagicNumbers.getBlock(material).defaultBlockState()); // Paper - entity.time = 1; ++ entity.time = 1; ++ ++ this.world.addFreshEntity(entity, SpawnReason.CUSTOM); ++ // Paper end + return (FallingBlock) entity.getBukkitEntity(); + } - this.world.addFreshEntity(entity, SpawnReason.CUSTOM); @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { Validate.notNull(location, "Location cannot be null"); - Validate.notNull(data, "Material cannot be null"); + Validate.notNull(data, "BlockData cannot be null"); -- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), ((CraftBlockData) data).getState()); -+ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), ((CraftBlockData) data).getState()); // Paper - entity.time = 1; +- FallingBlockEntity entity = FallingBlockEntity.fall(world, new BlockPos(location.getX(), location.getY(), location.getZ()), ((CraftBlockData) data).getState(), SpawnReason.CUSTOM); ++ // Paper start - restore API behavior for spawning falling blocks ++ FallingBlockEntity entity = new FallingBlockEntity(this.world, location.getX(), location.getY(), location.getZ(), ((CraftBlockData) data).getState()); ++ entity.time = 1; ++ ++ this.world.addFreshEntity(entity, SpawnReason.CUSTOM); ++ // Paper end + return (FallingBlock) entity.getBukkitEntity(); + } - this.world.addFreshEntity(entity, SpawnReason.CUSTOM); diff --git a/patches/server/Optimize-brigadier-child-sorting-performance.patch b/patches/server/Optimize-brigadier-child-sorting-performance.patch index c10e9000fd..79a3c8d996 100644 --- a/patches/server/Optimize-brigadier-child-sorting-performance.patch +++ b/patches/server/Optimize-brigadier-child-sorting-performance.patch @@ -8,20 +8,20 @@ diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java +++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java -@@ -0,0 +0,0 @@ import java.util.stream.Collectors; +@@ -0,0 +0,0 @@ import java.util.function.Predicate; import net.minecraft.commands.CommandSourceStack; public abstract class CommandNode implements Comparable> { -- private Map> children = Maps.newLinkedHashMap(); -+ private Map> children = Maps.newTreeMap(); // Paper - Switch to tree map for automatic sorting - private Map> literals = Maps.newLinkedHashMap(); - private Map> arguments = Maps.newLinkedHashMap(); +- private final Map> children = new LinkedHashMap<>(); ++ private Map> children = com.google.common.collect.Maps.newTreeMap(); // Paper - Switch to tree map for automatic sorting + private final Map> literals = new LinkedHashMap<>(); + private final Map> arguments = new LinkedHashMap<>(); public Predicate requirement; @@ -0,0 +0,0 @@ public abstract class CommandNode implements Comparable> { + this.arguments.put(node.getName(), (ArgumentCommandNode) node); } } - -- this.children = this.children.entrySet().stream().sorted(Map.Entry.comparingByValue()).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); ++ + // Paper - Remove manual sorting, it is no longer needed } diff --git a/work/Bukkit b/work/Bukkit index fc460d1bb8..3151477447 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit fc460d1bb8d5f2bc9ff07dad1b7b402eed06d7c4 +Subproject commit 31514774479a17c4a8cfb2d44f392a590a2b282c diff --git a/work/CraftBukkit b/work/CraftBukkit index a459f4d4f5..9cc7d766dc 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit a459f4d4f5f89e6266be8db2e7facea1cb00b5d0 +Subproject commit 9cc7d766dc36bf5f565381f0d1be885911895c1a