новый пакет PlayerBlockPlacementPacket
This commit is contained in:
@@ -85,6 +85,7 @@ public enum State {
|
|||||||
.put(0x15, EntityActionPacket.class)
|
.put(0x15, EntityActionPacket.class)
|
||||||
.put(0x1A, HeldItemChangePacket.class)
|
.put(0x1A, HeldItemChangePacket.class)
|
||||||
.put(0x1D, AnimationPacket.class)
|
.put(0x1D, AnimationPacket.class)
|
||||||
|
.put(0x1F, PlayerBlockPlacementPacket.class)
|
||||||
.build(),
|
.build(),
|
||||||
ImmutableMap.<Class<? extends SCPacket>, Integer>builder()
|
ImmutableMap.<Class<? extends SCPacket>, Integer>builder()
|
||||||
.put(BossBarPacket.class, 0x0C)
|
.put(BossBarPacket.class, 0x0C)
|
||||||
|
|||||||
@@ -1,4 +1,31 @@
|
|||||||
package mc.core.network.proto_1_12_2.packets;
|
package mc.core.network.proto_1_12_2.packets;
|
||||||
|
|
||||||
public class PlayerBlockPlacementPacket {
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import mc.core.Location;
|
||||||
|
import mc.core.network.CSPacket;
|
||||||
|
import mc.core.network.NetInputStream;
|
||||||
|
import mc.core.network.proto_1_12_2.Direction;
|
||||||
|
import mc.core.utils.CompactedCoords;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
public class PlayerBlockPlacementPacket implements CSPacket {
|
||||||
|
private Location location;
|
||||||
|
private Direction face;
|
||||||
|
/** true - main hand; false - off hand */
|
||||||
|
private boolean hand;
|
||||||
|
private float cursorX, cursorY, cursorZ;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSelf(NetInputStream netStream) {
|
||||||
|
long compactedCoords = netStream.readLong();
|
||||||
|
double[] xyz = CompactedCoords.uncompressXYZ(compactedCoords);
|
||||||
|
location = new Location(xyz[0], xyz[1], xyz[2], null);
|
||||||
|
face = Direction.getById(netStream.readVarInt());
|
||||||
|
hand = (netStream.readVarInt() == 1);
|
||||||
|
cursorX = netStream.readFloat();
|
||||||
|
cursorY = netStream.readFloat();
|
||||||
|
cursorZ = netStream.readFloat();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user