Fix heightmap file, hotfix enchantment rewriting without mappings

This commit is contained in:
Nassim Jahnke 2023-03-05 09:32:56 +01:00
parent c765f20558
commit b3825e637e
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 5 additions and 1 deletions

View File

@ -291,9 +291,13 @@ public abstract class ItemRewriter<C extends ClientboundPacketType, S extends Se
public void register() {
map(Type.UNSIGNED_BYTE); // Container id
handler(wrapper -> {
Mappings mappings = protocol.getMappingData().getEnchantmentMappings();
if (mappings == null) {
return;
}
short property = wrapper.passthrough(Type.SHORT);
if (property >= 4 && property <= 6) { // Enchantment id
Mappings mappings = protocol.getMappingData().getEnchantmentMappings();
short enchantmentId = (short) mappings.getNewId(wrapper.read(Type.SHORT));
wrapper.write(Type.SHORT, enchantmentId);
}