Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-11-20 06:50:10 +01:00
Handle translatables in 1.14/1.15 entity display names
Dieser Commit ist enthalten in:
Ursprung
587a5e487f
Commit
eb6e9e016a
@ -175,7 +175,7 @@ public abstract class EntityRewriterBase<C extends ClientboundPacketType, T exte
|
||||
}
|
||||
}
|
||||
|
||||
public void registerMetaTypeHandler(@Nullable MetaType itemType, @Nullable MetaType blockType, @Nullable MetaType particleType, @Nullable MetaType optChatType) {
|
||||
public void registerMetaTypeHandler(@Nullable MetaType itemType, @Nullable MetaType blockType, @Nullable MetaType particleType, @Nullable MetaType optionalComponentType) {
|
||||
filter().handler((event, meta) -> {
|
||||
MetaType type = meta.metaType();
|
||||
if (itemType != null && type == itemType) {
|
||||
@ -185,7 +185,7 @@ public abstract class EntityRewriterBase<C extends ClientboundPacketType, T exte
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
|
||||
} else if (particleType != null && type == particleType) {
|
||||
rewriteParticle(meta.value());
|
||||
} else if (optChatType != null && type == optChatType) {
|
||||
} else if (optionalComponentType != null && type == optionalComponentType) {
|
||||
JsonElement text = meta.value();
|
||||
if (text != null) {
|
||||
protocol.getTranslatableRewriter().processText(text);
|
||||
|
@ -31,8 +31,6 @@ import com.viaversion.viaversion.api.minecraft.VillagerData;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.Entity1_14Types;
|
||||
import com.viaversion.viaversion.api.minecraft.entities.EntityType;
|
||||
import com.viaversion.viaversion.api.minecraft.item.Item;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.MetaType;
|
||||
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers;
|
||||
@ -348,18 +346,10 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<ClientboundPackets1_
|
||||
if (typeId <= 15) {
|
||||
meta.setMetaType(Types1_13_2.META_TYPES.byId(typeId));
|
||||
}
|
||||
|
||||
MetaType type = meta.metaType();
|
||||
|
||||
if (type == Types1_13_2.META_TYPES.itemType) {
|
||||
Item item = (Item) meta.getValue();
|
||||
meta.setValue(protocol.getItemRewriter().handleItemToClient(item));
|
||||
} else if (type == Types1_13_2.META_TYPES.blockStateType) {
|
||||
int blockstate = meta.value();
|
||||
meta.setValue(protocol.getMappingData().getNewBlockStateId(blockstate));
|
||||
}
|
||||
});
|
||||
|
||||
registerMetaTypeHandler(Types1_13_2.META_TYPES.itemType, Types1_13_2.META_TYPES.blockStateType, null, Types1_13_2.META_TYPES.optionalComponentType);
|
||||
|
||||
filter().type(Entity1_14Types.PILLAGER).cancel(15);
|
||||
|
||||
filter().type(Entity1_14Types.FOX).cancel(15);
|
||||
|
@ -192,7 +192,7 @@ public class EntityPackets1_15 extends EntityRewriter<ClientboundPackets1_15, Pr
|
||||
|
||||
@Override
|
||||
protected void registerRewrites() {
|
||||
registerMetaTypeHandler(Types1_14.META_TYPES.itemType, Types1_14.META_TYPES.blockStateType, Types1_14.META_TYPES.particleType, null);
|
||||
registerMetaTypeHandler(Types1_14.META_TYPES.itemType, Types1_14.META_TYPES.blockStateType, Types1_14.META_TYPES.particleType, Types1_14.META_TYPES.optionalComponentType);
|
||||
|
||||
filter().filterFamily(Entity1_15Types.LIVINGENTITY).removeIndex(12);
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren