mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-21 16:47:57 +01:00
Don't override getTranslatableRewriter in 1.13->1.12, 1.14->1.13 protocols
The method is used in item handling and would otherwise mess up the lore
This commit is contained in:
parent
614207aeef
commit
0d4257f228
@ -63,7 +63,9 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
|
||||
if (lore != null) {
|
||||
boolean changed = false;
|
||||
for (Tag loreEntryTag : lore) {
|
||||
if (!(loreEntryTag instanceof StringTag)) continue;
|
||||
if (!(loreEntryTag instanceof StringTag)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
StringTag loreEntry = (StringTag) loreEntryTag;
|
||||
String newValue = protocol.getTranslatableRewriter().processText(loreEntry.getValue()).toString();
|
||||
|
@ -142,8 +142,8 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_
|
||||
return blockItemPackets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter<ClientboundPackets1_13> getTranslatableRewriter() {
|
||||
// Don't override the parent method
|
||||
public TranslatableRewriter<ClientboundPackets1_13> translatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<ClientboundPackets1_
|
||||
int typeId = meta.metaType().typeId();
|
||||
if (typeId == 4) {
|
||||
JsonElement element = meta.value();
|
||||
protocol.getTranslatableRewriter().processText(element);
|
||||
protocol.translatableRewriter().processText(element);
|
||||
meta.setMetaType(MetaType1_12.Chat);
|
||||
} else if (typeId == 5) {
|
||||
// Rewrite optional chat to string
|
||||
|
@ -228,8 +228,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
||||
return itemRewriter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TranslatableRewriter<ClientboundPackets1_13> getTranslatableRewriter() {
|
||||
public TranslatableRewriter<ClientboundPackets1_13> translatableRewriter() {
|
||||
return translatableRewriter;
|
||||
}
|
||||
}
|
||||
|
@ -22,10 +22,13 @@ import com.viaversion.viabackwards.api.rewriters.LegacyEntityRewriter;
|
||||
import com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.Protocol1_13To1_13_1;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import com.viaversion.viaversion.api.type.types.Particle;
|
||||
import com.viaversion.viaversion.api.type.types.version.Types1_13;
|
||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||
import java.util.List;
|
||||
|
||||
@ -127,8 +130,21 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<ClientboundPackets
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
registerMetaTypeHandler(Types1_13.META_TYPES.itemType, Types1_13.META_TYPES.blockStateType, Types1_13.META_TYPES.particleType,
|
||||
Types1_13.META_TYPES.optionalComponentType, Types1_13.META_TYPES.componentType);
|
||||
// Rewrite items & blocks
|
||||
filter().handler((event, meta) -> {
|
||||
if (meta.metaType() == Types1_13.META_TYPES.itemType) {
|
||||
protocol.getItemRewriter().handleItemToClient((Item) meta.getValue());
|
||||
} else if (meta.metaType() == Types1_13.META_TYPES.blockStateType) {
|
||||
// Convert to new block id
|
||||
int data = (int) meta.getValue();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||
} else if (meta.metaType() == Types1_13.META_TYPES.particleType) {
|
||||
rewriteParticle((Particle) meta.getValue());
|
||||
} else if (meta.metaType() == Types1_13.META_TYPES.optionalComponentType || meta.metaType() == Types1_13.META_TYPES.componentType) {
|
||||
JsonElement element = meta.value();
|
||||
protocol.translatableRewriter().processText(element);
|
||||
}
|
||||
});
|
||||
|
||||
// Remove shooter UUID
|
||||
filter().filterFamily(Entity1_13Types.EntityType.ABSTRACT_ARROW).cancel(7);
|
||||
|
Loading…
Reference in New Issue
Block a user