3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-10-01 23:50:11 +02:00

Fix NPE in TippedArrow when it has no components (#4694)

Dieser Commit ist enthalten in:
Valaphee The Meerkat 2024-05-27 14:08:04 +02:00 committet von GitHub
Ursprung 5f7a31a1d8
Commit cb0488a271
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -41,16 +41,18 @@ public class TippedArrowItem extends ArrowItem {
@Override
public ItemData.Builder translateToBedrock(int count, DataComponents components, ItemMapping mapping, ItemMappings mappings) {
PotionContents potionContents = components.get(DataComponentType.POTION_CONTENTS);
if (potionContents != null) {
TippedArrowPotion tippedArrowPotion = TippedArrowPotion.of(potionContents.getPotionId());
if (tippedArrowPotion != null) {
return ItemData.builder()
.definition(mapping.getBedrockDefinition())
.damage(tippedArrowPotion.getBedrockId())
.count(count);
if (components != null) {
PotionContents potionContents = components.get(DataComponentType.POTION_CONTENTS);
if (potionContents != null) {
TippedArrowPotion tippedArrowPotion = TippedArrowPotion.of(potionContents.getPotionId());
if (tippedArrowPotion != null) {
return ItemData.builder()
.definition(mapping.getBedrockDefinition())
.damage(tippedArrowPotion.getBedrockId())
.count(count);
}
GeyserImpl.getInstance().getLogger().debug("Unknown Java potion (tipped arrow): " + potionContents.getPotionId());
}
GeyserImpl.getInstance().getLogger().debug("Unknown Java potion (tipped arrow): " + potionContents.getPotionId());
}
return super.translateToBedrock(count, components, mapping, mappings);
}