1.14.4 support

This commit is contained in:
KennyTV 2019-07-19 12:53:37 +02:00
parent c186d13ae5
commit d66eb0c56b
3 changed files with 63 additions and 1 deletions

View File

@ -22,6 +22,7 @@ import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14;
import nl.matsv.viabackwards.protocol.protocol1_13to1_13_1.Protocol1_13To1_13_1;
import nl.matsv.viabackwards.protocol.protocol1_14_1to1_14_2.Protocol1_14_1To1_14_2;
import nl.matsv.viabackwards.protocol.protocol1_14_2to1_14_3.Protocol1_14_2To1_14_3;
import nl.matsv.viabackwards.protocol.protocol1_14_3to1_14_4.Protocol1_14_3To1_14_4;
import nl.matsv.viabackwards.protocol.protocol1_14to1_14_1.Protocol1_14To1_14_1;
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
@ -52,6 +53,7 @@ public interface ViaBackwardsPlatform {
ProtocolRegistry.registerProtocol(new Protocol1_14To1_14_1(), Collections.singletonList(ProtocolVersion.v1_14.getId()), ProtocolVersion.v1_14_1.getId());
ProtocolRegistry.registerProtocol(new Protocol1_14_1To1_14_2(), Collections.singletonList(ProtocolVersion.v1_14_1.getId()), ProtocolVersion.v1_14_2.getId());
ProtocolRegistry.registerProtocol(new Protocol1_14_2To1_14_3(), Collections.singletonList(ProtocolVersion.v1_14_2.getId()), ProtocolVersion.v1_14_3.getId());
ProtocolRegistry.registerProtocol(new Protocol1_14_3To1_14_4(), Collections.singletonList(ProtocolVersion.v1_14_3.getId()), ProtocolVersion.v1_14_4.getId());
}
}

View File

@ -0,0 +1,60 @@
package nl.matsv.viabackwards.protocol.protocol1_14_3to1_14_4;
import nl.matsv.viabackwards.api.BackwardsProtocol;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
public class Protocol1_14_3To1_14_4 extends BackwardsProtocol {
@Override
protected void registerPackets() {
// Acknowledge Player Digging - added in pre4
registerOutgoing(State.PLAY, 0x5c, -1, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
wrapper.cancel();
}
});
}
});
// Trade list
registerOutgoing(State.PLAY, 0x27, 0x27, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
wrapper.passthrough(Type.VAR_INT);
int size = wrapper.passthrough(Type.UNSIGNED_BYTE);
for (int i = 0; i < size; i++) {
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM);
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM);
if (wrapper.passthrough(Type.BOOLEAN)) {
wrapper.passthrough(Type.FLAT_VAR_INT_ITEM);
}
wrapper.passthrough(Type.BOOLEAN);
wrapper.passthrough(Type.INT);
wrapper.passthrough(Type.INT);
wrapper.passthrough(Type.INT);
wrapper.passthrough(Type.INT);
wrapper.passthrough(Type.FLOAT);
wrapper.read(Type.INT); // demand value added in pre-5
}
}
});
}
});
}
@Override
public void init(UserConnection userConnection) {
}
}

View File

@ -61,7 +61,7 @@
<dependency>
<groupId>us.myles</groupId>
<artifactId>viaversion</artifactId>
<version>2.1.2</version>
<version>2.1.3</version>
<scope>provided</scope>
</dependency>
</dependencies>