update 1.13.2 -> 1.14 Packet Ids

This commit is contained in:
Marco 2019-05-19 19:15:50 +02:00
parent cb396c8534
commit 3706b72855
5 changed files with 141 additions and 82 deletions

View File

@ -35,72 +35,62 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
new PlayerPackets1_14().register(this);
new SoundPackets1_14().register(this);
out(State.PLAY, 0x2E, 0x2D); // c
out(State.PLAY, 0x2F, 0x2E); // c
out(State.PLAY, 0x30, 0x2F); // c
out(State.PLAY, 0x31, 0x30); // c
out(State.PLAY, 0x32, 0x31); // c
out(State.PLAY, 0x33, 0x32); // c
// Entity sound
out(State.PLAY, 0x4E, -1, new PacketRemapper() {
@Override
public void registerMap() { // c
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper packetWrapper) throws Exception {
packetWrapper.cancel(); // todo
}
});
}
});
registerOutgoing(State.PLAY, 0x15, 0x16);
//Unknown packet added in 19w11a - 0x02
registerIncoming(State.PLAY, 0x03, 0x02); // r
registerIncoming(State.PLAY, 0x04, 0x03); // r
registerIncoming(State.PLAY, 0x05, 0x04); // r
registerIncoming(State.PLAY, 0x06, 0x05); // r
registerIncoming(State.PLAY, 0x07, 0x06); // r
registerIncoming(State.PLAY, 0x08, 0x07); // r
registerOutgoing(State.PLAY, 0x17, 0x18);
registerIncoming(State.PLAY, 0x0A, 0x09); // r
registerIncoming(State.PLAY, 0x0B, 0x0A); // r
registerOutgoing(State.PLAY, 0x19, 0x1A);
registerOutgoing(State.PLAY, 0x1A, 0x1B);
registerOutgoing(State.PLAY, 0x1B, 0x1C);
registerOutgoing(State.PLAY, 0x54, 0x1D);
registerOutgoing(State.PLAY, 0x1C, 0x1E);
registerOutgoing(State.PLAY, 0x1D, 0x1F);
registerOutgoing(State.PLAY, 0x1E, 0x20);
registerOutgoing(State.PLAY, 0x20, 0x21);
registerIncoming(State.PLAY, 0x0D, 0x0C); // r
registerIncoming(State.PLAY, 0x0E, 0x0D); // r
//Unknown packet added in 19w11a - 0x0F
registerIncoming(State.PLAY, 0x10, 0x0E); // r
registerIncoming(State.PLAY, 0x11, 0x0F); // r
registerIncoming(State.PLAY, 0x12, 0x10); // r
registerIncoming(State.PLAY, 0x13, 0x11); // r
registerIncoming(State.PLAY, 0x14, 0x12); // r
registerIncoming(State.PLAY, 0x15, 0x13); // r
registerIncoming(State.PLAY, 0x16, 0x14); // r
registerIncoming(State.PLAY, 0x17, 0x15); // r
registerIncoming(State.PLAY, 0x18, 0x16); // r
registerIncoming(State.PLAY, 0x19, 0x17); // r
registerOutgoing(State.PLAY, 0x2B, 0x27);
registerIncoming(State.PLAY, 0x1B, 0x19); // r
registerIncoming(State.PLAY, 0x1C, 0x1A); // r
registerOutgoing(State.PLAY, 0x2C, 0x2B);
registerIncoming(State.PLAY, 0x1E, 0x1C); // r
registerIncoming(State.PLAY, 0x1F, 0x1D); // r
registerIncoming(State.PLAY, 0x20, 0x1E); // r
registerIncoming(State.PLAY, 0x21, 0x1F); // r
registerIncoming(State.PLAY, 0x22, 0x20); // r
registerIncoming(State.PLAY, 0x23, 0x21); // r
registerOutgoing(State.PLAY, 0x30, 0x2D);
registerOutgoing(State.PLAY, 0x31, 0x2E);
registerOutgoing(State.PLAY, 0x32, 0x2F);
registerOutgoing(State.PLAY, 0x33, 0x30);
registerOutgoing(State.PLAY, 0x34, 0x31);
// Position and look
registerOutgoing(State.PLAY, 0x35, 0x32);
registerIncoming(State.PLAY, 0x25, 0x23); // r
registerOutgoing(State.PLAY, 0x36, 0x34);
registerIncoming(State.PLAY, 0x29, 0x27); // r
registerIncoming(State.PLAY, 0x2A, 0x28); // r
registerOutgoing(State.PLAY, 0x38, 0x36);
registerOutgoing(State.PLAY, 0x39, 0x37);
registerIncoming(State.PLAY, 0x2C, 0x2A); // r
registerOutgoing(State.PLAY, 0x3B, 0x39);
registerOutgoing(State.PLAY, 0x3C, 0x3A);
registerOutgoing(State.PLAY, 0x3D, 0x3B);
registerOutgoing(State.PLAY, 0x3E, 0x3C);
registerOutgoing(State.PLAY, 0x3F, 0x3D);
registerOutgoing(State.PLAY, 0x42, 0x3E);
registerOutgoing(State.PLAY, 0x4F, 0x4E); // c
registerOutgoing(State.PLAY, 0x50, 0x4F); // c
registerOutgoing(State.PLAY, 0x51, 0x50); // c
registerOutgoing(State.PLAY, 0x44, 0x40);
registerOutgoing(State.PLAY, 0x45, 0x41);
registerOutgoing(State.PLAY, 0x52, 0x51, new PacketRemapper() { // c
registerOutgoing(State.PLAY, 0x47, 0x43);
registerOutgoing(State.PLAY, 0x48, 0x44);
registerOutgoing(State.PLAY, 0x49, 0x45);
registerOutgoing(State.PLAY, 0x4A, 0x46);
registerOutgoing(State.PLAY, 0x4B, 0x47);
registerOutgoing(State.PLAY, 0x4C, 0x48);
registerOutgoing(State.PLAY, 0x4E, 0x4A);
registerOutgoing(State.PLAY, 0x4F, 0x4B);
registerOutgoing(State.PLAY, 0x52, 0x4C);
registerOutgoing(State.PLAY, 0x53, 0x4E); // c
registerOutgoing(State.PLAY, 0x55, 0x4F); // c
registerOutgoing(State.PLAY, 0x56, 0x50); // c
registerOutgoing(State.PLAY, 0x57, 0x51, new PacketRemapper() { // c
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -141,11 +131,11 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
}
});
registerOutgoing(State.PLAY, 0x53, 0x52); // c
registerOutgoing(State.PLAY, 0x54, 0x53); // c
registerOutgoing(State.PLAY, 0x58, 0x52); // c
registerOutgoing(State.PLAY, 0x59, 0x53); // c
// tags
registerOutgoing(State.PLAY, 0x56, 0x55, new PacketRemapper() {
registerOutgoing(State.PLAY, 0x5B, 0x55, new PacketRemapper() {
@Override
public void registerMap() { // c
handler(new PacketHandler() {
@ -187,7 +177,7 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
// Light update
out(State.PLAY, 0x57, -1, new PacketRemapper() {
out(State.PLAY, 0x24, -1, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -198,6 +188,52 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
});
}
});
//Incomming
//Unknown packet added in 19w11a - 0x02
registerIncoming(State.PLAY, 0x03, 0x02); // r
registerIncoming(State.PLAY, 0x04, 0x03); // r
registerIncoming(State.PLAY, 0x05, 0x04); // r
registerIncoming(State.PLAY, 0x06, 0x05); // r
registerIncoming(State.PLAY, 0x07, 0x06); // r
registerIncoming(State.PLAY, 0x08, 0x07); // r
registerIncoming(State.PLAY, 0x0A, 0x09); // r
registerIncoming(State.PLAY, 0x0B, 0x0A); // r
registerIncoming(State.PLAY, 0x0D, 0x0C); // r
registerIncoming(State.PLAY, 0x0E, 0x0D); // r
//Unknown packet added in 19w11a - 0x0F
registerIncoming(State.PLAY, 0x0F, 0x0E); // r
registerIncoming(State.PLAY, 0x11, 0x10); // r
registerIncoming(State.PLAY, 0x12, 0x11); // r
registerIncoming(State.PLAY, 0x13, 0x12); // r
registerIncoming(State.PLAY, 0x14, 0xF0); // r
registerIncoming(State.PLAY, 0x15, 0x13); // r
registerIncoming(State.PLAY, 0x16, 0x14); // r
registerIncoming(State.PLAY, 0x17, 0x15); // r
registerIncoming(State.PLAY, 0x18, 0x16); // r
registerIncoming(State.PLAY, 0x19, 0x17); // r
registerIncoming(State.PLAY, 0x1B, 0x19); // r
registerIncoming(State.PLAY, 0x1C, 0x1A); // r
registerIncoming(State.PLAY, 0x1E, 0x1C); // r
registerIncoming(State.PLAY, 0x1F, 0x1D); // r
registerIncoming(State.PLAY, 0x20, 0x1E); // r
// registerIncoming(State.PLAY, 0x21, 0x1F); // r TDO fix
registerIncoming(State.PLAY, 0x22, 0x20); // r
registerIncoming(State.PLAY, 0x23, 0x21); // r
registerIncoming(State.PLAY, 0x25, 0x23); // r
// registerIncoming(State.PLAY, 0x29, 0x27); // r
registerIncoming(State.PLAY, 0x2A, 0x27); // r
registerIncoming(State.PLAY, 0x2B, 0x28); // r
registerIncoming(State.PLAY, 0x2D, 0x2A); // r
}
public static int getNewBlockStateId(int id) {

View File

@ -34,7 +34,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
@Override
protected void registerPackets(Protocol1_13_2To1_14 protocol) {
// Open window
protocol.registerOutgoing(State.PLAY, 0x58, 0x14, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x2E, 0x14, new PacketRemapper() {
@Override
public void registerMap() { // c
handler(new PacketHandler() {
@ -97,7 +97,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
// Horse window
protocol.registerOutgoing(State.PLAY, 0x14, 0x14, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x1F, 0x14, new PacketRemapper() {
@Override
public void registerMap() { // c
handler(new PacketHandler() {
@ -114,7 +114,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
// Window items packet
protocol.registerOutgoing(State.PLAY, 0x15, 0x15, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x14, 0x15, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID
@ -131,7 +131,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
// Set slot packet
protocol.registerOutgoing(State.PLAY, 0x17, 0x17, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x16, 0x17, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.BYTE); // 0 - Window ID
@ -148,7 +148,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
// Trade list
protocol.out(State.PLAY, 0x59, 0x19, new PacketRemapper() {
protocol.out(State.PLAY, 0x27, 0x19, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -190,7 +190,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
// Book open
protocol.registerOutgoing(State.PLAY, 0x2C, 0x19, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x2D, 0x19, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -204,7 +204,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
// Entity Equipment Packet
protocol.registerOutgoing(State.PLAY, 0x42, 0x42, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x46, 0x42, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -223,7 +223,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
Set<String> removedTypes = ImmutableSet.of("crafting_special_suspiciousstew", "blasting", "smoking", "campfire_cooking", "stonecutting");
// Declare Recipes
protocol.registerOutgoing(State.PLAY, 0x55, 0x54, new PacketRemapper() { // c
protocol.registerOutgoing(State.PLAY, 0x5A, 0x54, new PacketRemapper() { // c
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -403,7 +403,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
//Chunk
protocol.registerOutgoing(State.PLAY, 0x22, 0x22, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x21, 0x22, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -431,7 +431,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
// Effect packet
protocol.registerOutgoing(State.PLAY, 0x23, 0x23, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x22, 0x23, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // Effect Id
@ -453,7 +453,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
//spawn particle
protocol.registerOutgoing(State.PLAY, 0x24, 0x24, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x23, 0x24, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Particle ID
@ -494,7 +494,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
//respawn
protocol.registerOutgoing(State.PLAY, 0x38, 0x38, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x3A, 0x38, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.INT); // 0 - Dimension ID
@ -511,7 +511,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
});
// Spawn position
protocol.registerOutgoing(State.PLAY, 0x49, 0x49, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x4D, 0x49, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION1_14, Type.POSITION);

View File

@ -11,10 +11,12 @@ import nl.matsv.viabackwards.protocol.protocol1_12_2to1_13.packets.BlockItemPack
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.Protocol1_13_2To1_14;
import nl.matsv.viabackwards.protocol.protocol1_13_2to1_14.data.EntityTypeMapping;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.minecraft.Position;
import us.myles.ViaVersion.api.minecraft.VillagerData;
import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_13_2;
import us.myles.ViaVersion.api.minecraft.metadata.types.MetaType1_14;
import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
@ -22,8 +24,12 @@ import us.myles.ViaVersion.api.type.types.version.Types1_12;
import us.myles.ViaVersion.api.type.types.version.Types1_13_2;
import us.myles.ViaVersion.api.type.types.version.Types1_14;
import us.myles.ViaVersion.packets.State;
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.MetadataRewriter;
import us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage.EntityTracker;
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
@ -212,9 +218,24 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
}
});
// Destroy entities
protocol.registerOutgoing(State.PLAY, 0x37, 0x35, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT_ARRAY); // 0 - Entity IDS
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
for (int entity : wrapper.get(Type.VAR_INT_ARRAY, 0))
wrapper.user().get(EntityTracker.class).removeEntity(entity);
}
});
}
});
// Metadata packet
protocol.registerOutgoing(State.PLAY, 0x3F, 0x3F, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x43, 0x3F, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Entity ID
@ -258,6 +279,8 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
addTrackedEntity(wrapper.user(), entityId, EntityType1_14.EntityType.PLAYER);
wrapper.write(Type.UNSIGNED_BYTE, (short) 0);
wrapper.read(Type.VAR_INT); //Read View Distance
}
});
}

View File

@ -23,7 +23,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
});
// Open Sign Editor
protocol.registerOutgoing(State.PLAY, 0x2D, 0x2C, new PacketRemapper() { // c
protocol.registerOutgoing(State.PLAY, 0x2F, 0x2C, new PacketRemapper() { // c
@Override
public void registerMap() {
map(Type.POSITION1_14, Type.POSITION);
@ -40,7 +40,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
});
// Edit Book
protocol.registerIncoming(State.PLAY, 0x0c, 0x0B, new PacketRemapper() {
protocol.registerIncoming(State.PLAY, 0x0C, 0x0B, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {
@ -53,7 +53,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
});
// Player Digging
protocol.registerIncoming(State.PLAY, 0x1a, 0x18, new PacketRemapper() {
protocol.registerIncoming(State.PLAY, 0x1A, 0x18, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -63,7 +63,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
});
// Recipe Book Data
protocol.registerIncoming(State.PLAY, 0x1d, 0x1B, new PacketRemapper() {
protocol.registerIncoming(State.PLAY, 0x1D, 0x1B, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT);
@ -99,7 +99,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
});
// Update Structure Block
protocol.registerIncoming(State.PLAY, 0x27, 0x25, new PacketRemapper() {
protocol.registerIncoming(State.PLAY, 0x28, 0x25, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION, Type.POSITION1_14);
@ -107,7 +107,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
});
// Update Sign
protocol.registerIncoming(State.PLAY, 0x28, 0x26, new PacketRemapper() {
protocol.registerIncoming(State.PLAY, 0x29, 0x26, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.POSITION, Type.POSITION1_14);
@ -115,7 +115,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
});
// Player Block Placement
protocol.registerIncoming(State.PLAY, 0x2b, 0x29, new PacketRemapper() {
protocol.registerIncoming(State.PLAY, 0x2C, 0x29, new PacketRemapper() {
@Override
public void registerMap() {
handler(new PacketHandler() {

View File

@ -13,7 +13,7 @@ public class SoundPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
@Override
protected void registerPackets(Protocol1_13_2To1_14 protocol) {
// Sound Effect
protocol.registerOutgoing(State.PLAY, 0x4D, 0x4D, new PacketRemapper() {
protocol.registerOutgoing(State.PLAY, 0x51, 0x4D, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // Sound Id