diff options
Diffstat (limited to 'src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java')
-rw-r--r-- | src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java | 7 |
1 files changed, 6 insertions, 1 deletions
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; } } |