Handle translatables in lore tag conversion in 1.14->1.13.2 (#810)

This commit is contained in:
EnZaXD 2024-07-05 16:09:43 +02:00 committed by GitHub
parent 22508f6ab7
commit dd6bc4f1db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -87,7 +87,7 @@ public class TranslatableRewriter<C extends ClientboundPacketType> extends Compo
return translatables.get(translationKey);
}
public Map<String, String> getTranslatableMappings(final String sectionIdentifier) {
public static Map<String, String> getTranslatableMappings(final String sectionIdentifier) {
return TRANSLATABLES.get(sectionIdentifier);
}
}

View File

@ -20,6 +20,7 @@ package com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter;
import com.google.common.collect.ImmutableSet;
import com.viaversion.viabackwards.api.rewriters.BackwardsItemRewriter;
import com.viaversion.viabackwards.api.rewriters.EnchantmentRewriter;
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
import com.viaversion.viabackwards.protocol.v1_14to1_13_2.Protocol1_14To1_13_2;
import com.viaversion.viabackwards.protocol.v1_14to1_13_2.storage.ChunkLightStorage;
import com.viaversion.viaversion.api.Via;
@ -48,6 +49,8 @@ import com.viaversion.nbt.tag.CompoundTag;
import com.viaversion.nbt.tag.ListTag;
import com.viaversion.nbt.tag.StringTag;
import com.viaversion.viaversion.libs.gson.JsonParseException;
import com.viaversion.viaversion.libs.mcstructs.text.utils.TextUtils;
import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13;
import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13;
import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ServerboundPackets1_13;
import com.viaversion.viaversion.protocols.v1_13_2to1_14.Protocol1_13_2To1_14;
@ -477,6 +480,8 @@ public class BlockItemPacketRewriter1_14 extends BackwardsItemRewriter<Clientbou
each.remove();
continue;
}
TextUtils.setTranslator(component, s -> Protocol1_12_2To1_13.MAPPINGS.getMojangTranslation().
getOrDefault(s, TranslatableRewriter.getTranslatableMappings("1.14").get(s)));
loreEntry.setValue(component.asLegacyFormatString());
}
} catch (final JsonParseException e) {