This commit is contained in:
creeper123123321 2019-03-16 09:27:36 -03:00
parent d99c5f5e60
commit 1885840768
No known key found for this signature in database
GPG Key ID: 0AC57D54786721D1
4 changed files with 106 additions and 49 deletions

View File

@ -54,6 +54,48 @@ public class Protocol1_13_2To1_14 extends BackwardsProtocol {
} }
}); });
//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, 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
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
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, 0x28); // r
registerIncoming(State.PLAY, 0x2C, 0x2A); // r
registerOutgoing(State.PLAY, 0x4F, 0x4E); // c registerOutgoing(State.PLAY, 0x4F, 0x4E); // c
registerOutgoing(State.PLAY, 0x50, 0x4F); // c registerOutgoing(State.PLAY, 0x50, 0x4F); // c
registerOutgoing(State.PLAY, 0x51, 0x50); // c registerOutgoing(State.PLAY, 0x51, 0x50); // c

View File

@ -45,43 +45,39 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
int type = wrapper.read(Type.VAR_INT); int type = wrapper.read(Type.VAR_INT);
String stringType = null; String stringType = null;
int slotSize = 0; int slotSize = 0;
if (type < 6) {
stringType = "minecraft:container";
slotSize = (type + 1) * 9;
} else
switch (type) { switch (type) {
case 0: case 11:
stringType = "minecraft:container";
slotSize = 27;
break;
case 1:
stringType = "minecraft:container";
slotSize = 54;
break;
case 7:
stringType = "minecraft:crafting_table"; stringType = "minecraft:crafting_table";
break; break;
case 9: case 14:
stringType = "minecraft:furnace"; stringType = "minecraft:furnace";
break; break;
case 2: case 6:
stringType = "minecraft:dropper"; stringType = "minecraft:dropper";
break; break;
case 8: case 12:
stringType = "minecraft:enchanting_table"; stringType = "minecraft:enchanting_table";
break; break;
case 6: case 10:
stringType = "minecraft:brewing_stand"; stringType = "minecraft:brewing_stand";
break; break;
case 14: case 18:
stringType = "minecraft:villager"; stringType = "minecraft:villager";
break; break;
case 4: case 8:
stringType = "minecraft:beacon"; stringType = "minecraft:beacon";
break; break;
case 3: case 7:
stringType = "minecraft:anvil"; stringType = "minecraft:anvil";
break; break;
case 11: case 15:
stringType = "minecraft:hopper"; stringType = "minecraft:hopper";
break; break;
case 15: case 19:
stringType = "minecraft:shulker_box"; stringType = "minecraft:shulker_box";
break; break;
} }
@ -180,7 +176,14 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
wrapper.passthrough(Type.BOOLEAN); // Trade disabled wrapper.passthrough(Type.BOOLEAN); // Trade disabled
wrapper.passthrough(Type.INT); // Number of tools uses wrapper.passthrough(Type.INT); // Number of tools uses
wrapper.passthrough(Type.INT); // Maximum number of trade uses wrapper.passthrough(Type.INT); // Maximum number of trade uses
wrapper.read(Type.INT);
wrapper.read(Type.INT);
wrapper.read(Type.FLOAT);
} }
wrapper.read(Type.VAR_INT);
wrapper.read(Type.VAR_INT);
wrapper.read(Type.BOOLEAN);
} }
}); });
} }
@ -292,7 +295,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
*/ */
// Click window packet // Click window packet
protocol.registerIncoming(State.PLAY, 0x08, 0x08, new PacketRemapper() { protocol.registerIncoming(State.PLAY, 0x09, 0x08, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.UNSIGNED_BYTE); // 0 - Window ID map(Type.UNSIGNED_BYTE); // 0 - Window ID
@ -312,7 +315,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
}); });
// Creative Inventory Action // Creative Inventory Action
protocol.registerIncoming(State.PLAY, 0x24, 0x24, new PacketRemapper() { protocol.registerIncoming(State.PLAY, 0x26, 0x24, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.SHORT); // 0 - Slot map(Type.SHORT); // 0 - Slot
@ -501,6 +504,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); ClientWorld clientWorld = wrapper.user().get(ClientWorld.class);
int dimensionId = wrapper.get(Type.INT, 0); int dimensionId = wrapper.get(Type.INT, 0);
clientWorld.setEnvironment(dimensionId); clientWorld.setEnvironment(dimensionId);
wrapper.write(Type.UNSIGNED_BYTE, (short) 0); // todo - do we need to store it from difficulty packet?
} }
}); });
} }

View File

@ -256,6 +256,8 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
// Register Type ID // Register Type ID
addTrackedEntity(wrapper.user(), entityId, EntityType1_14.EntityType.PLAYER); addTrackedEntity(wrapper.user(), entityId, EntityType1_14.EntityType.PLAYER);
wrapper.write(Type.UNSIGNED_BYTE, (short) 0);
} }
}); });
} }

View File

@ -13,6 +13,15 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
@Override @Override
protected void registerPackets(Protocol1_13_2To1_14 protocol) { protected void registerPackets(Protocol1_13_2To1_14 protocol) {
// Server Difficulty
protocol.registerOutgoing(State.PLAY, 0x0D, 0x0D, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.UNSIGNED_BYTE);
map(Type.BOOLEAN, Type.NOTHING); // Locked
}
});
// Open Sign Editor // Open Sign Editor
protocol.registerOutgoing(State.PLAY, 0x2D, 0x2C, new PacketRemapper() { // c protocol.registerOutgoing(State.PLAY, 0x2D, 0x2C, new PacketRemapper() { // c
@Override @Override
@ -31,7 +40,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
}); });
// Edit Book // Edit Book
protocol.registerIncoming(State.PLAY, 0x0B, 0x0B, new PacketRemapper() { protocol.registerIncoming(State.PLAY, 0x0c, 0x0B, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(new PacketHandler() { handler(new PacketHandler() {
@ -44,7 +53,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
}); });
// Player Digging // Player Digging
protocol.registerIncoming(State.PLAY, 0x18, 0x18, new PacketRemapper() { protocol.registerIncoming(State.PLAY, 0x1a, 0x18, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.VAR_INT); map(Type.VAR_INT);
@ -54,7 +63,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
}); });
// Recipe Book Data // Recipe Book Data
protocol.registerIncoming(State.PLAY, 0x1B, 0x1B, new PacketRemapper() { protocol.registerIncoming(State.PLAY, 0x1d, 0x1B, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.VAR_INT); map(Type.VAR_INT);
@ -82,7 +91,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
}); });
// Update Command Block // Update Command Block
protocol.registerIncoming(State.PLAY, 0x22, 0x22, new PacketRemapper() { protocol.registerIncoming(State.PLAY, 0x24, 0x22, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.POSITION, Type.POSITION1_14); map(Type.POSITION, Type.POSITION1_14);
@ -90,7 +99,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
}); });
// Update Structure Block // Update Structure Block
protocol.registerIncoming(State.PLAY, 0x25, 0x25, new PacketRemapper() { protocol.registerIncoming(State.PLAY, 0x27, 0x25, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.POSITION, Type.POSITION1_14); map(Type.POSITION, Type.POSITION1_14);
@ -98,7 +107,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
}); });
// Update Sign // Update Sign
protocol.registerIncoming(State.PLAY, 0x26, 0x26, new PacketRemapper() { protocol.registerIncoming(State.PLAY, 0x28, 0x26, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.POSITION, Type.POSITION1_14); map(Type.POSITION, Type.POSITION1_14);
@ -106,7 +115,7 @@ public class PlayerPackets1_14 extends Rewriter<Protocol1_13_2To1_14> {
}); });
// Player Block Placement // Player Block Placement
protocol.registerIncoming(State.PLAY, 0x29, 0x29, new PacketRemapper() { protocol.registerIncoming(State.PLAY, 0x2b, 0x29, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
handler(new PacketHandler() { handler(new PacketHandler() {