diff --git a/patches/api/0256-Add-PaperRegistry.patch b/patches/api/0256-Add-PaperRegistry.patch new file mode 100644 index 000000000..4cda0a858 --- /dev/null +++ b/patches/api/0256-Add-PaperRegistry.patch @@ -0,0 +1,112 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 2 Mar 2022 13:36:21 -0800 +Subject: [PATCH] Add PaperRegistry + + +diff --git a/src/main/java/io/papermc/paper/registry/Reference.java b/src/main/java/io/papermc/paper/registry/Reference.java +new file mode 100644 +index 0000000000000000000000000000000000000000..d880810cbf05bc45051fe29515054211572e33b4 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/Reference.java +@@ -0,0 +1,43 @@ ++package io.papermc.paper.registry; ++ ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Represents a reference to a server-backed registry value that may ++ * change. ++ * ++ * @param type of the value ++ */ ++public interface Reference extends Keyed { ++ ++ /** ++ * Gets the value from the registry with the key. ++ * ++ * @return the value ++ * @throws java.util.NoSuchElementException if there is no value with this key ++ */ ++ @NotNull T value(); ++ ++ /** ++ * Gets the value from the registry with the key. ++ * ++ * @return the value or null if it doesn't exist ++ */ ++ @Nullable T valueOrNull(); ++ ++ /** ++ * Creates a reference to a registered value. ++ * ++ * @param registry the registry the value is located in ++ * @param key the key to the value ++ * @param the type of the value ++ * @return a reference ++ */ ++ static @NotNull Reference create(@NotNull Registry registry, @NotNull NamespacedKey key) { ++ return new ReferenceImpl<>(registry, key); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/registry/ReferenceImpl.java b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java +new file mode 100644 +index 0000000000000000000000000000000000000000..f29e76a6b66ddfec12ddf8db6dcb2df6083b5982 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/ReferenceImpl.java +@@ -0,0 +1,31 @@ ++package io.papermc.paper.registry; ++ ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.NoSuchElementException; ++ ++record ReferenceImpl(@NotNull Registry registry, @NotNull NamespacedKey key) implements Reference { ++ ++ @Override ++ public @NotNull T value() { ++ final T value = this.registry.get(this.key); ++ if (value == null) { ++ throw new NoSuchElementException("No such value with key " + this.key); ++ } ++ return value; ++ } ++ ++ @Override ++ public @Nullable T valueOrNull() { ++ return this.registry.get(this.key); ++ } ++ ++ @Override ++ public @NotNull NamespacedKey getKey() { ++ return this.key; ++ } ++} +diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java +index b24439b379be1a90dde4e6f4dbe5ca3fdd8face4..0697214210a6e87f690b9454d9651d06ca57a524 100644 +--- a/src/main/java/org/bukkit/UnsafeValues.java ++++ b/src/main/java/org/bukkit/UnsafeValues.java +@@ -147,5 +147,15 @@ public interface UnsafeValues { + * Use this when sending custom packets, so that there are no collisions on the client or server. + */ + public int nextEntityId(); ++ ++ /** ++ * Gets the server-backed registry for a type. ++ * ++ * @param classOfT type ++ * @param type ++ * @return the server-backed registry ++ * @throws IllegalArgumentException if there isn't a registry for that type ++ */ ++ @org.jetbrains.annotations.NotNull Registry registryFor(Class classOfT); + // Paper end + } diff --git a/patches/api/0256-Add-StructureLocateEvent.patch b/patches/api/0256-Add-StructureLocateEvent.patch deleted file mode 100644 index 88c14d8ea..000000000 --- a/patches/api/0256-Add-StructureLocateEvent.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dfsek -Date: Tue, 15 Sep 2020 21:59:16 -0700 -Subject: [PATCH] Add StructureLocateEvent - - -diff --git a/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java -new file mode 100644 -index 0000000000000000000000000000000000000000..45b6694fc5741831e2df638b1f760a3ca28a4907 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java -@@ -0,0 +1,155 @@ -+package io.papermc.paper.event.world; -+ -+import org.bukkit.Location; -+import org.bukkit.StructureType; -+import org.bukkit.World; -+import org.bukkit.event.Cancellable; -+import org.bukkit.event.HandlerList; -+import org.bukkit.event.world.WorldEvent; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+/** -+ * Called before a structure/feature is located. -+ * This happens when: -+ *
    -+ *
  • The /locate command is used.
  • -+ *
  • An Eye of Ender is used.
  • -+ *
  • An Explorer/Treasure Map is activated.
  • -+ *
  • {@link World#locateNearestStructure(Location, StructureType, int, boolean)} is invoked.
  • -+ *
-+ */ -+public class StructureLocateEvent extends WorldEvent implements Cancellable { -+ private static final HandlerList handlers = new HandlerList(); -+ private final Location origin; -+ private Location result = null; -+ private StructureType type; -+ private int radius; -+ private boolean findUnexplored; -+ private boolean cancelled = false; -+ -+ public StructureLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored) { -+ super(world); -+ this.origin = origin; -+ this.type = structureType; -+ this.radius = radius; -+ this.findUnexplored = findUnexplored; -+ } -+ -+ @NotNull -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+ -+ @NotNull -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ /** -+ * Gets the location set as the structure location, if it was defined. -+ *

-+ * Returns {@code null} if it has not been set by {@link StructureLocateEvent#setResult(Location)}. -+ * Since this event fires before the search is done, the actual location is unknown at this point. -+ * -+ * @return The result location, if it has been set. null if it has not. -+ * @see World#locateNearestStructure(Location, StructureType, int, boolean) -+ */ -+ @Nullable -+ public Location getResult() { -+ return result; -+ } -+ -+ /** -+ * Sets the result {@link Location}. This causes the search to be skipped, and the location passed here to be used as the result. -+ * -+ * @param result the {@link Location} of the structure. -+ */ -+ public void setResult(@Nullable Location result) { -+ this.result = result; -+ } -+ -+ /** -+ * Gets the {@link StructureType} that is to be located. -+ * -+ * @return the structure type. -+ */ -+ @NotNull -+ public StructureType getType() { -+ return type; -+ } -+ -+ /** -+ * Sets the {@link StructureType} that is to be located. -+ * -+ * @param type the structure type. -+ */ -+ public void setType(@NotNull StructureType type) { -+ this.type = type; -+ } -+ -+ /** -+ * Gets the {@link Location} from which the search is to be conducted. -+ * -+ * @return {@link Location} where search begins -+ */ -+ @NotNull -+ public Location getOrigin() { -+ return origin; -+ } -+ -+ /** -+ * Gets the search radius in which to attempt locating the structure. -+ *

-+ * This radius may not always be obeyed during the structure search! -+ * -+ * @return the search radius. -+ */ -+ public int getRadius() { -+ return radius; -+ } -+ -+ /** -+ * Sets the search radius in which to attempt locating the structure. -+ *

-+ * This radius may not always be obeyed during the structure search! -+ * -+ * @param radius the search radius. -+ */ -+ public void setRadius(int radius) { -+ this.radius = radius; -+ } -+ -+ /** -+ * Gets whether to search exclusively for unexplored structures. -+ *

-+ * As with the search radius, this value is not always obeyed. -+ * -+ * @return Whether to search for only unexplored structures. -+ */ -+ public boolean shouldFindUnexplored() { -+ return findUnexplored; -+ } -+ -+ /** -+ * Sets whether to search exclusively for unexplored structures. -+ *

-+ * As with the search radius, this value is not always obeyed. -+ * -+ * @param findUnexplored Whether to search for only unexplored structures. -+ */ -+ public void setFindUnexplored(boolean findUnexplored) { -+ this.findUnexplored = findUnexplored; -+ } -+ -+ @Override -+ public boolean isCancelled() { -+ return cancelled; -+ } -+ -+ @Override -+ public void setCancelled(boolean cancel) { -+ this.cancelled = cancel; -+ } -+} diff --git a/patches/api/0257-Add-StructuresLocateEvent.patch b/patches/api/0257-Add-StructuresLocateEvent.patch new file mode 100644 index 000000000..30880b64e --- /dev/null +++ b/patches/api/0257-Add-StructuresLocateEvent.patch @@ -0,0 +1,461 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: dfsek +Date: Tue, 15 Sep 2020 21:59:16 -0700 +Subject: [PATCH] Add StructuresLocateEvent + +Co-authored-by: Jake Potrebic + +diff --git a/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0c83a02059d65672ff191c42932d850950e9ea00 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/world/StructureLocateEvent.java +@@ -0,0 +1,157 @@ ++package io.papermc.paper.event.world; ++ ++import org.bukkit.Location; ++import org.bukkit.StructureType; ++import org.bukkit.World; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.world.WorldEvent; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++/** ++ * Called before a structure/feature is located. ++ * This happens when: ++ *

    ++ *
  • The /locate command is used.
  • ++ *
  • An Eye of Ender is used.
  • ++ *
  • An Explorer/Treasure Map is activated.
  • ++ *
  • {@link World#locateNearestStructure(Location, StructureType, int, boolean)} is invoked.
  • ++ *
++ * @deprecated no longer used, see {@link StructuresLocateEvent} ++ */ ++@Deprecated(forRemoval = true) ++public class StructureLocateEvent extends WorldEvent implements Cancellable { ++ private static final HandlerList handlers = new HandlerList(); ++ private final Location origin; ++ private Location result = null; ++ private StructureType type; ++ private int radius; ++ private boolean findUnexplored; ++ private boolean cancelled = false; ++ ++ public StructureLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored) { ++ super(world); ++ this.origin = origin; ++ this.type = structureType; ++ this.radius = radius; ++ this.findUnexplored = findUnexplored; ++ } ++ ++ @NotNull ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++ ++ @NotNull ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ /** ++ * Gets the location set as the structure location, if it was defined. ++ *

++ * Returns {@code null} if it has not been set by {@link StructureLocateEvent#setResult(Location)}. ++ * Since this event fires before the search is done, the actual location is unknown at this point. ++ * ++ * @return The result location, if it has been set. null if it has not. ++ * @see World#locateNearestStructure(Location, StructureType, int, boolean) ++ */ ++ @Nullable ++ public Location getResult() { ++ return result; ++ } ++ ++ /** ++ * Sets the result {@link Location}. This causes the search to be skipped, and the location passed here to be used as the result. ++ * ++ * @param result the {@link Location} of the structure. ++ */ ++ public void setResult(@Nullable Location result) { ++ this.result = result; ++ } ++ ++ /** ++ * Gets the {@link StructureType} that is to be located. ++ * ++ * @return the structure type. ++ */ ++ @NotNull ++ public StructureType getType() { ++ return type; ++ } ++ ++ /** ++ * Sets the {@link StructureType} that is to be located. ++ * ++ * @param type the structure type. ++ */ ++ public void setType(@NotNull StructureType type) { ++ this.type = type; ++ } ++ ++ /** ++ * Gets the {@link Location} from which the search is to be conducted. ++ * ++ * @return {@link Location} where search begins ++ */ ++ @NotNull ++ public Location getOrigin() { ++ return origin; ++ } ++ ++ /** ++ * Gets the search radius in which to attempt locating the structure. ++ *

++ * This radius may not always be obeyed during the structure search! ++ * ++ * @return the search radius. ++ */ ++ public int getRadius() { ++ return radius; ++ } ++ ++ /** ++ * Sets the search radius in which to attempt locating the structure. ++ *

++ * This radius may not always be obeyed during the structure search! ++ * ++ * @param radius the search radius. ++ */ ++ public void setRadius(int radius) { ++ this.radius = radius; ++ } ++ ++ /** ++ * Gets whether to search exclusively for unexplored structures. ++ *

++ * As with the search radius, this value is not always obeyed. ++ * ++ * @return Whether to search for only unexplored structures. ++ */ ++ public boolean shouldFindUnexplored() { ++ return findUnexplored; ++ } ++ ++ /** ++ * Sets whether to search exclusively for unexplored structures. ++ *

++ * As with the search radius, this value is not always obeyed. ++ * ++ * @param findUnexplored Whether to search for only unexplored structures. ++ */ ++ public void setFindUnexplored(boolean findUnexplored) { ++ this.findUnexplored = findUnexplored; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++} +diff --git a/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java +new file mode 100644 +index 0000000000000000000000000000000000000000..566f9df8f615142e14330965f3491f4e83846783 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java +@@ -0,0 +1,164 @@ ++package io.papermc.paper.event.world; ++ ++import io.papermc.paper.world.structure.ConfiguredStructure; ++import org.bukkit.Location; ++import org.bukkit.World; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.event.world.WorldEvent; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++import java.util.ArrayList; ++import java.util.List; ++ ++/** ++ * Called before a set of configured structures is located. ++ * This happens when: ++ *

    ++ *
  • The /locate command is used.
  • ++ *
  • An Eye of Ender is used.
  • ++ *
  • An Explorer/Treasure Map is activated.
  • ++ *
  • A dolphin swims to a treasure location.
  • ++ *
  • A trade is done with a villager for a map.
  • ++ *
  • {@link World#locateNearestStructure(Location, org.bukkit.StructureType, int, boolean)} is invoked.
  • ++ *
++ */ ++public class StructuresLocateEvent extends WorldEvent implements Cancellable { ++ ++ private static final HandlerList HANDLER_LIST = new HandlerList(); ++ ++ private final Location origin; ++ private Result result; ++ private List configuredStructures; ++ private int radius; ++ private boolean findUnexplored; ++ private boolean cancelled; ++ ++ public StructuresLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull List configuredStructures, int radius, boolean findUnexplored) { ++ super(world); ++ this.origin = origin; ++ this.configuredStructures = configuredStructures; ++ this.radius = radius; ++ this.findUnexplored = findUnexplored; ++ } ++ ++ /** ++ * Gets the {@link Location} from which the search is to be conducted. ++ * ++ * @return {@link Location} where search begins ++ */ ++ public @NotNull Location getOrigin() { ++ return this.origin; ++ } ++ ++ /** ++ * Gets the {@link Location} and {@link ConfiguredStructure} set as the result, if it was defined. ++ *

++ * Returns {@code null} if it has not been set by {@link StructuresLocateEvent#setResult(Result)}. ++ * Since this event fires before the search is done, the actual result is unknown at this point. ++ * ++ * @return The result location and structure, if it has been set. null if it has not. ++ * @see World#locateNearestStructure(Location, org.bukkit.StructureType, int, boolean) ++ */ ++ public @Nullable Result getResult() { ++ return this.result; ++ } ++ ++ /** ++ * Sets the result {@link Location} and {@link ConfiguredStructure}. This causes the search to be ++ * skipped, and the result object passed here to be used as the result. ++ * ++ * @param result the {@link Location} and {@link ConfiguredStructure} of the search. ++ */ ++ public void setResult(@Nullable Result result) { ++ this.result = result; ++ } ++ ++ /** ++ * Gets a mutable list of ConfiguredStructures that are valid targets for the search. ++ * ++ * @return a mutable list of ConfiguredStructures ++ */ ++ public @NotNull List getConfiguredStructures() { ++ return this.configuredStructures; ++ } ++ ++ /** ++ * Sets the list of ConfiguredStructures that are valid targets for the search. ++ * ++ * @param configuredStructures a list of ConfiguredStructure targets ++ */ ++ public void setConfiguredStructures(@NotNull List configuredStructures) { ++ this.configuredStructures = new ArrayList<>(configuredStructures); ++ } ++ ++ /** ++ * Gets the search radius in which to attempt locating the structure. ++ *

++ * This radius may not always be obeyed during the structure search! ++ * ++ * @return the search radius. ++ */ ++ public int getRadius() { ++ return this.radius; ++ } ++ ++ /** ++ * Sets the search radius in which to attempt locating the structure. ++ *

++ * This radius may not always be obeyed during the structure search! ++ * ++ * @param radius the search radius. ++ */ ++ public void setRadius(int radius) { ++ this.radius = radius; ++ } ++ ++ /** ++ * Gets whether to search exclusively for unexplored structures. ++ *

++ * As with the search radius, this value is not always obeyed. ++ * ++ * @return Whether to search for only unexplored structures. ++ */ ++ public boolean shouldFindUnexplored() { ++ return this.findUnexplored; ++ } ++ ++ /** ++ * Sets whether to search exclusively for unexplored structures. ++ *

++ * As with the search radius, this value is not always obeyed. ++ * ++ * @param findUnexplored Whether to search for only unexplored structures. ++ */ ++ public void setFindUnexplored(boolean findUnexplored) { ++ this.findUnexplored = findUnexplored; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ @Override ++ public @NotNull HandlerList getHandlers() { ++ return HANDLER_LIST; ++ } ++ ++ public static @NotNull HandlerList getHandlerList() { ++ return HANDLER_LIST; ++ } ++ ++ /** ++ * Result for {@link StructuresLocateEvent}. ++ */ ++ public record Result(@NotNull Location position, @NotNull ConfiguredStructure configuredStructure) { ++ } ++} +diff --git a/src/main/java/io/papermc/paper/world/structure/ConfiguredStructure.java b/src/main/java/io/papermc/paper/world/structure/ConfiguredStructure.java +new file mode 100644 +index 0000000000000000000000000000000000000000..280febf7482418734558c50c22688248ac2b14f3 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/world/structure/ConfiguredStructure.java +@@ -0,0 +1,97 @@ ++package io.papermc.paper.world.structure; ++ ++import io.papermc.paper.registry.Reference; ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.Registry; ++import org.bukkit.StructureType; ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.Objects; ++ ++/** ++ * Represents a configured structure each with a ++ * {@link StructureType}. Multiple ConfiguredStructures can have ++ * the same {@link StructureType}. ++ */ ++public final class ConfiguredStructure implements Keyed { ++ ++ public static final Reference PILLAGER_OUTPOST = create("pillager_outpost"); ++ public static final Reference MINESHAFT = create("mineshaft"); ++ public static final Reference MINESHAFT_MESA = create("mineshaft_mesa"); ++ public static final Reference WOODLAND_MANSION = create("mansion"); ++ public static final Reference JUNGLE_TEMPLE = create("jungle_pyramid"); ++ public static final Reference DESERT_PYRAMID = create("desert_pyramid"); ++ public static final Reference IGLOO = create("igloo"); ++ public static final Reference SHIPWRECK = create("shipwreck"); ++ public static final Reference SHIPWRECK_BEACHED = create("shipwreck_beached"); ++ public static final Reference SWAMP_HUT = create("swamp_hut"); ++ public static final Reference STRONGHOLD = create("stronghold"); ++ public static final Reference OCEAN_MONUMENT = create("monument"); ++ public static final Reference OCEAN_RUIN_COLD = create("ocean_ruin_cold"); ++ public static final Reference OCEAN_RUIN_WARM = create("ocean_ruin_warm"); ++ public static final Reference FORTRESS = create("fortress"); ++ public static final Reference NETHER_FOSSIL = create("nether_fossil"); ++ public static final Reference END_CITY = create("end_city"); ++ public static final Reference BURIED_TREASURE = create("buried_treasure"); ++ public static final Reference BASTION_REMNANT = create("bastion_remnant"); ++ public static final Reference VILLAGE_PLAINS = create("village_plains"); ++ public static final Reference VILLAGE_DESERT = create("village_desert"); ++ public static final Reference VILLAGE_SAVANNA = create("village_savanna"); ++ public static final Reference VILLAGE_SNOWY = create("village_snowy"); ++ public static final Reference VILLAGE_TAIGA = create("village_taiga"); ++ public static final Reference RUINED_PORTAL_STANDARD = create("ruined_portal"); ++ public static final Reference RUINED_PORTAL_DESERT = create("ruined_portal_desert"); ++ public static final Reference RUINED_PORTAL_JUNGLE = create("ruined_portal_jungle"); ++ public static final Reference RUINED_PORTAL_SWAMP = create("ruined_portal_swamp"); ++ public static final Reference RUINED_PORTAL_MOUNTAIN = create("ruined_portal_mountain"); ++ public static final Reference RUINED_PORTAL_OCEAN = create("ruined_portal_ocean"); ++ public static final Reference RUINED_PORTAL_NETHER = create("ruined_portal_nether"); ++ ++ private final NamespacedKey key; ++ private final StructureType structureType; ++ ++ ConfiguredStructure(@NotNull NamespacedKey key, @NotNull StructureType structureType) { ++ this.key = key; ++ this.structureType = structureType; ++ } ++ ++ @Override ++ public @NotNull NamespacedKey getKey() { ++ return this.key; ++ } ++ ++ /** ++ * Gets the structure type for this configure structure. ++ * ++ * @return the structure type ++ */ ++ public @NotNull StructureType getStructureType() { ++ return this.structureType; ++ } ++ ++ @Override ++ public boolean equals(Object o) { ++ if (this == o) return true; ++ if (o == null || getClass() != o.getClass()) return false; ++ ConfiguredStructure structure = (ConfiguredStructure) o; ++ return this.key.equals(structure.key) && this.structureType.equals(structure.structureType); ++ } ++ ++ @Override ++ public int hashCode() { ++ return Objects.hash(this.key, this.structureType); ++ } ++ ++ @Override ++ public String toString() { ++ return "ConfiguredStructure{" + ++ "key=" + this.key + ++ ", structureType=" + this.structureType + ++ '}'; ++ } ++ ++ private static @NotNull Reference create(@NotNull String name) { ++ return Reference.create(Registry.CONFIGURED_STRUCTURE, NamespacedKey.minecraft(name)); ++ } ++} +diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java +index a696fcaffa03af9e6c92e2ef3e12b38eb59e5db4..bfe0d98e6032c7633d6bb97382426f94fb437430 100644 +--- a/src/main/java/org/bukkit/Registry.java ++++ b/src/main/java/org/bukkit/Registry.java +@@ -189,6 +189,13 @@ public interface Registry extends Iterable { + return GameEvent.getByKey(key); + } + }; ++ // Paper start ++ /** ++ * Configured structures. ++ * @see io.papermc.paper.world.structure.ConfiguredStructure ++ */ ++ Registry CONFIGURED_STRUCTURE = Bukkit.getUnsafe().registryFor(io.papermc.paper.world.structure.ConfiguredStructure.class); ++ // Paper end + + /** + * Get the object by its key. diff --git a/patches/api/0257-Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/api/0258-Return-chat-component-with-empty-text-instead-of-thr.patch similarity index 100% rename from patches/api/0257-Return-chat-component-with-empty-text-instead-of-thr.patch rename to patches/api/0258-Return-chat-component-with-empty-text-instead-of-thr.patch diff --git a/patches/api/0258-Add-BlockPreDispenseEvent.patch b/patches/api/0259-Add-BlockPreDispenseEvent.patch similarity index 100% rename from patches/api/0258-Add-BlockPreDispenseEvent.patch rename to patches/api/0259-Add-BlockPreDispenseEvent.patch diff --git a/patches/api/0259-Added-Vanilla-Entity-Tags.patch b/patches/api/0260-Added-Vanilla-Entity-Tags.patch similarity index 100% rename from patches/api/0259-Added-Vanilla-Entity-Tags.patch rename to patches/api/0260-Added-Vanilla-Entity-Tags.patch diff --git a/patches/api/0260-added-Wither-API.patch b/patches/api/0261-added-Wither-API.patch similarity index 100% rename from patches/api/0260-added-Wither-API.patch rename to patches/api/0261-added-Wither-API.patch diff --git a/patches/api/0261-Added-PlayerChangeBeaconEffectEvent.patch b/patches/api/0262-Added-PlayerChangeBeaconEffectEvent.patch similarity index 100% rename from patches/api/0261-Added-PlayerChangeBeaconEffectEvent.patch rename to patches/api/0262-Added-PlayerChangeBeaconEffectEvent.patch diff --git a/patches/api/0262-Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/api/0263-Added-PlayerStonecutterRecipeSelectEvent.patch similarity index 100% rename from patches/api/0262-Added-PlayerStonecutterRecipeSelectEvent.patch rename to patches/api/0263-Added-PlayerStonecutterRecipeSelectEvent.patch diff --git a/patches/api/0263-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/api/0264-Add-dropLeash-variable-to-EntityUnleashEvent.patch similarity index 100% rename from patches/api/0263-Add-dropLeash-variable-to-EntityUnleashEvent.patch rename to patches/api/0264-Add-dropLeash-variable-to-EntityUnleashEvent.patch diff --git a/patches/api/0264-add-DragonEggFormEvent.patch b/patches/api/0265-add-DragonEggFormEvent.patch similarity index 100% rename from patches/api/0264-add-DragonEggFormEvent.patch rename to patches/api/0265-add-DragonEggFormEvent.patch diff --git a/patches/api/0265-EntityMoveEvent.patch b/patches/api/0266-EntityMoveEvent.patch similarity index 100% rename from patches/api/0265-EntityMoveEvent.patch rename to patches/api/0266-EntityMoveEvent.patch diff --git a/patches/api/0266-Allow-adding-items-to-BlockDropItemEvent.patch b/patches/api/0267-Allow-adding-items-to-BlockDropItemEvent.patch similarity index 100% rename from patches/api/0266-Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/api/0267-Allow-adding-items-to-BlockDropItemEvent.patch diff --git a/patches/api/0267-Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/api/0268-Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 100% rename from patches/api/0267-Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/api/0268-Add-getMainThreadExecutor-to-BukkitScheduler.patch diff --git a/patches/api/0268-living-entity-allow-attribute-registration.patch b/patches/api/0269-living-entity-allow-attribute-registration.patch similarity index 100% rename from patches/api/0268-living-entity-allow-attribute-registration.patch rename to patches/api/0269-living-entity-allow-attribute-registration.patch diff --git a/patches/api/0269-Add-missing-effects.patch b/patches/api/0270-Add-missing-effects.patch similarity index 100% rename from patches/api/0269-Add-missing-effects.patch rename to patches/api/0270-Add-missing-effects.patch diff --git a/patches/api/0270-Expose-Tracked-Players.patch b/patches/api/0271-Expose-Tracked-Players.patch similarity index 100% rename from patches/api/0270-Expose-Tracked-Players.patch rename to patches/api/0271-Expose-Tracked-Players.patch diff --git a/patches/api/0271-Cache-the-result-of-Material-isBlock.patch b/patches/api/0272-Cache-the-result-of-Material-isBlock.patch similarity index 100% rename from patches/api/0271-Cache-the-result-of-Material-isBlock.patch rename to patches/api/0272-Cache-the-result-of-Material-isBlock.patch diff --git a/patches/api/0272-Add-worldborder-events.patch b/patches/api/0273-Add-worldborder-events.patch similarity index 100% rename from patches/api/0272-Add-worldborder-events.patch rename to patches/api/0273-Add-worldborder-events.patch diff --git a/patches/api/0273-added-PlayerNameEntityEvent.patch b/patches/api/0274-added-PlayerNameEntityEvent.patch similarity index 100% rename from patches/api/0273-added-PlayerNameEntityEvent.patch rename to patches/api/0274-added-PlayerNameEntityEvent.patch diff --git a/patches/api/0274-Add-recipe-to-cook-events.patch b/patches/api/0275-Add-recipe-to-cook-events.patch similarity index 100% rename from patches/api/0274-Add-recipe-to-cook-events.patch rename to patches/api/0275-Add-recipe-to-cook-events.patch diff --git a/patches/api/0275-Add-Block-isValidTool.patch b/patches/api/0276-Add-Block-isValidTool.patch similarity index 100% rename from patches/api/0275-Add-Block-isValidTool.patch rename to patches/api/0276-Add-Block-isValidTool.patch diff --git a/patches/api/0276-Implement-Keyed-on-World.patch b/patches/api/0277-Implement-Keyed-on-World.patch similarity index 98% rename from patches/api/0276-Implement-Keyed-on-World.patch rename to patches/api/0277-Implement-Keyed-on-World.patch index 933373e6d..86b1e2d5e 100644 --- a/patches/api/0276-Implement-Keyed-on-World.patch +++ b/patches/api/0277-Implement-Keyed-on-World.patch @@ -50,7 +50,7 @@ index b1cfea011efa985f644328486196edf5c73e72cd..67c6443c5639beafade19bc39932f30b * Gets the map from the given item ID. * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 85c1f5b33e933b23946cad3c5ad37cc350ee5d3c..a17b0f540f1b0a85d16ca3e07da2fc495349a699 100644 +index 37f0acb893f886ac0605838eb03b4a935b96f85b..47b9b8b476cbc7a4ef329dbd7629195851c8f4ea 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -43,7 +43,7 @@ import org.jetbrains.annotations.Nullable; diff --git a/patches/api/0277-Item-Rarity-API.patch b/patches/api/0278-Item-Rarity-API.patch similarity index 91% rename from patches/api/0277-Item-Rarity-API.patch rename to patches/api/0278-Item-Rarity-API.patch index 93fb11dcd..102250b8b 100644 --- a/patches/api/0277-Item-Rarity-API.patch +++ b/patches/api/0278-Item-Rarity-API.patch @@ -61,13 +61,13 @@ index 9f0048888a2fe40316154613a722d1c709fd3856..709ae1eaabd81ee712d7d6f353c4983f /** diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index b24439b379be1a90dde4e6f4dbe5ca3fdd8face4..4b01c6f82d172b55268fe670c1106b5038ff6eee 100644 +index 0697214210a6e87f690b9454d9651d06ca57a524..8cbd493f695229a7dad46916087aeb3159328bfe 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -147,5 +147,22 @@ public interface UnsafeValues { - * Use this when sending custom packets, so that there are no collisions on the client or server. +@@ -157,5 +157,22 @@ public interface UnsafeValues { + * @throws IllegalArgumentException if there isn't a registry for that type */ - public int nextEntityId(); + @org.jetbrains.annotations.NotNull Registry registryFor(Class classOfT); + + /** + * Gets the item rarity of a material. The material MUST be an item. diff --git a/patches/api/0278-Expose-protocol-version.patch b/patches/api/0279-Expose-protocol-version.patch similarity index 82% rename from patches/api/0278-Expose-protocol-version.patch rename to patches/api/0279-Expose-protocol-version.patch index 20f05a032..d50d6d888 100644 --- a/patches/api/0278-Expose-protocol-version.patch +++ b/patches/api/0279-Expose-protocol-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 4b01c6f82d172b55268fe670c1106b5038ff6eee..2708718e0391960f9e784f38e5753d95e71de2fc 100644 +index 8cbd493f695229a7dad46916087aeb3159328bfe..45a5e148ae5582a805e350b526cfb3ad87f6f945 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -164,5 +164,12 @@ public interface UnsafeValues { +@@ -174,5 +174,12 @@ public interface UnsafeValues { * @return the itemstack rarity */ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack); diff --git a/patches/api/0279-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch b/patches/api/0280-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch similarity index 100% rename from patches/api/0279-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch rename to patches/api/0280-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch diff --git a/patches/api/0280-add-isDeeplySleeping-to-HumanEntity.patch b/patches/api/0281-add-isDeeplySleeping-to-HumanEntity.patch similarity index 100% rename from patches/api/0280-add-isDeeplySleeping-to-HumanEntity.patch rename to patches/api/0281-add-isDeeplySleeping-to-HumanEntity.patch diff --git a/patches/api/0281-add-consumeFuel-to-FurnaceBurnEvent.patch b/patches/api/0282-add-consumeFuel-to-FurnaceBurnEvent.patch similarity index 100% rename from patches/api/0281-add-consumeFuel-to-FurnaceBurnEvent.patch rename to patches/api/0282-add-consumeFuel-to-FurnaceBurnEvent.patch diff --git a/patches/api/0282-add-get-set-drop-chance-to-EntityEquipment.patch b/patches/api/0283-add-get-set-drop-chance-to-EntityEquipment.patch similarity index 100% rename from patches/api/0282-add-get-set-drop-chance-to-EntityEquipment.patch rename to patches/api/0283-add-get-set-drop-chance-to-EntityEquipment.patch diff --git a/patches/api/0283-Added-PlayerDeepSleepEvent.patch b/patches/api/0284-Added-PlayerDeepSleepEvent.patch similarity index 100% rename from patches/api/0283-Added-PlayerDeepSleepEvent.patch rename to patches/api/0284-Added-PlayerDeepSleepEvent.patch diff --git a/patches/api/0284-More-World-API.patch b/patches/api/0285-More-World-API.patch similarity index 97% rename from patches/api/0284-More-World-API.patch rename to patches/api/0285-More-World-API.patch index 8442c331f..d963c90cf 100644 --- a/patches/api/0284-More-World-API.patch +++ b/patches/api/0285-More-World-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] More World API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index a17b0f540f1b0a85d16ca3e07da2fc495349a699..b29b313dfe6342460d5f1ff085a0a61b4604d5ea 100644 +index 47b9b8b476cbc7a4ef329dbd7629195851c8f4ea..def9f0f9803e71cbe57abcffeb9114a5ab462e54 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -3645,6 +3645,114 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0285-Added-PlayerBedFailEnterEvent.patch b/patches/api/0286-Added-PlayerBedFailEnterEvent.patch similarity index 100% rename from patches/api/0285-Added-PlayerBedFailEnterEvent.patch rename to patches/api/0286-Added-PlayerBedFailEnterEvent.patch diff --git a/patches/api/0286-Introduce-beacon-activation-deactivation-events.patch b/patches/api/0287-Introduce-beacon-activation-deactivation-events.patch similarity index 100% rename from patches/api/0286-Introduce-beacon-activation-deactivation-events.patch rename to patches/api/0287-Introduce-beacon-activation-deactivation-events.patch diff --git a/patches/api/0287-PlayerMoveEvent-Improvements.patch b/patches/api/0288-PlayerMoveEvent-Improvements.patch similarity index 100% rename from patches/api/0287-PlayerMoveEvent-Improvements.patch rename to patches/api/0288-PlayerMoveEvent-Improvements.patch diff --git a/patches/api/0288-add-RespawnFlags-to-PlayerRespawnEvent.patch b/patches/api/0289-add-RespawnFlags-to-PlayerRespawnEvent.patch similarity index 100% rename from patches/api/0288-add-RespawnFlags-to-PlayerRespawnEvent.patch rename to patches/api/0289-add-RespawnFlags-to-PlayerRespawnEvent.patch diff --git a/patches/api/0289-Add-more-WanderingTrader-API.patch b/patches/api/0290-Add-more-WanderingTrader-API.patch similarity index 100% rename from patches/api/0289-Add-more-WanderingTrader-API.patch rename to patches/api/0290-Add-more-WanderingTrader-API.patch diff --git a/patches/api/0290-Add-EntityBlockStorage-clearEntities.patch b/patches/api/0291-Add-EntityBlockStorage-clearEntities.patch similarity index 100% rename from patches/api/0290-Add-EntityBlockStorage-clearEntities.patch rename to patches/api/0291-Add-EntityBlockStorage-clearEntities.patch diff --git a/patches/api/0291-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch b/patches/api/0292-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch similarity index 100% rename from patches/api/0291-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch rename to patches/api/0292-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch diff --git a/patches/api/0292-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch b/patches/api/0293-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch similarity index 100% rename from patches/api/0292-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch rename to patches/api/0293-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch diff --git a/patches/api/0293-Inventory-close.patch b/patches/api/0294-Inventory-close.patch similarity index 100% rename from patches/api/0293-Inventory-close.patch rename to patches/api/0294-Inventory-close.patch diff --git a/patches/api/0294-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch b/patches/api/0295-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch similarity index 100% rename from patches/api/0294-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch rename to patches/api/0295-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch diff --git a/patches/api/0295-Add-basic-Datapack-API.patch b/patches/api/0296-Add-basic-Datapack-API.patch similarity index 100% rename from patches/api/0295-Add-basic-Datapack-API.patch rename to patches/api/0296-Add-basic-Datapack-API.patch diff --git a/patches/api/0296-additions-to-PlayerGameModeChangeEvent.patch b/patches/api/0297-additions-to-PlayerGameModeChangeEvent.patch similarity index 100% rename from patches/api/0296-additions-to-PlayerGameModeChangeEvent.patch rename to patches/api/0297-additions-to-PlayerGameModeChangeEvent.patch diff --git a/patches/api/0297-ItemStack-repair-check-API.patch b/patches/api/0298-ItemStack-repair-check-API.patch similarity index 94% rename from patches/api/0297-ItemStack-repair-check-API.patch rename to patches/api/0298-ItemStack-repair-check-API.patch index 12d5ceff8..ce9919df1 100644 --- a/patches/api/0297-ItemStack-repair-check-API.patch +++ b/patches/api/0298-ItemStack-repair-check-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 2708718e0391960f9e784f38e5753d95e71de2fc..93d139cd498d0c9f616c077ce1c25e3f8e9f55b5 100644 +index 45a5e148ae5582a805e350b526cfb3ad87f6f945..d712a2c7a8ec02d3abbbcb8e616e002e5cdf1afe 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -165,6 +165,16 @@ public interface UnsafeValues { +@@ -175,6 +175,16 @@ public interface UnsafeValues { */ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack); diff --git a/patches/api/0298-More-Enchantment-API.patch b/patches/api/0299-More-Enchantment-API.patch similarity index 100% rename from patches/api/0298-More-Enchantment-API.patch rename to patches/api/0299-More-Enchantment-API.patch diff --git a/patches/api/0299-List-all-missing-hard-depends-not-just-first.patch b/patches/api/0300-List-all-missing-hard-depends-not-just-first.patch similarity index 100% rename from patches/api/0299-List-all-missing-hard-depends-not-just-first.patch rename to patches/api/0300-List-all-missing-hard-depends-not-just-first.patch diff --git a/patches/api/0300-Add-Mob-lookAt-API.patch b/patches/api/0301-Add-Mob-lookAt-API.patch similarity index 100% rename from patches/api/0300-Add-Mob-lookAt-API.patch rename to patches/api/0301-Add-Mob-lookAt-API.patch diff --git a/patches/api/0301-ItemStack-editMeta.patch b/patches/api/0302-ItemStack-editMeta.patch similarity index 100% rename from patches/api/0301-ItemStack-editMeta.patch rename to patches/api/0302-ItemStack-editMeta.patch diff --git a/patches/api/0302-Add-EntityInsideBlockEvent.patch b/patches/api/0303-Add-EntityInsideBlockEvent.patch similarity index 100% rename from patches/api/0302-Add-EntityInsideBlockEvent.patch rename to patches/api/0303-Add-EntityInsideBlockEvent.patch diff --git a/patches/api/0303-Attributes-API-for-item-defaults.patch b/patches/api/0304-Attributes-API-for-item-defaults.patch similarity index 94% rename from patches/api/0303-Attributes-API-for-item-defaults.patch rename to patches/api/0304-Attributes-API-for-item-defaults.patch index 708e878f3..58f5631c9 100644 --- a/patches/api/0303-Attributes-API-for-item-defaults.patch +++ b/patches/api/0304-Attributes-API-for-item-defaults.patch @@ -31,10 +31,10 @@ index 709ae1eaabd81ee712d7d6f353c4983f20f6dc4f..fb8758970a76ee263fc85aaccbafb0bf /** diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 93d139cd498d0c9f616c077ce1c25e3f8e9f55b5..eeac5e445dba5e1eace52e908d5146c079269c17 100644 +index d712a2c7a8ec02d3abbbcb8e616e002e5cdf1afe..2141396d252cb78630181785d5ae0c17f8f7df10 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -175,6 +175,18 @@ public interface UnsafeValues { +@@ -185,6 +185,18 @@ public interface UnsafeValues { */ public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial); diff --git a/patches/api/0304-Add-cause-to-Weather-ThunderChangeEvents.patch b/patches/api/0305-Add-cause-to-Weather-ThunderChangeEvents.patch similarity index 100% rename from patches/api/0304-Add-cause-to-Weather-ThunderChangeEvents.patch rename to patches/api/0305-Add-cause-to-Weather-ThunderChangeEvents.patch diff --git a/patches/api/0305-More-Lidded-Block-API.patch b/patches/api/0306-More-Lidded-Block-API.patch similarity index 100% rename from patches/api/0305-More-Lidded-Block-API.patch rename to patches/api/0306-More-Lidded-Block-API.patch diff --git a/patches/api/0306-Add-PlayerKickEvent-causes.patch b/patches/api/0307-Add-PlayerKickEvent-causes.patch similarity index 97% rename from patches/api/0306-Add-PlayerKickEvent-causes.patch rename to patches/api/0307-Add-PlayerKickEvent-causes.patch index 49d610755..8977bbbb3 100644 --- a/patches/api/0306-Add-PlayerKickEvent-causes.patch +++ b/patches/api/0307-Add-PlayerKickEvent-causes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerKickEvent causes diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 71de9f4c7f07c4c0b1155df14794de3ba8e28d69..c7d02e196d57f41c35d37e9a16d8e079a5c176ae 100644 +index d881ae7fb0c17242998c0a495ccd81802611410a..35be51b2b57acfc5dc165b22e16f499fac906e34 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -236,6 +236,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM diff --git a/patches/api/0307-Add-PufferFishStateChangeEvent.patch b/patches/api/0308-Add-PufferFishStateChangeEvent.patch similarity index 100% rename from patches/api/0307-Add-PufferFishStateChangeEvent.patch rename to patches/api/0308-Add-PufferFishStateChangeEvent.patch diff --git a/patches/api/0308-Add-BellRevealRaiderEvent.patch b/patches/api/0309-Add-BellRevealRaiderEvent.patch similarity index 100% rename from patches/api/0308-Add-BellRevealRaiderEvent.patch rename to patches/api/0309-Add-BellRevealRaiderEvent.patch diff --git a/patches/api/0309-Add-ElderGuardianAppearanceEvent.patch b/patches/api/0310-Add-ElderGuardianAppearanceEvent.patch similarity index 100% rename from patches/api/0309-Add-ElderGuardianAppearanceEvent.patch rename to patches/api/0310-Add-ElderGuardianAppearanceEvent.patch diff --git a/patches/api/0310-Add-more-line-of-sight-methods.patch b/patches/api/0311-Add-more-line-of-sight-methods.patch similarity index 95% rename from patches/api/0310-Add-more-line-of-sight-methods.patch rename to patches/api/0311-Add-more-line-of-sight-methods.patch index 9142f690a..28e2128ee 100644 --- a/patches/api/0310-Add-more-line-of-sight-methods.patch +++ b/patches/api/0311-Add-more-line-of-sight-methods.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add more line of sight methods diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index b29b313dfe6342460d5f1ff085a0a61b4604d5ea..abce27d50ef62f14948220272a2452874ae69836 100644 +index def9f0f9803e71cbe57abcffeb9114a5ab462e54..d149dd1d3d2703a428006e0c3ab5f9251e560882 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -76,6 +76,14 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0311-Add-more-LimitedRegion-API.patch b/patches/api/0312-Add-more-LimitedRegion-API.patch similarity index 100% rename from patches/api/0311-Add-more-LimitedRegion-API.patch rename to patches/api/0312-Add-more-LimitedRegion-API.patch diff --git a/patches/api/0312-Missing-Entity-Behavior-API.patch b/patches/api/0313-Missing-Entity-Behavior-API.patch similarity index 100% rename from patches/api/0312-Missing-Entity-Behavior-API.patch rename to patches/api/0313-Missing-Entity-Behavior-API.patch diff --git a/patches/api/0313-Add-Git-information-to-version-command-on-startup.patch b/patches/api/0314-Add-Git-information-to-version-command-on-startup.patch similarity index 98% rename from patches/api/0313-Add-Git-information-to-version-command-on-startup.patch rename to patches/api/0314-Add-Git-information-to-version-command-on-startup.patch index 56a17b9b8..ef7aa8edd 100644 --- a/patches/api/0313-Add-Git-information-to-version-command-on-startup.patch +++ b/patches/api/0314-Add-Git-information-to-version-command-on-startup.patch @@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..909617079db61b675cc7b60b44ef96b3 + } +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0ecff0322c3ff4e6e3c6fcaf72d0ab786ba423fa..c88eb8946d5ce145fc1cd27795826daeb7f27bff 100644 +index 7732d26277ca8b845898cb01c7623a2f175f0aaa..2af2a948dc9c0d4ad28fccb1c9a2b28d5db99203 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -53,6 +53,7 @@ import org.bukkit.util.CachedServerIcon; diff --git a/patches/api/0314-Adds-PlayerArmSwingEvent.patch b/patches/api/0315-Adds-PlayerArmSwingEvent.patch similarity index 100% rename from patches/api/0314-Adds-PlayerArmSwingEvent.patch rename to patches/api/0315-Adds-PlayerArmSwingEvent.patch diff --git a/patches/api/0315-Add-PlayerSignCommandPreprocessEvent.patch b/patches/api/0316-Add-PlayerSignCommandPreprocessEvent.patch similarity index 100% rename from patches/api/0315-Add-PlayerSignCommandPreprocessEvent.patch rename to patches/api/0316-Add-PlayerSignCommandPreprocessEvent.patch diff --git a/patches/api/0316-fix-empty-array-elements-in-command-arguments.patch b/patches/api/0317-fix-empty-array-elements-in-command-arguments.patch similarity index 100% rename from patches/api/0316-fix-empty-array-elements-in-command-arguments.patch rename to patches/api/0317-fix-empty-array-elements-in-command-arguments.patch diff --git a/patches/api/0317-Stinger-API.patch b/patches/api/0318-Stinger-API.patch similarity index 100% rename from patches/api/0317-Stinger-API.patch rename to patches/api/0318-Stinger-API.patch diff --git a/patches/api/0318-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch b/patches/api/0319-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch similarity index 100% rename from patches/api/0318-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch rename to patches/api/0319-Rewrite-LogEvents-to-contain-the-source-jars-in-stac.patch diff --git a/patches/api/0319-Add-PlayerSetSpawnEvent.patch b/patches/api/0320-Add-PlayerSetSpawnEvent.patch similarity index 100% rename from patches/api/0319-Add-PlayerSetSpawnEvent.patch rename to patches/api/0320-Add-PlayerSetSpawnEvent.patch diff --git a/patches/api/0320-Added-EntityDamageItemEvent.patch b/patches/api/0321-Added-EntityDamageItemEvent.patch similarity index 100% rename from patches/api/0320-Added-EntityDamageItemEvent.patch rename to patches/api/0321-Added-EntityDamageItemEvent.patch diff --git a/patches/api/0321-Make-EntityUnleashEvent-cancellable.patch b/patches/api/0322-Make-EntityUnleashEvent-cancellable.patch similarity index 100% rename from patches/api/0321-Make-EntityUnleashEvent-cancellable.patch rename to patches/api/0322-Make-EntityUnleashEvent-cancellable.patch diff --git a/patches/api/0322-Change-EnderEye-target-without-changing-other-things.patch b/patches/api/0323-Change-EnderEye-target-without-changing-other-things.patch similarity index 100% rename from patches/api/0322-Change-EnderEye-target-without-changing-other-things.patch rename to patches/api/0323-Change-EnderEye-target-without-changing-other-things.patch diff --git a/patches/api/0323-Add-BlockBreakBlockEvent.patch b/patches/api/0324-Add-BlockBreakBlockEvent.patch similarity index 100% rename from patches/api/0323-Add-BlockBreakBlockEvent.patch rename to patches/api/0324-Add-BlockBreakBlockEvent.patch diff --git a/patches/api/0324-Add-helpers-for-left-right-click-to-Action.patch b/patches/api/0325-Add-helpers-for-left-right-click-to-Action.patch similarity index 100% rename from patches/api/0324-Add-helpers-for-left-right-click-to-Action.patch rename to patches/api/0325-Add-helpers-for-left-right-click-to-Action.patch diff --git a/patches/api/0325-Option-to-prevent-NBT-copy-in-smithing-recipes.patch b/patches/api/0326-Option-to-prevent-NBT-copy-in-smithing-recipes.patch similarity index 100% rename from patches/api/0325-Option-to-prevent-NBT-copy-in-smithing-recipes.patch rename to patches/api/0326-Option-to-prevent-NBT-copy-in-smithing-recipes.patch diff --git a/patches/api/0326-More-CommandBlock-API.patch b/patches/api/0327-More-CommandBlock-API.patch similarity index 100% rename from patches/api/0326-More-CommandBlock-API.patch rename to patches/api/0327-More-CommandBlock-API.patch diff --git a/patches/api/0327-Fix-plugin-provides-load-order.patch b/patches/api/0328-Fix-plugin-provides-load-order.patch similarity index 100% rename from patches/api/0327-Fix-plugin-provides-load-order.patch rename to patches/api/0328-Fix-plugin-provides-load-order.patch diff --git a/patches/api/0328-Add-missing-team-sidebar-display-slots.patch b/patches/api/0329-Add-missing-team-sidebar-display-slots.patch similarity index 100% rename from patches/api/0328-Add-missing-team-sidebar-display-slots.patch rename to patches/api/0329-Add-missing-team-sidebar-display-slots.patch diff --git a/patches/api/0329-add-back-EntityPortalExitEvent.patch b/patches/api/0330-add-back-EntityPortalExitEvent.patch similarity index 100% rename from patches/api/0329-add-back-EntityPortalExitEvent.patch rename to patches/api/0330-add-back-EntityPortalExitEvent.patch diff --git a/patches/api/0330-Add-methods-to-find-targets-for-lightning-strikes.patch b/patches/api/0331-Add-methods-to-find-targets-for-lightning-strikes.patch similarity index 95% rename from patches/api/0330-Add-methods-to-find-targets-for-lightning-strikes.patch rename to patches/api/0331-Add-methods-to-find-targets-for-lightning-strikes.patch index 188fbbfd7..bba162689 100644 --- a/patches/api/0330-Add-methods-to-find-targets-for-lightning-strikes.patch +++ b/patches/api/0331-Add-methods-to-find-targets-for-lightning-strikes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add methods to find targets for lightning strikes diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index abce27d50ef62f14948220272a2452874ae69836..268d77210e47d5247ac9b82c344fac323b16a0c4 100644 +index d149dd1d3d2703a428006e0c3ab5f9251e560882..22191f733bbda0710ffae425fda1861e3c2ec87f 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -759,6 +759,37 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0331-Get-entity-default-attributes.patch b/patches/api/0332-Get-entity-default-attributes.patch similarity index 94% rename from patches/api/0331-Get-entity-default-attributes.patch rename to patches/api/0332-Get-entity-default-attributes.patch index 345875fc4..12f3ed8dc 100644 --- a/patches/api/0331-Get-entity-default-attributes.patch +++ b/patches/api/0332-Get-entity-default-attributes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Get entity default attributes diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index eeac5e445dba5e1eace52e908d5146c079269c17..2e1ec0aa44836ab5be944cf2dbd4601dfb43aed6 100644 +index 2141396d252cb78630181785d5ae0c17f8f7df10..b78d18fc09cee98f0eac907409188c35b3c137fc 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -193,5 +193,22 @@ public interface UnsafeValues { +@@ -203,5 +203,22 @@ public interface UnsafeValues { * @return the server's protocol version */ int getProtocolVersion(); diff --git a/patches/api/0332-Left-handed-API.patch b/patches/api/0333-Left-handed-API.patch similarity index 100% rename from patches/api/0332-Left-handed-API.patch rename to patches/api/0333-Left-handed-API.patch diff --git a/patches/api/0333-Add-advancement-display-API.patch b/patches/api/0334-Add-advancement-display-API.patch similarity index 100% rename from patches/api/0333-Add-advancement-display-API.patch rename to patches/api/0334-Add-advancement-display-API.patch diff --git a/patches/api/0334-Add-ItemFactory-getMonsterEgg-API.patch b/patches/api/0335-Add-ItemFactory-getMonsterEgg-API.patch similarity index 100% rename from patches/api/0334-Add-ItemFactory-getMonsterEgg-API.patch rename to patches/api/0335-Add-ItemFactory-getMonsterEgg-API.patch diff --git a/patches/api/0335-Add-critical-damage-API.patch b/patches/api/0336-Add-critical-damage-API.patch similarity index 100% rename from patches/api/0335-Add-critical-damage-API.patch rename to patches/api/0336-Add-critical-damage-API.patch diff --git a/patches/api/0336-Fix-issues-with-mob-conversion.patch b/patches/api/0337-Fix-issues-with-mob-conversion.patch similarity index 100% rename from patches/api/0336-Fix-issues-with-mob-conversion.patch rename to patches/api/0337-Fix-issues-with-mob-conversion.patch diff --git a/patches/api/0337-Add-isCollidable-methods-to-various-places.patch b/patches/api/0338-Add-isCollidable-methods-to-various-places.patch similarity index 95% rename from patches/api/0337-Add-isCollidable-methods-to-various-places.patch rename to patches/api/0338-Add-isCollidable-methods-to-various-places.patch index 3a0f511ff..ac6c443e6 100644 --- a/patches/api/0337-Add-isCollidable-methods-to-various-places.patch +++ b/patches/api/0338-Add-isCollidable-methods-to-various-places.patch @@ -26,10 +26,10 @@ index fb8758970a76ee263fc85aaccbafb0bf1745afb8..ef7054fec75d91082be27fdd2a06469f /** diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 2e1ec0aa44836ab5be944cf2dbd4601dfb43aed6..329612597a2cdf556f5ca970f5409e1c77a5d911 100644 +index b78d18fc09cee98f0eac907409188c35b3c137fc..54b0fe21d3b6379e6550a3b1dc81c2a44e7699da 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java -@@ -210,5 +210,14 @@ public interface UnsafeValues { +@@ -220,5 +220,14 @@ public interface UnsafeValues { * @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first) */ @org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey); diff --git a/patches/api/0338-Goat-ram-API.patch b/patches/api/0339-Goat-ram-API.patch similarity index 100% rename from patches/api/0338-Goat-ram-API.patch rename to patches/api/0339-Goat-ram-API.patch diff --git a/patches/api/0339-Add-API-for-resetting-a-single-score.patch b/patches/api/0340-Add-API-for-resetting-a-single-score.patch similarity index 100% rename from patches/api/0339-Add-API-for-resetting-a-single-score.patch rename to patches/api/0340-Add-API-for-resetting-a-single-score.patch diff --git a/patches/api/0340-Add-Raw-Byte-Entity-Serialization.patch b/patches/api/0341-Add-Raw-Byte-Entity-Serialization.patch similarity index 100% rename from patches/api/0340-Add-Raw-Byte-Entity-Serialization.patch rename to patches/api/0341-Add-Raw-Byte-Entity-Serialization.patch diff --git a/patches/api/0341-Add-PlayerItemFrameChangeEvent.patch b/patches/api/0342-Add-PlayerItemFrameChangeEvent.patch similarity index 100% rename from patches/api/0341-Add-PlayerItemFrameChangeEvent.patch rename to patches/api/0342-Add-PlayerItemFrameChangeEvent.patch diff --git a/patches/api/0342-Add-player-health-update-API.patch b/patches/api/0343-Add-player-health-update-API.patch similarity index 100% rename from patches/api/0342-Add-player-health-update-API.patch rename to patches/api/0343-Add-player-health-update-API.patch diff --git a/patches/api/0343-Allow-delegation-to-vanilla-chunk-gen.patch b/patches/api/0344-Allow-delegation-to-vanilla-chunk-gen.patch similarity index 100% rename from patches/api/0343-Allow-delegation-to-vanilla-chunk-gen.patch rename to patches/api/0344-Allow-delegation-to-vanilla-chunk-gen.patch diff --git a/patches/api/0344-Add-more-Campfire-API.patch b/patches/api/0345-Add-more-Campfire-API.patch similarity index 100% rename from patches/api/0344-Add-more-Campfire-API.patch rename to patches/api/0345-Add-more-Campfire-API.patch diff --git a/patches/api/0345-Move-VehicleCollisionEvent-HandlerList-up.patch b/patches/api/0346-Move-VehicleCollisionEvent-HandlerList-up.patch similarity index 100% rename from patches/api/0345-Move-VehicleCollisionEvent-HandlerList-up.patch rename to patches/api/0346-Move-VehicleCollisionEvent-HandlerList-up.patch diff --git a/patches/api/0346-Improve-scoreboard-entries.patch b/patches/api/0347-Improve-scoreboard-entries.patch similarity index 100% rename from patches/api/0346-Improve-scoreboard-entries.patch rename to patches/api/0347-Improve-scoreboard-entries.patch diff --git a/patches/api/0347-Entity-powdered-snow-API.patch b/patches/api/0348-Entity-powdered-snow-API.patch similarity index 100% rename from patches/api/0347-Entity-powdered-snow-API.patch rename to patches/api/0348-Entity-powdered-snow-API.patch diff --git a/patches/api/0348-Add-API-for-item-entity-health.patch b/patches/api/0349-Add-API-for-item-entity-health.patch similarity index 100% rename from patches/api/0348-Add-API-for-item-entity-health.patch rename to patches/api/0349-Add-API-for-item-entity-health.patch diff --git a/patches/api/0349-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch b/patches/api/0350-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch similarity index 100% rename from patches/api/0349-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch rename to patches/api/0350-Expose-isFuel-and-canSmelt-methods-to-FurnaceInvento.patch diff --git a/patches/api/0350-Bucketable-API.patch b/patches/api/0351-Bucketable-API.patch similarity index 100% rename from patches/api/0350-Bucketable-API.patch rename to patches/api/0351-Bucketable-API.patch diff --git a/patches/api/0351-System-prop-for-default-config-comment-parsing.patch b/patches/api/0352-System-prop-for-default-config-comment-parsing.patch similarity index 100% rename from patches/api/0351-System-prop-for-default-config-comment-parsing.patch rename to patches/api/0352-System-prop-for-default-config-comment-parsing.patch diff --git a/patches/api/0352-Expose-vanilla-BiomeProvider-from-WorldInfo.patch b/patches/api/0353-Expose-vanilla-BiomeProvider-from-WorldInfo.patch similarity index 100% rename from patches/api/0352-Expose-vanilla-BiomeProvider-from-WorldInfo.patch rename to patches/api/0353-Expose-vanilla-BiomeProvider-from-WorldInfo.patch diff --git a/patches/api/0353-Remove-upstream-snakeyaml-fix.patch b/patches/api/0354-Remove-upstream-snakeyaml-fix.patch similarity index 100% rename from patches/api/0353-Remove-upstream-snakeyaml-fix.patch rename to patches/api/0354-Remove-upstream-snakeyaml-fix.patch diff --git a/patches/api/0354-Add-new-overload-to-PersistentDataContainer-has.patch b/patches/api/0355-Add-new-overload-to-PersistentDataContainer-has.patch similarity index 100% rename from patches/api/0354-Add-new-overload-to-PersistentDataContainer-has.patch rename to patches/api/0355-Add-new-overload-to-PersistentDataContainer-has.patch diff --git a/patches/api/0355-Multiple-Entries-with-Scoreboards.patch b/patches/api/0356-Multiple-Entries-with-Scoreboards.patch similarity index 100% rename from patches/api/0355-Multiple-Entries-with-Scoreboards.patch rename to patches/api/0356-Multiple-Entries-with-Scoreboards.patch diff --git a/patches/api/0356-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch b/patches/api/0357-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch similarity index 100% rename from patches/api/0356-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch rename to patches/api/0357-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch diff --git a/patches/api/0357-Warn-on-strange-EventHandler-return-types.patch b/patches/api/0358-Warn-on-strange-EventHandler-return-types.patch similarity index 100% rename from patches/api/0357-Warn-on-strange-EventHandler-return-types.patch rename to patches/api/0358-Warn-on-strange-EventHandler-return-types.patch diff --git a/patches/api/0358-Multi-Block-Change-API.patch b/patches/api/0359-Multi-Block-Change-API.patch similarity index 94% rename from patches/api/0358-Multi-Block-Change-API.patch rename to patches/api/0359-Multi-Block-Change-API.patch index c0bde68f1..958908136 100644 --- a/patches/api/0358-Multi-Block-Change-API.patch +++ b/patches/api/0359-Multi-Block-Change-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Multi Block Change API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 5a1b733934bfe4388dad59125caa9c2d45df5dd1..131daee2b29f7016463a00ce7927dff7b0a1b1b4 100644 +index 3a96d1fe95952a1b0be0ef7b3cdf431e5bb8b54f..f954801f6a5d465b8545e75d7ff5af0352d6ec0d 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -579,6 +579,27 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM diff --git a/patches/api/0359-Fix-NotePlayEvent.patch b/patches/api/0360-Fix-NotePlayEvent.patch similarity index 100% rename from patches/api/0359-Fix-NotePlayEvent.patch rename to patches/api/0360-Fix-NotePlayEvent.patch diff --git a/patches/api/0360-Freeze-Tick-Lock-API.patch b/patches/api/0361-Freeze-Tick-Lock-API.patch similarity index 100% rename from patches/api/0360-Freeze-Tick-Lock-API.patch rename to patches/api/0361-Freeze-Tick-Lock-API.patch diff --git a/patches/api/0361-Dolphin-API.patch b/patches/api/0362-Dolphin-API.patch similarity index 100% rename from patches/api/0361-Dolphin-API.patch rename to patches/api/0362-Dolphin-API.patch diff --git a/patches/api/0362-More-PotionEffectType-API.patch b/patches/api/0363-More-PotionEffectType-API.patch similarity index 92% rename from patches/api/0362-More-PotionEffectType-API.patch rename to patches/api/0363-More-PotionEffectType-API.patch index 4e999e136..6340f5fd9 100644 --- a/patches/api/0362-More-PotionEffectType-API.patch +++ b/patches/api/0363-More-PotionEffectType-API.patch @@ -5,14 +5,13 @@ Subject: [PATCH] More PotionEffectType API diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index a696fcaffa03af9e6c92e2ef3e12b38eb59e5db4..6242336de18fdd708cc3d7b745cbbace13140bc0 100644 +index bfe0d98e6032c7633d6bb97382426f94fb437430..798aab0d644ca383ff4391685d854af65925fb0c 100644 --- a/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java -@@ -189,6 +189,27 @@ public interface Registry extends Iterable { - return GameEvent.getByKey(key); - } - }; -+ // Paper start +@@ -195,6 +195,25 @@ public interface Registry extends Iterable { + * @see io.papermc.paper.world.structure.ConfiguredStructure + */ + Registry CONFIGURED_STRUCTURE = Bukkit.getUnsafe().registryFor(io.papermc.paper.world.structure.ConfiguredStructure.class); + /** + * Potion effect types. + * @@ -32,10 +31,9 @@ index a696fcaffa03af9e6c92e2ef3e12b38eb59e5db4..6242336de18fdd708cc3d7b745cbbace + return Arrays.stream(org.bukkit.potion.PotionEffectType.values()).iterator(); + } + }; -+ // Paper end + // Paper end /** - * Get the object by its key. diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java index 22c28a503732671bc84c51372262e909d035c1fa..06e0f13d658b63b1fa984abb515eb0de704f9215 100644 --- a/src/main/java/org/bukkit/potion/PotionEffectType.java diff --git a/patches/api/0363-Expand-the-Registry-API.patch b/patches/api/0364-Expand-the-Registry-API.patch similarity index 86% rename from patches/api/0363-Expand-the-Registry-API.patch rename to patches/api/0364-Expand-the-Registry-API.patch index 43d9ced4d..87956152e 100644 --- a/patches/api/0363-Expand-the-Registry-API.patch +++ b/patches/api/0364-Expand-the-Registry-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expand the Registry API diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index 6242336de18fdd708cc3d7b745cbbace13140bc0..661d424c609a01ad9bee837b4069d9e4e98d20c0 100644 +index 798aab0d644ca383ff4391685d854af65925fb0c..41363490b1e72d53ab3f1f26fe464858bb7b8f72 100644 --- a/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java -@@ -209,6 +209,25 @@ public interface Registry extends Iterable { +@@ -214,6 +214,25 @@ public interface Registry extends Iterable { return Arrays.stream(org.bukkit.potion.PotionEffectType.values()).iterator(); } }; diff --git a/patches/api/0364-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/api/0365-API-for-creating-command-sender-which-forwards-feedb.patch similarity index 100% rename from patches/api/0364-API-for-creating-command-sender-which-forwards-feedb.patch rename to patches/api/0365-API-for-creating-command-sender-which-forwards-feedb.patch diff --git a/patches/api/0365-Implement-regenerateChunk.patch b/patches/api/0366-Implement-regenerateChunk.patch similarity index 91% rename from patches/api/0365-Implement-regenerateChunk.patch rename to patches/api/0366-Implement-regenerateChunk.patch index cd1a358e5..fe3631f74 100644 --- a/patches/api/0365-Implement-regenerateChunk.patch +++ b/patches/api/0366-Implement-regenerateChunk.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement regenerateChunk diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 268d77210e47d5247ac9b82c344fac323b16a0c4..d63570d60481e864a15d5594ac54c372151093d4 100644 +index 22191f733bbda0710ffae425fda1861e3c2ec87f..8a688583e65cd22e0417f9fd24e51803486d095e 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -507,8 +507,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0366-Don-t-load-plugins-prefixed-with-a-dot.patch b/patches/api/0367-Don-t-load-plugins-prefixed-with-a-dot.patch similarity index 100% rename from patches/api/0366-Don-t-load-plugins-prefixed-with-a-dot.patch rename to patches/api/0367-Don-t-load-plugins-prefixed-with-a-dot.patch diff --git a/patches/api/0367-Add-GameEvent-tags.patch b/patches/api/0368-Add-GameEvent-tags.patch similarity index 100% rename from patches/api/0367-Add-GameEvent-tags.patch rename to patches/api/0368-Add-GameEvent-tags.patch diff --git a/patches/api/0368-Furnace-RecipesUsed-API.patch b/patches/api/0369-Furnace-RecipesUsed-API.patch similarity index 100% rename from patches/api/0368-Furnace-RecipesUsed-API.patch rename to patches/api/0369-Furnace-RecipesUsed-API.patch diff --git a/patches/api/0369-Configurable-sculk-sensor-listener-range.patch b/patches/api/0370-Configurable-sculk-sensor-listener-range.patch similarity index 100% rename from patches/api/0369-Configurable-sculk-sensor-listener-range.patch rename to patches/api/0370-Configurable-sculk-sensor-listener-range.patch diff --git a/patches/api/0370-Add-missing-block-data-mins-and-maxes.patch b/patches/api/0371-Add-missing-block-data-mins-and-maxes.patch similarity index 100% rename from patches/api/0370-Add-missing-block-data-mins-and-maxes.patch rename to patches/api/0371-Add-missing-block-data-mins-and-maxes.patch diff --git a/patches/api/0371-Custom-Potion-Mixes.patch b/patches/api/0372-Custom-Potion-Mixes.patch similarity index 100% rename from patches/api/0371-Custom-Potion-Mixes.patch rename to patches/api/0372-Custom-Potion-Mixes.patch diff --git a/patches/server/0579-Add-PaperRegistry.patch b/patches/server/0579-Add-PaperRegistry.patch new file mode 100644 index 000000000..0b14017da --- /dev/null +++ b/patches/server/0579-Add-PaperRegistry.patch @@ -0,0 +1,220 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Wed, 2 Mar 2022 13:33:08 -0800 +Subject: [PATCH] Add PaperRegistry + +PaperRegistry is a server-backed impl of bukkit's Registry interface + +diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistry.java b/src/main/java/io/papermc/paper/registry/PaperRegistry.java +new file mode 100644 +index 0000000000000000000000000000000000000000..51cec316df8bc0c7d36e0b1dfdf8d9fae04e3606 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/PaperRegistry.java +@@ -0,0 +1,145 @@ ++package io.papermc.paper.registry; ++ ++import com.google.common.base.Preconditions; ++import com.google.common.base.Suppliers; ++import net.minecraft.core.Holder; ++import net.minecraft.core.Registry; ++import net.minecraft.core.RegistryAccess; ++import net.minecraft.resources.ResourceKey; ++import net.minecraft.resources.ResourceLocation; ++import net.minecraft.server.MinecraftServer; ++import org.bukkit.Keyed; ++import org.bukkit.NamespacedKey; ++import org.bukkit.craftbukkit.util.CraftNamespacedKey; ++import org.checkerframework.checker.nullness.qual.NonNull; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.checkerframework.framework.qual.DefaultQualifier; ++ ++import java.util.Collections; ++import java.util.HashMap; ++import java.util.Iterator; ++import java.util.Map; ++import java.util.Objects; ++import java.util.Optional; ++import java.util.function.Supplier; ++ ++@DefaultQualifier(NonNull.class) ++public abstract class PaperRegistry implements org.bukkit.Registry { ++ ++ @SuppressWarnings("FieldMayBeFinal") // non-final for testing ++ private static Supplier REGISTRY_ACCESS = Suppliers.memoize(() -> MinecraftServer.getServer().registryAccess()); ++ private static final Map, PaperRegistry> INTERNAL_REGISTRIES = new HashMap<>(); ++ public static final Map, PaperRegistry> REGISTRIES = Collections.unmodifiableMap(INTERNAL_REGISTRIES); ++ private static final Map, PaperRegistry> REGISTRY_BY_API_CLASS = new HashMap<>(); ++ private static final Map>, PaperRegistry> REGISTRY_BY_RES_KEY = new HashMap<>(); ++ ++ private boolean registered; ++ private final RegistryKey registryKey; ++ private final Supplier> registry; ++ private final Map cache = new HashMap<>(); ++ ++ public PaperRegistry(RegistryKey registryKey) { ++ this.registryKey = registryKey; ++ this.registry = Suppliers.memoize(() -> REGISTRY_ACCESS.get().registryOrThrow(this.registryKey.resourceKey())); ++ } ++ ++ @Override ++ public @Nullable API get(NamespacedKey key) { ++ return this.cache.computeIfAbsent(key, k -> { ++ final @Nullable MINECRAFT nms = this.registry.get().get(CraftNamespacedKey.toMinecraft(k)); ++ if (nms != null) { ++ return this.convertToApi(k, nms); ++ } ++ return null; ++ }); ++ } ++ ++ public abstract API convertToApi(NamespacedKey key, MINECRAFT nms); ++ ++ public API convertToApi(ResourceLocation resourceLocation, MINECRAFT nms) { ++ return this.convertToApi(CraftNamespacedKey.fromMinecraft(resourceLocation), nms); ++ } ++ ++ public API convertToApi(Holder nmsHolder) { ++ final Optional> key = nmsHolder.unwrapKey(); ++ if (nmsHolder.isBound() && key.isPresent()) { ++ return this.convertToApi(key.get().location(), nmsHolder.value()); ++ } else if (!nmsHolder.isBound() && key.isPresent()) { ++ return this.convertToApi(key.get().location(), this.registry.get().getOrThrow(key.get())); ++ } else if (nmsHolder.isBound() && key.isEmpty()) { ++ final @Nullable ResourceLocation loc = this.registry.get().getKey(nmsHolder.value()); ++ if (loc != null) { ++ return this.convertToApi(loc, nmsHolder.value()); ++ } ++ } ++ throw new IllegalStateException("Cannot convert " + nmsHolder + " to an API type in: " + this.registryKey); ++ } ++ ++ public MINECRAFT getMinecraftValue(API apiValue) { ++ return this.registry.get().getOptional(CraftNamespacedKey.toMinecraft(apiValue.getKey())).orElseThrow(); ++ } ++ ++ public Holder getMinecraftHolder(API apiValue) { ++ return this.registry.get().getHolderOrThrow(ResourceKey.create(this.registryKey.resourceKey(), CraftNamespacedKey.toMinecraft(apiValue.getKey()))); ++ } ++ ++ @Override ++ public Iterator iterator() { ++ return this.registry.get().keySet().stream().map(key -> this.get(CraftNamespacedKey.fromMinecraft(key))).iterator(); ++ } ++ ++ public void clearCache() { ++ this.cache.clear(); ++ } ++ ++ public void register() { ++ if (this.registered) { ++ throw new IllegalStateException("Already registered: " + this.registryKey.apiClass()); ++ } ++ INTERNAL_REGISTRIES.put(this.registryKey, this); ++ REGISTRY_BY_API_CLASS.put(this.registryKey.apiClass(), this); ++ REGISTRY_BY_RES_KEY.put(this.registryKey.resourceKey(), this); ++ this.registered = true; ++ } ++ ++ @Override ++ public boolean equals(@Nullable Object o) { ++ if (this == o) return true; ++ if (o == null || !PaperRegistry.class.isAssignableFrom(o.getClass())) return false; ++ PaperRegistry that = (PaperRegistry) o; ++ return this.registryKey.equals(that.registryKey); ++ } ++ ++ @Override ++ public int hashCode() { ++ return Objects.hash(this.registryKey); ++ } ++ ++ protected static Supplier> registryFor(ResourceKey> registryKey) { ++ return Suppliers.memoize(() -> REGISTRY_ACCESS.get().registryOrThrow(registryKey)); ++ } ++ ++ public static void clearCaches() { ++ for (PaperRegistry registry : INTERNAL_REGISTRIES.values()) { ++ registry.clearCache(); ++ } ++ } ++ ++ @SuppressWarnings("unchecked") ++ public static PaperRegistry getRegistry(Class classOfT) { ++ Preconditions.checkArgument(REGISTRY_BY_API_CLASS.containsKey(classOfT), "No registry for that type"); ++ return (PaperRegistry) REGISTRY_BY_API_CLASS.get(classOfT); ++ } ++ ++ @SuppressWarnings("unchecked") ++ public static PaperRegistry getRegistry(ResourceKey> resourceKey) { ++ Preconditions.checkArgument(REGISTRY_BY_RES_KEY.containsKey(resourceKey)); ++ return (PaperRegistry) REGISTRY_BY_RES_KEY.get(resourceKey); ++ } ++ ++ @SuppressWarnings("unchecked") ++ public static PaperRegistry getRegistry(RegistryKey registryKey) { ++ Preconditions.checkArgument(INTERNAL_REGISTRIES.containsKey(registryKey)); ++ return (PaperRegistry) INTERNAL_REGISTRIES.get(registryKey); ++ } ++} +diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java +new file mode 100644 +index 0000000000000000000000000000000000000000..6f39e343147803e15e7681c993b8797a629702e7 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java +@@ -0,0 +1,8 @@ ++package io.papermc.paper.registry; ++ ++import net.minecraft.core.Registry; ++import net.minecraft.resources.ResourceKey; ++import org.bukkit.Keyed; ++ ++public record RegistryKey(Class apiClass, ResourceKey> resourceKey) { ++} +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 0f03525066b818a81583618e9a80f245032493b7..6d1dd3d33bcaa7a1262a53c4fed57564c74df286 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -2038,6 +2038,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop Registry registryFor(Class classOfT) { ++ return io.papermc.paper.registry.PaperRegistry.getRegistry(classOfT); ++ } + // Paper end + + /** +diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java +index d6b6b7a3d2949126520e8256563afeb2b43bf12c..37934f0da922d696373e7a3a8cf976fcb9015271 100644 +--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java ++++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java +@@ -38,6 +38,15 @@ public abstract class AbstractTestingBase { + MultiPackResourceManager resourceManager = new MultiPackResourceManager(PackType.SERVER_DATA, Collections.singletonList(new VanillaPackResources(ServerPacksSource.BUILT_IN_METADATA, "minecraft"))); + // add tags and loot tables for unit tests + RegistryAccess.Frozen registry = RegistryAccess.builtinCopy().freeze(); ++ // Paper start ++ try { ++ java.lang.reflect.Field field = io.papermc.paper.registry.PaperRegistry.class.getDeclaredField("REGISTRY_ACCESS"); ++ field.trySetAccessible(); ++ field.set(null, com.google.common.base.Suppliers.ofInstance(registry)); ++ } catch (ReflectiveOperationException ex) { ++ throw new IllegalStateException("Could not reflectively set RegistryAccess in PaperRegistry", ex); ++ } ++ // Paper end + // Register vanilla pack + DATA_PACK = ReloadableServerResources.loadResources(resourceManager, registry, Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join(); + // Bind tags diff --git a/patches/server/0579-Add-StructureLocateEvent.patch b/patches/server/0579-Add-StructureLocateEvent.patch deleted file mode 100644 index 06a35aac4..000000000 --- a/patches/server/0579-Add-StructureLocateEvent.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dfsek -Date: Wed, 16 Sep 2020 01:12:29 -0700 -Subject: [PATCH] Add StructureLocateEvent - - -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 f9fc2fc63080a60fe61ebb08ddd93c4f189df84d..4864fce027b0871e50b2060880be9e24bfdd3887 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -294,6 +294,20 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource { - - @Nullable - public Pair>> findNearestMapFeature(ServerLevel worldserver, HolderSet> holderset, BlockPos center, int radius, boolean skipExistingChunks) { -+ // Paper start -+ /*org.bukkit.World world1 = worldserver.getWorld(); -+ org.bukkit.Location originLocation = new org.bukkit.Location(world1, center.getX(), center.getY(), center.getZ()); -+ io.papermc.paper.event.world.StructureLocateEvent event = new io.papermc.paper.event.world.StructureLocateEvent(world1, originLocation, org.bukkit.StructureType.getStructureTypes().get(structureFeature.getFeatureName()), radius, skipExistingChunks); -+ if(!event.callEvent()) return null; -+ // If event call set a final location, skip structure finding and just return set result. -+ if(event.getResult() != null) return new BlockPos(event.getResult().getBlockX(), event.getResult().getBlockY(), event.getResult().getBlockZ()); -+ // Get origin location (re)defined by event call. -+ center = new BlockPos(event.getOrigin().getBlockX(), event.getOrigin().getBlockY(), event.getOrigin().getBlockZ()); -+ // Get radius and whether to find unexplored structures (re)defined by event call. -+ radius = event.getRadius(); -+ skipExistingChunks = event.shouldFindUnexplored(); -+ structureFeature = StructureFeature.STRUCTURES_REGISTRY.get(event.getType().getName());*/ -+ // Paper end - Set> set = (Set) holderset.stream().flatMap((holder) -> { - return ((ConfiguredStructureFeature) holder.value()).biomes().stream(); - }).collect(Collectors.toSet()); diff --git a/patches/server/0580-Add-StructuresLocateEvent.patch b/patches/server/0580-Add-StructuresLocateEvent.patch new file mode 100644 index 000000000..3dd19fb95 --- /dev/null +++ b/patches/server/0580-Add-StructuresLocateEvent.patch @@ -0,0 +1,224 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: dfsek +Date: Wed, 16 Sep 2020 01:12:29 -0700 +Subject: [PATCH] Add StructuresLocateEvent + +Co-authored-by: Jake Potrebic + +diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java +index 6f39e343147803e15e7681c993b8797a629702e7..cbff75f19e54b37c762b209b04f6d4799152cf5b 100644 +--- a/src/main/java/io/papermc/paper/registry/RegistryKey.java ++++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java +@@ -1,8 +1,13 @@ + package io.papermc.paper.registry; + ++import io.papermc.paper.world.structure.ConfiguredStructure; + import net.minecraft.core.Registry; + import net.minecraft.resources.ResourceKey; ++import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; + import org.bukkit.Keyed; + + public record RegistryKey(Class apiClass, ResourceKey> resourceKey) { ++ ++ public static final RegistryKey> CONFIGURED_STRUCTURE_REGISTRY = new RegistryKey<>(ConfiguredStructure.class, Registry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY); ++ + } +diff --git a/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java b/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java +new file mode 100644 +index 0000000000000000000000000000000000000000..41f6c2e1e60fc32e6393097711412ca2ad643e57 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java +@@ -0,0 +1,42 @@ ++package io.papermc.paper.world.structure; ++ ++import io.papermc.paper.registry.PaperRegistry; ++import io.papermc.paper.registry.RegistryKey; ++import net.minecraft.core.Registry; ++import net.minecraft.resources.ResourceLocation; ++import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; ++import net.minecraft.world.level.levelgen.feature.StructureFeature; ++import org.bukkit.NamespacedKey; ++import org.bukkit.StructureType; ++import org.checkerframework.checker.nullness.qual.NonNull; ++import org.checkerframework.framework.qual.DefaultQualifier; ++ ++import java.util.Objects; ++import java.util.function.Supplier; ++ ++@DefaultQualifier(NonNull.class) ++public final class PaperConfiguredStructure { ++ ++ private PaperConfiguredStructure() { ++ } ++ ++ public static void init() { ++ new ConfiguredStructureRegistry().register(); ++ } ++ ++ static final class ConfiguredStructureRegistry extends PaperRegistry> { ++ ++ private static final Supplier>> STRUCTURE_FEATURE_REGISTRY = registryFor(Registry.STRUCTURE_FEATURE_REGISTRY); ++ ++ public ConfiguredStructureRegistry() { ++ super(RegistryKey.CONFIGURED_STRUCTURE_REGISTRY); ++ } ++ ++ @Override ++ public ConfiguredStructure convertToApi(NamespacedKey key, ConfiguredStructureFeature nms) { ++ final ResourceLocation structureFeatureLoc = Objects.requireNonNull(STRUCTURE_FEATURE_REGISTRY.get().getKey(nms.feature)); ++ final StructureType structureType = Objects.requireNonNull(StructureType.getStructureTypes().get(structureFeatureLoc.getPath()), structureFeatureLoc + " could not be converted to an API type"); ++ return new ConfiguredStructure(key, structureType); ++ } ++ } ++} +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 6d1dd3d33bcaa7a1262a53c4fed57564c74df286..8d197cc55d0afab1bb247623777f6cd8db231846 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -2038,7 +2038,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop>> findNearestMapFeature(ServerLevel worldserver, HolderSet> holderset, BlockPos center, int radius, boolean skipExistingChunks) { ++ // Paper start - StructureLocateEvent ++ final org.bukkit.World world = worldserver.getWorld(); ++ final org.bukkit.Location origin = net.minecraft.server.MCUtil.toLocation(worldserver, center); ++ final var paperRegistry = io.papermc.paper.registry.PaperRegistry.getRegistry(io.papermc.paper.registry.RegistryKey.CONFIGURED_STRUCTURE_REGISTRY); ++ final List configuredStructures = new ArrayList<>(); ++ for (Holder> holder : holderset) { ++ configuredStructures.add(paperRegistry.convertToApi(holder)); ++ } ++ final io.papermc.paper.event.world.StructuresLocateEvent event = new io.papermc.paper.event.world.StructuresLocateEvent(world, origin, configuredStructures, radius, skipExistingChunks); ++ if (!event.callEvent()) { ++ return null; ++ } ++ if (event.getResult() != null) { ++ return Pair.of(net.minecraft.server.MCUtil.toBlockPosition(event.getResult().position()), paperRegistry.getMinecraftHolder(event.getResult().configuredStructure())); ++ } ++ center = net.minecraft.server.MCUtil.toBlockPosition(event.getOrigin()); ++ radius = event.getRadius(); ++ skipExistingChunks = event.shouldFindUnexplored(); ++ holderset = HolderSet.direct(paperRegistry::getMinecraftHolder, event.getConfiguredStructures()); ++ // Paper end + Set> set = (Set) holderset.stream().flatMap((holder) -> { + return ((ConfiguredStructureFeature) holder.value()).biomes().stream(); + }).collect(Collectors.toSet()); +diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/ConfiguredStructureFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/ConfiguredStructureFeature.java +index af9ef29f5c5a600e4544ba735c833699cc93f93a..473a54963fbe08beeff26a828827f9f72d8a29b8 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/feature/ConfiguredStructureFeature.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/ConfiguredStructureFeature.java +@@ -38,6 +38,7 @@ public class ConfiguredStructureFeature biomes; + public final Map spawnOverrides; + public final boolean adaptNoise; ++ static { io.papermc.paper.world.structure.PaperConfiguredStructure.init(); } // Paper + + public ConfiguredStructureFeature(F feature, FC config, HolderSet biomes, boolean bl, Map map) { + this.feature = feature; +diff --git a/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java b/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java +new file mode 100644 +index 0000000000000000000000000000000000000000..29c0209327374d5a4dad4e3bacdba7fa56d80749 +--- /dev/null ++++ b/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java +@@ -0,0 +1,89 @@ ++package io.papermc.paper.world.structure; ++ ++import io.papermc.paper.registry.Reference; ++import net.minecraft.data.BuiltinRegistries; ++import net.minecraft.resources.ResourceKey; ++import net.minecraft.resources.ResourceLocation; ++import net.minecraft.server.Bootstrap; ++import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature; ++import net.minecraft.world.level.levelgen.structure.BuiltinStructures; ++import org.bukkit.NamespacedKey; ++import org.bukkit.craftbukkit.util.CraftNamespacedKey; ++import org.bukkit.support.AbstractTestingBase; ++import org.junit.AfterClass; ++import org.junit.BeforeClass; ++import org.junit.Test; ++ ++import java.io.PrintStream; ++import java.lang.reflect.Field; ++import java.lang.reflect.Modifier; ++import java.util.LinkedHashMap; ++import java.util.Map; ++import java.util.StringJoiner; ++ ++import static org.junit.Assert.assertEquals; ++import static org.junit.Assert.assertNotNull; ++import static org.junit.Assert.assertTrue; ++ ++public class ConfiguredStructureTest extends AbstractTestingBase { ++ ++ private static final Map BUILT_IN_STRUCTURES = new LinkedHashMap<>(); ++ private static final Map> DEFAULT_CONFIGURED_STRUCTURES = new LinkedHashMap<>(); ++ ++ private static PrintStream out; ++ ++ @BeforeClass ++ public static void collectStructures() throws ReflectiveOperationException { ++ out = System.out; ++ System.setOut(Bootstrap.STDOUT); ++ for (Field field : BuiltinStructures.class.getDeclaredFields()) { ++ if (field.getType().equals(ResourceKey.class) && Modifier.isStatic(field.getModifiers())) { ++ BUILT_IN_STRUCTURES.put(((ResourceKey) field.get(null)).location(), field.getName()); ++ } ++ } ++ for (Field field : ConfiguredStructure.class.getDeclaredFields()) { ++ if (field.getType().equals(Reference.class) && Modifier.isStatic(field.getModifiers())) { ++ final Reference ref = (Reference) field.get(null); ++ DEFAULT_CONFIGURED_STRUCTURES.put(ref.getKey(), ref); ++ } ++ } ++ } ++ ++ @Test ++ public void testMinecraftToApi() { ++ assertEquals("configured structure maps should be the same size", BUILT_IN_STRUCTURES.size(), BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE.size()); ++ ++ Map> missing = new LinkedHashMap<>(); ++ for (ConfiguredStructureFeature feature : BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE) { ++ final ResourceLocation key = BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE.getKey(feature); ++ assertNotNull("Missing built-in registry key", key); ++ if (DEFAULT_CONFIGURED_STRUCTURES.get(CraftNamespacedKey.fromMinecraft(key)) == null) { ++ missing.put(key, feature); ++ } ++ } ++ ++ assertTrue(printMissing(missing), missing.isEmpty()); ++ } ++ ++ @Test ++ public void testApiToMinecraft() { ++ for (NamespacedKey apiKey : DEFAULT_CONFIGURED_STRUCTURES.keySet()) { ++ assertTrue(apiKey + " does not have a minecraft counterpart", BuiltinRegistries.CONFIGURED_STRUCTURE_FEATURE.containsKey(CraftNamespacedKey.toMinecraft(apiKey))); ++ } ++ } ++ ++ private static String printMissing(Map> missing) { ++ final StringJoiner joiner = new StringJoiner("\n", "Missing: \n", ""); ++ ++ missing.forEach((key, configuredFeature) -> { ++ joiner.add("public static final Reference " + BUILT_IN_STRUCTURES.get(key) + " = create(\"" + key.getPath() + "\");"); ++ }); ++ ++ return joiner.toString(); ++ } ++ ++ @AfterClass ++ public static void after() { ++ System.setOut(out); ++ } ++} diff --git a/patches/server/0580-Collision-option-for-requiring-a-player-participant.patch b/patches/server/0581-Collision-option-for-requiring-a-player-participant.patch similarity index 100% rename from patches/server/0580-Collision-option-for-requiring-a-player-participant.patch rename to patches/server/0581-Collision-option-for-requiring-a-player-participant.patch diff --git a/patches/server/0581-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch b/patches/server/0582-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch similarity index 100% rename from patches/server/0581-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch rename to patches/server/0582-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch diff --git a/patches/server/0582-Return-chat-component-with-empty-text-instead-of-thr.patch b/patches/server/0583-Return-chat-component-with-empty-text-instead-of-thr.patch similarity index 100% rename from patches/server/0582-Return-chat-component-with-empty-text-instead-of-thr.patch rename to patches/server/0583-Return-chat-component-with-empty-text-instead-of-thr.patch diff --git a/patches/server/0583-Make-schedule-command-per-world.patch b/patches/server/0584-Make-schedule-command-per-world.patch similarity index 100% rename from patches/server/0583-Make-schedule-command-per-world.patch rename to patches/server/0584-Make-schedule-command-per-world.patch diff --git a/patches/server/0584-Configurable-max-leash-distance.patch b/patches/server/0585-Configurable-max-leash-distance.patch similarity index 100% rename from patches/server/0584-Configurable-max-leash-distance.patch rename to patches/server/0585-Configurable-max-leash-distance.patch diff --git a/patches/server/0585-Implement-BlockPreDispenseEvent.patch b/patches/server/0586-Implement-BlockPreDispenseEvent.patch similarity index 100% rename from patches/server/0585-Implement-BlockPreDispenseEvent.patch rename to patches/server/0586-Implement-BlockPreDispenseEvent.patch diff --git a/patches/server/0586-added-Wither-API.patch b/patches/server/0587-added-Wither-API.patch similarity index 100% rename from patches/server/0586-added-Wither-API.patch rename to patches/server/0587-added-Wither-API.patch diff --git a/patches/server/0587-Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/patches/server/0588-Added-firing-of-PlayerChangeBeaconEffectEvent.patch similarity index 100% rename from patches/server/0587-Added-firing-of-PlayerChangeBeaconEffectEvent.patch rename to patches/server/0588-Added-firing-of-PlayerChangeBeaconEffectEvent.patch diff --git a/patches/server/0588-Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/0589-Add-toggle-for-always-placing-the-dragon-egg.patch similarity index 100% rename from patches/server/0588-Add-toggle-for-always-placing-the-dragon-egg.patch rename to patches/server/0589-Add-toggle-for-always-placing-the-dragon-egg.patch diff --git a/patches/server/0589-Added-PlayerStonecutterRecipeSelectEvent.patch b/patches/server/0590-Added-PlayerStonecutterRecipeSelectEvent.patch similarity index 100% rename from patches/server/0589-Added-PlayerStonecutterRecipeSelectEvent.patch rename to patches/server/0590-Added-PlayerStonecutterRecipeSelectEvent.patch diff --git a/patches/server/0590-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/server/0591-Add-dropLeash-variable-to-EntityUnleashEvent.patch similarity index 100% rename from patches/server/0590-Add-dropLeash-variable-to-EntityUnleashEvent.patch rename to patches/server/0591-Add-dropLeash-variable-to-EntityUnleashEvent.patch diff --git a/patches/server/0591-Reset-shield-blocking-on-dimension-change.patch b/patches/server/0592-Reset-shield-blocking-on-dimension-change.patch similarity index 100% rename from patches/server/0591-Reset-shield-blocking-on-dimension-change.patch rename to patches/server/0592-Reset-shield-blocking-on-dimension-change.patch diff --git a/patches/server/0592-add-DragonEggFormEvent.patch b/patches/server/0593-add-DragonEggFormEvent.patch similarity index 100% rename from patches/server/0592-add-DragonEggFormEvent.patch rename to patches/server/0593-add-DragonEggFormEvent.patch diff --git a/patches/server/0593-EntityMoveEvent.patch b/patches/server/0594-EntityMoveEvent.patch similarity index 97% rename from patches/server/0593-EntityMoveEvent.patch rename to patches/server/0594-EntityMoveEvent.patch index 0ceba87d2..6647094d2 100644 --- a/patches/server/0593-EntityMoveEvent.patch +++ b/patches/server/0594-EntityMoveEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] EntityMoveEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0f03525066b818a81583618e9a80f245032493b7..9912b4e10abb5c41f2b92d992a6fe00ee5545740 100644 +index 6d1dd3d33bcaa7a1262a53c4fed57564c74df286..c1e9b32fd8f147e0cbbe830a62b8b51ea62c9d30 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1541,6 +1541,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop Registry registryFor(Class classOfT) { + return io.papermc.paper.registry.PaperRegistry.getRegistry(classOfT); } + + @Override diff --git a/patches/server/0617-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch b/patches/server/0618-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch similarity index 100% rename from patches/server/0617-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch rename to patches/server/0618-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch diff --git a/patches/server/0618-copy-TESign-isEditable-from-snapshots.patch b/patches/server/0619-copy-TESign-isEditable-from-snapshots.patch similarity index 100% rename from patches/server/0618-copy-TESign-isEditable-from-snapshots.patch rename to patches/server/0619-copy-TESign-isEditable-from-snapshots.patch diff --git a/patches/server/0619-Drop-carried-item-when-player-has-disconnected.patch b/patches/server/0620-Drop-carried-item-when-player-has-disconnected.patch similarity index 100% rename from patches/server/0619-Drop-carried-item-when-player-has-disconnected.patch rename to patches/server/0620-Drop-carried-item-when-player-has-disconnected.patch diff --git a/patches/server/0620-forced-whitelist-use-configurable-kick-message.patch b/patches/server/0621-forced-whitelist-use-configurable-kick-message.patch similarity index 90% rename from patches/server/0620-forced-whitelist-use-configurable-kick-message.patch rename to patches/server/0621-forced-whitelist-use-configurable-kick-message.patch index 0ad726ab2..399824040 100644 --- a/patches/server/0620-forced-whitelist-use-configurable-kick-message.patch +++ b/patches/server/0621-forced-whitelist-use-configurable-kick-message.patch @@ -5,7 +5,7 @@ Subject: [PATCH] forced whitelist: use configurable kick message diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9912b4e10abb5c41f2b92d992a6fe00ee5545740..824d90b541355d711a170ff8e163a894ba17ff00 100644 +index c1e9b32fd8f147e0cbbe830a62b8b51ea62c9d30..1cac02ba1eced8c1cda0de750dfe640acdca21c0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -73,7 +73,6 @@ import net.minecraft.gametest.framework.GameTestTicker; @@ -16,7 +16,7 @@ index 9912b4e10abb5c41f2b92d992a6fe00ee5545740..824d90b541355d711a170ff8e163a894 import net.minecraft.network.protocol.game.ClientboundChangeDifficultyPacket; import net.minecraft.network.protocol.game.ClientboundSetTimePacket; import net.minecraft.network.protocol.status.ServerStatus; -@@ -2119,7 +2118,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop) net.minecraft.core.Registry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey))); return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier); } diff --git a/patches/server/0727-Goat-ram-API.patch b/patches/server/0728-Goat-ram-API.patch similarity index 100% rename from patches/server/0727-Goat-ram-API.patch rename to patches/server/0728-Goat-ram-API.patch diff --git a/patches/server/0728-Add-API-for-resetting-a-single-score.patch b/patches/server/0729-Add-API-for-resetting-a-single-score.patch similarity index 100% rename from patches/server/0728-Add-API-for-resetting-a-single-score.patch rename to patches/server/0729-Add-API-for-resetting-a-single-score.patch diff --git a/patches/server/0729-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0730-Add-Raw-Byte-Entity-Serialization.patch similarity index 100% rename from patches/server/0729-Add-Raw-Byte-Entity-Serialization.patch rename to patches/server/0730-Add-Raw-Byte-Entity-Serialization.patch diff --git a/patches/server/0730-Vanilla-command-permission-fixes.patch b/patches/server/0731-Vanilla-command-permission-fixes.patch similarity index 100% rename from patches/server/0730-Vanilla-command-permission-fixes.patch rename to patches/server/0731-Vanilla-command-permission-fixes.patch diff --git a/patches/server/0731-Make-CallbackExecutor-strict-again.patch b/patches/server/0732-Make-CallbackExecutor-strict-again.patch similarity index 100% rename from patches/server/0731-Make-CallbackExecutor-strict-again.patch rename to patches/server/0732-Make-CallbackExecutor-strict-again.patch diff --git a/patches/server/0732-Do-not-allow-the-server-to-unload-chunks-at-request-.patch b/patches/server/0733-Do-not-allow-the-server-to-unload-chunks-at-request-.patch similarity index 100% rename from patches/server/0732-Do-not-allow-the-server-to-unload-chunks-at-request-.patch rename to patches/server/0733-Do-not-allow-the-server-to-unload-chunks-at-request-.patch diff --git a/patches/server/0733-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch b/patches/server/0734-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch similarity index 100% rename from patches/server/0733-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch rename to patches/server/0734-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch diff --git a/patches/server/0734-Correctly-handle-recursion-for-chunkholder-updates.patch b/patches/server/0735-Correctly-handle-recursion-for-chunkholder-updates.patch similarity index 100% rename from patches/server/0734-Correctly-handle-recursion-for-chunkholder-updates.patch rename to patches/server/0735-Correctly-handle-recursion-for-chunkholder-updates.patch diff --git a/patches/server/0735-Separate-lookup-locking-from-state-access-in-UserCac.patch b/patches/server/0736-Separate-lookup-locking-from-state-access-in-UserCac.patch similarity index 100% rename from patches/server/0735-Separate-lookup-locking-from-state-access-in-UserCac.patch rename to patches/server/0736-Separate-lookup-locking-from-state-access-in-UserCac.patch diff --git a/patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch b/patches/server/0737-Fix-chunks-refusing-to-unload-at-low-TPS.patch similarity index 100% rename from patches/server/0736-Fix-chunks-refusing-to-unload-at-low-TPS.patch rename to patches/server/0737-Fix-chunks-refusing-to-unload-at-low-TPS.patch diff --git a/patches/server/0737-Do-not-allow-ticket-level-changes-while-unloading-pl.patch b/patches/server/0738-Do-not-allow-ticket-level-changes-while-unloading-pl.patch similarity index 100% rename from patches/server/0737-Do-not-allow-ticket-level-changes-while-unloading-pl.patch rename to patches/server/0738-Do-not-allow-ticket-level-changes-while-unloading-pl.patch diff --git a/patches/server/0738-Do-not-allow-ticket-level-changes-when-updating-chun.patch b/patches/server/0739-Do-not-allow-ticket-level-changes-when-updating-chun.patch similarity index 100% rename from patches/server/0738-Do-not-allow-ticket-level-changes-when-updating-chun.patch rename to patches/server/0739-Do-not-allow-ticket-level-changes-when-updating-chun.patch diff --git a/patches/server/0739-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0740-Do-not-submit-profile-lookups-to-worldgen-threads.patch similarity index 100% rename from patches/server/0739-Do-not-submit-profile-lookups-to-worldgen-threads.patch rename to patches/server/0740-Do-not-submit-profile-lookups-to-worldgen-threads.patch diff --git a/patches/server/0740-Log-when-the-async-catcher-is-tripped.patch b/patches/server/0741-Log-when-the-async-catcher-is-tripped.patch similarity index 100% rename from patches/server/0740-Log-when-the-async-catcher-is-tripped.patch rename to patches/server/0741-Log-when-the-async-catcher-is-tripped.patch diff --git a/patches/server/0741-Add-paper-mobcaps-and-paper-playermobcaps.patch b/patches/server/0742-Add-paper-mobcaps-and-paper-playermobcaps.patch similarity index 100% rename from patches/server/0741-Add-paper-mobcaps-and-paper-playermobcaps.patch rename to patches/server/0742-Add-paper-mobcaps-and-paper-playermobcaps.patch diff --git a/patches/server/0742-Prevent-unload-calls-removing-tickets-for-sync-loads.patch b/patches/server/0743-Prevent-unload-calls-removing-tickets-for-sync-loads.patch similarity index 100% rename from patches/server/0742-Prevent-unload-calls-removing-tickets-for-sync-loads.patch rename to patches/server/0743-Prevent-unload-calls-removing-tickets-for-sync-loads.patch diff --git a/patches/server/0743-Sanitize-ResourceLocation-error-logging.patch b/patches/server/0744-Sanitize-ResourceLocation-error-logging.patch similarity index 100% rename from patches/server/0743-Sanitize-ResourceLocation-error-logging.patch rename to patches/server/0744-Sanitize-ResourceLocation-error-logging.patch diff --git a/patches/server/0744-Optimise-general-POI-access.patch b/patches/server/0745-Optimise-general-POI-access.patch similarity index 100% rename from patches/server/0744-Optimise-general-POI-access.patch rename to patches/server/0745-Optimise-general-POI-access.patch diff --git a/patches/server/0745-Allow-controlled-flushing-for-network-manager.patch b/patches/server/0746-Allow-controlled-flushing-for-network-manager.patch similarity index 100% rename from patches/server/0745-Allow-controlled-flushing-for-network-manager.patch rename to patches/server/0746-Allow-controlled-flushing-for-network-manager.patch diff --git a/patches/server/0746-Add-more-async-catchers.patch b/patches/server/0747-Add-more-async-catchers.patch similarity index 100% rename from patches/server/0746-Add-more-async-catchers.patch rename to patches/server/0747-Add-more-async-catchers.patch diff --git a/patches/server/0747-Rewrite-entity-bounding-box-lookup-calls.patch b/patches/server/0748-Rewrite-entity-bounding-box-lookup-calls.patch similarity index 100% rename from patches/server/0747-Rewrite-entity-bounding-box-lookup-calls.patch rename to patches/server/0748-Rewrite-entity-bounding-box-lookup-calls.patch diff --git a/patches/server/0748-Optimise-chunk-tick-iteration.patch b/patches/server/0749-Optimise-chunk-tick-iteration.patch similarity index 100% rename from patches/server/0748-Optimise-chunk-tick-iteration.patch rename to patches/server/0749-Optimise-chunk-tick-iteration.patch diff --git a/patches/server/0749-Execute-chunk-tasks-mid-tick.patch b/patches/server/0750-Execute-chunk-tasks-mid-tick.patch similarity index 98% rename from patches/server/0749-Execute-chunk-tasks-mid-tick.patch rename to patches/server/0750-Execute-chunk-tasks-mid-tick.patch index 577f243d3..c71b6c7cd 100644 --- a/patches/server/0749-Execute-chunk-tasks-mid-tick.patch +++ b/patches/server/0750-Execute-chunk-tasks-mid-tick.patch @@ -19,7 +19,7 @@ index b27021a42cbed3f0648a8d0903d00d03922ae221..eada966d7f108a6081be7a848f5c1dfc private MinecraftTimings() {} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fd65fd87ae40cdc12ae351d3fd7e4305826b5d93..e7c0f933a141aa2c846bb2fc07f161f9ef6c091d 100644 +index d33656cd5729f4debc7ffff2ab7194464c3e629e..f37dfe1bd53567239bf69852e75f09440dc1628c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1348,6 +1348,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop