Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-24 23:30:17 +01:00
Fix colored inventory titles on 1.13 and below (#350)
Dieser Commit ist enthalten in:
Ursprung
066fef0513
Commit
0812204f11
@ -36,9 +36,12 @@ import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
|
||||
import us.myles.ViaVersion.api.rewriters.TagRewriter;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13_1to1_13.Protocol1_13_1To1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13;
|
||||
import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld;
|
||||
import us.myles.viaversion.libs.gson.JsonElement;
|
||||
import us.myles.viaversion.libs.gson.JsonObject;
|
||||
|
||||
public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_13, ClientboundPackets1_13, ServerboundPackets1_13, ServerboundPackets1_13> {
|
||||
|
||||
@ -58,7 +61,6 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
|
||||
TranslatableRewriter translatableRewriter = new TranslatableRewriter(this);
|
||||
translatableRewriter.registerChatMessage(ClientboundPackets1_13.CHAT_MESSAGE);
|
||||
translatableRewriter.registerLegacyOpenWindow(ClientboundPackets1_13.OPEN_WINDOW);
|
||||
translatableRewriter.registerCombatEvent(ClientboundPackets1_13.COMBAT_EVENT);
|
||||
translatableRewriter.registerDisconnect(ClientboundPackets1_13.DISCONNECT);
|
||||
translatableRewriter.registerTabList(ClientboundPackets1_13.TAB_LIST);
|
||||
@ -96,6 +98,24 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
}
|
||||
});
|
||||
|
||||
registerOutgoing(ClientboundPackets1_13.OPEN_WINDOW, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.UNSIGNED_BYTE); // Id
|
||||
map(Type.STRING); // Window Type
|
||||
handler(wrapper -> {
|
||||
JsonElement title = wrapper.read(Type.COMPONENT);
|
||||
translatableRewriter.processText(title);
|
||||
|
||||
// https://bugs.mojang.com/browse/MC-124543
|
||||
JsonObject legacyComponent = new JsonObject();
|
||||
legacyComponent.addProperty("text", ChatRewriter.jsonToLegacyText(title.toString()));
|
||||
|
||||
wrapper.write(Type.COMPONENT, legacyComponent);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
registerOutgoing(ClientboundPackets1_13.TAB_COMPLETE, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren