From ad6931e3673c8b3703544f3d65241dc6ee79c19e Mon Sep 17 00:00:00 2001 From: Bixilon Date: Thu, 18 Jun 2020 13:39:47 +0200 Subject: [PATCH] PacketSteerVehicle --- .../serverbound/play/PacketSteerVehicle.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/main/java/de/bixilon/minosoft/protocol/packets/serverbound/play/PacketSteerVehicle.java diff --git a/src/main/java/de/bixilon/minosoft/protocol/packets/serverbound/play/PacketSteerVehicle.java b/src/main/java/de/bixilon/minosoft/protocol/packets/serverbound/play/PacketSteerVehicle.java new file mode 100644 index 000000000..1578fbe37 --- /dev/null +++ b/src/main/java/de/bixilon/minosoft/protocol/packets/serverbound/play/PacketSteerVehicle.java @@ -0,0 +1,56 @@ +/* + * Codename Minosoft + * Copyright (C) 2020 Moritz Zwerger + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. If not, see . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.protocol.packets.serverbound.play; + +import de.bixilon.minosoft.logging.Log; +import de.bixilon.minosoft.protocol.packets.ServerboundPacket; +import de.bixilon.minosoft.protocol.protocol.OutPacketBuffer; +import de.bixilon.minosoft.protocol.protocol.Packets; +import de.bixilon.minosoft.protocol.protocol.ProtocolVersion; + +public class PacketSteerVehicle implements ServerboundPacket { + + final float sideways; + final float forward; + final boolean jump; + final boolean unmount; + + public PacketSteerVehicle(float sideways, float forward, boolean jump, boolean unmount) { + this.sideways = sideways; + this.forward = forward; + this.jump = jump; + this.unmount = unmount; + log(); + } + + + @Override + public OutPacketBuffer write(ProtocolVersion v) { + OutPacketBuffer buffer = new OutPacketBuffer(v.getPacketCommand(Packets.Serverbound.PLAY_STEER_VEHICLE)); + switch (v) { + case VERSION_1_7_10: + buffer.writeFloat(sideways); + buffer.writeFloat(forward); + buffer.writeBoolean(jump); + buffer.writeBoolean(unmount); + break; + } + return buffer; + } + + @Override + public void log() { + Log.protocol(String.format("Steering vehicle: %s %s (jump=%s, unmount=%s)", sideways, forward, jump, unmount)); + } +}