Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-20 06:50:10 +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
Dieser Commit ist enthalten in:
Ursprung
614207aeef
Commit
0d4257f228
@ -63,7 +63,9 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
|
|||||||
if (lore != null) {
|
if (lore != null) {
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
for (Tag loreEntryTag : lore) {
|
for (Tag loreEntryTag : lore) {
|
||||||
if (!(loreEntryTag instanceof StringTag)) continue;
|
if (!(loreEntryTag instanceof StringTag)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
StringTag loreEntry = (StringTag) loreEntryTag;
|
StringTag loreEntry = (StringTag) loreEntryTag;
|
||||||
String newValue = protocol.getTranslatableRewriter().processText(loreEntry.getValue()).toString();
|
String newValue = protocol.getTranslatableRewriter().processText(loreEntry.getValue()).toString();
|
||||||
|
@ -142,8 +142,8 @@ public class Protocol1_12_2To1_13 extends BackwardsProtocol<ClientboundPackets1_
|
|||||||
return blockItemPackets;
|
return blockItemPackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// Don't override the parent method
|
||||||
public TranslatableRewriter<ClientboundPackets1_13> getTranslatableRewriter() {
|
public TranslatableRewriter<ClientboundPackets1_13> translatableRewriter() {
|
||||||
return translatableRewriter;
|
return translatableRewriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ public class EntityPackets1_13 extends LegacyEntityRewriter<ClientboundPackets1_
|
|||||||
int typeId = meta.metaType().typeId();
|
int typeId = meta.metaType().typeId();
|
||||||
if (typeId == 4) {
|
if (typeId == 4) {
|
||||||
JsonElement element = meta.value();
|
JsonElement element = meta.value();
|
||||||
protocol.getTranslatableRewriter().processText(element);
|
protocol.translatableRewriter().processText(element);
|
||||||
meta.setMetaType(MetaType1_12.Chat);
|
meta.setMetaType(MetaType1_12.Chat);
|
||||||
} else if (typeId == 5) {
|
} else if (typeId == 5) {
|
||||||
// Rewrite optional chat to string
|
// Rewrite optional chat to string
|
||||||
|
@ -228,8 +228,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol<ClientboundPackets1_
|
|||||||
return itemRewriter;
|
return itemRewriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public TranslatableRewriter<ClientboundPackets1_13> translatableRewriter() {
|
||||||
public TranslatableRewriter<ClientboundPackets1_13> getTranslatableRewriter() {
|
|
||||||
return 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.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.Entity1_13Types;
|
||||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
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.minecraft.metadata.Metadata;
|
||||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||||
import com.viaversion.viaversion.api.type.Type;
|
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.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 com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -127,8 +130,21 @@ public class EntityPackets1_13_1 extends LegacyEntityRewriter<ClientboundPackets
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerRewrites() {
|
protected void registerRewrites() {
|
||||||
registerMetaTypeHandler(Types1_13.META_TYPES.itemType, Types1_13.META_TYPES.blockStateType, Types1_13.META_TYPES.particleType,
|
// Rewrite items & blocks
|
||||||
Types1_13.META_TYPES.optionalComponentType, Types1_13.META_TYPES.componentType);
|
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
|
// Remove shooter UUID
|
||||||
filter().filterFamily(Entity1_13Types.EntityType.ABSTRACT_ARROW).cancel(7);
|
filter().filterFamily(Entity1_13Types.EntityType.ABSTRACT_ARROW).cancel(7);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren