This commit is contained in:
Chipmunk 2023-04-12 21:26:41 -04:00
parent 3bccd1edae
commit 483ba18302
2 changed files with 20 additions and 12 deletions

View file

@ -0,0 +1,7 @@
package land.chipmunk.chipmunkbot.data.chat;
import net.kyori.adventure.text.Component;
public interface PlayerMessageParser {
PlayerMessage parse (Component message);
}

View file

@ -14,7 +14,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.Server
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCreativeModeSlotPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.player.ServerboundPlayerActionPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.inventory.ServerboundSetCommandBlockPacket;
// import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundBlockEntityTagQuery;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.level.ServerboundBlockEntityTagQuery;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.ItemStack;
import com.github.steveice10.mc.protocol.data.game.entity.player.Hand;
import com.github.steveice10.mc.protocol.data.game.entity.object.Direction;
@ -84,21 +84,22 @@ public class CommandCore extends SessionAdapter {
relEnd.getZ() + origin.getZ()
);
// TODO: Figure out how to use OpenNBT
/* CompoundTag itemTag = new CompoundTag("tag");
CompoundTag itemTag = new CompoundTag("");
CompoundTag blockEntityTag = new CompoundTag("BlockEntityTag");
blockEntityTag.getValue().put("Command", new StringTag("Command", command));
blockEntityTag.getValue().put("auto", new ByteTag("auto", (byte) 1));
itemTag.getValue().put("BlockEntityTag", blockEntityTag);
blockEntityTag.put(new StringTag("Command", command));
blockEntityTag.put(new ByteTag("auto", (byte) 1));
itemTag.put(blockEntityTag);
Vector3i temporaryBlockPosition = Vector3i.from((int) position.x(), (int) position.y() - 1, (int) position.z()); */
final PositionManager position = client.position();
client.chat().command(command);
Vector3i temporaryBlockPosition = Vector3i.from((int) position.x(), (int) position.y() - 1, (int) position.z());
// final Session session = client.session();
// session.send(new ServerboundSetCreativeModeSlotPacket(45, new ItemStack(371 /* command_block */, 1, itemTag)));
// session.send(new ServerboundPlayerActionPacket(PlayerAction.START_DIGGING, temporaryBlockPosition, Direction.NORTH, 0));
// session.send(new ServerboundUseItemOnPacket(temporaryBlockPosition, Direction.NORTH, Hand.OFF_HAND, 0.5f, 0.5f, 0.5f, false, 0));
// client.chat().command(command);
final Session session = client.session();
session.send(new ServerboundSetCreativeModeSlotPacket(45, new ItemStack(371 /* command_block */, 1, itemTag)));
session.send(new ServerboundPlayerActionPacket(PlayerAction.START_DIGGING, temporaryBlockPosition, Direction.NORTH, 0));
session.send(new ServerboundUseItemOnPacket(temporaryBlockPosition, Direction.NORTH, Hand.OFF_HAND, 0.5f, 0.5f, 0.5f, false, 0));
}
public void incrementCurrentBlock () {