mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-22 16:57:40 +01:00
1.16.4-pre1
This commit is contained in:
parent
e945db8cb6
commit
2669967b49
@ -31,6 +31,7 @@ import nl.matsv.viabackwards.protocol.protocol1_15_1to1_15_2.Protocol1_15_1To1_1
|
|||||||
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
import nl.matsv.viabackwards.protocol.protocol1_15_2to1_16.Protocol1_15_2To1_16;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_15to1_15_1.Protocol1_15To1_15_1;
|
import nl.matsv.viabackwards.protocol.protocol1_15to1_15_1.Protocol1_15To1_15_1;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_16_2to1_16_3.Protocol1_16_2To1_16_3;
|
import nl.matsv.viabackwards.protocol.protocol1_16_2to1_16_3.Protocol1_16_2To1_16_3;
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_16_3to1_16_4.Protocol1_16_3To1_16_4;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_16to1_16_1.Protocol1_16To1_16_1;
|
import nl.matsv.viabackwards.protocol.protocol1_16to1_16_1.Protocol1_16To1_16_1;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.Protocol1_16_1To1_16_2;
|
import nl.matsv.viabackwards.protocol.protocol1_16_1to1_16_2.Protocol1_16_1To1_16_2;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
||||||
@ -92,6 +93,7 @@ public interface ViaBackwardsPlatform {
|
|||||||
registerProtocol(new Protocol1_16To1_16_1(), ProtocolVersion.v1_16, ProtocolVersion.v1_16_1);
|
registerProtocol(new Protocol1_16To1_16_1(), ProtocolVersion.v1_16, ProtocolVersion.v1_16_1);
|
||||||
registerProtocol(new Protocol1_16_1To1_16_2(), ProtocolVersion.v1_16_1, ProtocolVersion.v1_16_2);
|
registerProtocol(new Protocol1_16_1To1_16_2(), ProtocolVersion.v1_16_1, ProtocolVersion.v1_16_2);
|
||||||
registerProtocol(new Protocol1_16_2To1_16_3(), ProtocolVersion.v1_16_2, ProtocolVersion.v1_16_3);
|
registerProtocol(new Protocol1_16_2To1_16_3(), ProtocolVersion.v1_16_2, ProtocolVersion.v1_16_3);
|
||||||
|
registerProtocol(new Protocol1_16_3To1_16_4(), ProtocolVersion.v1_16_3, ProtocolVersion.v1_16_4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
package nl.matsv.viabackwards.protocol.protocol1_16_3to1_16_4;
|
||||||
|
|
||||||
|
import nl.matsv.viabackwards.api.BackwardsProtocol;
|
||||||
|
import nl.matsv.viabackwards.protocol.protocol1_16_3to1_16_4.storage.PlayerHandStorage;
|
||||||
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||||
|
import us.myles.ViaVersion.api.type.Type;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2;
|
||||||
|
import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2;
|
||||||
|
|
||||||
|
public class Protocol1_16_3To1_16_4 extends BackwardsProtocol<ClientboundPackets1_16_2, ClientboundPackets1_16_2, ServerboundPackets1_16_2, ServerboundPackets1_16_2> {
|
||||||
|
|
||||||
|
public Protocol1_16_3To1_16_4() {
|
||||||
|
super(ClientboundPackets1_16_2.class, ClientboundPackets1_16_2.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16_2.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void registerPackets() {
|
||||||
|
registerIncoming(ServerboundPackets1_16_2.EDIT_BOOK, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
map(Type.FLAT_VAR_INT_ITEM);
|
||||||
|
map(Type.BOOLEAN);
|
||||||
|
handler(wrapper -> {
|
||||||
|
int slot = wrapper.read(Type.VAR_INT);
|
||||||
|
if (slot == 1) {
|
||||||
|
wrapper.write(Type.VAR_INT, 40); // offhand
|
||||||
|
} else {
|
||||||
|
wrapper.write(Type.VAR_INT, wrapper.user().get(PlayerHandStorage.class).getCurrentHand());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
registerIncoming(ServerboundPackets1_16_2.HELD_ITEM_CHANGE, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
short slot = wrapper.passthrough(Type.SHORT);
|
||||||
|
wrapper.user().get(PlayerHandStorage.class).setCurrentHand(slot);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
registerOutgoing(ClientboundPackets1_16_2.HELD_ITEM_CHANGE, new PacketRemapper() {
|
||||||
|
@Override
|
||||||
|
public void registerMap() {
|
||||||
|
handler(wrapper -> {
|
||||||
|
byte slot = wrapper.passthrough(Type.BYTE);
|
||||||
|
wrapper.user().get(PlayerHandStorage.class).setCurrentHand(slot);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(UserConnection user) {
|
||||||
|
user.put(new PlayerHandStorage(user));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package nl.matsv.viabackwards.protocol.protocol1_16_3to1_16_4.storage;
|
||||||
|
|
||||||
|
import us.myles.ViaVersion.api.data.StoredObject;
|
||||||
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
|
||||||
|
public class PlayerHandStorage extends StoredObject {
|
||||||
|
|
||||||
|
private int currentHand;
|
||||||
|
|
||||||
|
public PlayerHandStorage(UserConnection user) {
|
||||||
|
super(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentHand() {
|
||||||
|
return currentHand;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentHand(int currentHand) {
|
||||||
|
this.currentHand = currentHand;
|
||||||
|
}
|
||||||
|
}
|
2
pom.xml
2
pom.xml
@ -65,7 +65,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>us.myles</groupId>
|
<groupId>us.myles</groupId>
|
||||||
<artifactId>viaversion</artifactId>
|
<artifactId>viaversion</artifactId>
|
||||||
<version>3.2.0-SNAPSHOT</version>
|
<version>3.2.0-1.16.4-pre1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user