aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2024-09-06 23:02:34 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2024-09-06 23:02:34 -0400
commit263695053d997e75ec4a10f0de3ea0cb8a0de80c (patch)
treea3d331738b56e0661731511cb46297d51e6ae9cd /src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java
parent04b4941e65693f8d6b55f924781d7dd7cd26b1d5 (diff)
downloadmeteor-trashy-addon-dev.tar.xz
1.21 ... maybe (still testing)HEADdev
Special thanks to Xenapte for the 1.20.6 patch.
Diffstat (limited to 'src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java')
-rw-r--r--src/main/java/org/chrisoft/trashyaddon/commands/MapTallyCommand.java7
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;
}
}