Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Fix enchantments when there are less than three options
Dieser Commit ist enthalten in:
Ursprung
5d4b368e51
Commit
787e6fe5f7
@ -47,6 +47,9 @@ public class EnchantingContainer extends Container {
|
|||||||
geyserEnchantOptions = new GeyserEnchantOption[3];
|
geyserEnchantOptions = new GeyserEnchantOption[3];
|
||||||
for (int i = 0; i < geyserEnchantOptions.length; i++) {
|
for (int i = 0; i < geyserEnchantOptions.length; i++) {
|
||||||
geyserEnchantOptions[i] = new GeyserEnchantOption(i);
|
geyserEnchantOptions[i] = new GeyserEnchantOption(i);
|
||||||
|
// Options cannot be null, so we build initial options
|
||||||
|
// GeyserSession can be safely null here because it's only needed for net IDs
|
||||||
|
enchantOptions[i] = geyserEnchantOptions[i].build(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,12 +67,8 @@ public class GeyserEnchantOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public EnchantOptionData build(GeyserSession session) {
|
public EnchantOptionData build(GeyserSession session) {
|
||||||
if (enchantLevel == -1) {
|
|
||||||
// Should not be sent to the client, as it is supposed to be empty
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new EnchantOptionData(xpCost, javaIndex + 16, EMPTY,
|
return new EnchantOptionData(xpCost, javaIndex + 16, EMPTY,
|
||||||
Collections.singletonList(new EnchantData(bedrockEnchantIndex, enchantLevel)), EMPTY,
|
enchantLevel == -1 ? EMPTY : Collections.singletonList(new EnchantData(bedrockEnchantIndex, enchantLevel)), EMPTY,
|
||||||
javaEnchantIndex == -1 ? "unknown" : ENCHANT_NAMES.get(javaEnchantIndex), session.getNextItemNetId());
|
javaEnchantIndex == -1 ? "unknown" : ENCHANT_NAMES.get(javaEnchantIndex), enchantLevel == -1 ? 0 : session.getNextItemNetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren