From 2fad2df879bbfd4dec76ab47479fe1a08ace8843 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Fri, 28 Apr 2023 18:55:33 +0700 Subject: [PATCH] CompoundTag mabe mabe --- .idea/workspace.xml | 77 +++++-------------- .../chomens_bot/plugins/CorePlugin.java | 15 ++-- 2 files changed, 26 insertions(+), 66 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 1816f3b..0eadede 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -4,47 +4,8 @@ - @@ -520,7 +480,8 @@ - diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CorePlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CorePlugin.java index ad596fa..7c28233 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CorePlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/CorePlugin.java @@ -17,7 +17,6 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server import com.github.steveice10.opennbt.tag.builtin.ByteTag; import com.github.steveice10.opennbt.tag.builtin.CompoundTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; -import com.github.steveice10.opennbt.tag.builtin.Tag; import com.github.steveice10.packetlib.Session; import com.github.steveice10.packetlib.event.session.DisconnectedEvent; import com.github.steveice10.packetlib.packet.Packet; @@ -120,12 +119,12 @@ public class CorePlugin extends PositionPlugin.PositionListener { public void runPlaceBlock (String command) { if (!ready) return; - Map tag = new HashMap<>(); - Map blockEntityTag = new HashMap<>(); - blockEntityTag.put("Command", new StringTag("Command", command)); - blockEntityTag.put("auto", new ByteTag("auto", (byte) 1)); - blockEntityTag.put("TrackOutput", new ByteTag("TrackOutput", (byte) 1)); - tag.put("BlockEntityTag", new CompoundTag("BlockEntityTag", blockEntityTag)); + final CompoundTag tag = new CompoundTag(""); + final CompoundTag blockEntityTag = new CompoundTag("BlockEntityTag"); + blockEntityTag.put(new StringTag("Command", command)); + blockEntityTag.put(new ByteTag("auto", (byte) 1)); + blockEntityTag.put(new ByteTag("TrackOutput", (byte) 1)); + tag.put(blockEntityTag); final Vector3i temporaryBlockPosition = Vector3i.from( bot.position().position().getX(), @@ -134,7 +133,7 @@ public class CorePlugin extends PositionPlugin.PositionListener { ); final Session session = bot.session(); - session.send(new ServerboundSetCreativeModeSlotPacket(36, new ItemStack(kaboom ? 490 /* repeating command block id */ : 371 /* command block id */, 64, new CompoundTag("", tag)))); + session.send(new ServerboundSetCreativeModeSlotPacket(36, new ItemStack(kaboom ? 490 /* repeating command block id */ : 371 /* command block id */, 64, tag))); session.send(new ServerboundPlayerActionPacket(PlayerAction.START_DIGGING, temporaryBlockPosition, Direction.NORTH, 0)); session.send(new ServerboundUseItemOnPacket(temporaryBlockPosition, Direction.UP, Hand.MAIN_HAND, 0.5f, 0.5f, 0.5f, false, 1)); }