Fix illager metadata in 1.13->1.14

This commit is contained in:
Nassim Jahnke 2024-04-20 13:36:00 +02:00
parent 216dcb2931
commit 949b3d712e
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 12 additions and 8 deletions

View File

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

View File

@ -376,7 +376,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
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) -> {
final int effectColor = meta.value();
@ -405,7 +405,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
if (metaIndex == 11) {
// If the particle is found first
final Metadata colorData = event.metaAtIndex(9);
if (colorData != null) {
if (colorData != null && colorData.metaType() == Types1_20_5.META_TYPES.varIntType) {
addColor(meta, colorData.value());
}
}