From ffd503fa9e2969e70f953f9410ae20280d4acc74 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 13 Jun 2024 06:57:35 -0700 Subject: more material rerouting --- patches/api/0011-Timings-v2.patch | 23 ++++++++++------------- patches/server/1053-Adopt-MaterialRerouting.patch | 18 ++++++++++++++++-- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/patches/api/0011-Timings-v2.patch b/patches/api/0011-Timings-v2.patch index 015941b546..a22b422a6f 100644 --- a/patches/api/0011-Timings-v2.patch +++ b/patches/api/0011-Timings-v2.patch @@ -717,10 +717,10 @@ index 0000000000000000000000000000000000000000..199789d56d22fcb1b77ebd56805cc28a +} diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java new file mode 100644 -index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf542989301d21b1c +index 0000000000000000000000000000000000000000..065991e7a7f6119797ea315a56836ba17dd17d05 --- /dev/null +++ b/src/main/java/co/aikar/timings/TimingHistory.java -@@ -0,0 +1,355 @@ +@@ -0,0 +1,352 @@ +/* + * This file is licensed under the MIT License (MIT). + * @@ -874,17 +874,14 @@ index 0000000000000000000000000000000000000000..eb9d58f8852e732a1284beeaf5429893 + } + } + ), -+ toObjectMapper(input.tileEntityCounts.entrySet(), -+ new Function, JSONPair>() { -+ @NotNull -+ @Override -+ public JSONPair apply(Map.Entry entry) { -+ tileEntityTypeSet.add(entry.getKey()); -+ return pair( -+ String.valueOf(entry.getKey().ordinal()), -+ entry.getValue().count() -+ ); -+ } ++ toObjectMapper( ++ input.tileEntityCounts.entrySet(), ++ entry -> { ++ tileEntityTypeSet.add(entry.getKey()); ++ return pair( ++ String.valueOf(entry.getKey().ordinal()), ++ entry.getValue().count() ++ ); + } + ) + ); diff --git a/patches/server/1053-Adopt-MaterialRerouting.patch b/patches/server/1053-Adopt-MaterialRerouting.patch index 29760fa722..e628afe53a 100644 --- a/patches/server/1053-Adopt-MaterialRerouting.patch +++ b/patches/server/1053-Adopt-MaterialRerouting.patch @@ -7,16 +7,30 @@ Adopts the paper-api to the material rerouting infrastructure introduced by upstream. diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/MaterialRerouting.java b/src/main/java/org/bukkit/craftbukkit/legacy/MaterialRerouting.java -index 3ff0f0e34356cee4c510fdd60af723b1c5df156a..deb121526016b0bffa8346e3074503fab9ef7c31 100644 +index 3ff0f0e34356cee4c510fdd60af723b1c5df156a..2ea35134bdb04244739ac6740242d4e4ec62623a 100644 --- a/src/main/java/org/bukkit/craftbukkit/legacy/MaterialRerouting.java +++ b/src/main/java/org/bukkit/craftbukkit/legacy/MaterialRerouting.java -@@ -600,4 +600,8 @@ public class MaterialRerouting { +@@ -600,4 +600,22 @@ public class MaterialRerouting { public static void setBlocks(ToolComponent.ToolRule toolRule, Collection blocks) { toolRule.setBlocks(blocks.stream().map(MaterialRerouting::transformToBlockType).toList()); } + + // Paper start - register paper API specific material consumers in rerouting ++ public static org.bukkit.Material getMinecartMaterial(org.bukkit.entity.Minecart minecart, @InjectPluginVersion ApiVersion version) { ++ return minecart.getMinecartMaterial(); ++ } ++ ++ public static Material getBoatMaterial(Boat boat, @InjectPluginVersion ApiVersion version) { ++ return boat.getBoatMaterial(); ++ } + ++ public static Material getType(io.papermc.paper.event.player.PlayerItemCooldownEvent event, @InjectPluginVersion ApiVersion version) { ++ return event.getType(); ++ } ++ ++ public static Collection getInfiniburn(World world, @InjectPluginVersion ApiVersion version) { ++ return world.getInfiniburn(); ++ } + // Paper end - register paper API specific material consumers in rerouting } diff --git a/src/test/java/org/bukkit/craftbukkit/legacy/MaterialReroutingTest.java b/src/test/java/org/bukkit/craftbukkit/legacy/MaterialReroutingTest.java -- cgit v1.2.3