Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
Rename old position type
Dieser Commit ist enthalten in:
Ursprung
553dd2cb45
Commit
50e55529d9
@ -34,8 +34,8 @@ public enum MetaType1_12 implements MetaType {
|
||||
Slot(5, Type.ITEM1_8),
|
||||
Boolean(6, Type.BOOLEAN),
|
||||
Vector3F(7, Type.ROTATION),
|
||||
Position(8, Type.POSITION),
|
||||
OptPosition(9, Type.OPTIONAL_POSITION),
|
||||
Position(8, Type.POSITION1_8),
|
||||
OptPosition(9, Type.OPTIONAL_POSITION1_8),
|
||||
Direction(10, Type.VAR_INT),
|
||||
OptUUID(11, Type.OPTIONAL_UUID),
|
||||
BlockID(12, Type.VAR_INT),
|
||||
|
@ -34,8 +34,8 @@ public enum MetaType1_9 implements MetaType {
|
||||
Slot(5, Type.ITEM1_8),
|
||||
Boolean(6, Type.BOOLEAN),
|
||||
Vector3F(7, Type.ROTATION),
|
||||
Position(8, Type.POSITION),
|
||||
OptPosition(9, Type.OPTIONAL_POSITION),
|
||||
Position(8, Type.POSITION1_8),
|
||||
OptPosition(9, Type.OPTIONAL_POSITION1_8),
|
||||
Direction(10, Type.VAR_INT),
|
||||
OptUUID(11, Type.OPTIONAL_UUID),
|
||||
BlockID(12, Type.VAR_INT);
|
||||
|
@ -37,8 +37,8 @@ public final class MetaTypes1_13 extends AbstractMetaTypes {
|
||||
public final MetaType itemType = add(6, Type.ITEM1_13);
|
||||
public final MetaType booleanType = add(7, Type.BOOLEAN);
|
||||
public final MetaType rotationType = add(8, Type.ROTATION);
|
||||
public final MetaType positionType = add(9, Type.POSITION);
|
||||
public final MetaType optionalPositionType = add(10, Type.OPTIONAL_POSITION);
|
||||
public final MetaType positionType = add(9, Type.POSITION1_8);
|
||||
public final MetaType optionalPositionType = add(10, Type.OPTIONAL_POSITION1_8);
|
||||
public final MetaType directionType = add(11, Type.VAR_INT);
|
||||
public final MetaType optionalUUIDType = add(12, Type.OPTIONAL_UUID);
|
||||
public final MetaType blockStateType = add(13, Type.VAR_INT);
|
||||
|
@ -37,8 +37,8 @@ public final class MetaTypes1_13_2 extends AbstractMetaTypes {
|
||||
public final MetaType itemType = add(6, Type.ITEM1_13_2);
|
||||
public final MetaType booleanType = add(7, Type.BOOLEAN);
|
||||
public final MetaType rotationType = add(8, Type.ROTATION);
|
||||
public final MetaType positionType = add(9, Type.POSITION);
|
||||
public final MetaType optionalPositionType = add(10, Type.OPTIONAL_POSITION);
|
||||
public final MetaType positionType = add(9, Type.POSITION1_8);
|
||||
public final MetaType optionalPositionType = add(10, Type.OPTIONAL_POSITION1_8);
|
||||
public final MetaType directionType = add(11, Type.VAR_INT);
|
||||
public final MetaType optionalUUIDType = add(12, Type.OPTIONAL_UUID);
|
||||
public final MetaType blockStateType = add(13, Type.VAR_INT);
|
||||
|
@ -132,8 +132,8 @@ public abstract class Type<T> implements ByteBufReader<T>, ByteBufWriter<T> {
|
||||
public static final VarLongType VAR_LONG = new VarLongType();
|
||||
|
||||
/* MC Types */
|
||||
public static final Type<Position> POSITION = new PositionType1_8();
|
||||
public static final Type<Position> OPTIONAL_POSITION = new PositionType1_8.OptionalPositionType();
|
||||
public static final Type<Position> POSITION1_8 = new PositionType1_8();
|
||||
public static final Type<Position> OPTIONAL_POSITION1_8 = new PositionType1_8.OptionalPositionType();
|
||||
public static final Type<Position> POSITION1_14 = new PositionType1_14();
|
||||
public static final Type<Position> OPTIONAL_POSITION_1_14 = new PositionType1_14.OptionalPosition1_14Type();
|
||||
public static final Type<EulerAngle> ROTATION = new EulerAngleType();
|
||||
|
@ -51,7 +51,7 @@ public class PositionType1_8 extends Type<Position> {
|
||||
public static final class OptionalPositionType extends OptionalType<Position> {
|
||||
|
||||
public OptionalPositionType() {
|
||||
super(Type.POSITION);
|
||||
super(Type.POSITION1_8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
|
||||
registerClientbound(ClientboundPackets1_9_3.BLOCK_ACTION, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION); // 0 - Position
|
||||
map(Type.POSITION1_8); // 0 - Position
|
||||
map(Type.UNSIGNED_BYTE); // 1 - Action ID
|
||||
map(Type.UNSIGNED_BYTE); // 2 - Action Param
|
||||
map(Type.VAR_INT); // 3 - Block Type
|
||||
@ -188,7 +188,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
|
||||
registerClientbound(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION); // 0 - Position
|
||||
map(Type.POSITION1_8); // 0 - Position
|
||||
map(Type.UNSIGNED_BYTE); // 1 - Action
|
||||
map(Type.NAMED_COMPOUND_TAG); // 2 - NBT data
|
||||
|
||||
@ -253,7 +253,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
|
||||
@Override
|
||||
public void register() {
|
||||
this.map(Type.INT); //effectID
|
||||
this.map(Type.POSITION); //pos
|
||||
this.map(Type.POSITION1_8); //pos
|
||||
this.map(Type.INT); //effectData
|
||||
this.map(Type.BOOLEAN); //serverwide / global
|
||||
handler(packetWrapper -> {
|
||||
@ -285,7 +285,7 @@ public class Protocol1_11To1_10 extends AbstractProtocol<ClientboundPackets1_9_3
|
||||
registerServerbound(ServerboundPackets1_9_3.PLAYER_BLOCK_PLACEMENT, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION); // 0 - Location
|
||||
map(Type.POSITION1_8); // 0 - Location
|
||||
map(Type.VAR_INT); // 1 - Face
|
||||
map(Type.VAR_INT); // 2 - Hand
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class WorldPackets {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.INT); // Effect Id
|
||||
map(Type.POSITION); // Location
|
||||
map(Type.POSITION1_8); // Location
|
||||
map(Type.INT); // Data
|
||||
handler(wrapper -> {
|
||||
int id = wrapper.get(Type.INT, 0);
|
||||
|
@ -109,7 +109,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
|
||||
}
|
||||
|
||||
public static final PacketHandler POS_TO_3_INT = wrapper -> {
|
||||
Position position = wrapper.read(Type.POSITION);
|
||||
Position position = wrapper.read(Type.POSITION1_8);
|
||||
wrapper.write(Type.INT, position.x());
|
||||
wrapper.write(Type.INT, position.y());
|
||||
wrapper.write(Type.INT, position.z());
|
||||
@ -334,7 +334,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.INT); // Effect Id
|
||||
map(Type.POSITION); // Location
|
||||
map(Type.POSITION1_8); // Location
|
||||
map(Type.INT); // Data
|
||||
handler(wrapper -> {
|
||||
int id = wrapper.get(Type.INT, 0);
|
||||
@ -638,7 +638,7 @@ public class Protocol1_13To1_12_2 extends AbstractProtocol<ClientboundPackets1_1
|
||||
handler(wrapper -> {
|
||||
wrapper.write(Type.BOOLEAN, false);
|
||||
final Position playerLookTarget = Via.getManager().getProviders().get(PlayerLookTargetProvider.class).getPlayerLookTarget(wrapper.user());
|
||||
wrapper.write(Type.OPTIONAL_POSITION, playerLookTarget);
|
||||
wrapper.write(Type.OPTIONAL_POSITION1_8, playerLookTarget);
|
||||
if (!wrapper.isCancelled() && Via.getConfig().get1_13TabCompleteDelay() > 0) {
|
||||
TabCompleteTracker tracker = wrapper.user().get(TabCompleteTracker.class);
|
||||
wrapper.cancel();
|
||||
|
@ -88,7 +88,7 @@ public final class ConnectionData {
|
||||
updateBlockStorage(user, pos.x(), pos.y(), pos.z(), newBlockState);
|
||||
|
||||
PacketWrapper blockUpdatePacket = PacketWrapper.create(ClientboundPackets1_13.BLOCK_CHANGE, null, user);
|
||||
blockUpdatePacket.write(Type.POSITION, pos);
|
||||
blockUpdatePacket.write(Type.POSITION1_8, pos);
|
||||
blockUpdatePacket.write(Type.VAR_INT, newBlockState);
|
||||
blockUpdatePacket.send(Protocol1_13To1_12_2.class);
|
||||
}
|
||||
|
@ -102,12 +102,12 @@ public class WorldPackets {
|
||||
protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION); // 0 - Location
|
||||
map(Type.POSITION1_8); // 0 - Location
|
||||
map(Type.UNSIGNED_BYTE); // 1 - Action
|
||||
map(Type.NAMED_COMPOUND_TAG); // 2 - NBT data
|
||||
|
||||
handler(wrapper -> {
|
||||
Position position = wrapper.get(Type.POSITION, 0);
|
||||
Position position = wrapper.get(Type.POSITION1_8, 0);
|
||||
short action = wrapper.get(Type.UNSIGNED_BYTE, 0);
|
||||
CompoundTag tag = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
|
||||
|
||||
@ -132,12 +132,12 @@ public class WorldPackets {
|
||||
protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_ACTION, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION); // Location
|
||||
map(Type.POSITION1_8); // Location
|
||||
map(Type.UNSIGNED_BYTE); // Action Id
|
||||
map(Type.UNSIGNED_BYTE); // Action param
|
||||
map(Type.VAR_INT); // Block Id - /!\ NOT BLOCK STATE ID
|
||||
handler(wrapper -> {
|
||||
Position pos = wrapper.get(Type.POSITION, 0);
|
||||
Position pos = wrapper.get(Type.POSITION1_8, 0);
|
||||
short action = wrapper.get(Type.UNSIGNED_BYTE, 0);
|
||||
short param = wrapper.get(Type.UNSIGNED_BYTE, 1);
|
||||
int blockId = wrapper.get(Type.VAR_INT, 0);
|
||||
@ -165,7 +165,7 @@ public class WorldPackets {
|
||||
|
||||
if (blockId == 73) { // Note block
|
||||
PacketWrapper blockChange = wrapper.create(ClientboundPackets1_13.BLOCK_CHANGE);
|
||||
blockChange.write(Type.POSITION, pos);
|
||||
blockChange.write(Type.POSITION1_8, pos);
|
||||
blockChange.write(Type.VAR_INT, 249 + (action * 24 * 2) + (param * 2));
|
||||
blockChange.send(Protocol1_13To1_12_2.class);
|
||||
}
|
||||
@ -177,10 +177,10 @@ public class WorldPackets {
|
||||
protocol.registerClientbound(ClientboundPackets1_12_1.BLOCK_CHANGE, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION);
|
||||
map(Type.POSITION1_8);
|
||||
map(Type.VAR_INT);
|
||||
handler(wrapper -> {
|
||||
Position position = wrapper.get(Type.POSITION, 0);
|
||||
Position position = wrapper.get(Type.POSITION1_8, 0);
|
||||
int newId = toNewId(wrapper.get(Type.VAR_INT, 0));
|
||||
|
||||
UserConnection userConnection = wrapper.user();
|
||||
@ -540,7 +540,7 @@ public class WorldPackets {
|
||||
|
||||
// Incoming Packets
|
||||
protocol.registerServerbound(ServerboundPackets1_13.PLAYER_BLOCK_PLACEMENT, wrapper -> {
|
||||
Position pos = wrapper.passthrough(Type.POSITION);
|
||||
Position pos = wrapper.passthrough(Type.POSITION1_8);
|
||||
wrapper.passthrough(Type.VAR_INT); // block face
|
||||
wrapper.passthrough(Type.VAR_INT); // hand
|
||||
wrapper.passthrough(Type.FLOAT); // cursor x
|
||||
@ -553,7 +553,7 @@ public class WorldPackets {
|
||||
});
|
||||
protocol.registerServerbound(ServerboundPackets1_13.PLAYER_DIGGING, wrapper -> {
|
||||
int status = wrapper.passthrough(Type.VAR_INT); // Status
|
||||
Position pos = wrapper.passthrough(Type.POSITION); // Location
|
||||
Position pos = wrapper.passthrough(Type.POSITION1_8); // Location
|
||||
wrapper.passthrough(Type.UNSIGNED_BYTE); // block face
|
||||
|
||||
// 0 = Started digging: if in creative this causes the block to break directly
|
||||
|
@ -82,7 +82,7 @@ public class BlockEntityProvider implements Provider {
|
||||
|
||||
private void sendBlockChange(UserConnection user, Position position, int blockId) throws Exception {
|
||||
PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_13.BLOCK_CHANGE, null, user);
|
||||
wrapper.write(Type.POSITION, position);
|
||||
wrapper.write(Type.POSITION1_8, position);
|
||||
wrapper.write(Type.VAR_INT, blockId);
|
||||
|
||||
wrapper.send(Protocol1_13To1_12_2.class);
|
||||
|
@ -39,7 +39,7 @@ public class TabCompleteTracker implements StorableObject {
|
||||
wrapper.write(Type.STRING, lastTabComplete);
|
||||
wrapper.write(Type.BOOLEAN, false);
|
||||
final Position playerLookTarget = Via.getManager().getProviders().get(PlayerLookTargetProvider.class).getPlayerLookTarget(connection);
|
||||
wrapper.write(Type.OPTIONAL_POSITION, playerLookTarget);
|
||||
wrapper.write(Type.OPTIONAL_POSITION1_8, playerLookTarget);
|
||||
try {
|
||||
wrapper.scheduleSendToServer(Protocol1_13To1_12_2.class);
|
||||
} catch (Exception e) {
|
||||
|
@ -142,7 +142,7 @@ public class EntityPackets {
|
||||
map(Type.VAR_INT);
|
||||
map(Type.UUID);
|
||||
map(Type.VAR_INT);
|
||||
map(Type.POSITION, Type.POSITION1_14);
|
||||
map(Type.POSITION1_8, Type.POSITION1_14);
|
||||
map(Type.BYTE);
|
||||
}
|
||||
});
|
||||
@ -233,7 +233,7 @@ public class EntityPackets {
|
||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||
tracker.setSleeping(entityId, true);
|
||||
|
||||
Position position = wrapper.read(Type.POSITION);
|
||||
Position position = wrapper.read(Type.POSITION1_8);
|
||||
List<Metadata> metadataList = new LinkedList<>();
|
||||
metadataList.add(new Metadata(12, Types1_14.META_TYPES.optionalPositionType, position));
|
||||
if (tracker.clientEntityId() != entityId) {
|
||||
|
@ -37,7 +37,7 @@ public class PlayerPackets {
|
||||
protocol.registerClientbound(ClientboundPackets1_13.OPEN_SIGN_EDITOR, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION, Type.POSITION1_14);
|
||||
map(Type.POSITION1_8, Type.POSITION1_14);
|
||||
}
|
||||
});
|
||||
|
||||
@ -45,7 +45,7 @@ public class PlayerPackets {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.VAR_INT);
|
||||
map(Type.POSITION1_14, Type.POSITION);
|
||||
map(Type.POSITION1_14, Type.POSITION1_8);
|
||||
}
|
||||
});
|
||||
|
||||
@ -78,7 +78,7 @@ public class PlayerPackets {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.VAR_INT); // Action
|
||||
map(Type.POSITION1_14, Type.POSITION); // Position
|
||||
map(Type.POSITION1_14, Type.POSITION1_8); // Position
|
||||
}
|
||||
});
|
||||
|
||||
@ -109,19 +109,19 @@ public class PlayerPackets {
|
||||
protocol.registerServerbound(ServerboundPackets1_14.UPDATE_COMMAND_BLOCK, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION1_14, Type.POSITION);
|
||||
map(Type.POSITION1_14, Type.POSITION1_8);
|
||||
}
|
||||
});
|
||||
protocol.registerServerbound(ServerboundPackets1_14.UPDATE_STRUCTURE_BLOCK, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION1_14, Type.POSITION);
|
||||
map(Type.POSITION1_14, Type.POSITION1_8);
|
||||
}
|
||||
});
|
||||
protocol.registerServerbound(ServerboundPackets1_14.UPDATE_SIGN, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION1_14, Type.POSITION);
|
||||
map(Type.POSITION1_14, Type.POSITION1_8);
|
||||
}
|
||||
});
|
||||
|
||||
@ -134,7 +134,7 @@ public class PlayerPackets {
|
||||
float z = wrapper.read(Type.FLOAT);
|
||||
wrapper.read(Type.BOOLEAN); // new unknown boolean
|
||||
|
||||
wrapper.write(Type.POSITION, position);
|
||||
wrapper.write(Type.POSITION1_8, position);
|
||||
wrapper.write(Type.VAR_INT, face);
|
||||
wrapper.write(Type.VAR_INT, hand);
|
||||
wrapper.write(Type.FLOAT, x);
|
||||
|
@ -59,20 +59,20 @@ public class WorldPackets {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.VAR_INT);
|
||||
map(Type.POSITION, Type.POSITION1_14);
|
||||
map(Type.POSITION1_8, Type.POSITION1_14);
|
||||
map(Type.BYTE);
|
||||
}
|
||||
});
|
||||
protocol.registerClientbound(ClientboundPackets1_13.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION, Type.POSITION1_14);
|
||||
map(Type.POSITION1_8, Type.POSITION1_14);
|
||||
}
|
||||
});
|
||||
protocol.registerClientbound(ClientboundPackets1_13.BLOCK_ACTION, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION, Type.POSITION1_14); // Location
|
||||
map(Type.POSITION1_8, Type.POSITION1_14); // Location
|
||||
map(Type.UNSIGNED_BYTE); // Action id
|
||||
map(Type.UNSIGNED_BYTE); // Action param
|
||||
map(Type.VAR_INT); // Block id - /!\ NOT BLOCK STATE
|
||||
@ -82,7 +82,7 @@ public class WorldPackets {
|
||||
protocol.registerClientbound(ClientboundPackets1_13.BLOCK_CHANGE, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION, Type.POSITION1_14);
|
||||
map(Type.POSITION1_8, Type.POSITION1_14);
|
||||
map(Type.VAR_INT);
|
||||
handler(wrapper -> {
|
||||
int id = wrapper.get(Type.VAR_INT, 0);
|
||||
@ -251,7 +251,7 @@ public class WorldPackets {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.INT); // Effect Id
|
||||
map(Type.POSITION, Type.POSITION1_14); // Location
|
||||
map(Type.POSITION1_8, Type.POSITION1_14); // Location
|
||||
map(Type.INT); // Data
|
||||
handler(wrapper -> {
|
||||
int id = wrapper.get(Type.INT, 0);
|
||||
@ -308,7 +308,7 @@ public class WorldPackets {
|
||||
protocol.registerClientbound(ClientboundPackets1_13.SPAWN_POSITION, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION, Type.POSITION1_14);
|
||||
map(Type.POSITION1_8, Type.POSITION1_14);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class Protocol1_9_3To1_9_1_2 extends AbstractProtocol<ClientboundPackets1
|
||||
// Sign update packet
|
||||
registerClientbound(ClientboundPackets1_9.UPDATE_SIGN, null, wrapper -> {
|
||||
//read data
|
||||
Position position = wrapper.read(Type.POSITION);
|
||||
Position position = wrapper.read(Type.POSITION1_8);
|
||||
JsonElement[] lines = new JsonElement[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
lines[i] = wrapper.read(Type.COMPONENT);
|
||||
@ -68,7 +68,7 @@ public class Protocol1_9_3To1_9_1_2 extends AbstractProtocol<ClientboundPackets1
|
||||
|
||||
//write data
|
||||
wrapper.setPacketType(ClientboundPackets1_9_3.BLOCK_ENTITY_DATA);
|
||||
wrapper.write(Type.POSITION, position); //Block location
|
||||
wrapper.write(Type.POSITION1_8, position); //Block location
|
||||
wrapper.write(Type.UNSIGNED_BYTE, (short) 9); //Action type (9 update sign)
|
||||
|
||||
//Create nbt
|
||||
|
@ -238,7 +238,7 @@ public class SpawnPackets {
|
||||
});
|
||||
|
||||
map(Type.STRING); // 2 - Title
|
||||
map(Type.POSITION); // 3 - Position
|
||||
map(Type.POSITION1_8); // 3 - Position
|
||||
map(Type.BYTE); // 4 - Direction
|
||||
}
|
||||
});
|
||||
|
@ -53,7 +53,7 @@ public class WorldPackets {
|
||||
protocol.registerClientbound(ClientboundPackets1_8.UPDATE_SIGN, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION); // 0 - Sign Position
|
||||
map(Type.POSITION1_8); // 0 - Sign Position
|
||||
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 1 - Sign Line (json)
|
||||
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 2 - Sign Line (json)
|
||||
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 3 - Sign Line (json)
|
||||
@ -65,7 +65,7 @@ public class WorldPackets {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.INT); // 0 - Effect ID
|
||||
map(Type.POSITION); // 1 - Position
|
||||
map(Type.POSITION1_8); // 1 - Position
|
||||
map(Type.INT); // 2 - Data
|
||||
map(Type.BOOLEAN); // 3 - Disable relative volume
|
||||
|
||||
@ -207,7 +207,7 @@ public class WorldPackets {
|
||||
protocol.registerClientbound(ClientboundPackets1_8.BLOCK_ENTITY_DATA, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION); // 0 - Block Position
|
||||
map(Type.POSITION1_8); // 0 - Block Position
|
||||
map(Type.UNSIGNED_BYTE); // 1 - Action
|
||||
map(Type.NAMED_COMPOUND_TAG); // 2 - NBT (Might not be present)
|
||||
handler(wrapper -> {
|
||||
@ -229,7 +229,7 @@ public class WorldPackets {
|
||||
}
|
||||
if (action == 2) { // Update Command Block
|
||||
CommandBlockProvider provider = Via.getManager().getProviders().get(CommandBlockProvider.class);
|
||||
provider.addOrUpdateBlock(wrapper.user(), wrapper.get(Type.POSITION, 0), wrapper.get(Type.NAMED_COMPOUND_TAG, 0));
|
||||
provider.addOrUpdateBlock(wrapper.user(), wrapper.get(Type.POSITION1_8, 0), wrapper.get(Type.NAMED_COMPOUND_TAG, 0));
|
||||
|
||||
// To prevent window issues don't send updates
|
||||
wrapper.cancel();
|
||||
@ -243,7 +243,7 @@ public class WorldPackets {
|
||||
protocol.registerServerbound(ServerboundPackets1_9.UPDATE_SIGN, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION); // 0 - Sign Position
|
||||
map(Type.POSITION1_8); // 0 - Sign Position
|
||||
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 1 - Sign Line (json)
|
||||
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 2 - Sign Line (json)
|
||||
map(Type.STRING, Protocol1_9To1_8.FIX_JSON); // 3 - Sign Line (json)
|
||||
@ -255,7 +255,7 @@ public class WorldPackets {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.VAR_INT); // Action
|
||||
map(Type.POSITION); // Position
|
||||
map(Type.POSITION1_8); // Position
|
||||
handler(wrapper -> {
|
||||
int status = wrapper.get(Type.VAR_INT, 0);
|
||||
if (status == 6)
|
||||
@ -282,7 +282,7 @@ public class WorldPackets {
|
||||
// Wipe the input buffer
|
||||
wrapper.clearInputBuffer();
|
||||
wrapper.setPacketType(ServerboundPackets1_8.PLAYER_BLOCK_PLACEMENT);
|
||||
wrapper.write(Type.POSITION, new Position(-1, (short) -1, -1));
|
||||
wrapper.write(Type.POSITION1_8, new Position(-1, (short) -1, -1));
|
||||
wrapper.write(Type.UNSIGNED_BYTE, (short) 255);
|
||||
// Write item in hand
|
||||
Item item = Protocol1_9To1_8.getHandItem(wrapper.user());
|
||||
@ -335,7 +335,7 @@ public class WorldPackets {
|
||||
protocol.registerServerbound(ServerboundPackets1_9.PLAYER_BLOCK_PLACEMENT, new PacketHandlers() {
|
||||
@Override
|
||||
public void register() {
|
||||
map(Type.POSITION); // 0 - Position
|
||||
map(Type.POSITION1_8); // 0 - Position
|
||||
map(Type.VAR_INT, Type.UNSIGNED_BYTE); // 1 - Block Face
|
||||
handler(wrapper -> {
|
||||
final int hand = wrapper.read(Type.VAR_INT); // 2 - Hand
|
||||
@ -354,7 +354,7 @@ public class WorldPackets {
|
||||
int face = wrapper.get(Type.UNSIGNED_BYTE, 0);
|
||||
if (face == 255)
|
||||
return;
|
||||
Position p = wrapper.get(Type.POSITION, 0);
|
||||
Position p = wrapper.get(Type.POSITION1_8, 0);
|
||||
int x = p.x();
|
||||
int y = p.y();
|
||||
int z = p.z();
|
||||
@ -386,13 +386,13 @@ public class WorldPackets {
|
||||
handler(wrapper -> {
|
||||
CommandBlockProvider provider = Via.getManager().getProviders().get(CommandBlockProvider.class);
|
||||
|
||||
Position pos = wrapper.get(Type.POSITION, 0);
|
||||
Position pos = wrapper.get(Type.POSITION1_8, 0);
|
||||
Optional<CompoundTag> tag = provider.get(wrapper.user(), pos);
|
||||
// Send the Update Block Entity packet if present
|
||||
if (tag.isPresent()) {
|
||||
PacketWrapper updateBlockEntity = PacketWrapper.create(ClientboundPackets1_9.BLOCK_ENTITY_DATA, null, wrapper.user());
|
||||
|
||||
updateBlockEntity.write(Type.POSITION, pos);
|
||||
updateBlockEntity.write(Type.POSITION1_8, pos);
|
||||
updateBlockEntity.write(Type.UNSIGNED_BYTE, (short) 2);
|
||||
updateBlockEntity.write(Type.NAMED_COMPOUND_TAG, tag.get());
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class BlockRewriter<C extends ClientboundPacketType> {
|
||||
}
|
||||
|
||||
public static <C extends ClientboundPacketType> BlockRewriter<C> legacy(final Protocol<C, ?, ?, ?> protocol) {
|
||||
return new BlockRewriter<>(protocol, Type.POSITION, Type.NAMED_COMPOUND_TAG);
|
||||
return new BlockRewriter<>(protocol, Type.POSITION1_8, Type.NAMED_COMPOUND_TAG);
|
||||
}
|
||||
|
||||
public static <C extends ClientboundPacketType> BlockRewriter<C> for1_14(final Protocol<C, ?, ?, ?> protocol) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren