убираем не используемые пакеты
This commit is contained in:
@@ -70,7 +70,6 @@ public enum State {
|
||||
PLAY(3,
|
||||
ImmutableMap.<Integer, Class<? extends CSPacket>>builder()
|
||||
.put(0x00, TeleportConfirmPacket.class)
|
||||
.put(0x01, TabCompletePacket.class)
|
||||
.put(0x02, ChatMessageClientPacket.class)
|
||||
.put(0x04, ClientSettingsPacket.class)
|
||||
.put(0x09, PluginMessagePacket.class)
|
||||
@@ -79,18 +78,13 @@ public enum State {
|
||||
.put(0x0E, PlayerPositionAndLookPacket.class)
|
||||
.put(0x0F, PlayerLookPacket.class)
|
||||
.put(0x13, PlayerAbilitiesPacket.class)
|
||||
.put(0x14, PlayerDiggingPacket.class)
|
||||
.put(0x15, EntityActionPacket.class)
|
||||
.put(0x1A, HeldItemChangePacket.class)
|
||||
.put(0x1D, AnimationPacket.class)
|
||||
.put(0x1F, PlayerBlockPlacementPacket.class)
|
||||
.build(),
|
||||
ImmutableMap.<Class<? extends SCPacket>, Integer>builder()
|
||||
.put(BossBarPacket.class, 0x0C)
|
||||
.put(ChatMessageServerPacket.class, 0x0F)
|
||||
.put(PluginMessagePacket.class, 0x18)
|
||||
.put(UnloadChunkPacket.class, 0x1D)
|
||||
.put(ChangeGameState.class, 0x1E)
|
||||
.put(KeepAlivePacket.class, 0x1F)
|
||||
.put(ChunkDataPacket.class, 0x20)
|
||||
.put(JoinGamePacket.class, 0x23)
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* DmitriyMX <dimon550@gmail.com>
|
||||
* 2018-06-17
|
||||
*/
|
||||
package mc.core.network.proto_1_12_2.packets.clientside;
|
||||
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.NetInputStream;
|
||||
|
||||
public class AnimationPacket implements CSPacket {
|
||||
private int handAnimation;
|
||||
|
||||
@Override
|
||||
public void readSelf(NetInputStream netStream) {
|
||||
this.handAnimation = netStream.readVarInt();
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package mc.core.network.proto_1_12_2.packets.clientside;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.NetInputStream;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Getter
|
||||
public class EntityActionPacket implements CSPacket {
|
||||
@RequiredArgsConstructor
|
||||
public enum Action {
|
||||
START_SNEAKING(0),
|
||||
STOP_SNEAKING(1),
|
||||
LEAVE_BED(2), // Leave bed is only sent when the “Leave Bed” button is clicked on the sleep GUI, not when waking up due today time.
|
||||
START_SPRINTING(3),
|
||||
STOP_SPRINTING(4),
|
||||
START_JUMP_WITH_HORSE(5),
|
||||
STOP_JUMP_WITH_HORSE(6),
|
||||
OPEN_HORSE_INVENTORY(7), // Open horse inventory is only sent when pressing the inventory key (default: E) while on a horse — all other methods of opening a horse's inventory (involving right-clicking or shift-right-clicking it) do not use this packet.
|
||||
START_FLYING_WITH_ELYTRA(8);
|
||||
|
||||
public static Action getById(final int id) {
|
||||
return Arrays.stream(Action.values())
|
||||
.filter(action -> action.id == id)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Getter
|
||||
private final int id;
|
||||
}
|
||||
|
||||
private int entityId;
|
||||
private Action action;
|
||||
private int jumpBoost; // Only used by the “start jump with horse” action, in which case it ranges from 0 to 100. In all other cases it is 0.
|
||||
|
||||
@Override
|
||||
public void readSelf(NetInputStream netStream) {
|
||||
entityId = netStream.readVarInt();
|
||||
action = Action.getById(netStream.readVarInt());
|
||||
jumpBoost = netStream.readVarInt();
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package mc.core.network.proto_1_12_2.packets.clientside;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.NetInputStream;
|
||||
import mc.core.network.proto_1_12_2.Direction;
|
||||
import mc.core.network.proto_1_12_2.serializers.BlockLocationSerializer;
|
||||
import mc.core.world.block.BlockLocation;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
public class PlayerBlockPlacementPacket implements CSPacket {
|
||||
private BlockLocation 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();
|
||||
location = BlockLocationSerializer.fromLong(compactedCoords);
|
||||
face = Direction.getById(netStream.readVarInt());
|
||||
hand = (netStream.readVarInt() == 1);
|
||||
cursorX = netStream.readFloat();
|
||||
cursorY = netStream.readFloat();
|
||||
cursorZ = netStream.readFloat();
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package mc.core.network.proto_1_12_2.packets.clientside;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.NetInputStream;
|
||||
import mc.core.network.proto_1_12_2.Direction;
|
||||
import mc.core.network.proto_1_12_2.serializers.BlockLocationSerializer;
|
||||
import mc.core.world.block.BlockLocation;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Getter
|
||||
@ToString
|
||||
public class PlayerDiggingPacket implements CSPacket {
|
||||
@RequiredArgsConstructor
|
||||
public enum Status {
|
||||
STARTED_DIGGING(0),
|
||||
CANCELLED_DIGGING(1),
|
||||
FINISHED_DIGGING(2),
|
||||
DROP_ITEM_STACK(3),
|
||||
DROP_ITEM(4),
|
||||
/* Indicates that the currently held item should have its
|
||||
* state updated such as eating food, pulling back bows,
|
||||
* using buckets, etc. Location is always set to 0/0/0,
|
||||
* Face is always set to -Y.
|
||||
*/
|
||||
SHOOT_ARROW(5),
|
||||
FINISH_EATING(5),
|
||||
SWAP_ITEM_IN_HAND(6);
|
||||
|
||||
public static Status getById(final int id) {
|
||||
return Arrays.stream(Status.values())
|
||||
.filter(status -> status.id == id)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Getter
|
||||
private final int id;
|
||||
}
|
||||
|
||||
private Status status;
|
||||
private BlockLocation location;
|
||||
private Direction face;
|
||||
|
||||
@Override
|
||||
public void readSelf(NetInputStream netStream) {
|
||||
status = Status.getById(netStream.readVarInt());
|
||||
long compactCoord = netStream.readLong();
|
||||
location = BlockLocationSerializer.fromLong(compactCoord);
|
||||
face = Direction.getById(netStream.readByte());
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* DmitriyMX <dimon550@gmail.com>
|
||||
* 2018-06-17
|
||||
*/
|
||||
package mc.core.network.proto_1_12_2.packets.clientside;
|
||||
|
||||
import mc.core.network.CSPacket;
|
||||
import mc.core.network.NetInputStream;
|
||||
import mc.core.world.block.BlockLocation;
|
||||
|
||||
public class TabCompletePacket implements CSPacket {
|
||||
private String text;
|
||||
private boolean assumeCommand;
|
||||
private boolean hasPosition;
|
||||
private BlockLocation location;
|
||||
|
||||
@Override
|
||||
public void readSelf(NetInputStream netStream) {
|
||||
this.text = netStream.readString();
|
||||
this.assumeCommand = netStream.readBoolean();
|
||||
this.hasPosition = netStream.readBoolean();
|
||||
|
||||
if (this.hasPosition) {
|
||||
long compactValue = netStream.readLong();
|
||||
|
||||
double x = compactValue >> 38;
|
||||
double y = (compactValue >> 26) & 0xFFF;
|
||||
double z = compactValue << 38 >> 38; // is normal?
|
||||
|
||||
this.location = new BlockLocation((int)x, (int)y, (int)z); //FIXME
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package mc.core.network.proto_1_12_2.packets.serverside;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import mc.core.network.NetOutputStream;
|
||||
import mc.core.network.SCPacket;
|
||||
|
||||
@Setter
|
||||
public class ChangeGameState implements SCPacket {
|
||||
@RequiredArgsConstructor
|
||||
public enum Reason {
|
||||
INVALID_BED(0), // Would be used to switch between messages, but the only used message is 0 for invalid bed (wat?)
|
||||
RAINING_END(1),
|
||||
RAINING_BEGIN(2),
|
||||
CHANGE_GAMEMODE(3), // 0: Survival, 1: Creative, 2: Adventure, 3: Spectator
|
||||
ARROW_HITTING_PLAYER(6), // Appears to be played when an arrow strikes another player in Multiplayer
|
||||
FADE_VALUE(7), // The current darkness value. 1 = Dark, 0 = Bright, Setting the value higher causes the game to change color and freeze
|
||||
FADE_TIME(8), // Time in ticks for the sky to fade
|
||||
GUARDIAN_APPEARANCE(10); // Play elder guardian mob appearance (effect and sound)
|
||||
|
||||
private final int id;
|
||||
}
|
||||
|
||||
private Reason reason;
|
||||
private float value;
|
||||
|
||||
@Override
|
||||
public void writeSelf(NetOutputStream netStream) {
|
||||
netStream.writeUnsignedByte(reason.id);
|
||||
netStream.writeFloat(value);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package mc.core.network.proto_1_12_2.packets.serverside;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import mc.core.network.NetOutputStream;
|
||||
import mc.core.network.SCPacket;
|
||||
|
||||
import java.security.PublicKey;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Setter
|
||||
public class EncryptionRequestPacket implements SCPacket {
|
||||
private String serverId;
|
||||
private PublicKey publicKey;
|
||||
private byte[] verifyToken;
|
||||
|
||||
@Override
|
||||
public void writeSelf(NetOutputStream netStream) {
|
||||
netStream.writeString(serverId);
|
||||
byte[] bytes = publicKey.getEncoded();
|
||||
netStream.writeVarInt(bytes.length);
|
||||
netStream.writeBytes(bytes);
|
||||
netStream.writeVarInt(verifyToken.length);
|
||||
netStream.writeBytes(verifyToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user