use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayInRequestHorseInventory in project LanternServer by LanternPowered.
the class CodecPlayInPlayerAction method decode.
@Override
public Message decode(CodecContext context, ByteBuffer buf) throws CodecException {
// Normally should this be the entity id, but only the
// client player will send this, so it won't be used
buf.readVarInt();
final int action = buf.readVarInt();
final int value = buf.readVarInt();
// Sneaking states
if (action == 0 || action == 1) {
return new MessagePlayInPlayerSneak(action == 0);
// Sprinting states
} else if (action == 3 || action == 4) {
return new MessagePlayInPlayerSprint(action == 3);
// Leave bed button is pressed
} else if (action == 2) {
return new MessagePlayInLeaveBed();
// Horse jump power action
} else if (action == 5) {
// Make sure that the vehicle movement message doesn't add the jump message as well
context.getChannel().attr(CANCEL_NEXT_JUMP_MESSAGE).set(true);
return new MessagePlayInPlayerVehicleJump(false, ((float) value) / 100f);
} else if (action == 6) {
// be removed in 1.9, so ignoring it.
return NullMessage.INSTANCE;
} else if (action == 7) {
return new MessagePlayInRequestHorseInventory();
} else if (action == 8) {
return new MessagePlayInStartElytraFlying();
}
throw new CodecException("Unknown action type: " + action);
}
Aggregations