SPIGOT-7518: Fix NullPointerException when calling Block#applyBoneMeal()
This commit is contained in:
parent
5a2d905aff
commit
864f616da6
@ -1,6 +1,6 @@
|
|||||||
--- a/net/minecraft/world/item/ItemBoneMeal.java
|
--- a/net/minecraft/world/item/ItemBoneMeal.java
|
||||||
+++ b/net/minecraft/world/item/ItemBoneMeal.java
|
+++ b/net/minecraft/world/item/ItemBoneMeal.java
|
||||||
@@ -34,6 +34,12 @@
|
@@ -34,13 +34,19 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
|
public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
|
||||||
@ -13,3 +13,20 @@
|
|||||||
World world = itemactioncontext.getLevel();
|
World world = itemactioncontext.getLevel();
|
||||||
BlockPosition blockposition = itemactioncontext.getClickedPos();
|
BlockPosition blockposition = itemactioncontext.getClickedPos();
|
||||||
BlockPosition blockposition1 = blockposition.relative(itemactioncontext.getClickedFace());
|
BlockPosition blockposition1 = blockposition.relative(itemactioncontext.getClickedFace());
|
||||||
|
|
||||||
|
if (growCrop(itemactioncontext.getItemInHand(), world, blockposition)) {
|
||||||
|
if (!world.isClientSide) {
|
||||||
|
- itemactioncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH);
|
||||||
|
+ if (itemactioncontext.getPlayer() != null) itemactioncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); // CraftBukkit - SPIGOT-7518
|
||||||
|
world.levelEvent(1505, blockposition, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -51,7 +57,7 @@
|
||||||
|
|
||||||
|
if (flag && growWaterPlant(itemactioncontext.getItemInHand(), world, blockposition1, itemactioncontext.getClickedFace())) {
|
||||||
|
if (!world.isClientSide) {
|
||||||
|
- itemactioncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH);
|
||||||
|
+ if (itemactioncontext.getPlayer() != null) itemactioncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); // CraftBukkit - SPIGOT-7518
|
||||||
|
world.levelEvent(1505, blockposition1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user