Archiviert
13
0

Replace ConfiguredStructure api with Structure (#8642)

Dieser Commit ist enthalten in:
Jake Potrebic 2023-02-28 08:36:01 -08:00 committet von GitHub
Ursprung f408c253ec
Commit e57441254d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
75 geänderte Dateien mit 283 neuen und 486 gelöschten Zeilen

Datei anzeigen

@ -90,23 +90,3 @@ index 0000000000000000000000000000000000000000..f29e76a6b66ddfec12ddf8db6dcb2df6
+ return this.key;
+ }
+}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 1f89a3c1c3b73a939c2653102fc1dc8b630672a8..e5e91f4b4492fa1e709d81f313aac80761ab9e07 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -132,5 +132,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 <T> type
+ * @return the server-backed registry
+ * @throws IllegalArgumentException if there isn't a registry for that type
+ */
+ <T extends Keyed> @org.jetbrains.annotations.NotNull Registry<T> registryFor(Class<T> classOfT);
// Paper end
}

Datei anzeigen

@ -170,23 +170,27 @@ index 0000000000000000000000000000000000000000..0c83a02059d65672ff191c42932d8509
+}
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
index 0000000000000000000000000000000000000000..1648ed317145eb73c0cca431823449b2adc43e04
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/world/StructuresLocateEvent.java
@@ -0,0 +1,164 @@
@@ -0,0 +1,208 @@
+package io.papermc.paper.event.world;
+
+import io.papermc.paper.math.Position;
+import io.papermc.paper.util.TransformingRandomAccessList;
+import io.papermc.paper.world.structure.ConfiguredStructure;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+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.bukkit.generator.structure.Structure;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.jetbrains.annotations.UnmodifiableView;
+
+/**
+ * Called <b>before</b> a set of configured structures is located.
@ -206,15 +210,16 @@ index 0000000000000000000000000000000000000000..566f9df8f615142e14330965f3491f4e
+
+ private final Location origin;
+ private Result result;
+ private List<ConfiguredStructure> configuredStructures;
+ private List<Structure> structures;
+ private List<ConfiguredStructure> legacy$structures;
+ private int radius;
+ private boolean findUnexplored;
+ private boolean cancelled;
+
+ public StructuresLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull List<ConfiguredStructure> configuredStructures, int radius, boolean findUnexplored) {
+ public StructuresLocateEvent(@NotNull World world, @NotNull Location origin, @NotNull List<Structure> structures, int radius, boolean findUnexplored) {
+ super(world);
+ this.origin = origin;
+ this.configuredStructures = configuredStructures;
+ this.setStructures(structures);
+ this.radius = radius;
+ this.findUnexplored = findUnexplored;
+ }
@ -229,23 +234,23 @@ index 0000000000000000000000000000000000000000..566f9df8f615142e14330965f3491f4e
+ }
+
+ /**
+ * Gets the {@link Location} and {@link ConfiguredStructure} set as the result, if it was defined.
+ * Gets the {@link Location} and {@link Structure} set as the result, if it was defined.
+ * <p>
+ * Returns {@code null} if it has not been set by {@link StructuresLocateEvent#setResult(Result)}.
+ * Since this event fires <i>before</i> 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)
+ * @see World#locateNearestStructure(Location, org.bukkit.generator.structure.StructureType, int, boolean)
+ */
+ public @Nullable Result getResult() {
+ return this.result;
+ }
+
+ /**
+ * Sets the result {@link Location} and {@link ConfiguredStructure}. This causes the search to be
+ * Sets the result {@link Location} and {@link Structure}. 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.
+ * @param result the {@link Location} and {@link Structure} of the search.
+ */
+ public void setResult(@Nullable Result result) {
+ this.result = result;
@ -255,18 +260,41 @@ index 0000000000000000000000000000000000000000..566f9df8f615142e14330965f3491f4e
+ * Gets a mutable list of ConfiguredStructures that are valid targets for the search.
+ *
+ * @return a mutable list of ConfiguredStructures
+ * @deprecated use {@link #getStructures()}
+ */
+ @Deprecated(forRemoval = true)
+ public @NotNull List<ConfiguredStructure> getConfiguredStructures() {
+ return this.configuredStructures;
+ return this.legacy$structures;
+ }
+
+ /**
+ * Sets the list of ConfiguredStructures that are valid targets for the search.
+ *
+ * @param configuredStructures a list of ConfiguredStructure targets
+ * @deprecated use {@link #setStructures(List)}
+ */
+ @Deprecated(forRemoval = true)
+ public void setConfiguredStructures(@NotNull List<ConfiguredStructure> configuredStructures) {
+ this.configuredStructures = new ArrayList<>(configuredStructures);
+ this.setStructures(configuredStructures.stream().map(ConfiguredStructure::toModern).toList());
+ }
+
+ /**
+ * Gets an unmodifiable list of Structures that are valid targets for the search.
+ *
+ * @return an unmodifiable list of Structures
+ */
+ public @NotNull @UnmodifiableView List<Structure> getStructures() {
+ return Collections.unmodifiableList(this.structures);
+ }
+
+ /**
+ * Sets the list of Structures that are valid targets for the search.
+ *
+ * @param structures a list of Structures targets
+ */
+ public void setStructures(final @NotNull List<Structure> structures) {
+ this.structures = structures;
+ this.legacy$structures = new TransformingRandomAccessList<>(this.structures, ConfiguredStructure::fromModern, ConfiguredStructure::toModern);
+ }
+
+ /**
@ -274,7 +302,7 @@ index 0000000000000000000000000000000000000000..566f9df8f615142e14330965f3491f4e
+ * <p>
+ * This radius may not always be obeyed during the structure search!
+ *
+ * @return the search radius.
+ * @return the search radius (in chunks)
+ */
+ public int getRadius() {
+ return this.radius;
@ -285,7 +313,7 @@ index 0000000000000000000000000000000000000000..566f9df8f615142e14330965f3491f4e
+ * <p>
+ * This radius may not always be obeyed during the structure search!
+ *
+ * @param radius the search radius.
+ * @param radius the search radius (in chunks)
+ */
+ public void setRadius(int radius) {
+ this.radius = radius;
@ -335,31 +363,51 @@ index 0000000000000000000000000000000000000000..566f9df8f615142e14330965f3491f4e
+ /**
+ * Result for {@link StructuresLocateEvent}.
+ */
+ public record Result(@NotNull Location position, @NotNull ConfiguredStructure configuredStructure) {
+ public record Result(@NotNull Position pos, @NotNull Structure structure) {
+
+ @Deprecated(forRemoval = true)
+ public Result(final @NotNull Location position, @NotNull ConfiguredStructure configuredStructure) {
+ this(position, configuredStructure.toModern());
+ }
+
+ @Deprecated(forRemoval = true)
+ public @NotNull ConfiguredStructure configuredStructure() {
+ return Objects.requireNonNull(ConfiguredStructure.fromModern(this.structure), "Please use the newer Structure API");
+ }
+
+ @Deprecated(forRemoval = true)
+ public @NotNull Location position() {
+ //noinspection DataFlowIssue
+ return this.pos.toLocation(null);
+ }
+ }
+}
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..5a43e40b7311ed2acb51f6ba8b12d1f34569ff2e
index 0000000000000000000000000000000000000000..b9a98f3c89cf847afd510bd1588d3a6d4b7eac0e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/world/structure/ConfiguredStructure.java
@@ -0,0 +1,98 @@
@@ -0,0 +1,112 @@
+package io.papermc.paper.world.structure;
+
+import io.papermc.paper.registry.Reference;
+import java.util.Objects;
+import org.bukkit.Keyed;
+import org.bukkit.NamespacedKey;
+import org.bukkit.Registry;
+import org.bukkit.StructureType;
+import org.bukkit.generator.structure.Structure;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Objects;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Represents a configured structure each with a
+ * {@link StructureType}. Multiple ConfiguredStructures can have
+ * the same {@link StructureType}.
+ * @deprecated use {@link Structure}
+ */
+@Deprecated(forRemoval = true)
+public final class ConfiguredStructure implements Keyed {
+
+ public static final Reference<ConfiguredStructure> PILLAGER_OUTPOST = create("pillager_outpost");
@ -441,12 +489,22 @@ index 0000000000000000000000000000000000000000..5a43e40b7311ed2acb51f6ba8b12d1f3
+ private static @NotNull Reference<ConfiguredStructure> create(@NotNull String name) {
+ return Reference.create(Registry.CONFIGURED_STRUCTURE, NamespacedKey.minecraft(name));
+ }
+
+ @ApiStatus.Internal
+ public @NotNull Structure toModern() {
+ return Objects.requireNonNull(Registry.STRUCTURE.get(this.key));
+ }
+
+ @ApiStatus.Internal
+ public static @Nullable ConfiguredStructure fromModern(@NotNull Structure structure) {
+ return Registry.CONFIGURED_STRUCTURE.get(structure.getKey());
+ }
+}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index ff1fcdaccbca81602278a0b52670f7b895ba22b7..9e39c028b3d7bea4f2998d6ed8d53d88361ccfcd 100644
index ff1fcdaccbca81602278a0b52670f7b895ba22b7..c0655a7c29e113297484a53d72cc5ea0affbe8ce 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -211,6 +211,13 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -211,6 +211,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
return GameEvent.getByKey(key);
}
};
@ -454,7 +512,9 @@ index ff1fcdaccbca81602278a0b52670f7b895ba22b7..9e39c028b3d7bea4f2998d6ed8d53d88
+ /**
+ * Configured structures.
+ * @see io.papermc.paper.world.structure.ConfiguredStructure
+ * @deprecated use {@link #STRUCTURE}
+ */
+ @Deprecated(forRemoval = true)
+ Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Bukkit.getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class);
+ // Paper end

Datei anzeigen

@ -78,13 +78,13 @@ index 02b898d441c42771903d5839c3cde544b1a25778..1a3b4f20c7126caf8a34040028f73508
* Create a new virtual {@link WorldBorder}.
* <p>
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index e5e91f4b4492fa1e709d81f313aac80761ab9e07..3545313f1c592e29d0bb5d055fc4e5c71c8a6fca 100644
index 1f89a3c1c3b73a939c2653102fc1dc8b630672a8..6c45841538f2f073691331f975741a62b03a6637 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -142,5 +142,10 @@ public interface UnsafeValues {
* @throws IllegalArgumentException if there isn't a registry for that type
@@ -132,5 +132,10 @@ public interface UnsafeValues {
* Use this when sending custom packets, so that there are no collisions on the client or server.
*/
<T extends Keyed> @org.jetbrains.annotations.NotNull Registry<T> registryFor(Class<T> classOfT);
public int nextEntityId();
+
+ /**
+ * Just don't use it.

Datei anzeigen

@ -61,10 +61,10 @@ index 7e447f8be7dc9768df487e1f7f4b9aafedb33e2d..eb8aa093148eea3b2fcafe06e8f1277e
/**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 3545313f1c592e29d0bb5d055fc4e5c71c8a6fca..aa6d4e0ea2a1e2b96cc94d5a1d2223caecfea7a4 100644
index 6c45841538f2f073691331f975741a62b03a6637..e87cbaf9c1ea1330ab1597f98c8864d0c5b8bdcd 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -147,5 +147,22 @@ public interface UnsafeValues {
@@ -137,5 +137,22 @@ public interface UnsafeValues {
* Just don't use it.
*/
@org.jetbrains.annotations.NotNull String getMainLevelName();

Datei anzeigen

@ -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 aa6d4e0ea2a1e2b96cc94d5a1d2223caecfea7a4..c876f95989d5bb64e745f8f62b4874422156d49c 100644
index e87cbaf9c1ea1330ab1597f98c8864d0c5b8bdcd..906f313d8c91e65ce934143208ed281ce02f5354 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -164,5 +164,12 @@ public interface UnsafeValues {
@@ -154,5 +154,12 @@ public interface UnsafeValues {
* @return the itemstack rarity
*/
public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);

Datei anzeigen

@ -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 c876f95989d5bb64e745f8f62b4874422156d49c..52e0bee77f10965932c67333e7d22cbbcdc08048 100644
index 906f313d8c91e65ce934143208ed281ce02f5354..29a91ec8e97ce66383a1dd1fc3dcbcdcca7cfc41 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -165,6 +165,16 @@ public interface UnsafeValues {
@@ -155,6 +155,16 @@ public interface UnsafeValues {
*/
public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);

Datei anzeigen

@ -31,10 +31,10 @@ index eb8aa093148eea3b2fcafe06e8f1277ebbe2f275..9c6291531d3081bf601364815fdd0a9b
/**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 52e0bee77f10965932c67333e7d22cbbcdc08048..3388f31c2f287c8dcf4bfd157a04d9383cbe41e3 100644
index 29a91ec8e97ce66383a1dd1fc3dcbcdcca7cfc41..0d47278d68cdf015cb980721c234a3abee39646a 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -175,6 +175,18 @@ public interface UnsafeValues {
@@ -165,6 +165,18 @@ public interface UnsafeValues {
*/
public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial);

Datei anzeigen

@ -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 3388f31c2f287c8dcf4bfd157a04d9383cbe41e3..393e0e9bacb30cdae4154ec2573e000a82cc89e7 100644
index 0d47278d68cdf015cb980721c234a3abee39646a..29ccd90e2733b528ef0866f93053adf66dd9ddf3 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -193,5 +193,22 @@ public interface UnsafeValues {
@@ -183,5 +183,22 @@ public interface UnsafeValues {
* @return the server's protocol version
*/
int getProtocolVersion();

Datei anzeigen

@ -26,10 +26,10 @@ index 9c6291531d3081bf601364815fdd0a9b801eee50..33371518fc8c5d97625f3d528ba8fee2
/**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 393e0e9bacb30cdae4154ec2573e000a82cc89e7..aa5fff8704fa002af0cffb09049311edaef19339 100644
index 29ccd90e2733b528ef0866f93053adf66dd9ddf3..2a23e93d9e308c5eba0a2b658f11f571a0c01e26 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -210,5 +210,14 @@ public interface UnsafeValues {
@@ -200,5 +200,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);

Datei anzeigen

@ -5,13 +5,14 @@ Subject: [PATCH] More PotionEffectType API
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 9e39c028b3d7bea4f2998d6ed8d53d88361ccfcd..3dc747080b7bfea4b04b5a47cc7ae4698c758802 100644
index c0655a7c29e113297484a53d72cc5ea0affbe8ce..0a3a41ae4c488b148266129d3663be3f8830d509 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -217,6 +217,25 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* @see io.papermc.paper.world.structure.ConfiguredStructure
@@ -219,6 +219,26 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*/
@Deprecated(forRemoval = true)
Registry<io.papermc.paper.world.structure.ConfiguredStructure> CONFIGURED_STRUCTURE = Bukkit.getRegistry(io.papermc.paper.world.structure.ConfiguredStructure.class);
+
+ /**
+ * Potion effect types.
+ *

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add NamespacedKey biome methods
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 80314e6dabadcd290841c792f3a5fafecd6ea036..7cf5223d3f66783e05767e16000bf51925064d66 100644
index b8ca571f8e88e7b676c5d1e1d90f6e5cb8538147..b92255a9c87620f46adb140689b1cd328a476d61 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -227,5 +227,32 @@ public interface UnsafeValues {
@@ -217,5 +217,32 @@ public interface UnsafeValues {
* @throws IllegalArgumentException if {@link Material#isBlock()} is false
*/
boolean isCollidable(@org.jetbrains.annotations.NotNull Material material);

Datei anzeigen

@ -3463,13 +3463,14 @@ index 0000000000000000000000000000000000000000..cea9c098ade00ee87b8efc8164ab72f5
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..9798a1010120125039cbf226a0e3679cc92f92c7
index 0000000000000000000000000000000000000000..902317d2dc198a1cbfc679810bcb2173644354cb
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -0,0 +1,512 @@
@@ -0,0 +1,517 @@
+package io.papermc.paper.util;
+
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.papermc.paper.math.Position;
+import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet;
+import java.lang.ref.Cleaner;
+import net.minecraft.core.BlockPos;
@ -3933,6 +3934,10 @@ index 0000000000000000000000000000000000000000..9798a1010120125039cbf226a0e3679c
+ return new BlockPos(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
+ }
+
+ public static BlockPos toBlockPos(Position pos) {
+ return new BlockPos(pos.blockX(), pos.blockY(), pos.blockZ());
+ }
+
+ public static boolean isEdgeOfChunk(BlockPos pos) {
+ final int modX = pos.getX() & 15;
+ final int modZ = pos.getZ() & 15;

Datei anzeigen

@ -11844,13 +11844,13 @@ index 0000000000000000000000000000000000000000..a6fb7ae77d7cad2243e28a33718e4631
+
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
index 9798a1010120125039cbf226a0e3679cc92f92c7..cf3e083c2ada3275a52c303de16a62576696e83f 100644
index 902317d2dc198a1cbfc679810bcb2173644354cb..d58d44faa40be2421f4cb54740a3abdbad72875c 100644
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -1,16 +1,29 @@
package io.papermc.paper.util;
@@ -2,16 +2,29 @@ package io.papermc.paper.util;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.papermc.paper.math.Position;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.internal.Streams;
@ -11877,7 +11877,7 @@ index 9798a1010120125039cbf226a0e3679cc92f92c7..cf3e083c2ada3275a52c303de16a6257
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
@@ -20,8 +33,11 @@ import org.spigotmc.AsyncCatcher;
@@ -21,8 +34,11 @@ import org.spigotmc.AsyncCatcher;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -11889,7 +11889,7 @@ index 9798a1010120125039cbf226a0e3679cc92f92c7..cf3e083c2ada3275a52c303de16a6257
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.LinkedBlockingQueue;
@@ -506,6 +522,100 @@ public final class MCUtil {
@@ -511,6 +527,100 @@ public final class MCUtil {
}
}

Datei anzeigen

@ -565,7 +565,7 @@ index 0000000000000000000000000000000000000000..7ac27392a8647ef7d0dc78efe78703e9
+ @NotNull GameProfile buildGameProfile();
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
index cf3e083c2ada3275a52c303de16a62576696e83f..b19850ae31f6c796cb3491dd5070d28e0ffd242c 100644
index d58d44faa40be2421f4cb54740a3abdbad72875c..9ee4dc54039cbe6b8c9bd3018044c73f923a736e 100644
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -1,5 +1,7 @@
@ -574,9 +574,9 @@ index cf3e083c2ada3275a52c303de16a62576696e83f..b19850ae31f6c796cb3491dd5070d28e
+import com.destroystokyo.paper.profile.CraftPlayerProfile;
+import com.destroystokyo.paper.profile.PlayerProfile;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.papermc.paper.math.Position;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
@@ -25,6 +27,7 @@ import net.minecraft.world.level.Level;
@@ -26,6 +28,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus;
import org.apache.commons.lang.exception.ExceptionUtils;
@ -584,7 +584,7 @@ index cf3e083c2ada3275a52c303de16a62576696e83f..b19850ae31f6c796cb3491dd5070d28e
import org.bukkit.Location;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.CraftWorld;
@@ -372,6 +375,10 @@ public final class MCUtil {
@@ -373,6 +376,10 @@ public final class MCUtil {
return run.get();
}

Datei anzeigen

@ -13,10 +13,10 @@ Shulkers) may need to be changed in order for it to re-save properly
No more crashing though.
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
index b19850ae31f6c796cb3491dd5070d28e0ffd242c..d1a59c2af0557a816c094983ec60097fb4de060c 100644
index 9ee4dc54039cbe6b8c9bd3018044c73f923a736e..6efb8b10f17c70b05128039376d254e6beda3841 100644
--- a/src/main/java/io/papermc/paper/util/MCUtil.java
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -14,6 +14,8 @@ import it.unimi.dsi.fastutil.objects.ReferenceArrayList;
@@ -15,6 +15,8 @@ import it.unimi.dsi.fastutil.objects.ReferenceArrayList;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.MinecraftServer;
@ -25,7 +25,7 @@ index b19850ae31f6c796cb3491dd5070d28e0ffd242c..d1a59c2af0557a816c094983ec60097f
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.DistanceManager;
@@ -529,6 +531,21 @@ public final class MCUtil {
@@ -534,6 +536,21 @@ public final class MCUtil {
}
}

Datei anzeigen

@ -1,242 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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..7c265d27da034986be73921d35bf08ae250b42f3
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistry.java
@@ -0,0 +1,167 @@
+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.concurrent.ConcurrentHashMap;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+@DefaultQualifier(NonNull.class)
+public abstract class PaperRegistry<API extends Keyed, MINECRAFT> implements org.bukkit.Registry<API> {
+
+ @SuppressWarnings("FieldMayBeFinal") // non-final for testing
+ private static Supplier<RegistryAccess> REGISTRY_ACCESS = Suppliers.memoize(() -> MinecraftServer.getServer().registryAccess());
+ private static final Map<RegistryKey<?, ?>, PaperRegistry<?, ?>> INTERNAL_REGISTRIES = new HashMap<>();
+ public static final Map<RegistryKey<?, ?>, PaperRegistry<?, ?>> REGISTRIES = Collections.unmodifiableMap(INTERNAL_REGISTRIES);
+ private static final Map<Class<?>, PaperRegistry<?, ?>> REGISTRY_BY_API_CLASS = new HashMap<>();
+ private static final Map<ResourceKey<? extends Registry<?>>, PaperRegistry<?, ?>> REGISTRY_BY_RES_KEY = new HashMap<>();
+
+ private boolean registered;
+ private final RegistryKey<API, MINECRAFT> registryKey;
+ private final Supplier<Registry<MINECRAFT>> registry;
+ private final Map<NamespacedKey, API> cache = new ConcurrentHashMap<>();
+ private final Map<NamespacedKey, ResourceKey<MINECRAFT>> resourceKeyCache = new ConcurrentHashMap<>();
+
+ public PaperRegistry(RegistryKey<API, MINECRAFT> 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 @Nullable API convertToApi(NamespacedKey key, MINECRAFT nms);
+
+ public API convertToApiOrThrow(ResourceLocation resourceLocation, MINECRAFT nms) {
+ return Objects.requireNonNull(this.convertToApi(resourceLocation, nms), resourceLocation + " has a null api representation");
+ }
+
+ public @Nullable API convertToApi(ResourceLocation resourceLocation, MINECRAFT nms) {
+ return this.convertToApi(CraftNamespacedKey.fromMinecraft(resourceLocation), nms);
+ }
+
+ public API convertToApiOrThrow(Holder<MINECRAFT> nmsHolder) {
+ return Objects.requireNonNull(this.convertToApi(nmsHolder), nmsHolder + " has a null api representation");
+ }
+
+ public @Nullable API convertToApi(Holder<MINECRAFT> nmsHolder) {
+ final Optional<ResourceKey<MINECRAFT>> 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 void convertToApi(Iterable<Holder<MINECRAFT>> holders, Consumer<API> apiConsumer, boolean throwOnNull) {
+ for (Holder<MINECRAFT> holder : holders) {
+ final @Nullable API api = this.convertToApi(holder);
+ if (api == null && throwOnNull) {
+ throw new NullPointerException(holder + " has a null api representation");
+ } else if (api != null) {
+ apiConsumer.accept(api);
+ }
+ }
+ }
+
+ public MINECRAFT getMinecraftValue(API apiValue) {
+ return this.registry.get().getOptional(CraftNamespacedKey.toMinecraft(apiValue.getKey())).orElseThrow();
+ }
+
+ public Holder<MINECRAFT> getMinecraftHolder(API apiValue) {
+ return this.registry.get().getHolderOrThrow(this.resourceKeyCache.computeIfAbsent(apiValue.getKey(), key -> ResourceKey.create(this.registryKey.resourceKey(), CraftNamespacedKey.toMinecraft(key))));
+ }
+
+ @Override
+ public Iterator<API> 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 <T> Supplier<Registry<T>> registryFor(ResourceKey<? extends Registry<T>> 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 <T extends Keyed> PaperRegistry<T, ?> getRegistry(Class<T> classOfT) {
+ Preconditions.checkArgument(REGISTRY_BY_API_CLASS.containsKey(classOfT), "No registry for that type");
+ return (PaperRegistry<T, ?>) REGISTRY_BY_API_CLASS.get(classOfT);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> PaperRegistry<?, T> getRegistry(ResourceKey<? extends Registry<T>> resourceKey) {
+ Preconditions.checkArgument(REGISTRY_BY_RES_KEY.containsKey(resourceKey));
+ return (PaperRegistry<?, T>) REGISTRY_BY_RES_KEY.get(resourceKey);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <A extends Keyed, M> PaperRegistry<A, M> getRegistry(RegistryKey<A, M> registryKey) {
+ Preconditions.checkArgument(INTERNAL_REGISTRIES.containsKey(registryKey));
+ return (PaperRegistry<A, M>) 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<API extends Keyed, MINECRAFT>(Class<API> apiClass, ResourceKey<? extends Registry<MINECRAFT>> resourceKey) {
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 04137173ca7034b9dff37a68518e8b6fb0330188..9b1bde95e8303e5d4adfe92f09240df8e6323dac 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2016,6 +2016,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.worldData.setDataConfiguration(worlddataconfiguration);
this.resources.managers.updateRegistryTags(this.registryAccess());
+ io.papermc.paper.registry.PaperRegistry.clearCaches(); // Paper
new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper
// Paper start
if (Thread.currentThread() != this.serverThread) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 1caee283ae73943f936eddd822fbe64dc7815fdf..611cf30d17e110ff7b38219053919b52a86dfb19 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -516,6 +516,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int nextEntityId() {
return net.minecraft.world.entity.Entity.nextEntityId();
}
+
+ @Override
+ public <T extends org.bukkit.Keyed> Registry<T> registryFor(Class<T> 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 1caa4ce02cd396160f0d9d5461de8290e7c078bb..a19c1e8253b0dd0da77008f892b68187acd17c4a 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
@@ -49,6 +49,15 @@ public abstract class AbstractTestingBase {
layers = WorldLoader.loadAndReplaceLayer(resourceManager, layers, RegistryLayer.WORLDGEN, RegistryDataLoader.WORLDGEN_REGISTRIES);
REGISTRY_CUSTOM = layers.compositeAccess().freeze();
io.papermc.paper.testing.DummyServer.setup(); // Paper
+ // 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_CUSTOM));
+ } 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_CUSTOM, FeatureFlags.REGISTRY.allFlags(), Commands.CommandSelection.DEDICATED, 0, MoreExecutors.directExecutor(), MoreExecutors.directExecutor()).join();
// Bind tags

Datei anzeigen

@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Mon, 27 Feb 2023 18:28:39 -0800
Subject: [PATCH] TODO Registry Modification API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
index 763f9d4740429840e78d3462277eb577d2d9f66a..2ab8919bddfb286255041351b55fc6d70a1bc76f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
@@ -26,6 +26,7 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
if (bukkitClass == StructureType.class) {
return new CraftRegistry<>(BuiltInRegistries.STRUCTURE_TYPE, CraftStructureType::new);
}
+ // TODO registry modification API
return null;
}

Datei anzeigen

@ -5,69 +5,41 @@ Subject: [PATCH] Add StructuresLocateEvent
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java
index 6f39e343147803e15e7681c993b8797a629702e7..3a643d57b646c83974b5157b9cbb2a9f42e9bd59 100644
--- a/src/main/java/io/papermc/paper/registry/RegistryKey.java
+++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java
@@ -1,8 +1,14 @@
package io.papermc.paper.registry;
+import io.papermc.paper.world.structure.ConfiguredStructure;
import net.minecraft.core.Registry;
+import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
+import net.minecraft.world.level.levelgen.structure.Structure;
import org.bukkit.Keyed;
public record RegistryKey<API extends Keyed, MINECRAFT>(Class<API> apiClass, ResourceKey<? extends Registry<MINECRAFT>> resourceKey) {
+
+ public static final RegistryKey<ConfiguredStructure, Structure> CONFIGURED_STRUCTURE_REGISTRY = new RegistryKey<>(ConfiguredStructure.class, Registries.STRUCTURE);
+
}
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..16996c743b169e625ec810523c1d59a305e1d159
index 0000000000000000000000000000000000000000..09837f6e6c6ab8a1df2aacdb86646993123dd424
--- /dev/null
+++ b/src/main/java/io/papermc/paper/world/structure/PaperConfiguredStructure.java
@@ -0,0 +1,44 @@
@@ -0,0 +1,35 @@
+package io.papermc.paper.world.structure;
+
+import io.papermc.paper.registry.PaperRegistry;
+import io.papermc.paper.registry.RegistryKey;
+import java.util.Objects;
+import net.minecraft.core.Registry;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.core.registries.Registries;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.world.level.levelgen.structure.Structure;
+import org.bukkit.NamespacedKey;
+import org.bukkit.StructureType;
+import org.bukkit.craftbukkit.CraftRegistry;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.checkerframework.framework.qual.DefaultQualifier;
+
+import java.util.Objects;
+import java.util.function.Supplier;
+
+@DefaultQualifier(NonNull.class)
+@Deprecated(forRemoval = true)
+public final class PaperConfiguredStructure {
+
+ private PaperConfiguredStructure() {
+ }
+
+ public static void init() {
+ new ConfiguredStructureRegistry().register();
+ }
+ @Deprecated(forRemoval = true)
+ public static final class LegacyRegistry extends CraftRegistry<ConfiguredStructure, Structure> {
+
+ static final class ConfiguredStructureRegistry extends PaperRegistry<ConfiguredStructure, Structure> {
+
+ private static final Supplier<Registry<Structure>> STRUCTURE_FEATURE_REGISTRY = registryFor(Registries.STRUCTURE);
+
+ public ConfiguredStructureRegistry() {
+ super(RegistryKey.CONFIGURED_STRUCTURE_REGISTRY);
+ public LegacyRegistry(final Registry<Structure> minecraftRegistry) {
+ super(minecraftRegistry, LegacyRegistry::minecraftToBukkit);
+ }
+
+ @Override
+ public @Nullable ConfiguredStructure convertToApi(NamespacedKey key, Structure nms) {
+ private static @Nullable ConfiguredStructure minecraftToBukkit(NamespacedKey key, Structure nms) {
+ final ResourceLocation structureTypeLoc = Objects.requireNonNull(BuiltInRegistries.STRUCTURE_TYPE.getKey(nms.type()), "unexpected structure type " + nms.type());
+ final @Nullable StructureType structureType = StructureType.getStructureTypes().get(structureTypeLoc.getPath());
+ return structureType == null ? null : new ConfiguredStructure(key, structureType);
@ -75,54 +47,56 @@ index 0000000000000000000000000000000000000000..16996c743b169e625ec810523c1d59a3
+ }
+}
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 b6df6077107759963ee8205dddb90501d5ccb4d6..29032374f0e71a41a2de260d402b6fbff68288cc 100644
index b6df6077107759963ee8205dddb90501d5ccb4d6..aecdbbcc688aad308f81f48d50773a9866ded7b2 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -121,6 +121,26 @@ public abstract class ChunkGenerator {
@@ -121,6 +121,24 @@ public abstract class ChunkGenerator {
@Nullable
public Pair<BlockPos, Holder<Structure>> findNearestMapStructure(ServerLevel world, HolderSet<Structure> structures, BlockPos center, int radius, boolean skipReferencedStructures) {
+ // Paper start - StructureLocateEvent
+ // Paper start - StructuresLocateEvent
+ final org.bukkit.World bukkitWorld = world.getWorld();
+ final org.bukkit.Location origin = io.papermc.paper.util.MCUtil.toLocation(world, center);
+ final var paperRegistry = io.papermc.paper.registry.PaperRegistry.getRegistry(io.papermc.paper.registry.RegistryKey.CONFIGURED_STRUCTURE_REGISTRY);
+ final List<io.papermc.paper.world.structure.ConfiguredStructure> configuredStructures = new ArrayList<>();
+ paperRegistry.convertToApi(structures, configuredStructures::add, false); // gracefully handle missing api, use tests to check (or exclude)
+ if (!configuredStructures.isEmpty()) {
+ final io.papermc.paper.event.world.StructuresLocateEvent event = new io.papermc.paper.event.world.StructuresLocateEvent(bukkitWorld, origin, configuredStructures, radius, skipReferencedStructures);
+ final List<org.bukkit.generator.structure.Structure> apiStructures = structures.stream().map(Holder::value).map(nms -> org.bukkit.craftbukkit.generator.strucutre.CraftStructure.minecraftToBukkit(nms, world.registryAccess())).toList();
+ if (!apiStructures.isEmpty()) {
+ final io.papermc.paper.event.world.StructuresLocateEvent event = new io.papermc.paper.event.world.StructuresLocateEvent(bukkitWorld, origin, apiStructures, radius, skipReferencedStructures);
+ if (!event.callEvent()) {
+ return null;
+ }
+ if (event.getResult() != null) {
+ return Pair.of(io.papermc.paper.util.MCUtil.toBlockPosition(event.getResult().position()), paperRegistry.getMinecraftHolder(event.getResult().configuredStructure()));
+ return Pair.of(io.papermc.paper.util.MCUtil.toBlockPos(event.getResult().pos()), world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.strucutre.CraftStructure.bukkitToMinecraft(event.getResult().structure())));
+ }
+ center = io.papermc.paper.util.MCUtil.toBlockPosition(event.getOrigin());
+ radius = event.getRadius();
+ skipReferencedStructures = event.shouldFindUnexplored();
+ structures = HolderSet.direct(paperRegistry::getMinecraftHolder, event.getConfiguredStructures());
+ structures = HolderSet.direct(api -> world.registryAccess().registryOrThrow(Registries.STRUCTURE).wrapAsHolder(org.bukkit.craftbukkit.generator.strucutre.CraftStructure.bukkitToMinecraft(api)), event.getStructures());
+ }
+ // Paper end
ChunkGeneratorStructureState chunkgeneratorstructurestate = world.getChunkSource().getGeneratorState();
Map<StructurePlacement, Set<Holder<Structure>>> map = new Object2ObjectArrayMap();
Iterator iterator = structures.iterator();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index fed01c7ed32a0207216fd902976902b223cc3518..5b48102ad1c9940a5f41ba8084be0804b7536d30 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -318,6 +318,7 @@ public final class CraftServer implements Server {
this.structureManager = new CraftStructureManager(console.getStructureManager());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
index 2ab8919bddfb286255041351b55fc6d70a1bc76f..34888b525fd35ac64e6e5e66036ad965a6769959 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
@@ -27,6 +27,11 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
return new CraftRegistry<>(BuiltInRegistries.STRUCTURE_TYPE, CraftStructureType::new);
}
// TODO registry modification API
+ // Paper start - remove this after a while along with all ConfiguredStructure stuff
+ if (bukkitClass == io.papermc.paper.world.structure.ConfiguredStructure.class) {
+ return new io.papermc.paper.world.structure.PaperConfiguredStructure.LegacyRegistry(registryHolder.registryOrThrow(Registries.STRUCTURE));
+ }
+ // Paper end
Bukkit.setServer(this);
+ io.papermc.paper.world.structure.PaperConfiguredStructure.init(); // Paper
// Register all the Enchantments and PotionTypes now so we can stop new registration immediately after
Enchantments.SHARPNESS.getClass();
return null;
}
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..cb077ac5e24d6632c46927fef8ecd20f150d3596
index 0000000000000000000000000000000000000000..0d5306abdc72f139acdf3038ec155f853e371e7f
--- /dev/null
+++ b/src/test/java/io/papermc/paper/world/structure/ConfiguredStructureTest.java
@@ -0,0 +1,95 @@
@@ -0,0 +1,96 @@
+package io.papermc.paper.world.structure;
+
+import io.papermc.paper.registry.Reference;
@ -151,6 +125,7 @@ index 0000000000000000000000000000000000000000..cb077ac5e24d6632c46927fef8ecd20f
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+@Deprecated(forRemoval = true)
+public class ConfiguredStructureTest extends AbstractTestingBase {
+
+ private static final Map<ResourceLocation, String> BUILT_IN_STRUCTURES = new LinkedHashMap<>();

Datei anzeigen

@ -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 9b1bde95e8303e5d4adfe92f09240df8e6323dac..c22db75f87424e9b1dd2ae017619c0e2faee6901 100644
index 04137173ca7034b9dff37a68518e8b6fb0330188..cd9022186351fa398bb8ab590ee8108b8ff1c9d3 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1496,6 +1496,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

Datei anzeigen

@ -283,7 +283,7 @@ index 0000000000000000000000000000000000000000..b9922b07cb105618390187d98acdf89e
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c22db75f87424e9b1dd2ae017619c0e2faee6901..194f00dac49c54809d7a1dcccc9c2844399c5b0a 100644
index cd9022186351fa398bb8ab590ee8108b8ff1c9d3..7cb5fba71a7a3eb46917ff744cede12e3c42069e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1680,7 +1680,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

Datei anzeigen

@ -48,7 +48,7 @@ index 520cd1a6b347687b2ec6d13f034be391d1a1af85..cc885fd0eb19516d3864a43c2e4ae785
if (!OldUsersConverter.serverReadyAfterUserconversion(this)) {
return false;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index ad6a9e238d21a821e7d5c3634fbc8fc9bdfc38a3..437e78adcc4838a9887887858afe883c8f928fef 100644
index 8256ca255eb88dd3f0101eaf76225908eaadb480..480af67431b567b29c76f949a429f619164b8391 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -182,6 +182,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -20,10 +20,10 @@ index 3e4ac4020c9f51e634eadd43243d34267bea4b22..ce52ae980309ecddf597e14b759b77ea
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9d9731e52a9038e8e668e5d0f2044bcbf6f7ea86..5fbfc4b44c21ae9137e513972726ddddd2f64aa2 100644
index b68b19f32754c9c426e711892235b469a85fefb2..3135b7254776a96c581a5f8008c9712e996a27af 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1140,9 +1140,15 @@ public final class CraftServer implements Server {
@@ -1139,9 +1139,15 @@ public final class CraftServer implements Server {
File folder = new File(this.getWorldContainer(), name);
World world = this.getWorld(name);
@ -41,7 +41,7 @@ index 9d9731e52a9038e8e668e5d0f2044bcbf6f7ea86..5fbfc4b44c21ae9137e513972726dddd
if ((folder.exists()) && (!folder.isDirectory())) {
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
@@ -1231,7 +1237,7 @@ public final class CraftServer implements Server {
@@ -1230,7 +1236,7 @@ public final class CraftServer implements Server {
} else if (name.equals(levelName + "_the_end")) {
worldKey = net.minecraft.world.level.Level.END;
} else {
@ -50,7 +50,7 @@ index 9d9731e52a9038e8e668e5d0f2044bcbf6f7ea86..5fbfc4b44c21ae9137e513972726dddd
}
ServerLevel internal = (ServerLevel) new ServerLevel(this.console, console.executor, worldSession, worlddata, worldKey, worlddimension, this.getServer().progressListenerFactory.create(11),
@@ -1323,6 +1329,15 @@ public final class CraftServer implements Server {
@@ -1322,6 +1328,15 @@ public final class CraftServer implements Server {
return null;
}
@ -67,12 +67,12 @@ index 9d9731e52a9038e8e668e5d0f2044bcbf6f7ea86..5fbfc4b44c21ae9137e513972726dddd
// Check if a World already exists with the UID.
if (this.getWorld(world.getUID()) != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 611cf30d17e110ff7b38219053919b52a86dfb19..73334710407574124ad289bbd3379dccb3417755 100644
index 1caee283ae73943f936eddd822fbe64dc7815fdf..88074c487de90a7adc86c2345830147ac9f3ae77 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -521,6 +521,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public <T extends org.bukkit.Keyed> Registry<T> registryFor(Class<T> classOfT) {
return io.papermc.paper.registry.PaperRegistry.getRegistry(classOfT);
@@ -516,6 +516,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int nextEntityId() {
return net.minecraft.world.entity.Entity.nextEntityId();
}
+
+ @Override

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Item Rarity API
public net.minecraft.world.item.Item rarity
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 73334710407574124ad289bbd3379dccb3417755..f8bf5b0770e1e6b54d50e8063208083ea0b953a9 100644
index 88074c487de90a7adc86c2345830147ac9f3ae77..9c24c1f163fe6dd71239e6fb888d66a130e4596b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -526,6 +526,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -521,6 +521,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getMainLevelName() {
return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName;
}

Datei anzeigen

@ -7,7 +7,7 @@ Fixes disappearance of held items, when a player gets disconnected and PlayerDro
Closes #5036
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 437e78adcc4838a9887887858afe883c8f928fef..17dc86f7cb383bda18f28576113d1af0d5fb288a 100644
index 480af67431b567b29c76f949a429f619164b8391..d97ef7df5b4b98af95b8fff9ed541bbe8a43dfa8 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -570,6 +570,14 @@ public abstract class PlayerList {

Datei anzeigen

@ -5,10 +5,10 @@ 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 194f00dac49c54809d7a1dcccc9c2844399c5b0a..d5cd8d540438638268cc26e2fc9be8415950ee22 100644
index 7cb5fba71a7a3eb46917ff744cede12e3c42069e..40f78babdcf6fcb3ec5dd00ed36186bf61a98c6c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2122,7 +2122,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2121,7 +2121,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index f8bf5b0770e1e6b54d50e8063208083ea0b953a9..21648628856e425dd68d44bd81ac17ce4b4bff47 100644
index 9c24c1f163fe6dd71239e6fb888d66a130e4596b..9efcc26d49204255831a14115af09a8db7ad4636 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -540,6 +540,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -535,6 +535,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) {
return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()];
}

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Fix anchor respawn acting as a bed respawn from the end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 17dc86f7cb383bda18f28576113d1af0d5fb288a..12d65c3dfe2aa95d2aa80ba6bc4383f51e8cfc4a 100644
index d97ef7df5b4b98af95b8fff9ed541bbe8a43dfa8..a4b35d42d6e0e24b29e647f7a1e5735f8f07ef38 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -789,6 +789,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -18,7 +18,7 @@ index 908bf489f064780e6751de2762cb94668ae16d7e..7794964b08ac64e87fe83ebf7d7d4833
} else {
if (this.player.getHealth() > 0.0F) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 12d65c3dfe2aa95d2aa80ba6bc4383f51e8cfc4a..565a75e5e775edf604cdb4b991b17fb3ca3423ab 100644
index a4b35d42d6e0e24b29e647f7a1e5735f8f07ef38..aa069752df2e54cf6ef7fb4a7b82d91b219ba2ae 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -748,6 +748,12 @@ public abstract class PlayerList {

Datei anzeigen

@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415c
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 5fbfc4b44c21ae9137e513972726ddddd2f64aa2..59f9e2c09e72acedde901790f87432e53e8a4b70 100644
index 3135b7254776a96c581a5f8008c9712e996a27af..c58e8e36a2526272e7fa26dffbb4c5bd362692e1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -296,6 +296,7 @@ public final class CraftServer implements Server {
@ -103,7 +103,7 @@ index 5fbfc4b44c21ae9137e513972726ddddd2f64aa2..59f9e2c09e72acedde901790f87432e5
public static Exception excessiveVelEx; // Paper - Velocity warnings
static {
@@ -383,6 +384,7 @@ public final class CraftServer implements Server {
@@ -382,6 +383,7 @@ public final class CraftServer implements Server {
if (this.configuration.getBoolean("settings.use-map-color-cache")) {
MapPalette.setMapColorCache(new CraftMapColorCache(this.logger));
}
@ -111,7 +111,7 @@ index 5fbfc4b44c21ae9137e513972726ddddd2f64aa2..59f9e2c09e72acedde901790f87432e5
}
public boolean getCommandBlockOverride(String command) {
@@ -2781,5 +2783,11 @@ public final class CraftServer implements Server {
@@ -2780,5 +2782,11 @@ public final class CraftServer implements Server {
public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
return mobGoals;
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 21648628856e425dd68d44bd81ac17ce4b4bff47..12ad9ccac400159af9b6597811fec7d362be5906 100644
index 9efcc26d49204255831a14115af09a8db7ad4636..73fa833ecf2e783f25f24de48b00829a813c1d19 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -541,6 +541,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -536,6 +536,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()];
}

Datei anzeigen

@ -275,7 +275,7 @@ index bf19d95d9b48310de10ef6819b83035ee63a165c..e24b23461c592fae07697d3b2a1929cb
Main.LOGGER.info("Forcing world upgrade! {}", session.getLevelId()); // CraftBukkit
WorldUpgrader worldupgrader = new WorldUpgrader(session, dataFixer, dimensionOptionsRegistry, eraseCache);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d5cd8d540438638268cc26e2fc9be8415950ee22..13f8b4699c5b3a99715fada2d774469fb5c17363 100644
index 40f78babdcf6fcb3ec5dd00ed36186bf61a98c6c..b6e7b86bcb874ddf56a14334d30f95aadc9887ce 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -551,11 +551,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -359,10 +359,10 @@ index b294ef87fb93e7f4651dc04128124f297575860d..65fd57609e45ccd49ebfc1ba80d25243
return this.regionCache.getAndMoveToFirst(ChunkPos.asLong(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()));
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 59f9e2c09e72acedde901790f87432e53e8a4b70..b51f51381f765a3ebefc3f563062302211f068b5 100644
index c58e8e36a2526272e7fa26dffbb4c5bd362692e1..87651b9cf470e4e88676691c22a1e11939522547 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1216,12 +1216,7 @@ public final class CraftServer implements Server {
@@ -1215,12 +1215,7 @@ public final class CraftServer implements Server {
worlddata.customDimensions = iregistry;
worlddata.checkName(name);
worlddata.setModdedInfo(this.console.getServerModName(), this.console.getModdedStatus().shouldReportAsModified());
@ -376,7 +376,7 @@ index 59f9e2c09e72acedde901790f87432e53e8a4b70..b51f51381f765a3ebefc3f5630623022
long j = BiomeManager.obfuscateSeed(creator.seed());
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
@@ -1232,6 +1227,13 @@ public final class CraftServer implements Server {
@@ -1231,6 +1226,13 @@ public final class CraftServer implements Server {
biomeProvider = generator.getDefaultBiomeProvider(worldInfo);
}

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Attributes API for item defaults
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 12ad9ccac400159af9b6597811fec7d362be5906..6c39b620e9909759ab37d659c93e426c9f33ba95 100644
index 73fa833ecf2e783f25f24de48b00829a813c1d19..23b322f077312ad6b40964b12dff1ac03ad1a2b8 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -549,6 +549,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -544,6 +544,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
}

Datei anzeigen

@ -36,10 +36,10 @@ index b5f54ee82905e3e6ab5bfde35ab625f5feeb1393..c0a80824a0307ea673805015119cc834
public boolean shouldDisconnect() {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 13f8b4699c5b3a99715fada2d774469fb5c17363..213033a59be4239f1225286764be83dcc6fbf973 100644
index b6e7b86bcb874ddf56a14334d30f95aadc9887ce..34619d107231fe188d2b4c8eeefba8b6eaf4d3a5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2125,7 +2125,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2124,7 +2124,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)
@ -434,7 +434,7 @@ index 9a2d9bcad94612e5c2506db5a9dcd4a3f9271a59..6c166950247118cb1bbae4aa1fc3ee8a
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f54873b3f1fa9a5181d1fe6d1673d6c54de05b72..fede2a6f68de79783f3aa0fd9276a28479dfea48 100644
index aa069752df2e54cf6ef7fb4a7b82d91b219ba2ae..037491f78ebf9f36fa044eb250fef11ea521cd49 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -657,7 +657,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -789,7 +789,7 @@ index ee9648739fb39c5842063d7442df6eb5c9336d7f..569763b3c9e92a4071884f139fb12632
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java
index 9569068c0a6e1eb934f063634f5d3efe674aa33d..4dd6314c66e2d69b0e072cfc305058b62945d35f 100644
index 9569068c0a6e1eb934f063634f5d3efe674aa33d..5e3f0180accf633aa28ae87fe07464edfde50bff 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java
@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer;

Datei anzeigen

@ -59,7 +59,7 @@ index 49c45be8d757ee11a18ce507c6397835e3911e86..470b32ce81f5303c6d6d972e79f53cd8
this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false);
// Paper end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index adb546d97810b0a4f25568c8a5e50d01bdcfb274..a1ea893c4af69bdbbca9bee2760016e8c8a17bb3 100644
index 037491f78ebf9f36fa044eb250fef11ea521cd49..8dd9066868fd9a61936aabe2336c804c20b8bbc5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -543,6 +543,11 @@ public abstract class PlayerList {

Datei anzeigen

@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..76d0d00cd6742991e3f3ec827a75ee87
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index a24769e0be5c0d67b6a6b8441570e20a622e5cbd..6707c96293e3c734628cbb017ddcf098641d69c2 100644
index 87651b9cf470e4e88676691c22a1e11939522547..049861abd721a964c965177719fe5bc2d04214a0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -298,6 +298,7 @@ public final class CraftServer implements Server {

Datei anzeigen

@ -89,7 +89,7 @@ index 715a719d58f3333d8c3ce761182d4932e5b08e6c..8f6ec40f9aebececd4506ce29d33f44a
public void trackChunk(ChunkPos chunkPos, Packet<?> chunkDataPacket) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index a1ea893c4af69bdbbca9bee2760016e8c8a17bb3..892db3baaf2936d5db9b073faf7537b6a97ededf 100644
index 8dd9066868fd9a61936aabe2336c804c20b8bbc5..c646570cfa543d56011733af984345f73dc63cb9 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -833,13 +833,13 @@ public abstract class PlayerList {

Datei anzeigen

@ -81,10 +81,10 @@ index 0000000000000000000000000000000000000000..cf9d28ea97d93cec05c9fb768d59e283
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 6c39b620e9909759ab37d659c93e426c9f33ba95..72ce08862419ce5b6da6decb39d8c36adc1eaaf0 100644
index 23b322f077312ad6b40964b12dff1ac03ad1a2b8..c18829fb68db70296ddf546a903ed38cb12a593e 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -566,6 +566,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -561,6 +561,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int getProtocolVersion() {
return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion();
}

Datei anzeigen

@ -39,10 +39,10 @@ index 7b9e943b391c061782fccd2b8d705ceec8db50fe..966ac60daebb7bb211ab8096fc0c5f33
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 72ce08862419ce5b6da6decb39d8c36adc1eaaf0..dea05265776f2b57115f36e8a31ed7720cce2cd0 100644
index c18829fb68db70296ddf546a903ed38cb12a593e..368693d93700390915f538de37409b5a37f916b7 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -578,6 +578,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -573,6 +573,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
var supplier = net.minecraft.world.entity.ai.attributes.DefaultAttributes.getSupplier((net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity>) net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(bukkitEntityKey)));
return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
}

Datei anzeigen

@ -45,7 +45,7 @@ index f1ee89047e8cd916c762b91162842e3f981856b3..726a4ae7ab928eda3ae1c1e98f342157
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index dea05265776f2b57115f36e8a31ed7720cce2cd0..109f36e8892cc2e50d88054459321007ea00cf93 100644
index 368693d93700390915f538de37409b5a37f916b7..57a1b4f0e179deec31bcda23a1ebafe2c745df11 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -484,6 +484,29 @@ public final class CraftMagicNumbers implements UnsafeValues {

Datei anzeigen

@ -286,10 +286,10 @@ index bf3fb416d36a19958033cdbf5cc313556fa0201b..0a49769bfa83d0b9c435e3ab4bba8597
// Paper start - add parameters and int ret type
spawnCategoryForChunk(group, world, chunk, checker, runner, Integer.MAX_VALUE, null);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 0aead1e438c4c2c8c138697e9afbf52323ebf6ca..8c592dcae27b91edd6ca9374643097cf73f12750 100644
index 049861abd721a964c965177719fe5bc2d04214a0..a6e5333c6e339a3a1853a6023a2e68c046811a4d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2167,6 +2167,11 @@ public final class CraftServer implements Server {
@@ -2166,6 +2166,11 @@ public final class CraftServer implements Server {
@Override
public int getSpawnLimit(SpawnCategory spawnCategory) {

Datei anzeigen

@ -19,7 +19,7 @@ index 23e564b05ba438924180c91f9b19a60731eedd1b..5ec241d49ff5e3a161a39006f05823a5
private MinecraftTimings() {}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 213033a59be4239f1225286764be83dcc6fbf973..0868805c78d991c602d8f1d1b5aeb5c790c13384 100644
index 34619d107231fe188d2b4c8eeefba8b6eaf4d3a5..4fb05a2be3ff06ceddae37e1592db548c727a056 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1305,6 +1305,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -30,7 +30,7 @@ index 213033a59be4239f1225286764be83dcc6fbf973..0868805c78d991c602d8f1d1b5aeb5c7
return true;
} else {
if (this.haveTime()) {
@@ -2686,4 +2687,74 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2685,4 +2686,74 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
}
// Paper end

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Use Velocity compression and cipher natives
diff --git a/build.gradle.kts b/build.gradle.kts
index 5f9823714a0e7d1d4a73861996c4db03c8a0b99b..da408b67c42f6cc0b5322f57ff86f93f66eb8c06 100644
index 0f4162f47cea792696271b7157c95c399d2c3567..3c493f7eeffefee013c7837c3b46531fd20aac0f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -28,6 +28,11 @@ dependencies {

Datei anzeigen

@ -13,7 +13,7 @@ the material type of the block at that location.
public net.minecraft.world.level.block.entity.BlockEntityType validBlocks
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index be98a87edbe62cfcf5c1b6f6cd1d8e31b546c144..4e2cd5435cc2c87bc604e7eba4f587c0b029e571 100644
index e5e10c30fa9020e8dbbad708ef262eb6e1d559a6..9b1e2af71728c1a0842c690cee01161342dc35f1 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -250,7 +250,7 @@ public abstract class BlockEntity {

Datei anzeigen

@ -65,7 +65,7 @@ index acde45dcf605d9e2ce85002cd4d0d457c4afce38..b6dc42aef6458b0c09007bb0e13048b9
@Override
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 892db3baaf2936d5db9b073faf7537b6a97ededf..50455e4efa287c0c49b60ddcabff5a336b86365f 100644
index c646570cfa543d56011733af984345f73dc63cb9..0693667c670bfd3431a9cef18fc1dfe39bcc7f9a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -240,7 +240,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -19,10 +19,10 @@ index 98171f6c8e23f6ef89b897e4b80e3afb2a1950a0..06bff37e4c1fddd3be6343049a66787c
}
final Object val = config.get(key);
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 29032374f0e71a41a2de260d402b6fbff68288cc..95dd058fca280a1e16f3d327be2aabeab91be534 100644
index aecdbbcc688aad308f81f48d50773a9866ded7b2..9ef0937b7292ec118d2b65e9b098f5538410dbac 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -433,7 +433,14 @@ public abstract class ChunkGenerator {
@@ -431,7 +431,14 @@ public abstract class ChunkGenerator {
return (String) optional.orElseGet(placedfeature::toString);
};

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Allow delegation to vanilla chunk gen
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8c592dcae27b91edd6ca9374643097cf73f12750..6cf52ff65cd300c89df7030266df815959ec48cd 100644
index a6e5333c6e339a3a1853a6023a2e68c046811a4d..c4d5f3482881376bde77e826009a383804a2203d 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2340,6 +2340,90 @@ public final class CraftServer implements Server {
@@ -2339,6 +2339,90 @@ public final class CraftServer implements Server {
return new OldCraftChunkData(world.getMinHeight(), world.getMaxHeight(), handle.registryAccess().registryOrThrow(Registries.BIOME), world); // Paper - Anti-Xray - Add parameters
}

Datei anzeigen

@ -1202,7 +1202,7 @@ index d5b0777219c78aaff5c87fe8f422e67952ac241b..0c212a2136b4d275aa0d7e31af19f90d
}
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 50455e4efa287c0c49b60ddcabff5a336b86365f..3bc06377d022f6a3f6e0c2129640b6b9e04054f9 100644
index 0693667c670bfd3431a9cef18fc1dfe39bcc7f9a..d396e2cb91aa99d60c898f86e0f33d3ce3f885cd 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -874,7 +874,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -56,7 +56,7 @@ index b6dc42aef6458b0c09007bb0e13048b99531f8c0..7e8401a05905775f7209abb1269e24aa
if (gameprofile != null && packet.name().equalsIgnoreCase(gameprofile.getName())) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3bc06377d022f6a3f6e0c2129640b6b9e04054f9..d7a5d6e548e6239f3f5a26303e03b657fc2ec8f5 100644
index d396e2cb91aa99d60c898f86e0f33d3ce3f885cd..147d955d8be63255ff74457c2c3b92cd22577342 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -652,7 +652,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Expose vanilla BiomeProvider from WorldInfo
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0868805c78d991c602d8f1d1b5aeb5c790c13384..6986d5475b090bca60b5ae892512fd5e55ae9b07 100644
index 4fb05a2be3ff06ceddae37e1592db548c727a056..1b1b7560b7ae59c5da7ad0e3dfae32cbcaeedcbd 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -561,7 +561,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -18,10 +18,10 @@ index 0868805c78d991c602d8f1d1b5aeb5c790c13384..6986d5475b090bca60b5ae892512fd5e
biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6cf52ff65cd300c89df7030266df815959ec48cd..c41954c1c96c5b9e0ee49237e9dc6831a75c635e 100644
index c4d5f3482881376bde77e826009a383804a2203d..759d091593b75419e275e79eaa3afbfbef6aee10 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1223,7 +1223,7 @@ public final class CraftServer implements Server {
@@ -1222,7 +1222,7 @@ public final class CraftServer implements Server {
List<CustomSpawner> list = ImmutableList.of(new PhantomSpawner(), new PatrolSpawner(), new CatSpawner(), new VillageSiege(), new WanderingTraderSpawner(worlddata));
LevelStem worlddimension = iregistry.get(actualDimension);

Datei anzeigen

@ -122,10 +122,10 @@ index 0000000000000000000000000000000000000000..e3a5f1ec376319bdfda87fa27ae217bf
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c41954c1c96c5b9e0ee49237e9dc6831a75c635e..82099415303e91016ed02b0ca75f1437206704c1 100644
index 759d091593b75419e275e79eaa3afbfbef6aee10..11f133dccb7bb837d369b2b41f96b26875dc6967 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2001,6 +2001,13 @@ public final class CraftServer implements Server {
@@ -2000,6 +2000,13 @@ public final class CraftServer implements Server {
return console.console;
}

Datei anzeigen

@ -20,10 +20,10 @@ seeds/salts to the frequency reducer which has a similar effect.
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
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 95dd058fca280a1e16f3d327be2aabeab91be534..7e9c388179c75a233d9b179ea1e00428ac65ee99 100644
index 9ef0937b7292ec118d2b65e9b098f5538410dbac..130ac7164c63374120ca2cdfbb1f6c3eefb4b7a5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -570,7 +570,7 @@ public abstract class ChunkGenerator {
@@ -568,7 +568,7 @@ public abstract class ChunkGenerator {
}
}

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add missing Validate calls to CraftServer#getSpawnLimit
Copies appropriate checks from CraftWorld#getSpawnLimit
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 82099415303e91016ed02b0ca75f1437206704c1..6a5ee59bada7922217a21f1130d329af259eb5c7 100644
index 11f133dccb7bb837d369b2b41f96b26875dc6967..93f6b4ebf1ad238248b201878cfb3cdeee2515f9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2175,6 +2175,8 @@ public final class CraftServer implements Server {
@@ -2174,6 +2174,8 @@ public final class CraftServer implements Server {
@Override
public int getSpawnLimit(SpawnCategory spawnCategory) {
// Paper start

Datei anzeigen

@ -46,10 +46,10 @@ index 0000000000000000000000000000000000000000..e7d9fd2702a1ce96596580fff8f5ee4f
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6a5ee59bada7922217a21f1130d329af259eb5c7..8ad83861bd928500b206fdff341671d773efc223 100644
index 93f6b4ebf1ad238248b201878cfb3cdeee2515f9..1e38084012b576fcd26c1d432fd8b275d1054d7f 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2586,6 +2586,15 @@ public final class CraftServer implements Server {
@@ -2585,6 +2585,15 @@ public final class CraftServer implements Server {
return (org.bukkit.Tag<T>) new CraftEntityTag(BuiltInRegistries.ENTITY_TYPE, entityTagKey);
}
}
@ -65,7 +65,7 @@ index 6a5ee59bada7922217a21f1130d329af259eb5c7..8ad83861bd928500b206fdff341671d7
default -> throw new IllegalArgumentException();
}
@@ -2618,6 +2627,13 @@ public final class CraftServer implements Server {
@@ -2617,6 +2626,13 @@ public final class CraftServer implements Server {
net.minecraft.core.Registry<EntityType<?>> entityTags = BuiltInRegistries.ENTITY_TYPE;
return entityTags.getTags().map(pair -> (org.bukkit.Tag<T>) new CraftEntityTag(entityTags, pair.getFirst())).collect(ImmutableList.toImmutableList());
}

Datei anzeigen

@ -9,7 +9,7 @@ This might result in chunks loading far slower in the nether,
for example.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 6986d5475b090bca60b5ae892512fd5e55ae9b07..fa28023738fc50ac6c28e12bb7bbe249ddfc9a4a 100644
index 1b1b7560b7ae59c5da7ad0e3dfae32cbcaeedcbd..d0eedbf2970bd839422f2c911abf20d2c90c0177 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1308,6 +1308,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

Datei anzeigen

@ -10,7 +10,7 @@ just looking at the LevelStem key, look at the DimensionType key which
is one level below that. Defaults to off to keep vanilla behavior.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fa28023738fc50ac6c28e12bb7bbe249ddfc9a4a..d2409599c9d9765a2e1dc7418339923049abc416 100644
index d0eedbf2970bd839422f2c911abf20d2c90c0177..7587f54e1c397179d30270aee5da9b07caf62878 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -588,7 +588,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

Datei anzeigen

@ -7,7 +7,7 @@ Some parts of legacy conversion will need the overworld
to get the legacy structure data storage
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d2409599c9d9765a2e1dc7418339923049abc416..f42d7d9e11542370489fcc8dc42ea6eca50cf284 100644
index 7587f54e1c397179d30270aee5da9b07caf62878..126e15745bfc1a5f124b0d2ca679d12a28cc0220 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -600,9 +600,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -23,10 +23,10 @@ index d2409599c9d9765a2e1dc7418339923049abc416..f42d7d9e11542370489fcc8dc42ea6ec
if (worlddata.getCustomBossEvents() != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 8ad83861bd928500b206fdff341671d773efc223..850dc6f3977740a3a8f8dbf353e320d71c528d57 100644
index 1e38084012b576fcd26c1d432fd8b275d1054d7f..1c6f8b5a67785626b55bb03110ecf447c31ba4c0 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1252,10 +1252,11 @@ public final class CraftServer implements Server {
@@ -1251,10 +1251,11 @@ public final class CraftServer implements Server {
return null;
}

Datei anzeigen

@ -24,13 +24,13 @@ index 0000000000000000000000000000000000000000..6b0bed550763f34e18c9e92f9a47ec0c
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f42d7d9e11542370489fcc8dc42ea6eca50cf284..a8b3f0e8be414c4ea92cc85c9811ecd42e5ce9c1 100644
index 126e15745bfc1a5f124b0d2ca679d12a28cc0220..0d027c99eaa049d7e99c50df10e2131eaa8bafee 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2032,6 +2032,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2031,6 +2031,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.worldData.setDataConfiguration(worlddataconfiguration);
this.resources.managers.updateRegistryTags(this.registryAccess());
io.papermc.paper.registry.PaperRegistry.clearCaches(); // Paper
+ net.minecraft.world.item.alchemy.PotionBrewing.reload(); // Paper
new io.papermc.paper.event.server.ServerResourcesReloadedEvent(cause).callEvent(); // Paper
// Paper start
@ -164,7 +164,7 @@ index cf2b6487a640a7a613f3b3604ca7b1063b3ff102..0bab2693b91d5bab222c7db8bc6965cc
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 850dc6f3977740a3a8f8dbf353e320d71c528d57..c67dedfb194835473fb1f17d0d318d9ec561d83a 100644
index 1c6f8b5a67785626b55bb03110ecf447c31ba4c0..990ae9219f06abd3e3f04cbc0c67fe4c5904b79b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -299,6 +299,7 @@ public final class CraftServer implements Server {
@ -175,7 +175,7 @@ index 850dc6f3977740a3a8f8dbf353e320d71c528d57..c67dedfb194835473fb1f17d0d318d9e
static {
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
@@ -326,7 +327,7 @@ public final class CraftServer implements Server {
@@ -325,7 +326,7 @@ public final class CraftServer implements Server {
Enchantments.SHARPNESS.getClass();
org.bukkit.enchantments.Enchantment.stopAcceptingRegistrations();
@ -184,7 +184,7 @@ index 850dc6f3977740a3a8f8dbf353e320d71c528d57..c67dedfb194835473fb1f17d0d318d9e
MobEffects.BLINDNESS.getClass();
PotionEffectType.stopAcceptingRegistrations();
// Ugly hack :(
@@ -2907,5 +2908,10 @@ public final class CraftServer implements Server {
@@ -2906,5 +2907,10 @@ public final class CraftServer implements Server {
return datapackManager;
}

Datei anzeigen

@ -10,7 +10,7 @@ so we do not need that. The client only needs the chunk it is currently in to
be loaded to close the loading screen, so we just send an empty one.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d7a5d6e548e6239f3f5a26303e03b657fc2ec8f5..0093be36b2d107549da99d51894f7a332af5e3fa 100644
index 147d955d8be63255ff74457c2c3b92cd22577342..9a2ffca2b125aa5c00a956e1203066c5d23f9ee4 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -375,6 +375,16 @@ public abstract class PlayerList {

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Fix saving in unloadWorld
Change savingDisabled to false to ensure ServerLevel's saving logic gets called when unloadWorld is called with save = true
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c67dedfb194835473fb1f17d0d318d9ec561d83a..591ccb3b5be1207a18bc427dbd51758d8960b8cd 100644
index 990ae9219f06abd3e3f04cbc0c67fe4c5904b79b..3448954294e6c47e71172d616d955c0412fd0e19 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1300,7 +1300,7 @@ public final class CraftServer implements Server {
@@ -1299,7 +1299,7 @@ public final class CraftServer implements Server {
try {
if (save) {

Datei anzeigen

@ -6,7 +6,7 @@ Subject: [PATCH] Use username instead of display name in
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 2a1273d560279b97faeaa3c906e60cc51c356fce..2bd6cf60e2489b55b17e9245bc1481823ced7785 100644
index 9a2ffca2b125aa5c00a956e1203066c5d23f9ee4..b75966168795dcd0e89634bb9edf0206c8337d4a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1409,7 +1409,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] WorldCreator#keepSpawnLoaded
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 591ccb3b5be1207a18bc427dbd51758d8960b8cd..6dcbc6993a2462bc13820d3f8a77c188705fb6c2 100644
index 3448954294e6c47e71172d616d955c0412fd0e19..70e289c98cf39c5c6eeb7fb8b250be6e5bb52b8b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1259,6 +1259,7 @@ public final class CraftServer implements Server {
@@ -1258,6 +1258,7 @@ public final class CraftServer implements Server {
internal.setSpawnSettings(true, true);
// Paper - move up

Datei anzeigen

@ -7,7 +7,7 @@ Powder snow cauldrons should turn to water when
extinguishing an entity
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
index 1a7cb12fd3f183c00079d679452a01b8df8d2bbb..a223959f766ac41aff7aeff80606f5e7c37ebf49 100644
index 14164aa59fa5e315788cd7a207228081a05fd18f..2932419b7ca3f066b1db329829af36ba31e17c65 100644
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -64,7 +64,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add support for Proxy Protocol
diff --git a/build.gradle.kts b/build.gradle.kts
index da408b67c42f6cc0b5322f57ff86f93f66eb8c06..6a1853f3d988820f357c11371e32d50682e60401 100644
index 3c493f7eeffefee013c7837c3b46531fd20aac0f..4cc7d15f43b2547a723ea231bcf98bc13bdb85bf 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -20,6 +20,7 @@ dependencies {

Datei anzeigen

@ -30,7 +30,7 @@ index 40a42a632540d497c1393b112731c41c6e448228..f3fa2678796c33f3a408a02a1995ad11
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index 4e2cd5435cc2c87bc604e7eba4f587c0b029e571..58986bc0677c5ea1ad54d7d6d4efa5c2ea233aea 100644
index 9b1e2af71728c1a0842c690cee01161342dc35f1..1b248db497500aa6bd346b306dcb908af77626f3 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -256,4 +256,12 @@ public abstract class BlockEntity {

Datei anzeigen

@ -7,7 +7,7 @@ There are no plans to support creating worlds while worlds are
being ticked themselvess.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a8b3f0e8be414c4ea92cc85c9811ecd42e5ce9c1..0e04083ff0598451c66731b1518b2eb6367ae36c 100644
index 0d027c99eaa049d7e99c50df10e2131eaa8bafee..1b56bb2869d3cf22670b508133968e66493a5bec 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -308,6 +308,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -45,10 +45,10 @@ index a8b3f0e8be414c4ea92cc85c9811ecd42e5ce9c1..0e04083ff0598451c66731b1518b2eb6
this.profiler.popPush("connection");
MinecraftTimings.connectionTimer.startTiming(); // Spigot
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6dcbc6993a2462bc13820d3f8a77c188705fb6c2..bb0b7081c400b3928677d3c41e398053acd301d9 100644
index 70e289c98cf39c5c6eeb7fb8b250be6e5bb52b8b..c51f9a26c6a41158ebdc83adfb495a5412a1197b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -851,6 +851,11 @@ public final class CraftServer implements Server {
@@ -850,6 +850,11 @@ public final class CraftServer implements Server {
return new ArrayList<World>(this.worlds.values());
}
@ -60,7 +60,7 @@ index 6dcbc6993a2462bc13820d3f8a77c188705fb6c2..bb0b7081c400b3928677d3c41e398053
public DedicatedPlayerList getHandle() {
return this.playerList;
}
@@ -1136,6 +1141,7 @@ public final class CraftServer implements Server {
@@ -1135,6 +1140,7 @@ public final class CraftServer implements Server {
@Override
public World createWorld(WorldCreator creator) {
Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP");
@ -68,7 +68,7 @@ index 6dcbc6993a2462bc13820d3f8a77c188705fb6c2..bb0b7081c400b3928677d3c41e398053
Validate.notNull(creator, "Creator may not be null");
String name = creator.name();
@@ -1274,6 +1280,7 @@ public final class CraftServer implements Server {
@@ -1273,6 +1279,7 @@ public final class CraftServer implements Server {
@Override
public boolean unloadWorld(World world, boolean save) {

Datei anzeigen

@ -20,10 +20,10 @@ index 7c7e5f3c0f9cd1f16192a8fc8163da9b2d9519d5..888936385196a178ab8b730fd5e4fff4
Date date = new Date();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index bb0b7081c400b3928677d3c41e398053acd301d9..d275ca28f145f3e9bbf21e591129e6108efac57d 100644
index c51f9a26c6a41158ebdc83adfb495a5412a1197b..52dec44a061b773c4467279c766f504d079dd1a4 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1774,7 +1774,7 @@ public final class CraftServer implements Server {
@@ -1773,7 +1773,7 @@ public final class CraftServer implements Server {
// Paper end
Set<CommandSender> recipients = new HashSet<>();
for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) {

Datei anzeigen

@ -213,10 +213,10 @@ index 0bedd9eadbfe1ce290f22d6c648571e25e3ae0e9..093822a5256e8e919350a000239a3e92
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9c97e31a00bf226c7298242a6e0d4c0b35a49817..621919a4a45caa73a43020fdca24764d95d89fd2 100644
index 52dec44a061b773c4467279c766f504d079dd1a4..bbb8335dae0a3e2761e6bbb8dc723bcf28cd82ba 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -780,7 +780,7 @@ public final class CraftServer implements Server {
@@ -779,7 +779,7 @@ public final class CraftServer implements Server {
@Override
public long getConnectionThrottle() {
// Spigot Start - Automatically set connection throttle for bungee configurations

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add NamespacedKey biome methods
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com>
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 109f36e8892cc2e50d88054459321007ea00cf93..adde9b49bf043112765734716f01b0d29456e46c 100644
index 57a1b4f0e179deec31bcda23a1ebafe2c745df11..2d5c4d4170e9a7cae9200280de3706e4be317413 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -607,6 +607,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -602,6 +602,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
Preconditions.checkArgument(material.isBlock(), material + " is not a block");
return getBlock(material).hasCollision;
}

Datei anzeigen

@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..c1d3bac79bb8b4796c013ff4472f75dc
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 0e04083ff0598451c66731b1518b2eb6367ae36c..710ca7d3a5659953f64bc6dccdd93b43300961cc 100644
index 1b56bb2869d3cf22670b508133968e66493a5bec..753a917d34a1e1c1521a8916bc8e44a6acd90a46 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -998,6 +998,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa

Datei anzeigen

@ -263,7 +263,7 @@ index c35375e15c0368fec12d37a4b82668b51d9fe9ff..0c975875f1f2d0236d42a291486a7e78
stack.shrink(1);
}
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
index a223959f766ac41aff7aeff80606f5e7c37ebf49..1a90860bc39afb8bade96a5c6c40861dbb68c21e 100644
index 2932419b7ca3f066b1db329829af36ba31e17c65..e11eced0bf15dfecaf64f5e1c28e973c38746095 100644
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
@@ -63,7 +63,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {

Datei anzeigen

@ -79,7 +79,7 @@ index 834b899ec913def6fe4f517f5b76c9c0f92c970b..354b6e86b789ce80fe8f28384e4ca783
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c092bfa679c60fd11eb95aaa4828b4f3403869f8..15f1a1dd63633005787876c37f9a67fa4f3fcbb9 100644
index b75966168795dcd0e89634bb9edf0206c8337d4a..1b0ca19cd61a55998676b9f8ca17bf79966385db 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -351,7 +351,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -18,7 +18,7 @@ index aa11c64c74e1fd875161c9a80a16dbba6738bf1d..9b0b42add71172bd154226e51d62cebd
});
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 15f1a1dd63633005787876c37f9a67fa4f3fcbb9..4b754f6eae683248d7fe11d6d6cb168d5dd696a2 100644
index 1b0ca19cd61a55998676b9f8ca17bf79966385db..835e439a1af327c67558653ef79ef7e59692a976 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -297,7 +297,7 @@ public abstract class PlayerList {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Add missing isFuel Material entries
diff --git a/src/test/java/org/bukkit/support/AbstractTestingBase.java b/src/test/java/org/bukkit/support/AbstractTestingBase.java
index a19c1e8253b0dd0da77008f892b68187acd17c4a..5b4c93bb313019ad44eb8283865be45c69d99984 100644
index 1caa4ce02cd396160f0d9d5461de8290e7c078bb..1fa801c93597f6939b88442ad72812cc5080c37e 100644
--- a/src/test/java/org/bukkit/support/AbstractTestingBase.java
+++ b/src/test/java/org/bukkit/support/AbstractTestingBase.java
@@ -43,7 +43,12 @@ public abstract class AbstractTestingBase {

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Temp fix for EntityType.translationKey()
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 769efed4ce75231a5557e4723de5dc3121cedf3d..edc1a161cf509040fcaa12826743232f31d95bd7 100644
index 2d5c4d4170e9a7cae9200280de3706e4be317413..1244c1ca5e0907298b1ca6de538db82b2209ec4d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -440,7 +440,12 @@ public final class CraftMagicNumbers implements UnsafeValues {