fix issue with item default attribute API

This commit is contained in:
Jake Potrebic 2024-04-25 23:10:38 -07:00
parent bcdf1f96b8
commit 43d110e9a9
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
22 changed files with 71 additions and 94 deletions

View file

@ -3,9 +3,10 @@ From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 8 May 2021 15:02:00 -0700 Date: Sat, 8 May 2021 15:02:00 -0700
Subject: [PATCH] Attributes API for item defaults Subject: [PATCH] Attributes API for item defaults
(Now replaced by upstream's API)
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 7c14a272156cefe6d69e41fec6892891646e0985..0dd2a9c7ea5b56995ff238fd0e5eceacf91c9e6f 100644 index 7c14a272156cefe6d69e41fec6892891646e0985..eb9e0eb1aa6e203ff6f896b177ee60c8afacc62d 100644
--- a/src/main/java/org/bukkit/Material.java --- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java
@@ -4759,6 +4759,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla @@ -4759,6 +4759,21 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
@ -23,33 +24,10 @@ index 7c14a272156cefe6d69e41fec6892891646e0985..0dd2a9c7ea5b56995ff238fd0e5eceac
+ * @deprecated use {@link #getDefaultAttributeModifiers(EquipmentSlot)} + * @deprecated use {@link #getDefaultAttributeModifiers(EquipmentSlot)}
+ */ + */
+ @NotNull + @NotNull
+ @Deprecated + @Deprecated(forRemoval = true, since = "1.20.5")
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) { + public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
+ return Bukkit.getUnsafe().getItemAttributes(this, equipmentSlot); + return this.getDefaultAttributeModifiers(equipmentSlot);
+ } + }
// Paper end // Paper end
/** /**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 057f4db9cb6b686ab941ec5d3e6ca23dcfbd845f..db8ffa9b303b9128be175f383fdf838a4e0719e5 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -197,6 +197,18 @@ public interface UnsafeValues {
*/
public boolean isValidRepairItemStack(@org.jetbrains.annotations.NotNull ItemStack itemToBeRepaired, @org.jetbrains.annotations.NotNull ItemStack repairMaterial);
+ /**
+ * Returns an immutable multimap of attributes for the material and slot.
+ * {@link Material#isItem()} must be true for this material.
+ *
+ * @param material the material
+ * @param equipmentSlot the slot to get the attributes for
+ * @throws IllegalArgumentException if {@link Material#isItem()} is false
+ * @return an immutable multimap of attributes
+ */
+ @org.jetbrains.annotations.NotNull
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(@org.jetbrains.annotations.NotNull Material material, @org.jetbrains.annotations.NotNull EquipmentSlot equipmentSlot);
+
/**
* Returns the server's protocol version.
*

View file

@ -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 diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index db8ffa9b303b9128be175f383fdf838a4e0719e5..b205937d1cd627c1dd660277f69891b5412b1c16 100644 index 057f4db9cb6b686ab941ec5d3e6ca23dcfbd845f..900b502a400bb99a2131305812e48acfeb8b94a1 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -215,5 +215,22 @@ public interface UnsafeValues { @@ -203,5 +203,22 @@ public interface UnsafeValues {
* @return the server's protocol version * @return the server's protocol version
*/ */
int getProtocolVersion(); int getProtocolVersion();

View file

@ -5,12 +5,12 @@ Subject: [PATCH] Add isCollidable methods to various places
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 0dd2a9c7ea5b56995ff238fd0e5eceacf91c9e6f..22e59e24709b1aa1f326d382ebce752c2b42e435 100644 index eb9e0eb1aa6e203ff6f896b177ee60c8afacc62d..137b4553636f31574c51960cada6eb07d80a02d9 100644
--- a/src/main/java/org/bukkit/Material.java --- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java
@@ -4774,6 +4774,16 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla @@ -4774,6 +4774,16 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) { public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
return Bukkit.getUnsafe().getItemAttributes(this, equipmentSlot); return this.getDefaultAttributeModifiers(equipmentSlot);
} }
+ +
+ /** + /**
@ -26,10 +26,10 @@ index 0dd2a9c7ea5b56995ff238fd0e5eceacf91c9e6f..22e59e24709b1aa1f326d382ebce752c
/** /**
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index b205937d1cd627c1dd660277f69891b5412b1c16..ca0b126bff245ed3fe69bc49c28499f7a7aa9556 100644 index 900b502a400bb99a2131305812e48acfeb8b94a1..75c9569214321b3f23f3614722d7453020d095c3 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -232,5 +232,14 @@ public interface UnsafeValues { @@ -220,5 +220,14 @@ public interface UnsafeValues {
* @throws IllegalArgumentException if the entity does not exist of have default attributes (use {@link #hasDefaultEntityAttributes(NamespacedKey)} first) * @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); @org.jetbrains.annotations.NotNull org.bukkit.attribute.Attributable getDefaultEntityAttributes(@org.jetbrains.annotations.NotNull NamespacedKey entityKey);

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add Raw Byte Entity Serialization
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index ca0b126bff245ed3fe69bc49c28499f7a7aa9556..6426d8585bba71b3e998b1eb078ac0fc67076d65 100644 index 75c9569214321b3f23f3614722d7453020d095c3..bdfa60a764c13d82cd013335fb7b0c896abe74bd 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -158,6 +158,14 @@ public interface UnsafeValues { @@ -158,6 +158,14 @@ public interface UnsafeValues {

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/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 6426d8585bba71b3e998b1eb078ac0fc67076d65..d97e42de951527afb03eafc481704418dedffde9 100644 index bdfa60a764c13d82cd013335fb7b0c896abe74bd..0eddda31e47e807551436ae834e89ea56141f163 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -249,5 +249,32 @@ public interface UnsafeValues { @@ -237,5 +237,32 @@ public interface UnsafeValues {
* @throws IllegalArgumentException if {@link Material#isBlock()} is false * @throws IllegalArgumentException if {@link Material#isBlock()} is false
*/ */
boolean isCollidable(@org.jetbrains.annotations.NotNull Material material); boolean isCollidable(@org.jetbrains.annotations.NotNull Material material);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix custom statistic criteria creation
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index d97e42de951527afb03eafc481704418dedffde9..c73eed20d18d1109e3b78b9daa92d7438fc52e8d 100644 index 0eddda31e47e807551436ae834e89ea56141f163..7b54ca313ce65f91932ee8ee968196f6091db86f 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -276,5 +276,7 @@ public interface UnsafeValues { @@ -264,5 +264,7 @@ public interface UnsafeValues {
* @throws IllegalStateException if no biome by the given key is registered. * @throws IllegalStateException if no biome by the given key is registered.
*/ */
void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey); void setBiomeKey(RegionAccessor accessor, int x, int y, int z, NamespacedKey biomeKey);

View file

@ -27,7 +27,7 @@ index 6b68c92ec894451d99ded3e3df5965cb31d68ed2..fd5e433f930963c102c9c977523a0036
public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21")); public static final FeatureFlag UPDATE_121 = Bukkit.getUnsafe().getFeatureFlag(NamespacedKey.minecraft("update_1_21"));
} }
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 22e59e24709b1aa1f326d382ebce752c2b42e435..9de0f7bb9f91835d66e8ce85bbc9caf45ab552b0 100644 index 137b4553636f31574c51960cada6eb07d80a02d9..cdbb67b677d5226d15df40339b7df02482561e3e 100644
--- a/src/main/java/org/bukkit/Material.java --- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java
@@ -146,54 +146,67 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla @@ -146,54 +146,67 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add api for spawn egg texture colors
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index c73eed20d18d1109e3b78b9daa92d7438fc52e8d..1ac54ae7b4bcc7932492477e88a81954f71f342f 100644 index 7b54ca313ce65f91932ee8ee968196f6091db86f..e1493ef58854e7bc929a2fa5aaba9da527dfd563 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -279,4 +279,17 @@ public interface UnsafeValues { @@ -267,4 +267,17 @@ public interface UnsafeValues {
String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic); String getStatisticCriteriaKey(@NotNull org.bukkit.Statistic statistic);
// Paper end // Paper end

View file

@ -528,10 +528,10 @@ index 0000000000000000000000000000000000000000..304f978e40e1759bb19704cc5cec3995
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 1ac54ae7b4bcc7932492477e88a81954f71f342f..14a49bfd1822c25b95000f3fbb60ba1d55ae0d38 100644 index e1493ef58854e7bc929a2fa5aaba9da527dfd563..887129a95ff2e299507bf870b1ef3212afe6563e 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -292,4 +292,12 @@ public interface UnsafeValues { @@ -280,4 +280,12 @@ public interface UnsafeValues {
*/ */
@Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer); @Nullable org.bukkit.Color getSpawnEggLayerColor(org.bukkit.entity.EntityType entityType, int layer);
// Paper end - spawn egg color visibility // Paper end - spawn egg color visibility

View file

@ -108,10 +108,10 @@ index 0000000000000000000000000000000000000000..1d9bed6691f581529c53b577b26f1d0f
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 14a49bfd1822c25b95000f3fbb60ba1d55ae0d38..b9a07b2db8a3dcdb72c33c8ceda129921b2c02f1 100644 index 887129a95ff2e299507bf870b1ef3212afe6563e..c7d0cdd4778c329f09db6cea97ddb019690d6246 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java --- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -300,4 +300,6 @@ public interface UnsafeValues { @@ -288,4 +288,6 @@ public interface UnsafeValues {
@org.jetbrains.annotations.ApiStatus.Internal @org.jetbrains.annotations.ApiStatus.Internal
io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager<org.bukkit.plugin.Plugin> createPluginLifecycleEventManager(final org.bukkit.plugin.java.JavaPlugin plugin, final java.util.function.BooleanSupplier registrationCheck); io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager<org.bukkit.plugin.Plugin> createPluginLifecycleEventManager(final org.bukkit.plugin.java.JavaPlugin plugin, final java.util.function.BooleanSupplier registrationCheck);
// Paper end - lifecycle event API // Paper end - lifecycle event API

View file

@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 8 May 2021 15:01:54 -0700
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 6b3fbdf0a53f95c43eee7b745d85e8fcf84413b0..d85adc8aa11579d94ab48f6360e3df4c5796af30 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -561,6 +561,19 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
}
+ @Override
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(Material material, EquipmentSlot equipmentSlot) {
+ Item item = CraftMagicNumbers.getItem(material);
+ if (item == null) {
+ throw new IllegalArgumentException(material + " is not an item and therefore does not have attributes");
+ }
+ ImmutableMultimap.Builder<Attribute, AttributeModifier> attributeMapBuilder = ImmutableMultimap.builder();
+ item.getDefaultAttributeModifiers(CraftEquipmentSlot.getNMS(equipmentSlot)).forEach((attributeBase, attributeModifier) -> {
+ attributeMapBuilder.put(CraftAttribute.stringToBukkit(net.minecraft.core.registries.BuiltInRegistries.ATTRIBUTE.getKey(attributeBase).toString()), CraftAttributeInstance.convert(attributeModifier, equipmentSlot));
+ });
+ return attributeMapBuilder.build();
+ }
+
@Override
public int getProtocolVersion() {
return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion();

View file

@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 8 May 2021 15:01:54 -0700
Subject: [PATCH] Fix item default attributes API
(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
index 6b3fbdf0a53f95c43eee7b745d85e8fcf84413b0..bbe66459f29edf0c3de289a8b8a93e926323f82a 100644
--- a/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 {
@Override
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(Material material, EquipmentSlot slot) {
- ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
-
- ItemAttributeModifiers nmsDefaultAttributes = CraftMagicNumbers.getItem(material).getDefaultAttributeModifiers();
+ // Paper start - fix item default attribute API
+ final Item item = CraftMagicNumbers.getItem(material);
+ if (item == null) {
+ throw new IllegalArgumentException(material + " is not an item and therefore does not have attributes");
+ }
+ final ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
+ ItemAttributeModifiers nmsDefaultAttributes = item.components().getOrDefault(net.minecraft.core.component.DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY);
+ // Paper end - fix item default attribute API
nmsDefaultAttributes.forEach(CraftEquipmentSlot.getNMS(slot), (key, value) -> {
Attribute attribute = CraftAttribute.minecraftToBukkit(key.value());
defaultAttributes.put(attribute, CraftAttributeInstance.convert(value, slot));

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 d85adc8aa11579d94ab48f6360e3df4c5796af30..e747c87ff8f1101119a9fb33c4d52fd97ef04938 100644 index bbe66459f29edf0c3de289a8b8a93e926323f82a..c9c18f0e1d7ccb2c7024ed60bf1ac99d30f0104d 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
@@ -578,6 +578,18 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -570,6 +570,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 e747c87ff8f1101119a9fb33c4d52fd97ef04938..97a8748284547ee6c507d9f763772e34b2371d90 100644 index c9c18f0e1d7ccb2c7024ed60bf1ac99d30f0104d..71488300c3c4e45e6a8742c70f156fbc901efe5e 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
@@ -590,6 +590,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -582,6 +582,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 97a8748284547ee6c507d9f763772e34b2371d90..ab9cf64fdde15e80c4c6fb101ee4a328844aa112 100644 index 71488300c3c4e45e6a8742c70f156fbc901efe5e..277ed7b7281821b25d508e0faf56433ef2ede59e 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
@@ -501,7 +501,33 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -506,7 +506,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 ab9cf64fdde15e80c4c6fb101ee4a328844aa112..14a73354698a1d0592eb0fc10c73fc2d25c02e4e 100644 index 277ed7b7281821b25d508e0faf56433ef2ede59e..b44aa2f312d3cf51741c1a8e10dee366a724dc13 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
@@ -622,6 +622,19 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -614,6 +614,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 14a73354698a1d0592eb0fc10c73fc2d25c02e4e..b5b165fc9d28afa5bac24daee98df472ac254ee1 100644 index b44aa2f312d3cf51741c1a8e10dee366a724dc13..c5042837254bdc84e3064941b7aa567348af77a2 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
@@ -635,6 +635,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -627,6 +627,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 b5b165fc9d28afa5bac24daee98df472ac254ee1..af98e9e0777ecca333b32245262d453d71afa396 100644 index c5042837254bdc84e3064941b7aa567348af77a2..8dde83ba89ee5b29dcc8cc89dbf9274fea46eb00 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 af98e9e0777ecca333b32245262d453d71afa396..31acd769bdfdff0128275e401a6209df093506d3 100644 index 8dde83ba89ee5b29dcc8cc89dbf9274fea46eb00..0ea32cb3ccfc07b62fb174a381a24d52d082b5b4 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
@@ -663,6 +663,15 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -655,6 +655,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 31acd769bdfdff0128275e401a6209df093506d3..c6ce4e9428b5d6d117def376accdfb0c12b49565 100644 index 0ea32cb3ccfc07b62fb174a381a24d52d082b5b4..90e2e6719c043b133734a5f544f7e80f6a67b2f9 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
@@ -672,6 +672,13 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -664,6 +664,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 c6ce4e9428b5d6d117def376accdfb0c12b49565..b8f9731e9fbe435242d7d3ec54ca65871a763562 100644 index 90e2e6719c043b133734a5f544f7e80f6a67b2f9..a59f450f6eebaa144377c62a80ccf94c8c040dcc 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
@@ -662,6 +662,20 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -654,6 +654,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 b8f9731e9fbe435242d7d3ec54ca65871a763562..96354aeb0ac36b7d2d3370974380c1a0a58c3276 100644 index a59f450f6eebaa144377c62a80ccf94c8c040dcc..50068b7914e16c043ad31cf40ddc2dafdb33d324 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
@@ -517,7 +517,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -522,7 +522,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 b8f9731e9fbe435242d7d3ec54ca65871a763562..96354aeb0ac36b7d2d3370974380c1a0
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());
} }
@@ -538,7 +538,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -543,7 +543,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");