Improve default item attributes API (#10765)

This commit is contained in:
Jake Potrebic 2024-05-23 11:44:07 -07:00 committed by GitHub
parent d408381c77
commit 6de7a1f052
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 209 additions and 100 deletions

View file

@ -1,35 +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:02:00 -0700
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
index 04cb8279f2296cc42405355c7c1f120e761202c4..1df815c2e430a308baea08c9a7f3ca43377dc16e 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -4771,6 +4771,23 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
}
// Paper end - item rarity API
+ // Paper start - item default attributes API
+ /**
+ * Returns an immutable multimap of attributes for the slot.
+ * {@link #isItem()} must be true for this material.
+ *
+ * @param equipmentSlot the slot to get the attributes for
+ * @throws IllegalArgumentException if {@link #isItem()} is false
+ * @return an immutable multimap of attributes
+ * @deprecated use {@link #getDefaultAttributeModifiers(EquipmentSlot)}
+ */
+ @NotNull
+ @Deprecated(forRemoval = true, since = "1.20.5")
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
+ return this.getDefaultAttributeModifiers(equipmentSlot);
+ }
+ // Paper end - item default attributes API
+
/**
* Do not use for any reason.
*

View file

@ -0,0 +1,99 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 8 May 2021 15:02:00 -0700
Subject: [PATCH] Improve item default attribute API
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 04cb8279f2296cc42405355c7c1f120e761202c4..18862cce7e252e69153f0a5380aa07de26d9d2e7 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -4771,6 +4771,23 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
}
// Paper end - item rarity API
+ // Paper start - item default attributes API
+ /**
+ * Returns an immutable multimap of attributes for the slot.
+ * {@link #isItem()} must be true for this material.
+ *
+ * @param equipmentSlot the slot to get the attributes for
+ * @throws IllegalArgumentException if {@link #isItem()} is false
+ * @return an immutable multimap of attributes
+ * @deprecated use {@link #getDefaultAttributeModifiers(EquipmentSlot)}
+ */
+ @NotNull
+ @Deprecated(forRemoval = true, since = "1.20.5")
+ public Multimap<Attribute, AttributeModifier> getItemAttributes(@NotNull EquipmentSlot equipmentSlot) {
+ return this.getDefaultAttributeModifiers(equipmentSlot);
+ }
+ // Paper end - item default attributes API
+
/**
* Do not use for any reason.
*
@@ -5478,13 +5495,34 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
}
}
+ // Paper start - improve default item attribute API
+ /**
+ * Return an immutable copy of all default {@link Attribute}s and their {@link AttributeModifier}s.
+ * <p>
+ * Default attributes are those that are always preset on some items, unless
+ * they are specifically overridden on that {@link ItemStack}. Examples include
+ * the attack damage on weapons or the armor value on armor.
+ * <p>
+ * Only available when {@link #isItem()} is true.
+ *
+ * @return the immutable {@link Multimap} with the respective default
+ * Attributes and modifiers, or an empty map if no attributes are set.
+ */
+ public @NotNull @org.jetbrains.annotations.Unmodifiable Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers() {
+ final ItemType type = this.asItemType();
+ Preconditions.checkArgument(type != null, "The Material is not an item!");
+ return type.getDefaultAttributeModifiers();
+ }
+ // Paper end - improve default item attribute API
+
/**
* Return an immutable copy of all default {@link Attribute}s and their
* {@link AttributeModifier}s for a given {@link EquipmentSlot}.
- *
- * Default attributes are those that are always preset on some items, such
- * as the attack damage on weapons or the armor value on armor.
- *
+ * <p>
+ * Default attributes are those that are always preset on some items, unless
+ * they are specifically overridden on that {@link ItemStack}. Examples include
+ * the attack damage on weapons or the armor value on armor.
+ * <p>
* Only available when {@link #isItem()} is true.
*
* @param slot the {@link EquipmentSlot} to check
diff --git a/src/main/java/org/bukkit/inventory/ItemType.java b/src/main/java/org/bukkit/inventory/ItemType.java
index 3d30c4957a2950ac8d4635ed7bb9bf39ca8cd158..077bd4d4e50169780f27e8502104e9e4b2ecdae6 100644
--- a/src/main/java/org/bukkit/inventory/ItemType.java
+++ b/src/main/java/org/bukkit/inventory/ItemType.java
@@ -2378,6 +2378,21 @@ public interface ItemType extends Keyed, Translatable, net.kyori.adventure.trans
// @NotNull
// EquipmentSlot getEquipmentSlot();
+ // Paper start - improve default item attribute API
+ /**
+ * Return an immutable copy of all default {@link Attribute}s and their
+ * {@link AttributeModifier}s.
+ * <p>
+ * Default attributes are those that are always preset on some items, unless
+ * they are specifically overridden on that {@link ItemStack}. Examples include
+ * the attack damage on weapons or the armor value on armor.
+ *
+ * @return the immutable {@link Multimap} with the respective default
+ * Attributes and modifiers, or an empty map if no attributes are set.
+ */
+ @NotNull @org.jetbrains.annotations.Unmodifiable Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers();
+ // Paper end - improve default item attribute API
+
/**
* Return an immutable copy of all default {@link Attribute}s and their
* {@link AttributeModifier}s for a given {@link EquipmentSlot}.

View file

@ -1,47 +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] Fix item default attributes API
(previously added this API but upstream also added it)
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
index f5bb5802aae64773252c9399df0fbe9de3d1d121..566ac7873eb1bd39479e9d1404e124af235b6fcb 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
@@ -189,9 +189,10 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han
@Override
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot slot) {
- ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
-
- ItemAttributeModifiers nmsDefaultAttributes = this.item.getDefaultAttributeModifiers();
+ // Paper start - fix item default attribute API
+ final ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
+ ItemAttributeModifiers nmsDefaultAttributes = this.item.components().getOrDefault(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));
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 952a8147947fa0e2a960628fc760212d3d206ce6..27acc1965e16d697fa98f64cf64ecc6ecd775e86 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -399,9 +399,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

@ -0,0 +1,92 @@
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] Improve item default attribute API
Also fixes an issue where upstream isn't
actually getting the correct default attributes
diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
index 8afbb8e0cb368e95f23bb78c1261f9aa9b8abd86..0a18983151d17b8e1460b82326b0380087e13795 100644
--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java
@@ -74,7 +74,7 @@ public class CraftAttributeInstance implements AttributeInstance {
return new AttributeModifier(nms.id(), nms.name, nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()]);
}
- public static AttributeModifier convert(net.minecraft.world.entity.ai.attributes.AttributeModifier nms, EquipmentSlot slot) {
- return new AttributeModifier(nms.id(), nms.name, nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()], slot);
+ public static AttributeModifier convert(net.minecraft.world.entity.ai.attributes.AttributeModifier nms, net.minecraft.world.entity.EquipmentSlotGroup slot) { // Paper
+ return new AttributeModifier(nms.id(), nms.name, nms.amount(), AttributeModifier.Operation.values()[nms.operation().ordinal()], org.bukkit.craftbukkit.CraftEquipmentSlot.getSlot(slot)); // Paper
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
index 1aa8010e872686f392430ce47214a324d431cada..6bcc3192097dfbf378592fd2437a80dcd0825f13 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
@@ -187,15 +187,34 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han
// return CraftEquipmentSlot.getSlot(EntityInsentient.getEquipmentSlotForItem(CraftItemStack.asNMSCopy(ItemStack.of(this))));
// }
+ // Paper start - improve default attribute API
+ @Override
+ public @NotNull Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers() {
+ return this.getDefaultAttributeModifiers(sg -> true);
+ }
+ // Paper end - improve default attribute API
+
@Override
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot slot) {
- ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
+ // Paper start - improve/fix item default attribute API
+ final net.minecraft.world.entity.EquipmentSlot nmsSlot = CraftEquipmentSlot.getNMS(slot);
+ return this.getDefaultAttributeModifiers(sg -> sg.test(nmsSlot));
+ }
- ItemAttributeModifiers nmsDefaultAttributes = this.item.getDefaultAttributeModifiers();
- nmsDefaultAttributes.forEach(CraftEquipmentSlot.getNMS(slot), (key, value) -> {
- Attribute attribute = CraftAttribute.minecraftToBukkit(key.value());
- defaultAttributes.put(attribute, CraftAttributeInstance.convert(value, slot));
- });
+ private Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(final java.util.function.Predicate<net.minecraft.world.entity.EquipmentSlotGroup> slotPredicate) {
+ final ImmutableMultimap.Builder<Attribute, AttributeModifier> defaultAttributes = ImmutableMultimap.builder();
+ ItemAttributeModifiers nmsDefaultAttributes = this.item.components().getOrDefault(DataComponents.ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY);
+ if (nmsDefaultAttributes.modifiers().isEmpty()) {
+ // we have to check both places cause for some reason vanilla puts default modifiers for armor in a different place
+ nmsDefaultAttributes = this.item.getDefaultAttributeModifiers();
+ }
+ for (final net.minecraft.world.item.component.ItemAttributeModifiers.Entry entry : nmsDefaultAttributes.modifiers()) {
+ if (!slotPredicate.test(entry.slot())) continue;
+ final Attribute attribute = CraftAttribute.minecraftHolderToBukkit(entry.attribute());
+ final AttributeModifier modifier = CraftAttributeInstance.convert(entry.modifier(), entry.slot());
+ defaultAttributes.put(attribute, modifier);
+ }
+ // Paper end - improve/fix item default attribute API
return defaultAttributes.build();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 952a8147947fa0e2a960628fc760212d3d206ce6..f0577689f4c57ce6254aad32ccf5d8eac961c9bd 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -399,15 +399,11 @@ 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();
- nmsDefaultAttributes.forEach(CraftEquipmentSlot.getNMS(slot), (key, value) -> {
- Attribute attribute = CraftAttribute.minecraftToBukkit(key.value());
- defaultAttributes.put(attribute, CraftAttributeInstance.convert(value, slot));
- });
-
- return defaultAttributes.build();
+ // Paper start - delegate to method on ItemType
+ final org.bukkit.inventory.ItemType item = material.asItemType();
+ Preconditions.checkArgument(item != null, material + " is not an item and does not have default attributes");
+ return item.getDefaultAttributeModifiers(slot);
+ // Paper end - delegate to method on ItemType
}
@Override

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
index 27acc1965e16d697fa98f64cf64ecc6ecd775e86..6bfd5fad899720c853fc4812f50893a6d81f7ea8 100644
index f0577689f4c57ce6254aad32ccf5d8eac961c9bd..6a1f645595a579036b64ec05f24c967892d14376 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -563,6 +563,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -554,6 +554,18 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial));
}

View file

@ -7,7 +7,7 @@ Subject: [PATCH] Add Raw Byte Entity Serialization
public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 541789139e9ccb0371a93da989b1f9701fceb034..6b66a9732f8e8b23b8d00beb9822fbb46ac76cab 100644
index 74c5f418ea6b5861d8e5d4ced17b5a8772d6dcde..4abb1661e04278bf27a844cd0a957d4537aece37 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2106,6 +2106,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@ -50,10 +50,10 @@ index 9edcdc71b28cf08e42fbe44723ba540e8d4f7808..a61638bc8200f6aa25d9c3254aea6c0c
@Override
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
index 3824a02431e3b1d82576937248f2a57f1a0414b0..a2961166695e5fe4c607c82a490ce67c2e1b5fde 100644
index 6a1f645595a579036b64ec05f24c967892d14376..0bf7e2b73bbde4ac23a2f52a145de464f0851396 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -513,7 +513,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -504,7 +504,33 @@ public final class CraftMagicNumbers implements UnsafeValues {
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>
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 7d56cfaa460c1052d60344542c8ea60363894b8d..f5e8ff2a98a2357cb766e69bea982b25f2e2911b 100644
index 0bf7e2b73bbde4ac23a2f52a145de464f0851396..144118d50b0cae226480788fc9e74c178475369f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -603,6 +603,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -594,6 +594,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end

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
index f5e8ff2a98a2357cb766e69bea982b25f2e2911b..ea48f9317f66305bca0f01c51953b438f6e4833c 100644
index 144118d50b0cae226480788fc9e74c178475369f..ac42442b64b1b2ba29997d0720970e7f677a2702 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -618,6 +618,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -609,6 +609,14 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - namespaced key biome methods

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
index 0542c04bc9c59ff04291f2a45b70a7b43d74e7d5..053c09fa00d08b50aa25614a6310299efffe203a 100644
index ddf184592488c6664442f113321954fff109a466..96d8576caf8c8698a77f3321e5918f0768e13655 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -661,6 +661,15 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -652,6 +652,15 @@ public final class CraftMagicNumbers implements UnsafeValues {
return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT);
}

View file

@ -739,10 +739,10 @@ index d96399e9bf1a58db5a4a22e58abb99e7660e0694..66bdac50130f523f9dc4379b103b7a46
+ // 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
index 053c09fa00d08b50aa25614a6310299efffe203a..b137d4518727bfb4a058abbf33e6cfd3b6e05772 100644
index 96d8576caf8c8698a77f3321e5918f0768e13655..873cfc2615e79ea2cc74b0da2544c923206d8f8b 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -670,6 +670,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -661,6 +661,13 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// 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
index b137d4518727bfb4a058abbf33e6cfd3b6e05772..5572ecea5df864db291eff182969f0367fb7c5f5 100644
index 873cfc2615e79ea2cc74b0da2544c923206d8f8b..4c199dd62982eaedf7adba49444af7bf8f3d04bc 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -646,6 +646,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -637,6 +637,21 @@ public final class CraftMagicNumbers implements UnsafeValues {
}
// Paper end - fix custom stats criteria creation

View file

@ -28981,10 +28981,10 @@ index 1d287dd7379e56f7fd4b425880b850cd843f5789..8ab7ca373a885fbe658013c9c6a2e38d
return nbttagcompound;
});
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 9bd51aeedf2556e714960b081029f48afbc0f3f5..5a382907285a288f2a223189e690d3dbdf45594c 100644
index 4c199dd62982eaedf7adba49444af7bf8f3d04bc..e46714f38df931350d81c30907560c381c8d2725 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -529,7 +529,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -520,7 +520,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
final int dataVersion = compound.getInt("DataVersion");
@ -28993,7 +28993,7 @@ index 9bd51aeedf2556e714960b081029f48afbc0f3f5..5a382907285a288f2a223189e690d3db
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
}
@@ -550,7 +550,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
@@ -541,7 +541,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
int dataVersion = compound.getInt("DataVersion");