mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-11-22 12:16:21 +01:00
Fix component length read
This commit is contained in:
parent
8294f6af4f
commit
b506060e48
@ -50,7 +50,7 @@ public class TranslatableRewriter {
|
||||
protocol.registerOutgoing(State.LOGIN, 0x00, 0x00, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
||||
handler(wrapper -> wrapper.write(Type.COMPONENT_STRING, processText(wrapper.read(Type.COMPONENT_STRING))));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -59,7 +59,7 @@ public class TranslatableRewriter {
|
||||
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
||||
handler(wrapper -> wrapper.write(Type.COMPONENT_STRING, processText(wrapper.read(Type.COMPONENT_STRING))));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -68,7 +68,7 @@ public class TranslatableRewriter {
|
||||
protocol.registerOutgoing(packetType, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
||||
handler(wrapper -> wrapper.write(Type.COMPONENT_STRING, processText(wrapper.read(Type.COMPONENT_STRING))));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class TranslatableRewriter {
|
||||
handler(wrapper -> {
|
||||
int action = wrapper.get(Type.VAR_INT, 0);
|
||||
if (action == 0 || action == 3) {
|
||||
wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING)));
|
||||
wrapper.write(Type.COMPONENT_STRING, processText(wrapper.read(Type.COMPONENT_STRING)));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -95,7 +95,7 @@ public class TranslatableRewriter {
|
||||
public void registerMap() {
|
||||
map(Type.UNSIGNED_BYTE); // Id
|
||||
map(Type.STRING); // Window Type
|
||||
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
||||
handler(wrapper -> wrapper.write(Type.COMPONENT_STRING, processText(wrapper.read(Type.COMPONENT_STRING))));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -106,7 +106,7 @@ public class TranslatableRewriter {
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // Id
|
||||
map(Type.VAR_INT); // Window Type
|
||||
handler(wrapper -> wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING))));
|
||||
handler(wrapper -> wrapper.write(Type.COMPONENT_STRING, processText(wrapper.read(Type.COMPONENT_STRING))));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -119,7 +119,7 @@ public class TranslatableRewriter {
|
||||
if (wrapper.passthrough(Type.VAR_INT) == 2) {
|
||||
wrapper.passthrough(Type.VAR_INT);
|
||||
wrapper.passthrough(Type.INT);
|
||||
wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING)));
|
||||
wrapper.write(Type.COMPONENT_STRING, processText(wrapper.read(Type.COMPONENT_STRING)));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -133,7 +133,7 @@ public class TranslatableRewriter {
|
||||
handler(wrapper -> {
|
||||
int action = wrapper.passthrough(Type.VAR_INT);
|
||||
if (action >= 0 && action <= 2) {
|
||||
wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING)));
|
||||
wrapper.write(Type.COMPONENT_STRING, processText(wrapper.read(Type.COMPONENT_STRING)));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -145,8 +145,8 @@ public class TranslatableRewriter {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> {
|
||||
wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING)));
|
||||
wrapper.write(Type.STRING, processText(wrapper.read(Type.STRING)));
|
||||
wrapper.write(Type.COMPONENT_STRING, processText(wrapper.read(Type.COMPONENT_STRING)));
|
||||
wrapper.write(Type.COMPONENT_STRING, processText(wrapper.read(Type.COMPONENT_STRING)));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -137,7 +137,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
|
||||
wrapper.write(Type.STRING, stringType);
|
||||
|
||||
String title = wrapper.read(Type.STRING);
|
||||
String title = wrapper.read(Type.COMPONENT_STRING);
|
||||
if (containerTitle != null) {
|
||||
// Don't rewrite renamed, only translatable titles
|
||||
JsonObject object = GsonUtil.getGson().fromJson(title, JsonObject.class);
|
||||
@ -148,7 +148,7 @@ public class BlockItemPackets1_14 extends nl.matsv.viabackwards.api.rewriters.It
|
||||
}
|
||||
}
|
||||
}
|
||||
wrapper.write(Type.STRING, title);
|
||||
wrapper.write(Type.COMPONENT_STRING, title);
|
||||
|
||||
wrapper.write(Type.UNSIGNED_BYTE, (short) slotSize);
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int action = wrapper.get(Type.VAR_INT, 0);
|
||||
if (action == 0 || action == 3) {
|
||||
wrapper.write(Type.STRING, translatableRewriter.processText(wrapper.read(Type.STRING)));
|
||||
wrapper.write(Type.COMPONENT_STRING, translatableRewriter.processText(wrapper.read(Type.COMPONENT_STRING)));
|
||||
if (action == 0) {
|
||||
wrapper.passthrough(Type.FLOAT);
|
||||
wrapper.passthrough(Type.VAR_INT);
|
||||
|
@ -53,7 +53,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
registerOutgoing(ClientboundPackets1_16.CHAT_MESSAGE, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(wrapper -> wrapper.write(Type.STRING, translatableRewriter.processText(wrapper.read(Type.STRING))));
|
||||
handler(wrapper -> wrapper.write(Type.COMPONENT_STRING, translatableRewriter.processText(wrapper.read(Type.COMPONENT_STRING))));
|
||||
map(Type.BYTE);
|
||||
map(Type.UUID, Type.NOTHING); // Sender
|
||||
}
|
||||
@ -64,7 +64,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol<ClientboundPackets1_
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // Window Id
|
||||
map(Type.VAR_INT); // Window Type
|
||||
handler(wrapper -> wrapper.write(Type.STRING, translatableRewriter.processText(wrapper.read(Type.STRING))));
|
||||
handler(wrapper -> wrapper.write(Type.COMPONENT_STRING, translatableRewriter.processText(wrapper.read(Type.COMPONENT_STRING))));
|
||||
handler(wrapper -> {
|
||||
int windowType = wrapper.get(Type.VAR_INT, 1);
|
||||
if (windowType == 20) { // Smithing table
|
||||
|
Loading…
Reference in New Issue
Block a user