3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

Merge pull request #1135 from creeper123123321/dev

fix sign crash
Dieser Commit ist enthalten in:
Myles 2019-01-06 11:27:04 +00:00 committet von GitHub
Commit 9af078bb8c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 25 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -129,7 +129,8 @@ public class Protocol1_14To1_13_2 extends Protocol {
handler(new PacketHandler() { handler(new PacketHandler() {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {
int blockTagsSize = wrapper.passthrough(Type.VAR_INT); // block tags int blockTagsSize = wrapper.read(Type.VAR_INT);
wrapper.write(Type.VAR_INT, blockTagsSize + 3); // block tags
for (int i = 0; i < blockTagsSize; i++) { for (int i = 0; i < blockTagsSize; i++) {
wrapper.passthrough(Type.STRING); wrapper.passthrough(Type.STRING);
Integer[] blockIds = wrapper.passthrough(Type.VAR_INT_ARRAY); Integer[] blockIds = wrapper.passthrough(Type.VAR_INT_ARRAY);
@ -137,7 +138,21 @@ public class Protocol1_14To1_13_2 extends Protocol {
blockIds[j] = getNewBlockId(blockIds[j]); blockIds[j] = getNewBlockId(blockIds[j]);
} }
} }
int itemTagsSize = wrapper.passthrough(Type.VAR_INT); // item tags // Minecraft crashes if we not send signs tags
wrapper.write(Type.STRING, "minecraft:signs");
wrapper.write(Type.VAR_INT_ARRAY, new Integer[]{
getNewBlockId(150), getNewBlockId(155)
});
wrapper.write(Type.STRING, "minecraft:wall_signs");
wrapper.write(Type.VAR_INT_ARRAY, new Integer[]{
getNewBlockId(155)
});
wrapper.write(Type.STRING, "minecraft:standing_signs");
wrapper.write(Type.VAR_INT_ARRAY, new Integer[]{
getNewBlockId(150)
});
int itemTagsSize = wrapper.read(Type.VAR_INT);
wrapper.write(Type.VAR_INT, itemTagsSize + 1); // item tags
for (int i = 0; i < itemTagsSize; i++) { for (int i = 0; i < itemTagsSize; i++) {
wrapper.passthrough(Type.STRING); wrapper.passthrough(Type.STRING);
Integer[] itemIds = wrapper.passthrough(Type.VAR_INT_ARRAY); Integer[] itemIds = wrapper.passthrough(Type.VAR_INT_ARRAY);
@ -145,12 +160,17 @@ public class Protocol1_14To1_13_2 extends Protocol {
itemIds[j] = InventoryPackets.getNewItemId(itemIds[j]); itemIds[j] = InventoryPackets.getNewItemId(itemIds[j]);
} }
} }
// Should fix fuel shift clicking
wrapper.write(Type.STRING, "minecraft:signs");
wrapper.write(Type.VAR_INT_ARRAY, new Integer[]{
InventoryPackets.getNewItemId(541)
});
int fluidTagsSize = wrapper.passthrough(Type.VAR_INT); // fluid tags int fluidTagsSize = wrapper.passthrough(Type.VAR_INT); // fluid tags
for (int i = 0; i < fluidTagsSize; i++) { for (int i = 0; i < fluidTagsSize; i++) {
wrapper.passthrough(Type.STRING); wrapper.passthrough(Type.STRING);
wrapper.passthrough(Type.VAR_INT_ARRAY); wrapper.passthrough(Type.VAR_INT_ARRAY);
} }
wrapper.write(Type.VAR_INT, 0); // new unknown tags wrapper.write(Type.VAR_INT, 0); // new entity tags - do we need to send this?
} }
}); });
} }

Datei anzeigen

@ -267,7 +267,7 @@ public class WorldPackets {
public void registerMap() { public void registerMap() {
map(Type.VAR_INT, Type.UNSIGNED_BYTE); // 0 - Status map(Type.VAR_INT, Type.UNSIGNED_BYTE); // 0 - Status
map(Type.POSITION); // 1 - Position map(Type.POSITION); // 1 - Position
map(Type.UNSIGNED_BYTE); // 2 - Face map(Type.BYTE); // 2 - Face
handler(new PacketHandler() { handler(new PacketHandler() {
@Override @Override
public void handle(PacketWrapper wrapper) throws Exception { public void handle(PacketWrapper wrapper) throws Exception {