mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix NPE in TippedArrow when it has no components (#4694)
This commit is contained in:
parent
5f7a31a1d8
commit
cb0488a271
1 changed files with 11 additions and 9 deletions
|
@ -41,16 +41,18 @@ public class TippedArrowItem extends ArrowItem {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemData.Builder translateToBedrock(int count, DataComponents components, ItemMapping mapping, ItemMappings mappings) {
|
public ItemData.Builder translateToBedrock(int count, DataComponents components, ItemMapping mapping, ItemMappings mappings) {
|
||||||
PotionContents potionContents = components.get(DataComponentType.POTION_CONTENTS);
|
if (components != null) {
|
||||||
if (potionContents != null) {
|
PotionContents potionContents = components.get(DataComponentType.POTION_CONTENTS);
|
||||||
TippedArrowPotion tippedArrowPotion = TippedArrowPotion.of(potionContents.getPotionId());
|
if (potionContents != null) {
|
||||||
if (tippedArrowPotion != null) {
|
TippedArrowPotion tippedArrowPotion = TippedArrowPotion.of(potionContents.getPotionId());
|
||||||
return ItemData.builder()
|
if (tippedArrowPotion != null) {
|
||||||
.definition(mapping.getBedrockDefinition())
|
return ItemData.builder()
|
||||||
.damage(tippedArrowPotion.getBedrockId())
|
.definition(mapping.getBedrockDefinition())
|
||||||
.count(count);
|
.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);
|
return super.translateToBedrock(count, components, mapping, mappings);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue