use of org.dragonet.net.packet.minecraft.PEPacket in project Dragonet-Legacy by DragonetMC.
the class AnimateEntityMessageTranslator method handleSpecific.
@Override
public PEPacket[] handleSpecific(AnimateEntityMessage packet) {
AnimatePacket pkAnimate = new AnimatePacket();
pkAnimate.eid = packet.id;
//(msgAnimate.animation & 0xFF);
pkAnimate.action = (byte) 0x01;
return new PEPacket[] { pkAnimate };
}
use of org.dragonet.net.packet.minecraft.PEPacket in project Dragonet-Legacy by DragonetMC.
the class BlockChangeMessageTranslator method handleSpecific.
@Override
public PEPacket[] handleSpecific(BlockChangeMessage packet) {
UpdateBlockPacket pkBC = new UpdateBlockPacket();
UpdateBlockPacket.UpdateBlockRecord rec = new UpdateBlockPacket.UpdateBlockRecord();
rec.x = packet.x;
rec.z = packet.z;
rec.y = (byte) (packet.y & 0xFF);
rec.block = (byte) (this.getTranslator().getItemTranslator().translateToPE(packet.type >> 4) & 0xFF);
rec.meta = UpdateBlockPacket.FLAG_ALL;
pkBC.records = new UpdateBlockPacket.UpdateBlockRecord[] { rec };
return new PEPacket[] { pkBC };
}
use of org.dragonet.net.packet.minecraft.PEPacket in project Dragonet-Legacy by DragonetMC.
the class ChatMessageTranslator method handleSpecific.
@Override
public PEPacket[] handleSpecific(ChatMessage packet) {
String msg = "";
try {
//String msg = ((ChatMessage) message).text.asPlaintext();
Object json = new JSONParser().parse(packet.text.encode());
if (json instanceof JSONObject) {
msg = this.getTranslator().translateChatMessage((JSONObject) json);
} else {
msg = packet.text.asPlaintext();
}
} catch (ParseException ex) {
return null;
}
//if(json)
ChatPacket pkMessage = new ChatPacket();
pkMessage.source = "";
pkMessage.type = ChatPacket.TextType.RAW;
pkMessage.message = msg;
return new PEPacket[] { pkMessage };
}
use of org.dragonet.net.packet.minecraft.PEPacket in project Dragonet-Legacy by DragonetMC.
the class PENetworkClient method processPacketBuffer.
public void processPacketBuffer(byte[] buffer) {
PEPacket packet = Protocol.decode(buffer);
if (packet == null) {
return;
}
handlePacket(packet);
}
use of org.dragonet.net.packet.minecraft.PEPacket in project Dragonet-Legacy by DragonetMC.
the class PlayerPositionMessageTranslator method handleSpecific.
@Override
public PEPacket[] handleSpecific(PlayerPositionMessage packet) {
MovePlayerPacket pkMovePlayer = new MovePlayerPacket();
pkMovePlayer.eid = this.getSession().getPlayer().getEntityId();
pkMovePlayer.x = (float) packet.x;
pkMovePlayer.y = (float) packet.y;
pkMovePlayer.z = (float) packet.z;
pkMovePlayer.yaw = this.getSession().getPlayer().getLocation().getYaw();
pkMovePlayer.pitch = this.getSession().getPlayer().getLocation().getPitch();
pkMovePlayer.teleport = true;
return new PEPacket[] { pkMovePlayer };
}
Aggregations