debug: log send packet
This commit is contained in:
@@ -4,6 +4,7 @@ import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.handler.codec.MessageToByteEncoder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import mc.protocol.NetworkAttributes;
|
||||
import mc.protocol.State;
|
||||
import mc.protocol.io.NetByteBuf;
|
||||
@@ -11,6 +12,7 @@ import mc.protocol.packets.ServerSidePacket;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
public class ProtocolEncoder extends MessageToByteEncoder<ServerSidePacket> {
|
||||
|
||||
@Override
|
||||
@@ -18,6 +20,8 @@ public class ProtocolEncoder extends MessageToByteEncoder<ServerSidePacket> {
|
||||
State state = ctx.channel().attr(NetworkAttributes.STATE).get();
|
||||
int packetId = Objects.requireNonNull(state.getServerSidePacketId(packet.getClass()));
|
||||
|
||||
log.info("Send {}:{}", state, packet);
|
||||
|
||||
NetByteBuf buffer = new NetByteBuf(Unpooled.buffer());
|
||||
buffer.writeVarInt(packetId);
|
||||
packet.writeSelf(buffer);
|
||||
|
||||
@@ -64,7 +64,6 @@ public class PacketHandler {
|
||||
loginSuccessPacket.setUuid(UUID.randomUUID());
|
||||
loginSuccessPacket.setName(loginStartPacket.getName());
|
||||
|
||||
log.info("{}", loginSuccessPacket);
|
||||
channel.getCtx().writeAndFlush(loginSuccessPacket);
|
||||
channel.setState(State.PLAY);
|
||||
|
||||
@@ -75,7 +74,6 @@ public class PacketHandler {
|
||||
joinGamePacket.setDifficulty(Difficulty.PEACEFUL);
|
||||
joinGamePacket.setLevelType(LevelType.FLAT);
|
||||
|
||||
log.info("{}", joinGamePacket);
|
||||
channel.getCtx().write(joinGamePacket);
|
||||
|
||||
Location spawnLocation = new Location(0d, 63d, 0d);
|
||||
@@ -83,7 +81,6 @@ public class PacketHandler {
|
||||
var spawnPositionPacket = new SpawnPositionPacket();
|
||||
spawnPositionPacket.setSpawn(spawnLocation);
|
||||
|
||||
log.info("{}", spawnPositionPacket);
|
||||
channel.getCtx().write(spawnPositionPacket);
|
||||
|
||||
var playerAbilitiesPacket = new PlayerAbilitiesPacket();
|
||||
@@ -94,7 +91,6 @@ public class PacketHandler {
|
||||
playerAbilitiesPacket.setFieldOfView(0.0f);
|
||||
playerAbilitiesPacket.setFlyingSpeed(0.05f);
|
||||
|
||||
log.info("{}", playerAbilitiesPacket);
|
||||
channel.getCtx().write(playerAbilitiesPacket);
|
||||
|
||||
channel.getCtx().flush();
|
||||
@@ -104,7 +100,6 @@ public class PacketHandler {
|
||||
playerPositionAndLookPacket.setLook(new Look(0f, 0f));
|
||||
playerPositionAndLookPacket.setTeleportId(random.nextInt());
|
||||
|
||||
log.info("{}", playerPositionAndLookPacket);
|
||||
channel.getCtx().writeAndFlush(playerPositionAndLookPacket);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user