mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-11-29 13:06:00 +01:00
Updated TextComponentTranslator
This commit is contained in:
parent
792420cfd0
commit
1cac6e5e16
@ -68,7 +68,7 @@ public abstract class MixinInventoryPackets {
|
|||||||
wrapper.write(Type.STRING, uuid); // sync task id
|
wrapper.write(Type.STRING, uuid); // sync task id
|
||||||
wrapper.write(Type.UNSIGNED_BYTE, windowId);
|
wrapper.write(Type.UNSIGNED_BYTE, windowId);
|
||||||
wrapper.write(Type.UNSIGNED_BYTE, slots);
|
wrapper.write(Type.UNSIGNED_BYTE, slots);
|
||||||
wrapper.write(Type.COMPONENT, TextComponentTranslator.via1_14toViaLatest(title));
|
wrapper.write(Type.TAG, TextComponentTranslator.via1_14toViaLatest(title));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
|||||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||||
|
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
||||||
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14;
|
||||||
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
import de.florianmichael.viafabricplus.ViaFabricPlus;
|
||||||
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
import de.florianmichael.viafabricplus.protocolhack.ProtocolHack;
|
||||||
@ -40,7 +41,7 @@ public class TextComponentTranslator {
|
|||||||
* @param component The ViaVersion 1.14 text component
|
* @param component The ViaVersion 1.14 text component
|
||||||
* @return The native text component
|
* @return The native text component
|
||||||
*/
|
*/
|
||||||
public static JsonElement via1_14toViaLatest(final JsonElement component) {
|
public static Tag via1_14toViaLatest(final JsonElement component) {
|
||||||
try {
|
try {
|
||||||
var wrapper = PacketWrapper.create(ClientboundPackets1_14.OPEN_WINDOW, DUMMY_USER_CONNECTION);
|
var wrapper = PacketWrapper.create(ClientboundPackets1_14.OPEN_WINDOW, DUMMY_USER_CONNECTION);
|
||||||
wrapper.write(Type.VAR_INT, 1); // window id
|
wrapper.write(Type.VAR_INT, 1); // window id
|
||||||
@ -52,7 +53,7 @@ public class TextComponentTranslator {
|
|||||||
|
|
||||||
wrapper.read(Type.VAR_INT); // window id
|
wrapper.read(Type.VAR_INT); // window id
|
||||||
wrapper.read(Type.VAR_INT); // type id
|
wrapper.read(Type.VAR_INT); // type id
|
||||||
return wrapper.read(Type.COMPONENT); // title
|
return wrapper.read(Type.TAG); // title
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
ViaFabricPlus.global().getLogger().error("Error converting ViaVersion 1.14 text component to native text component", t);
|
ViaFabricPlus.global().getLogger().error("Error converting ViaVersion 1.14 text component to native text component", t);
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user