3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-20 06:50:10 +01:00

Handle optional block state entity meta

Dieser Commit ist enthalten in:
Nassim Jahnke 2023-04-18 13:39:59 +02:00
Ursprung 65c8024ba7
Commit da35067e1d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
10 geänderte Dateien mit 28 neuen und 22 gelöschten Zeilen

Datei anzeigen

@ -177,18 +177,24 @@ public abstract class EntityRewriterBase<C extends ClientboundPacketType, T exte
public void registerMetaTypeHandler(
@Nullable MetaType itemType,
@Nullable MetaType blockType,
@Nullable MetaType blockStateType,
@Nullable MetaType optionalBlockStateType,
@Nullable MetaType particleType,
@Nullable MetaType optionalComponentType,
@Nullable MetaType componentType
@Nullable MetaType componentType,
@Nullable MetaType optionalComponentType
) {
filter().handler((event, meta) -> {
MetaType type = meta.metaType();
if (type == itemType) {
protocol.getItemRewriter().handleItemToClient(meta.value());
} else if (type == blockType) {
} else if (type == blockStateType) {
int data = meta.value();
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
} else if (type == optionalBlockStateType) {
int data = meta.value();
if (data != 0) {
meta.setValue(protocol.getMappingData().getNewBlockStateId(data));
}
} else if (type == particleType) {
rewriteParticle(meta.value());
} else if (type == optionalComponentType || type == componentType) {

Datei anzeigen

@ -348,8 +348,8 @@ public class EntityPackets1_14 extends LegacyEntityRewriter<ClientboundPackets1_
}
});
registerMetaTypeHandler(Types1_13_2.META_TYPES.itemType, Types1_13_2.META_TYPES.blockStateType, null,
Types1_13_2.META_TYPES.optionalComponentType, Types1_13_2.META_TYPES.componentType);
registerMetaTypeHandler(Types1_13_2.META_TYPES.itemType, Types1_13_2.META_TYPES.blockStateType, null, null,
Types1_13_2.META_TYPES.componentType, Types1_13_2.META_TYPES.optionalComponentType);
filter().type(Entity1_14Types.PILLAGER).cancel(15);

Datei anzeigen

@ -192,8 +192,8 @@ 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,
Types1_14.META_TYPES.optionalComponentType, Types1_14.META_TYPES.componentType);
registerMetaTypeHandler(Types1_14.META_TYPES.itemType, Types1_14.META_TYPES.blockStateType, null, Types1_14.META_TYPES.particleType,
Types1_14.META_TYPES.componentType, Types1_14.META_TYPES.optionalComponentType);
filter().filterFamily(Entity1_15Types.LIVINGENTITY).removeIndex(12);

Datei anzeigen

@ -122,8 +122,8 @@ public class EntityPackets1_16_2 extends EntityRewriter<ClientboundPackets1_16_2
@Override
protected void registerRewrites() {
registerMetaTypeHandler(Types1_16.META_TYPES.itemType, Types1_16.META_TYPES.blockStateType,
Types1_16.META_TYPES.particleType, Types1_16.META_TYPES.optionalComponentType, Types1_16.META_TYPES.componentType);
registerMetaTypeHandler(Types1_16.META_TYPES.itemType, Types1_16.META_TYPES.blockStateType, null,
Types1_16.META_TYPES.particleType, Types1_16.META_TYPES.componentType, Types1_16.META_TYPES.optionalComponentType);
mapTypes(Entity1_16_2Types.values(), Entity1_16Types.class);
mapEntityTypeWithData(Entity1_16_2Types.PIGLIN_BRUTE, Entity1_16_2Types.PIGLIN).jsonName();

Datei anzeigen

@ -180,8 +180,8 @@ public final class EntityPackets1_17 extends EntityRewriter<ClientboundPackets1_
});
// Particles have already been handled
registerMetaTypeHandler(Types1_16.META_TYPES.itemType, Types1_16.META_TYPES.blockStateType, null,
Types1_16.META_TYPES.optionalComponentType, Types1_16.META_TYPES.componentType);
registerMetaTypeHandler(Types1_16.META_TYPES.itemType, Types1_16.META_TYPES.blockStateType, null, null,
Types1_16.META_TYPES.componentType, Types1_16.META_TYPES.optionalComponentType);
mapTypes(Entity1_17Types.values(), Entity1_16_2Types.class);
filter().type(Entity1_17Types.AXOLOTL).cancel(17);

Datei anzeigen

@ -117,8 +117,8 @@ public final class EntityPackets1_18 extends EntityRewriter<ClientboundPackets1_
});
// Particles have already been handled
registerMetaTypeHandler(Types1_17.META_TYPES.itemType, null, null,
Types1_17.META_TYPES.optionalComponentType, Types1_17.META_TYPES.componentType);
registerMetaTypeHandler(Types1_17.META_TYPES.itemType, null, null, null,
Types1_17.META_TYPES.componentType, Types1_17.META_TYPES.optionalComponentType);
}
@Override

Datei anzeigen

@ -269,8 +269,8 @@ public final class EntityPackets1_19 extends EntityRewriter<ClientboundPackets1_
}
});
registerMetaTypeHandler(Types1_18.META_TYPES.itemType, Types1_18.META_TYPES.blockStateType, null,
Types1_18.META_TYPES.optionalComponentType, Types1_18.META_TYPES.componentType);
registerMetaTypeHandler(Types1_18.META_TYPES.itemType, Types1_18.META_TYPES.blockStateType, null, null,
Types1_18.META_TYPES.componentType, Types1_18.META_TYPES.optionalComponentType);
filter().filterFamily(Entity1_19Types.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int data = (int) meta.getValue();

Datei anzeigen

@ -230,8 +230,8 @@ public final class EntityPackets1_19_3 extends EntityRewriter<ClientboundPackets
meta.setMetaType(Types1_19.META_TYPES.byId(id));
}
});
registerMetaTypeHandler(Types1_19.META_TYPES.itemType, Types1_19.META_TYPES.blockStateType, Types1_19.META_TYPES.particleType,
Types1_19.META_TYPES.optionalComponentType, Types1_19.META_TYPES.componentType);
registerMetaTypeHandler(Types1_19.META_TYPES.itemType, Types1_19.META_TYPES.blockStateType, null, Types1_19.META_TYPES.particleType,
Types1_19.META_TYPES.componentType, Types1_19.META_TYPES.optionalComponentType);
filter().index(6).handler((event, meta) -> {
// Sitting pose added

Datei anzeigen

@ -143,8 +143,8 @@ public final class EntityPackets1_19_4 extends EntityRewriter<ClientboundPackets
meta.setMetaType(Types1_19_3.META_TYPES.byId(id));
});
registerMetaTypeHandler(Types1_19_3.META_TYPES.itemType, Types1_19_3.META_TYPES.blockStateType, Types1_19_3.META_TYPES.particleType,
Types1_19_3.META_TYPES.optionalComponentType, Types1_19_3.META_TYPES.componentType);
registerMetaTypeHandler(Types1_19_3.META_TYPES.itemType, Types1_19_3.META_TYPES.blockStateType, null, Types1_19_3.META_TYPES.particleType,
Types1_19_3.META_TYPES.componentType, Types1_19_3.META_TYPES.optionalComponentType);
filter().filterFamily(Entity1_19_4Types.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value();

Datei anzeigen

@ -90,8 +90,8 @@ public final class EntityPackets1_20 extends EntityRewriter<ClientboundPackets1_
@Override
protected void registerRewrites() {
filter().handler((event, meta) -> meta.setMetaType(Types1_19_4.META_TYPES.byId(meta.metaType().typeId())));
registerMetaTypeHandler(Types1_19_4.META_TYPES.itemType, Types1_19_4.META_TYPES.blockStateType,
Types1_19_4.META_TYPES.particleType, Types1_19_4.META_TYPES.optionalComponentType, Types1_19_4.META_TYPES.componentType);
registerMetaTypeHandler(Types1_19_4.META_TYPES.itemType, Types1_19_4.META_TYPES.blockStateType, Types1_19_4.META_TYPES.optionalBlockStateType,
Types1_19_4.META_TYPES.particleType, Types1_19_4.META_TYPES.componentType, Types1_19_4.META_TYPES.optionalComponentType);
filter().filterFamily(Entity1_19_4Types.MINECART_ABSTRACT).index(11).handler((event, meta) -> {
final int blockState = meta.value();