support patch versions in api-version

This commit is contained in:
Jake Potrebic 2024-04-25 23:29:16 -07:00
parent 2997fd6459
commit 7e9da43b33
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
24 changed files with 77 additions and 124 deletions

View file

@ -4861,10 +4861,10 @@ index 0000000000000000000000000000000000000000..e3430f535e8e9c3b8b44bf2daece8c47
+} +}
diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940aee49799b index 0000000000000000000000000000000000000000..c685871155c8dff1d57ff151d7a5ec70350e5390
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java +++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/PaperPluginMeta.java
@@ -0,0 +1,248 @@ @@ -0,0 +1,271 @@
+package io.papermc.paper.plugin.provider.configuration; +package io.papermc.paper.plugin.provider.configuration;
+ +
+import com.google.common.base.Preconditions; +import com.google.common.base.Preconditions;
@ -4878,6 +4878,9 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a
+import io.papermc.paper.plugin.provider.configuration.type.DependencyConfiguration; +import io.papermc.paper.plugin.provider.configuration.type.DependencyConfiguration;
+import io.papermc.paper.plugin.provider.configuration.type.PermissionConfiguration; +import io.papermc.paper.plugin.provider.configuration.type.PermissionConfiguration;
+import io.papermc.paper.plugin.provider.configuration.type.PluginDependencyLifeCycle; +import io.papermc.paper.plugin.provider.configuration.type.PluginDependencyLifeCycle;
+import java.lang.reflect.Type;
+import java.util.function.Predicate;
+import org.bukkit.craftbukkit.util.ApiVersion;
+import org.bukkit.permissions.Permission; +import org.bukkit.permissions.Permission;
+import org.bukkit.permissions.PermissionDefault; +import org.bukkit.permissions.PermissionDefault;
+import org.bukkit.plugin.PluginLoadOrder; +import org.bukkit.plugin.PluginLoadOrder;
@ -4890,6 +4893,8 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a
+import org.spongepowered.configurate.objectmapping.ConfigSerializable; +import org.spongepowered.configurate.objectmapping.ConfigSerializable;
+import org.spongepowered.configurate.objectmapping.ObjectMapper; +import org.spongepowered.configurate.objectmapping.ObjectMapper;
+import org.spongepowered.configurate.objectmapping.meta.Required; +import org.spongepowered.configurate.objectmapping.meta.Required;
+import org.spongepowered.configurate.serialize.ScalarSerializer;
+import org.spongepowered.configurate.serialize.SerializationException;
+import org.spongepowered.configurate.yaml.NodeStyle; +import org.spongepowered.configurate.yaml.NodeStyle;
+import org.spongepowered.configurate.yaml.YamlConfigurationLoader; +import org.spongepowered.configurate.yaml.YamlConfigurationLoader;
+ +
@ -4925,14 +4930,14 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a
+ @FlattenedResolver + @FlattenedResolver
+ private PermissionConfiguration permissionConfiguration = new PermissionConfiguration(PermissionDefault.OP, List.of()); + private PermissionConfiguration permissionConfiguration = new PermissionConfiguration(PermissionDefault.OP, List.of());
+ @Required + @Required
+ @PluginConfigConstraints.PluginVersion + private ApiVersion apiVersion;
+ private String apiVersion;
+ +
+ private Map<PluginDependencyLifeCycle, Map<String, DependencyConfiguration>> dependencies = new EnumMap<>(PluginDependencyLifeCycle.class); + private Map<PluginDependencyLifeCycle, Map<String, DependencyConfiguration>> dependencies = new EnumMap<>(PluginDependencyLifeCycle.class);
+ +
+ public PaperPluginMeta() { + public PaperPluginMeta() {
+ } + }
+ +
+ static final ApiVersion MINIMUM = ApiVersion.getOrCreateVersion("1.19");
+ public static PaperPluginMeta create(BufferedReader reader) throws ConfigurateException { + public static PaperPluginMeta create(BufferedReader reader) throws ConfigurateException {
+ YamlConfigurationLoader loader = YamlConfigurationLoader.builder() + YamlConfigurationLoader loader = YamlConfigurationLoader.builder()
+ .indent(2) + .indent(2)
@ -4943,6 +4948,25 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a
+ +
+ return options.serializers((serializers) -> { + return options.serializers((serializers) -> {
+ serializers + serializers
+ .register(new ScalarSerializer<>(ApiVersion.class) {
+ @Override
+ public ApiVersion deserialize(final Type type, final Object obj) throws SerializationException {
+ try {
+ final ApiVersion version = ApiVersion.getOrCreateVersion(obj.toString());
+ if (version.isOlderThan(MINIMUM)) {
+ throw new SerializationException(version + " is too old for a paper plugin!");
+ }
+ return version;
+ } catch (final IllegalArgumentException e) {
+ throw new SerializationException(e);
+ }
+ }
+
+ @Override
+ protected Object serialize(final ApiVersion item, final Predicate<Class<?>> typeSupported) {
+ return item.getVersionString();
+ }
+ })
+ .register(new EnumValueSerializer()) + .register(new EnumValueSerializer())
+ .register(PermissionConfiguration.class, PermissionConfigurationSerializer.SERIALIZER) + .register(PermissionConfiguration.class, PermissionConfigurationSerializer.SERIALIZER)
+ .register(new ComponentSerializer()) + .register(new ComponentSerializer())
@ -4950,7 +4974,6 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a
+ ObjectMapper.factoryBuilder() + ObjectMapper.factoryBuilder()
+ .addConstraint(Constraint.class, new Constraint.Factory()) + .addConstraint(Constraint.class, new Constraint.Factory())
+ .addConstraint(PluginConfigConstraints.PluginName.class, String.class, new PluginConfigConstraints.PluginName.Factory()) + .addConstraint(PluginConfigConstraints.PluginName.class, String.class, new PluginConfigConstraints.PluginName.Factory())
+ .addConstraint(PluginConfigConstraints.PluginVersion.class, String.class, new PluginConfigConstraints.PluginVersion.Factory())
+ .addConstraint(PluginConfigConstraints.PluginNameSpace.class, String.class, new PluginConfigConstraints.PluginNameSpace.Factory()) + .addConstraint(PluginConfigConstraints.PluginNameSpace.class, String.class, new PluginConfigConstraints.PluginNameSpace.Factory())
+ .addNodeResolver(new FlattenedResolver.Factory()) + .addNodeResolver(new FlattenedResolver.Factory())
+ .build() + .build()
@ -5092,7 +5115,7 @@ index 0000000000000000000000000000000000000000..45bd29b70782e29eb11c36eaca0f940a
+ +
+ @Override + @Override
+ public @NotNull String getAPIVersion() { + public @NotNull String getAPIVersion() {
+ return this.apiVersion; + return this.apiVersion.getVersionString();
+ } + }
+ +
+ @Override + @Override
@ -5322,10 +5345,10 @@ index 0000000000000000000000000000000000000000..f951f4024745503e9cdfa7ff17b9313a
+} +}
diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..2e02f73b857c530a0cce3a8d6aae46e3b0966486 index 0000000000000000000000000000000000000000..3043a4216ec13c3de0cb931f11492ded1e6dc8de
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java +++ b/src/main/java/io/papermc/paper/plugin/provider/configuration/serializer/constraints/PluginConfigConstraints.java
@@ -0,0 +1,86 @@ @@ -0,0 +1,67 @@
+package io.papermc.paper.plugin.provider.configuration.serializer.constraints; +package io.papermc.paper.plugin.provider.configuration.serializer.constraints;
+ +
+import io.papermc.paper.plugin.util.NamespaceChecker; +import io.papermc.paper.plugin.util.NamespaceChecker;
@ -5345,7 +5368,6 @@ index 0000000000000000000000000000000000000000..2e02f73b857c530a0cce3a8d6aae46e3
+public final class PluginConfigConstraints { +public final class PluginConfigConstraints {
+ +
+ public static final Set<String> RESERVED_KEYS = Set.of("bukkit", "minecraft", "mojang", "spigot", "paper"); + public static final Set<String> RESERVED_KEYS = Set.of("bukkit", "minecraft", "mojang", "spigot", "paper");
+ public static final Set<String> VALID_PAPER_VERSIONS = Set.of("1.19", "1.20");
+ +
+ @Documented + @Documented
+ @Retention(RetentionPolicy.RUNTIME) + @Retention(RetentionPolicy.RUNTIME)
@ -5393,24 +5415,6 @@ index 0000000000000000000000000000000000000000..2e02f73b857c530a0cce3a8d6aae46e3
+ } + }
+ } + }
+ } + }
+
+ @Documented
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.FIELD)
+ public @interface PluginVersion {
+
+ final class Factory implements Constraint.Factory<PluginVersion, String> {
+
+ @Override
+ public Constraint<String> make(PluginVersion data, Type type) {
+ return value -> {
+ if (value != null && !VALID_PAPER_VERSIONS.contains(value)) {
+ throw new SerializationException("Provided plugin's version (%s) is not supported on this version.".formatted(value));
+ }
+ };
+ }
+ }
+ }
+} +}
diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java diff --git a/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java b/src/main/java/io/papermc/paper/plugin/provider/configuration/type/DependencyConfiguration.java
new file mode 100644 new file mode 100644
@ -7322,17 +7326,21 @@ index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7
@Override @Override
public FileConfiguration getConfig() { public FileConfiguration getConfig() {
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index da97b4e91b7952f1459e59c74447a659842990bc..adf28b8e77d42267ce41713e031ee316366202e8 100644 index da97b4e91b7952f1459e59c74447a659842990bc..fb8d14a2bdaaa25a2237fa4161388439ea8cfc0f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -421,6 +421,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -421,6 +421,16 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack); net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
return nmsItemStack.getItem().getDescriptionId(nmsItemStack); return nmsItemStack.getItem().getDescriptionId(nmsItemStack);
} }
+ // Paper start + // Paper start
+ @Override + @Override
+ public boolean isSupportedApiVersion(String apiVersion) { + public boolean isSupportedApiVersion(String apiVersion) {
+ return apiVersion != null && SUPPORTED_API.contains(apiVersion); + if (apiVersion == null) return false;
+ final ApiVersion toCheck = ApiVersion.getOrCreateVersion(apiVersion);
+ final ApiVersion minimumVersion = MinecraftServer.getServer().server.minimumAPI;
+
+ return !toCheck.isNewerThan(ApiVersion.CURRENT) && !toCheck.isOlderThan(minimumVersion);
+ } + }
+ // Paper end + // Paper end

View file

@ -1836,7 +1836,7 @@ index 45160b93a24dc74f6368441e2a4fe659ceaf5bf5..6573e72d041714ccc2bf0e3c8734bc21
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index adf28b8e77d42267ce41713e031ee316366202e8..29698be6e4990769cbe1c00088dfb9cfc73d966a 100644 index fb8d14a2bdaaa25a2237fa4161388439ea8cfc0f..fdeec67b7f71700f88714b8ad734a5525fb119fd 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -72,6 +72,7 @@ import org.bukkit.potion.PotionType; @@ -72,6 +72,7 @@ import org.bukkit.potion.PotionType;

View file

@ -2005,7 +2005,7 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222
+ } // Paper + } // Paper
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 29698be6e4990769cbe1c00088dfb9cfc73d966a..b1c07c945758e4cf4af86caa1dda47688feba849 100644 index fdeec67b7f71700f88714b8ad734a5525fb119fd..9ae089c6dbb1cc919b005fd9672a690f89ca2b42 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -213,6 +213,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -213,6 +213,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
@ -2021,7 +2021,7 @@ index 29698be6e4990769cbe1c00088dfb9cfc73d966a..b1c07c945758e4cf4af86caa1dda4768
public static byte toLegacyData(BlockState data) { public static byte toLegacyData(BlockState data) {
return CraftLegacy.toLegacyData(data); return CraftLegacy.toLegacyData(data);
@@ -459,6 +465,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -463,6 +469,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
public DamageSource.Builder createDamageSourceBuilder(DamageType damageType) { public DamageSource.Builder createDamageSourceBuilder(DamageType damageType) {
return new CraftDamageSourceBuilder(damageType); return new CraftDamageSourceBuilder(damageType);
} }

View file

@ -140,10 +140,10 @@ index 0000000000000000000000000000000000000000..22a55be34fde453fedd987173d95b8b3
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index b1c07c945758e4cf4af86caa1dda47688feba849..9e6e6ba95d5cd6cc5d4ada6ac5637b7b82e6fc97 100644 index 9ae089c6dbb1cc919b005fd9672a690f89ca2b42..2f21520106aa848a9108937474570a8c4e723cfb 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -470,6 +470,11 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -474,6 +474,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getTimingsServerName() { public String getTimingsServerName() {
return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName;
} }

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization
Serializes using NBT which is safer for server data migrations than bukkits format. Serializes using NBT which is safer for server data migrations than bukkits format.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 9e6e6ba95d5cd6cc5d4ada6ac5637b7b82e6fc97..9d81a9893ea556b93127130e575be6c422247049 100644 index 2f21520106aa848a9108937474570a8c4e723cfb..13568d93bf9c0243a9505d1c0aa36fb912bf2bb7 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -475,6 +475,53 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -479,6 +479,53 @@ public final class CraftMagicNumbers implements UnsafeValues {
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
return new com.destroystokyo.paper.PaperVersionFetcher(); return new com.destroystokyo.paper.PaperVersionFetcher();
} }

View file

@ -21,10 +21,10 @@ index c8e4e37b706bd8cb9698ac2d13d0d8668e2d1d14..909575a02bf5f7040eb9c8edb034e7b6
+ // Paper end - Expose entity id counter + // Paper end - Expose entity id counter
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 9d81a9893ea556b93127130e575be6c422247049..afd99d6a1c0face439cea5cf3e9646fe7139e77f 100644 index 13568d93bf9c0243a9505d1c0aa36fb912bf2bb7..b338b83d333b420c54c0362e2fc9839332fcc32e 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -522,6 +522,11 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -526,6 +526,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!");
return compound; return compound;
} }

View file

@ -15,7 +15,7 @@ manually reload the advancement data for all players, which
normally takes place as a part of the datapack reloading. normally takes place as a part of the datapack reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index afd99d6a1c0face439cea5cf3e9646fe7139e77f..75d78e99a9191547d95c340c34876398b694bee3 100644 index b338b83d333b420c54c0362e2fc9839332fcc32e..07befa14f64c5ae097378023a5b352278df2731a 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -333,7 +333,13 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -333,7 +333,13 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -67,10 +67,10 @@ index 99fa8f65801b1816b788fa42d49d6672bf331579..6debfd5866d4411ef8d51995bd07a0e2
// Check if a World already exists with the UID. // Check if a World already exists with the UID.
if (this.getWorld(world.getUID()) != null) { 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 diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 75d78e99a9191547d95c340c34876398b694bee3..a3366affccd901f35e5a018f4fb7614c621d2912 100644 index 07befa14f64c5ae097378023a5b352278df2731a..c0592a85a1a0781b83232533b9ca1b30b116eb98 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -533,6 +533,11 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -537,6 +537,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int nextEntityId() { public int nextEntityId() {
return net.minecraft.world.entity.Entity.nextEntityId(); return net.minecraft.world.entity.Entity.nextEntityId();
} }

View file

@ -7,10 +7,10 @@ Subject: [PATCH] Item Rarity API
public net.minecraft.world.item.Item rarity 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 diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index a3366affccd901f35e5a018f4fb7614c621d2912..1b4ea6cd4388b8d273816725dcd15d16f99d5695 100644 index c0592a85a1a0781b83232533b9ca1b30b116eb98..125ed63d8ae812284cd452b4387fd0d674c9c25a 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -538,6 +538,20 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -542,6 +542,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
public String getMainLevelName() { public String getMainLevelName() {
return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName; return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName;
} }

View file

@ -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 diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 1b4ea6cd4388b8d273816725dcd15d16f99d5695..75a53b4e8aa917399bc2054c3dde3e2f56362b45 100644 index 125ed63d8ae812284cd452b4387fd0d674c9c25a..c4457bb46c3e66f5954383fb18b6109a5fe2772d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -552,6 +552,11 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -556,6 +556,11 @@ public final class CraftMagicNumbers implements UnsafeValues {
public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) { public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) {
return io.papermc.paper.inventory.ItemRarity.values()[itemStack.getRarity().ordinal()]; return io.papermc.paper.inventory.ItemRarity.values()[itemStack.getRarity().ordinal()];
} }

View file

@ -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 diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 75a53b4e8aa917399bc2054c3dde3e2f56362b45..6b3fbdf0a53f95c43eee7b745d85e8fcf84413b0 100644 index c4457bb46c3e66f5954383fb18b6109a5fe2772d..a8ac14a908060aa656756ad728d0d1e826d3bbe7 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -553,6 +553,14 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -557,6 +557,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
return io.papermc.paper.inventory.ItemRarity.values()[itemStack.getRarity().ordinal()]; return io.papermc.paper.inventory.ItemRarity.values()[itemStack.getRarity().ordinal()];
} }

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Fix item default attributes API
(previously added this API but upstream also added it) (previously added this API but upstream also added it)
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 6b3fbdf0a53f95c43eee7b745d85e8fcf84413b0..bbe66459f29edf0c3de289a8b8a93e926323f82a 100644 index a8ac14a908060aa656756ad728d0d1e826d3bbe7..991a63f1a7cbd5d2cb88784a59ed0085b7bdfbe2 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -396,9 +396,14 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -396,9 +396,14 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -81,10 +81,10 @@ index 0000000000000000000000000000000000000000..ec9ebd2d539333293c51b7edfa18f18b
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index bbe66459f29edf0c3de289a8b8a93e926323f82a..c9c18f0e1d7ccb2c7024ed60bf1ac99d30f0104d 100644 index 991a63f1a7cbd5d2cb88784a59ed0085b7bdfbe2..4e02a5c432f0d9ff705c7f02dfccbc7d76d39805 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -570,6 +570,18 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -574,6 +574,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
public int getProtocolVersion() { public int getProtocolVersion() {
return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion(); return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion();
} }

View file

@ -39,10 +39,10 @@ index 1002123cd0c6f57cecc4e80f5f21cc6ff5886d37..e96023b71845526383288917e8d7c575
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index c9c18f0e1d7ccb2c7024ed60bf1ac99d30f0104d..71488300c3c4e45e6a8742c70f156fbc901efe5e 100644 index 4e02a5c432f0d9ff705c7f02dfccbc7d76d39805..c1c90d38ceaf7020dc19f1774cc88dbff1f05caf 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -582,6 +582,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -586,6 +586,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))); 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); return new io.papermc.paper.attribute.UnmodifiableAttributeMap(supplier);
} }

View file

@ -50,10 +50,10 @@ index 9edcdc71b28cf08e42fbe44723ba540e8d4f7808..a61638bc8200f6aa25d9c3254aea6c0c
@Override @Override
public boolean isInvisible() { // Paper - moved up from LivingEntity public boolean isInvisible() { // Paper - moved up from LivingEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 71488300c3c4e45e6a8742c70f156fbc901efe5e..277ed7b7281821b25d508e0faf56433ef2ede59e 100644 index c1c90d38ceaf7020dc19f1774cc88dbff1f05caf..af29b750a066ba44d6869eb8d466c3028c5c874d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -506,7 +506,33 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -510,7 +510,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
} }

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add NamespacedKey biome methods
Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> 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 diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 277ed7b7281821b25d508e0faf56433ef2ede59e..b44aa2f312d3cf51741c1a8e10dee366a724dc13 100644 index af29b750a066ba44d6869eb8d466c3028c5c874d..7852b06b3cd3bb8ca761e9d05b172a27f9ef6330 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -614,6 +614,19 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -618,6 +618,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
Preconditions.checkArgument(material.isBlock(), material + " is not a block"); Preconditions.checkArgument(material.isBlock(), material + " is not a block");
return getBlock(material).hasCollision; return getBlock(material).hasCollision;
} }

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix custom statistic criteria creation
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index b44aa2f312d3cf51741c1a8e10dee366a724dc13..c5042837254bdc84e3064941b7aa567348af77a2 100644 index 7852b06b3cd3bb8ca761e9d05b172a27f9ef6330..1a92d22d2b536a84af1cc404ca9809cae066407a 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -627,6 +627,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -631,6 +631,12 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey))); net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> biomeBase = cra.getHandle().registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME).getHolderOrThrow(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.BIOME, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(biomeKey)));
cra.setBiome(x, y, z, biomeBase); cra.setBiome(x, y, z, biomeBase);
} }

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Fix UnsafeValues#loadAdvancement
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index c5042837254bdc84e3064941b7aa567348af77a2..8dde83ba89ee5b29dcc8cc89dbf9274fea46eb00 100644 index 1a92d22d2b536a84af1cc404ca9809cae066407a..0a59d4354e332f4dba99404b770eb88f418546ca 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -320,7 +320,27 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -320,7 +320,27 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add api for spawn egg texture colors
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 8dde83ba89ee5b29dcc8cc89dbf9274fea46eb00..0ea32cb3ccfc07b62fb174a381a24d52d082b5b4 100644 index 0a59d4354e332f4dba99404b770eb88f418546ca..4213e5debc1737364de0dae42fbd1cb68dcb0c83 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -655,6 +655,15 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -659,6 +659,15 @@ public final class CraftMagicNumbers implements UnsafeValues {
} }
// Paper end // Paper end

View file

@ -739,10 +739,10 @@ index d96399e9bf1a58db5a4a22e58abb99e7660e0694..66bdac50130f523f9dc4379b103b7a46
+ // Paper end - lifecycle events + // Paper end - lifecycle events
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 0ea32cb3ccfc07b62fb174a381a24d52d082b5b4..90e2e6719c043b133734a5f544f7e80f6a67b2f9 100644 index 4213e5debc1737364de0dae42fbd1cb68dcb0c83..92d7e2435ea5c8b6fe9e5d2abb9d3c8cb350ef4d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -664,6 +664,13 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -668,6 +668,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
} }
// Paper end - spawn egg color visibility // Paper end - spawn egg color visibility

View file

@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack Tooltip API
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 90e2e6719c043b133734a5f544f7e80f6a67b2f9..a59f450f6eebaa144377c62a80ccf94c8c040dcc 100644 index 92d7e2435ea5c8b6fe9e5d2abb9d3c8cb350ef4d..2f44452631256e3d6abce02f861cc5bfa5208b53 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -654,6 +654,20 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -658,6 +658,20 @@ public final class CraftMagicNumbers implements UnsafeValues {
return org.bukkit.craftbukkit.CraftStatistic.getNMSStatistic(statistic).getName(); return org.bukkit.craftbukkit.CraftStatistic.getNMSStatistic(statistic).getName();
} }
// Paper end // Paper end

View file

@ -28899,10 +28899,10 @@ index 1d287dd7379e56f7fd4b425880b850cd843f5789..8ab7ca373a885fbe658013c9c6a2e38d
return nbttagcompound; return nbttagcompound;
}); });
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index a59f450f6eebaa144377c62a80ccf94c8c040dcc..50068b7914e16c043ad31cf40ddc2dafdb33d324 100644 index 2f44452631256e3d6abce02f861cc5bfa5208b53..ca1240c2534f1e6c7182996fde23e58f9c252960 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -522,7 +522,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -526,7 +526,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
final int dataVersion = compound.getInt("DataVersion"); final int dataVersion = compound.getInt("DataVersion");
@ -28911,7 +28911,7 @@ index a59f450f6eebaa144377c62a80ccf94c8c040dcc..50068b7914e16c043ad31cf40ddc2daf
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
} }
@@ -543,7 +543,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -547,7 +547,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
int dataVersion = compound.getInt("DataVersion"); int dataVersion = compound.getInt("DataVersion");

View file

@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 2 Jan 2024 10:35:46 -0800
Subject: [PATCH] fix ItemMeta removing CustomModelData
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 2157034e735c3921d4ef128688c30917aaad7161..ffdea312f93d00289364ef4d41a820cd1338f3bd 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -353,7 +353,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
}
}
- if (tag.contains(CraftMetaItem.CUSTOM_MODEL_DATA.NBT, CraftMagicNumbers.NBT.TAG_INT)) {
+ if (tag.contains(CraftMetaItem.CUSTOM_MODEL_DATA.NBT, CraftMagicNumbers.NBT.TAG_ANY_NUMBER)) { // Paper - correctly allow any number type
this.customModelData = tag.getInt(CraftMetaItem.CUSTOM_MODEL_DATA.NBT);
}
if (tag.contains(CraftMetaItem.BLOCK_DATA.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) {

View file

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: lukas <lukasalt98@gmail.com>
Date: Sun, 27 Dec 2020 16:47:00 +0100
Subject: [PATCH] Cache burn durations
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
index 9801b777bc6ab7de91d82b29a142459292ee8605..8f7029e602300f68b3c8411caa2d9e0b1e8be62e 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -134,7 +134,13 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
this.recipeType = recipeType; // Paper - cook speed multiplier API
}
+ private static Map<Item, Integer> cachedBurnDurations = null; // Paper - cache burn durations
public static Map<Item, Integer> getFuel() {
+ // Paper start - cache burn durations
+ if(cachedBurnDurations != null) {
+ return cachedBurnDurations;
+ }
+ // Paper end - cache burn durations
Map<Item, Integer> map = Maps.newLinkedHashMap();
AbstractFurnaceBlockEntity.add(map, (ItemLike) Items.LAVA_BUCKET, 20000);
@@ -196,7 +202,10 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.AZALEA, 100);
AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.FLOWERING_AZALEA, 100);
AbstractFurnaceBlockEntity.add(map, (ItemLike) Blocks.MANGROVE_ROOTS, 300);
- return map;
+ // Paper start - cache burn durations
+ cachedBurnDurations = com.google.common.collect.ImmutableMap.copyOf(map);
+ return cachedBurnDurations;
+ // Paper end - cache burn durations
}
// CraftBukkit start - add fields and methods