3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 16:40:10 +01:00

Fix illager metadata in 1.13->1.14

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-20 13:36:00 +02:00
Ursprung 216dcb2931
Commit 949b3d712e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
2 geänderte Dateien mit 12 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -150,13 +150,17 @@ public class MetadataRewriter1_14To1_13_2 extends EntityRewriter<ClientboundPack
event.cancel(); // "Is swinging arms" event.cancel(); // "Is swinging arms"
}); });
filter().type(EntityTypes1_14.ABSTRACT_ILLAGER_BASE).index(14).handler((event, meta) -> { filter().type(EntityTypes1_14.ABSTRACT_ILLAGER_BASE).handler((event, meta) -> {
EntityTracker1_14 tracker = tracker(event.user()); if (event.index() == 14) {
int entityId = event.entityId(); EntityTracker1_14 tracker = tracker(event.user());
tracker.setInsentientData(entityId, (byte) ((tracker.getInsentientData(entityId) & ~0x4) int entityId = event.entityId();
tracker.setInsentientData(entityId, (byte) ((tracker.getInsentientData(entityId) & ~0x4)
| (((Number) meta.getValue()).byteValue() != 0 ? 0x4 : 0))); // New attacking | (((Number) meta.getValue()).byteValue() != 0 ? 0x4 : 0))); // New attacking
event.createExtraMeta(new Metadata(13, Types1_14.META_TYPES.byteType, tracker.getInsentientData(entityId))); event.createExtraMeta(new Metadata(13, Types1_14.META_TYPES.byteType, tracker.getInsentientData(entityId)));
event.cancel(); // "Has target (aggressive state)" event.cancel(); // "Has target (aggressive state)"
} else if (event.index() > 14) {
meta.setId(meta.id() - 1);
}
}); });
filter().handler((event, meta) -> { filter().handler((event, meta) -> {

Datei anzeigen

@ -376,7 +376,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
null null
); );
filter().type(EntityTypes1_20_5.ZOMBIFIED_PIGLIN).removeIndex(19); // TODO Where is this coming from filter().type(EntityTypes1_20_5.ZOMBIFIED_PIGLIN).removeIndex(19); // TODO Somewhere between 1.8 and 1.11 we most likely have bad handling
filter().type(EntityTypes1_20_5.LIVINGENTITY).index(10).handler((event, meta) -> { filter().type(EntityTypes1_20_5.LIVINGENTITY).index(10).handler((event, meta) -> {
final int effectColor = meta.value(); final int effectColor = meta.value();
@ -405,7 +405,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
if (metaIndex == 11) { if (metaIndex == 11) {
// If the particle is found first // If the particle is found first
final Metadata colorData = event.metaAtIndex(9); final Metadata colorData = event.metaAtIndex(9);
if (colorData != null) { if (colorData != null && colorData.metaType() == Types1_20_5.META_TYPES.varIntType) {
addColor(meta, colorData.value()); addColor(meta, colorData.value());
} }
} }