mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
fix some more issues
This commit is contained in:
parent
a55b0c8097
commit
0cd4c50623
11 changed files with 165 additions and 107 deletions
|
@ -438,7 +438,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ */
|
||||
+ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
|
||||
+ .endsWith("_SPAWN_EGG")
|
||||
+ .ensureSize("SPAWN_EGGS", 78).lock();
|
||||
+ .ensureSize("SPAWN_EGGS", 80).lock();
|
||||
+
|
||||
+ /**
|
||||
+ * Covers all colors of stained glass.
|
||||
|
|
|
@ -21,6 +21,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
* additional info.
|
||||
*/
|
||||
POTION_BREAK(2002, Type.VISUAL, Color.class),
|
||||
@@ -0,0 +0,0 @@ public enum Effect {
|
||||
/**
|
||||
* Particles displayed when a villager grows a plant, data
|
||||
* is the number of particles
|
||||
+ * @deprecated partially replaced by {@link #BEE_GROWTH}
|
||||
*/
|
||||
+ @Deprecated(forRemoval = true, since = "1.20.5") // Paper
|
||||
VILLAGER_PLANT_GROW(2005, Type.VISUAL, Integer.class),
|
||||
/**
|
||||
* The sound/particles used by the enderdragon's breath
|
||||
@@ -0,0 +0,0 @@ public enum Effect {
|
||||
* block.
|
||||
*/
|
||||
|
@ -128,6 +138,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ */
|
||||
+ SHOOT_WHITE_SMOKE(2010, Type.VISUAL, BlockFace.class),
|
||||
+
|
||||
+ /**
|
||||
+ * {@link Integer} param is the number of particles
|
||||
+ */
|
||||
+ BEE_GROWTH(2011, Type.VISUAL, Integer.class),
|
||||
+
|
||||
+ PARTICLES_SCULK_CHARGE(3006, Type.VISUAL, Integer.class),
|
||||
+
|
||||
+ PARTICLES_SCULK_SHRIEK(3007, Type.SOUND),
|
||||
|
@ -136,6 +151,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ PARTICLES_EGG_CRACK(3009, Type.VISUAL),
|
||||
+
|
||||
+ @Deprecated(forRemoval = true, since = "1.20.5")
|
||||
+ GUST_DUST(3010, Type.VISUAL),
|
||||
+
|
||||
+ TRIAL_SPAWNER_SPAWN(3011, Type.VISUAL),
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shane Freeder <theboyetronic@gmail.com>
|
||||
Date: Sat, 4 Nov 2023 18:39:18 -0400
|
||||
Subject: [PATCH] Add MaterialTagsTest
|
||||
|
||||
|
||||
diff --git a/src/test/java/io/papermc/paper/inventory/item/MaterialTagsTest.java b/src/test/java/io/papermc/paper/inventory/item/MaterialTagsTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/inventory/item/MaterialTagsTest.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.inventory.item;
|
||||
+
|
||||
+import com.destroystokyo.paper.MaterialTags;
|
||||
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
+import java.util.List;
|
||||
+import java.util.stream.Collectors;
|
||||
+import java.util.stream.Stream;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import net.minecraft.world.item.enchantment.EnchantmentCategory;
|
||||
+import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
+import org.bukkit.support.AbstractTestingBase;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.junit.jupiter.api.Assertions;
|
||||
+import org.junit.jupiter.params.ParameterizedTest;
|
||||
+import org.junit.jupiter.params.provider.MethodSource;
|
||||
+
|
||||
+public class MaterialTagsTest extends AbstractTestingBase {
|
||||
+
|
||||
+ private final static EnchantmentCategory[] ENCHANTMENT_CATEGORIES = EnchantmentCategory.values();
|
||||
+
|
||||
+ @ParameterizedTest
|
||||
+ @MethodSource("items")
|
||||
+ public void testEnchantables(@NotNull final Item item) {
|
||||
+ final List<EnchantmentCategory> enchantableCategories = new ObjectArrayList<>();
|
||||
+ for (final EnchantmentCategory enchantmentCategory : ENCHANTMENT_CATEGORIES) {
|
||||
+ if (enchantmentCategory.canEnchant(item)) enchantableCategories.add(enchantmentCategory);
|
||||
+ }
|
||||
+
|
||||
+ final boolean taggedAsEnchantable = MaterialTags.ENCHANTABLE.isTagged(CraftMagicNumbers.getMaterial(item));
|
||||
+ final boolean requiresTagByInternals = !enchantableCategories.isEmpty();
|
||||
+ Assertions.assertEquals(
|
||||
+ requiresTagByInternals,
|
||||
+ taggedAsEnchantable,
|
||||
+ () -> "%s matches enchantment categories [%s] but was tagged by material tags as enchantable: %s".formatted(
|
||||
+ item.getDescriptionId(),
|
||||
+ enchantableCategories.stream().map(Enum::name).collect(Collectors.joining(", ")),
|
||||
+ taggedAsEnchantable
|
||||
+ )
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ private static Stream<Item> items() {
|
||||
+ return BuiltInRegistries.ITEM.stream();
|
||||
+ }
|
||||
+}
|
|
@ -232,6 +232,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Bogged.java b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Bogged.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
|
||||
@@ -0,0 +0,0 @@ public class Bogged extends AbstractSkeleton implements Shearable {
|
||||
}
|
||||
|
||||
private void spawnShearedMushrooms() {
|
||||
+ // Paper start - shear drops API
|
||||
+ this.generateShearedMushrooms(this::spawnAtLocation);
|
||||
+ }
|
||||
+ private void generateShearedMushrooms(java.util.function.Consumer<ItemStack> stackConsumer) {
|
||||
+ // Paper end - shear drops API
|
||||
if (this.level() instanceof ServerLevel serverLevel && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
LootTable lootTable = serverLevel.getServer().reloadableRegistries().getLootTable(BuiltInLootTables.BOGGED_SHEAR);
|
||||
LootParams lootParams = new LootParams.Builder(serverLevel)
|
||||
@@ -0,0 +0,0 @@ public class Bogged extends AbstractSkeleton implements Shearable {
|
||||
.create(LootContextParamSets.SHEARING);
|
||||
|
||||
for (ItemStack itemStack : lootTable.getRandomItems(lootParams)) {
|
||||
- this.spawnAtLocation(itemStack);
|
||||
+ stackConsumer.accept(itemStack); // Paper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - shear drops API
|
||||
+ @Override
|
||||
+ public java.util.List<ItemStack> generateDefaultDrops() {
|
||||
+ final java.util.List<ItemStack> drops = new java.util.ArrayList<>();
|
||||
+ this.generateShearedMushrooms(drops::add);
|
||||
+ return drops;
|
||||
+ }
|
||||
+ // Paper end - shear drops API
|
||||
+
|
||||
@Override
|
||||
public boolean readyForShearing() {
|
||||
return !this.isSheared() && this.isAlive();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
|
|
|
@ -5,7 +5,8 @@ Subject: [PATCH] Add methods to get translation keys
|
|||
|
||||
== AT ==
|
||||
public org.bukkit.craftbukkit.inventory.CraftMetaFirework
|
||||
public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/FireworkEffect$Type;)I
|
||||
public org.bukkit.craftbukkit.inventory.CraftMetaFirework power
|
||||
public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/FireworkEffect$Type;)Lnet/minecraft/world/item/component/FireworkExplosion$Shape;
|
||||
|
||||
Co-authored-by: MeFisto94 <MeFisto94@users.noreply.github.com>
|
||||
|
||||
|
@ -40,6 +41,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Paper end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java
|
||||
@@ -0,0 +0,0 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta {
|
||||
return new FireworkExplosion(CraftMetaFirework.getNBT(effect.getType()), colors, fadeColors, effect.hasTrail(), effect.hasFlicker());
|
||||
}
|
||||
|
||||
- static FireworkExplosion.Shape getNBT(Type type) {
|
||||
+ public static FireworkExplosion.Shape getNBT(Type type) { // Paper - package-private -> public
|
||||
switch (type) {
|
||||
case BALL:
|
||||
return FireworkExplosion.Shape.SMALL_BALL;
|
||||
diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
|
||||
|
@ -101,8 +115,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ @Test
|
||||
+ public void testFireworkEffectType() {
|
||||
+ for (FireworkEffect.Type type : FireworkEffect.Type.values()) {
|
||||
+ Assertions.assertEquals(net.minecraft.world.item.FireworkRocketItem.Shape.byId(org.bukkit.craftbukkit.inventory.CraftMetaFirework.getNBT(type)).getName(), org.bukkit.FireworkEffect.Type.NAMES.key(type), "translation key mismatch for " + type);
|
||||
+ for (final FireworkEffect.Type type : FireworkEffect.Type.values()) {
|
||||
+ final net.minecraft.world.item.component.FireworkExplosion.Shape nmsType = org.bukkit.craftbukkit.inventory.CraftMetaFirework.getNBT(type);
|
||||
+ Assertions.assertTrue(nmsType.getName().getContents() instanceof TranslatableContents, "contents aren't translatable");
|
||||
+ Assertions.assertEquals(((TranslatableContents) nmsType.getName().getContents()).getKey(), type.translationKey(), "translation key mismatch for " + type);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -75,6 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "time", "Allows the user to change or query the world's game time", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "tick", "Allows the user to control the tick rate of the server", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "title", "Allows the user to manage screen titles", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "transfer", "Allows the user to transfer to another server", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "weather", "Allows the user to set the weather", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "whitelist", "Allows the user to manage the server whitelist", PermissionDefault.OP, commands);
|
||||
+ DefaultPermissions.registerPermission(CommandPermissions.PREFIX + "worldborder", "Allows the user to manage the world border", PermissionDefault.OP, commands);
|
||||
|
@ -132,7 +133,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ CraftDefaultPermissions.registerCorePermissions();
|
||||
+ Set<String> perms = collectMinecraftCommandPerms();
|
||||
+
|
||||
+ Commands commands = new Commands(Commands.CommandSelection.DEDICATED, CommandBuildContext.configurable(AbstractTestingBase.REGISTRY_CUSTOM, FeatureFlags.VANILLA_SET));
|
||||
+ Commands commands = new Commands(Commands.CommandSelection.DEDICATED, CommandBuildContext.simple(AbstractTestingBase.REGISTRY_CUSTOM, FeatureFlags.VANILLA_SET));
|
||||
+ RootCommandNode<CommandSourceStack> root = commands.getDispatcher().getRoot();
|
||||
+ Set<String> missing = new LinkedHashSet<>();
|
||||
+ Set<String> foundPerms = new HashSet<>();
|
||||
|
|
|
@ -18,6 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
switch (effect) {
|
||||
+ case PARTICLES_SCULK_CHARGE: // Paper - add missing effects
|
||||
+ case TRIAL_SPAWNER_DETECT_PLAYER: // Paper - add missing effects
|
||||
+ case BEE_GROWTH: // Paper - add missing effects
|
||||
case VILLAGER_PLANT_GROW:
|
||||
datavalue = (Integer) data;
|
||||
break;
|
||||
|
@ -85,18 +86,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
@@ -0,0 +0,0 @@
|
||||
+package org.bukkit;
|
||||
+
|
||||
+import com.google.common.base.Joiner;
|
||||
+import java.lang.reflect.Field;
|
||||
+import java.lang.reflect.Modifier;
|
||||
+import java.util.ArrayList;
|
||||
+import java.util.HashMap;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.List;
|
||||
+import java.util.Map;
|
||||
+import java.util.Set;
|
||||
+import net.minecraft.world.level.block.LevelEvent;
|
||||
+import org.junit.jupiter.api.Test;
|
||||
+
|
||||
+import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
+import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
+import static org.junit.jupiter.api.Assertions.fail;
|
||||
+
|
||||
+public class EffectTest {
|
||||
+
|
||||
|
@ -125,12 +130,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ final Set<Integer> missingEvents = new HashSet<>();
|
||||
+ for (final Integer event : collectNmsLevelEvents()) {
|
||||
+ assertNotNull(toId.get(event), "missing API Effect: " + event);
|
||||
+ if (toId.get(event) == null) {
|
||||
+ missingEvents.add(event);
|
||||
+ }
|
||||
+ }
|
||||
+ if (!missingEvents.isEmpty()) {
|
||||
+ fail("Missing API Effects:\n" + Joiner.on("\n").join(missingEvents));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("deprecation")
|
||||
+ @Test
|
||||
+ public void checkNoExtraApi() throws ReflectiveOperationException {
|
||||
+ Map<Integer, Effect> toId = new HashMap<>();
|
||||
|
@ -142,8 +152,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ }
|
||||
+
|
||||
+ final List<Integer> nmsEvents = collectNmsLevelEvents();
|
||||
+ final Set<Effect> extraApiEffects = new HashSet<>();
|
||||
+ for (final Map.Entry<Integer, Effect> entry : toId.entrySet()) {
|
||||
+ assertTrue(nmsEvents.contains(entry.getKey()), "Extra API Effect: " + entry.getValue());
|
||||
+ if (!nmsEvents.contains(entry.getKey())) {
|
||||
+ extraApiEffects.add(entry.getValue());
|
||||
+ }
|
||||
+ }
|
||||
+ if (!extraApiEffects.isEmpty()) {
|
||||
+ fail("Extra API Effects:\n" + Joiner.on("\n").join(extraApiEffects));
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ @Test
|
||||
+ public void testRarityFormatting() {
|
||||
+ for (Rarity nmsRarity : Rarity.values()) {
|
||||
+ assertEquals(nmsRarity.color, PaperAdventure.asVanilla(ItemRarity.values()[nmsRarity.ordinal()].color), "rarity formatting is mis-matched");
|
||||
+ assertEquals(nmsRarity.color(), PaperAdventure.asVanilla(ItemRarity.values()[nmsRarity.ordinal()].color), "rarity formatting is mis-matched");
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -85,43 +85,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
// Paper end
|
||||
|
||||
@Override
|
||||
diff --git a/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java b/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
--- /dev/null
|
||||
+++ b/src/test/java/io/papermc/paper/entity/EntityCategoryTest.java
|
||||
@@ -0,0 +0,0 @@
|
||||
+package io.papermc.paper.entity;
|
||||
+
|
||||
+import com.google.common.base.Joiner;
|
||||
+import com.google.common.collect.Maps;
|
||||
+import com.google.common.collect.Sets;
|
||||
+import net.minecraft.world.entity.MobType;
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
+import org.bukkit.entity.EntityCategory;
|
||||
+import org.junit.jupiter.api.Test;
|
||||
+
|
||||
+import java.lang.reflect.Field;
|
||||
+import java.util.Map;
|
||||
+import java.util.Set;
|
||||
+
|
||||
+import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
+
|
||||
+public class EntityCategoryTest {
|
||||
+
|
||||
+ @Test
|
||||
+ public void test() throws IllegalAccessException {
|
||||
+
|
||||
+ Map<MobType, String> enumMonsterTypeFieldMap = Maps.newHashMap();
|
||||
+ for (Field field : MobType.class.getDeclaredFields()) {
|
||||
+ if (field.getType() == MobType.class) {
|
||||
+ enumMonsterTypeFieldMap.put( (MobType) field.get(null), field.getName());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ for (EntityCategory entityCategory : EntityCategory.values()) {
|
||||
+ enumMonsterTypeFieldMap.remove(CraftLivingEntity.fromBukkitEntityCategory(entityCategory));
|
||||
+ }
|
||||
+ assertTrue(enumMonsterTypeFieldMap.size() == 0, MobType.class.getName() + " instance(s): " + Joiner.on(", ").join(enumMonsterTypeFieldMap.values()) + " do not have bukkit equivalents");
|
||||
+ }
|
||||
+}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 26 Apr 2024 11:38:28 -0700
|
||||
Subject: [PATCH] Properly handle pdc and custom tags in ItemMeta
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
this.customTag = customData.copyTag();
|
||||
if (this.customTag.contains(CraftMetaItem.BUKKIT_CUSTOM_TAG.NBT)) {
|
||||
CompoundTag compound = this.customTag.getCompound(CraftMetaItem.BUKKIT_CUSTOM_TAG.NBT);
|
||||
+ this.customTag.remove(CraftMetaItem.BUKKIT_CUSTOM_TAG.NBT); // Paper - remove PDC from custom tag
|
||||
+ if (this.customTag.isEmpty()) this.customTag = null; // Paper - remove PDC from custom tag
|
||||
Set<String> keys = compound.getAllKeys();
|
||||
for (String key : keys) {
|
||||
this.persistentDataContainer.put(key, compound.get(key).copy());
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
ByteArrayInputStream buf = new ByteArrayInputStream(Base64.getDecoder().decode(custom));
|
||||
try {
|
||||
this.customTag = NbtIo.readCompressed(buf, NbtAccounter.unlimitedHeap());
|
||||
+ this.customTag.remove(CraftMetaItem.BUKKIT_CUSTOM_TAG.NBT); // Paper - ensure PDC isn't in custom tag
|
||||
+ if (this.customTag.isEmpty()) this.customTag = null; // Paper - ensure PDC isn't in custom tag
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(CraftMetaItem.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
|
||||
if (this.customTag != null) {
|
||||
itemTag.put(CraftMetaItem.CUSTOM_DATA, CustomData.of(this.customTag));
|
||||
+ this.customTag.remove(CraftMetaItem.BUKKIT_CUSTOM_TAG.BUKKIT);
|
||||
+ if (this.customTag.isEmpty()) this.customTag = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 26 Apr 2024 11:38:40 -0700
|
||||
Subject: [PATCH] handle converting old serialized names to new names
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||
enchantKey = "SWEEPING_EDGE";
|
||||
}
|
||||
|
||||
- Enchantment enchantment = Enchantment.getByName(enchantKey);
|
||||
+ Enchantment enchantment = Enchantment.getByName(org.bukkit.craftbukkit.legacy.FieldRename.convertEnchantmentName(org.bukkit.craftbukkit.util.ApiVersion.CURRENT, enchantKey)); // Paper - convert enchantment names
|
||||
if ((enchantment != null) && (entry.getValue() instanceof Integer)) {
|
||||
enchantments.put(enchantment, (Integer) entry.getValue());
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java
|
||||
@@ -0,0 +0,0 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta {
|
||||
|
||||
String entityType = SerializableMeta.getString(map, CraftMetaSpawnEgg.ENTITY_ID.BUKKIT, true);
|
||||
if (entityType != null) {
|
||||
- this.spawnedType = EntityType.fromName(entityType);
|
||||
+ this.spawnedType = EntityType.fromName(org.bukkit.craftbukkit.legacy.FieldRename.convertEntityTypeName(org.bukkit.craftbukkit.util.ApiVersion.CURRENT, entityType)); // Paper - handle old entity type field names
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue