From 263695053d997e75ec4a10f0de3ea0cb8a0de80c Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Fri, 6 Sep 2024 23:02:34 -0400 Subject: 1.21 ... maybe (still testing) Special thanks to Xenapte for the 1.20.6 patch. --- .../java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java') diff --git a/src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java b/src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java index cce0687..cfeaee8 100644 --- a/src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java +++ b/src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java @@ -8,6 +8,8 @@ import meteordevelopment.orbit.EventPriority; import meteordevelopment.orbit.listeners.IListener; import meteordevelopment.meteorclient.events.packets.InventoryEvent; import net.minecraft.command.CommandSource; +import net.minecraft.component.DataComponentTypes; +import net.minecraft.component.type.MapIdComponent; import net.minecraft.client.MinecraftClient; import net.minecraft.item.FilledMapItem; import net.minecraft.item.ItemStack; @@ -79,7 +81,10 @@ public class MapTallyCommand extends Command { int nmaps = 0; for (ItemStack s : stacks.subList(0, stacks.size() - 36)) { if (s.getItem() instanceof FilledMapItem) { - ids.add(FilledMapItem.getMapId(s)); + MapIdComponent idc = s.getComponents().get(DataComponentTypes.MAP_ID); + if (idc == null) + continue; + ids.add(idc.id()); ++nmaps; } } -- cgit v1.2.3