From 1ff855ba8bd3ecaee79457aab9407c7619880195 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Mon, 18 Nov 2024 18:41:14 +0100 Subject: move diff --- patches/api/0495-WIP-DataComponent-API.patch | 9 ++++--- patches/server/0009-MC-Utils.patch | 22 +++++++++++++++++ patches/server/0010-Adventure.patch | 4 +-- patches/server/1036-WIP-DataComponent-API.patch | 33 ++++--------------------- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/patches/api/0495-WIP-DataComponent-API.patch b/patches/api/0495-WIP-DataComponent-API.patch index d36b910d81..bab14a7f05 100644 --- a/patches/api/0495-WIP-DataComponent-API.patch +++ b/patches/api/0495-WIP-DataComponent-API.patch @@ -3607,10 +3607,10 @@ index 0000000000000000000000000000000000000000..a845ccfc21f101f0632249745bbd8b33 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java new file mode 100644 -index 0000000000000000000000000000000000000000..45d674b68ab0e532c2f87bc528c1b095a50b5068 +index 0000000000000000000000000000000000000000..ff1a14e19c21dd22f249503a0b738f190a75aca0 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/item/consumable/ConsumeEffect.java -@@ -0,0 +1,149 @@ +@@ -0,0 +1,150 @@ +package io.papermc.paper.datacomponent.item.consumable; + +import io.papermc.paper.registry.set.RegistryKeySet; @@ -3697,6 +3697,7 @@ index 0000000000000000000000000000000000000000..45d674b68ab0e532c2f87bc528c1b095 + */ + float diameter(); + } ++ + /** + * Represents a consumable effect that removes status effects on consumption + */ @@ -3796,7 +3797,7 @@ index 0000000000000000000000000000000000000000..5843768d0be2ae4a0219636ed7640727 + SCALE +} diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java -index 9b39e33514b15a9d07104e2ad826d0da11f569d6..116857b4479565b602b94d227ee32dc29ebd6e5f 100644 +index 9b39e33514b15a9d07104e2ad826d0da11f569d6..e5319bdb9f75358b8bb0ac35373125a7d94edfa6 100644 --- a/src/main/java/io/papermc/paper/registry/RegistryKey.java +++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java @@ -1,5 +1,6 @@ @@ -3812,7 +3813,7 @@ index 9b39e33514b15a9d07104e2ad826d0da11f569d6..116857b4479565b602b94d227ee32dc2 RegistryKey SOUND_EVENT = create("sound_event"); + /** + * Built-in registry for data component types. -+ * @see io.papermc.paper.registry.keys.DataComponentTypeKeys ++ * + */ + RegistryKey DATA_COMPONENT_TYPE = create("data_component_type"); diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index 946f4b6df5..108f5992a4 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -6339,6 +6339,28 @@ index f6e6f0ddef6693c58f28b89cf3df005a8d47e08d..101eea3452c9e387e770b716543c3a4f public static net.minecraft.world.item.ItemStack asNMSCopy(ItemStack original) { if (original instanceof CraftItemStack) { CraftItemStack stack = (CraftItemStack) original; +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java b/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java +index 097996d3955ab5126b71f7bff1dd2c62becb5ffd..a8b46ea5e4b6260c2728c67e8651b74fe6356605 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java +@@ -40,6 +40,17 @@ public final class CraftLocation { + return new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()); + } + ++ // Paper start ++ public static net.minecraft.core.GlobalPos toGlobalPos(Location location) { ++ return net.minecraft.core.GlobalPos.of(((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle().dimension(), toBlockPosition(location)); ++ } ++ ++ public static Location fromGlobalPos(net.minecraft.core.GlobalPos globalPos) { ++ BlockPos pos = globalPos.pos(); ++ return new org.bukkit.Location(net.minecraft.server.MinecraftServer.getServer().getLevel(globalPos.dimension()).getWorld(), pos.getX(), pos.getY(), pos.getZ()); ++ } ++ // Paper end ++ + public static Vec3 toVec3D(Location location) { + return new Vec3(location.getX(), location.getY(), location.getZ()); + } diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java index b8a865305cc61954aeebff4a7cd1d1973c5f46ab..e444662ee4d9405eeea7caa41b9cd6b36586d840 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index 789578cdd1..f7659f6916 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -1161,7 +1161,7 @@ index 0000000000000000000000000000000000000000..2fd6c3e65354071af71c7d8ebb97b559 +} diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java new file mode 100644 -index 0000000000000000000000000000000000000000..3eabc4a6a595cd761d20371256c19ac440f92ba2 +index 0000000000000000000000000000000000000000..610003a668c4a7fe53e3477accc6bafb8479b936 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java @@ -0,0 +1,483 @@ @@ -1315,7 +1315,7 @@ index 0000000000000000000000000000000000000000..3eabc4a6a595cd761d20371256c19ac4 + // Key + + public static Key asAdventure(final ResourceLocation key) { -+ return Key.key(key.getNamespace(), key.getPath()); // todo move in the right patch ++ return Key.key(key.getNamespace(), key.getPath()); + } + + public static ResourceLocation asVanilla(final Key key) { diff --git a/patches/server/1036-WIP-DataComponent-API.patch b/patches/server/1036-WIP-DataComponent-API.patch index d47e420277..e2ab7e231d 100644 --- a/patches/server/1036-WIP-DataComponent-API.patch +++ b/patches/server/1036-WIP-DataComponent-API.patch @@ -51,10 +51,10 @@ index 0000000000000000000000000000000000000000..4a49f65cae1354afbcd4afda07581790 +} diff --git a/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java b/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java new file mode 100644 -index 0000000000000000000000000000000000000000..870d17851699f46275f4d443ca2880f78d7574bb +index 0000000000000000000000000000000000000000..c11de1f077c51483c61af6492f998781df866b88 --- /dev/null +++ b/src/main/java/io/papermc/paper/datacomponent/ComponentAdapters.java -@@ -0,0 +1,170 @@ +@@ -0,0 +1,168 @@ +package io.papermc.paper.datacomponent; + +import io.papermc.paper.adventure.PaperAdventure; @@ -124,7 +124,6 @@ index 0000000000000000000000000000000000000000..870d17851699f46275f4d443ca2880f7 + static final Map>, ComponentAdapter> ADAPTERS = new HashMap<>(); + + public static void bootstrap() { -+ //noinspection deprecation + registerIdentity(DataComponents.MAX_STACK_SIZE); + registerIdentity(DataComponents.MAX_DAMAGE); + registerIdentity(DataComponents.DAMAGE); @@ -132,7 +131,6 @@ index 0000000000000000000000000000000000000000..870d17851699f46275f4d443ca2880f7 + register(DataComponents.CUSTOM_NAME, PaperAdventure::asAdventure, PaperAdventure::asVanilla); + register(DataComponents.ITEM_NAME, PaperAdventure::asAdventure, PaperAdventure::asVanilla); + register(DataComponents.ITEM_MODEL, CraftNamespacedKey::fromMinecraft, CraftNamespacedKey::toMinecraft); -+ + register(DataComponents.LORE, PaperItemLore::new); + register(DataComponents.RARITY, nms -> ItemRarity.valueOf(nms.name()), api -> Rarity.valueOf(api.name())); + register(DataComponents.ENCHANTMENTS, PaperItemEnchantments::new); @@ -190,7 +188,7 @@ index 0000000000000000000000000000000000000000..870d17851699f46275f4d443ca2880f7 + register(DataComponents.CONTAINER, PaperItemContainerContents::new); + register(DataComponents.BLOCK_STATE, PaperBlockItemDataProperties::new); + // bees -+ //register(DataComponents.LOCK, PaperLockCode::new); ++ // register(DataComponents.LOCK, PaperLockCode::new); + register(DataComponents.CONTAINER_LOOT, PaperSeededContainerLoot::new); + + // TODO: REMOVE THIS... we want to build the PR... so lets just make things UNTYPED! @@ -3657,7 +3655,7 @@ index f8c6da955e4bd0e480c7b581d2a4325738f9dd6f..ee1fce58c6e57dd93a30ee66e7488a92 // data-drivens entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(), diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 756c73a401437566258813946fa10c7caa8f2469..71c017fd98001c7f78b1bf19e9956703617c0e37 100644 +index 756c73a401437566258813946fa10c7caa8f2469..bfddaa146c1bcb6a3fdd43773ec06f91a259b200 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -206,7 +206,7 @@ public final class CraftItemStack extends ItemStack { @@ -3854,7 +3852,7 @@ index 756c73a401437566258813946fa10c7caa8f2469..71c017fd98001c7f78b1bf19e9956703 + + // It can be assumed that the prototype is equal since the type is the same. This way all we need to check is the patch + -+ // Fast path when excluded types is empty to not flatten the set ++ // Fast path when excluded types is empty + if (exclude.isEmpty()) { + return left.getComponentsPatch().equals(right.getComponentsPatch()); + } @@ -3918,27 +3916,6 @@ index a944803771d514572f94b4e98a6d4435a009c078..82cb8cd1635c279326cec8454f1906ce IntList colors = CraftMetaFirework.addColors(effect.getColors()); IntList fadeColors = CraftMetaFirework.addColors(effect.getFadeColors()); -diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java b/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java -index 097996d3955ab5126b71f7bff1dd2c62becb5ffd..2e75620e803868ad3c254d11e6265062b2542249 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftLocation.java -@@ -40,6 +40,16 @@ public final class CraftLocation { - return new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()); - } - -+ // Paper start - todo move in the right patch -+ public static net.minecraft.core.GlobalPos toGlobalPos(Location location) { -+ return net.minecraft.core.GlobalPos.of(((org.bukkit.craftbukkit.CraftWorld) location.getWorld()).getHandle().dimension(), toBlockPosition(location)); -+ } -+ -+ public static Location fromGlobalPos(net.minecraft.core.GlobalPos globalPos) { -+ return new org.bukkit.Location(net.minecraft.server.MinecraftServer.getServer().getLevel(globalPos.dimension()).getWorld(), globalPos.pos().getX(), globalPos.pos().getY(), globalPos.pos().getZ()); -+ } -+ // Paper end -+ - public static Vec3 toVec3D(Location location) { - return new Vec3(location.getX(), location.getY(), location.getZ()); - } diff --git a/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.ItemComponentTypesBridge b/src/main/resources/META-INF/services/io.papermc.paper.datacomponent.item.ItemComponentTypesBridge new file mode 100644 index 0000000000000000000000000000000000000000..0fd276c2fdbba784c1cd95105553996b4ba2460e -- cgit v1.2.3