Fix 1.12 -> 1.13 held enderman block translation (#3781)

This commit is contained in:
RK_01 2024-04-10 10:43:48 +02:00 committed by GitHub
parent 73178b504e
commit 6f53c069ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,7 +40,12 @@ public class MetadataRewriter1_13To1_12_2 extends EntityRewriter<ClientboundPack
protected void registerRewrites() { protected void registerRewrites() {
filter().mapMetaType(typeId -> Types1_13.META_TYPES.byId(typeId > 4 ? typeId + 1 : typeId)); filter().mapMetaType(typeId -> Types1_13.META_TYPES.byId(typeId > 4 ? typeId + 1 : typeId));
filter().metaType(Types1_13.META_TYPES.itemType).handler(((event, meta) -> protocol.getItemRewriter().handleItemToClient(meta.value()))); filter().metaType(Types1_13.META_TYPES.itemType).handler(((event, meta) -> protocol.getItemRewriter().handleItemToClient(meta.value())));
filter().metaType(Types1_13.META_TYPES.blockStateType).handler(((event, meta) -> meta.setValue(WorldPackets.toNewId(meta.value())))); filter().metaType(Types1_13.META_TYPES.blockStateType).handler(((event, meta) -> {
int oldId = meta.value();
int combined = (((oldId & 4095) << 4) | (oldId >> 12 & 15));
int newId = WorldPackets.toNewId(combined);
meta.setValue(newId);
}));
// Previously unused, now swimming // Previously unused, now swimming
filter().index(0).handler((event, meta) -> meta.setValue((byte) ((byte) meta.getValue() & ~0x10))); filter().index(0).handler((event, meta) -> meta.setValue((byte) ((byte) meta.getValue() & ~0x10)));
@ -53,14 +58,6 @@ public class MetadataRewriter1_13To1_12_2 extends EntityRewriter<ClientboundPack
} }
})); }));
filter().type(EntityTypes1_13.EntityType.ENDERMAN).index(12).handler((event, meta) -> {
// Remap held block to match new format for remapping to flat block
int stateId = meta.value();
int id = stateId & 4095;
int data = stateId >> 12 & 15;
meta.setValue((id << 4) | (data & 0xF));
});
filter().type(EntityTypes1_13.EntityType.WOLF).index(17).handler((event, meta) -> { filter().type(EntityTypes1_13.EntityType.WOLF).index(17).handler((event, meta) -> {
// Handle new colors // Handle new colors
meta.setValue(15 - (int) meta.getValue()); meta.setValue(15 - (int) meta.getValue());
@ -108,4 +105,4 @@ public class MetadataRewriter1_13To1_12_2 extends EntityRewriter<ClientboundPack
public EntityType objectTypeFromId(int type) { public EntityType objectTypeFromId(int type) {
return EntityTypes1_13.getTypeFromId(type, true); return EntityTypes1_13.getTypeFromId(type, true);
} }
} }