aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/chrisoft/trashyaddon/commands/MapDumpCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/chrisoft/trashyaddon/commands/MapDumpCommand.java')
-rw-r--r--src/main/java/org/chrisoft/trashyaddon/commands/MapDumpCommand.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/org/chrisoft/trashyaddon/commands/MapDumpCommand.java b/src/main/java/org/chrisoft/trashyaddon/commands/MapDumpCommand.java
index 2bc7096..b09c9be 100644
--- a/src/main/java/org/chrisoft/trashyaddon/commands/MapDumpCommand.java
+++ b/src/main/java/org/chrisoft/trashyaddon/commands/MapDumpCommand.java
@@ -4,6 +4,8 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.commands.Command;
import net.minecraft.command.CommandSource;
+import net.minecraft.component.DataComponentTypes;
+import net.minecraft.component.type.MapIdComponent;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.decoration.ItemFrameEntity;
import net.minecraft.client.MinecraftClient;
@@ -19,7 +21,6 @@ import java.util.zip.GZIPOutputStream;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Vector;
-import java.util.OptionalInt;
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
@@ -38,14 +39,14 @@ public class MapDumpCommand extends Command {
if (e.getType() != EntityType.ITEM_FRAME && e.getType() != EntityType.GLOW_ITEM_FRAME)
continue;
ItemFrameEntity ife = (ItemFrameEntity) e;
- OptionalInt oid = ife.getMapId();
- if (oid.isEmpty())
+ MapIdComponent idc = ife.getMapId(ife.getHeldItemStack());
+ if (idc == null)
continue;
- int id = oid.getAsInt();
- MapState mapState = FilledMapItem.getMapState(id, mc.world);
+ int id = idc.id();
+ MapState mapState = FilledMapItem.getMapState(idc, mc.world);
if (mapState == null)
continue;
- String name = ife.getHeldItemStack().hasCustomName() ? ife.getHeldItemStack().getName().getString() : "";
+ String name = ife.getHeldItemStack().contains(DataComponentTypes.CUSTOM_NAME) ? ife.getHeldItemStack().getName().getString() : "";
byte[] u8name = name.getBytes(StandardCharsets.UTF_8);
int bsz = 4 + 4 + u8name.length + 16384;
ByteBuffer buf = ByteBuffer.allocate(bsz);