--- a/net/minecraft/world/item/BoneMealItem.java
+++ b/net/minecraft/world/item/BoneMealItem.java
@@ -33,12 +_,17 @@
 
     @Override
     public InteractionResult useOn(UseOnContext context) {
+        // CraftBukkit start - extract bonemeal application logic to separate, static method
+        return BoneMealItem.applyBonemeal(context);
+    }
+    public static InteractionResult applyBonemeal(UseOnContext context) {
+        // CraftBukkit end
         Level level = context.getLevel();
         BlockPos clickedPos = context.getClickedPos();
         BlockPos blockPos = clickedPos.relative(context.getClickedFace());
         if (growCrop(context.getItemInHand(), level, clickedPos)) {
             if (!level.isClientSide) {
-                context.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH);
+                if (context.getPlayer() != null) context.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); // CraftBukkit - SPIGOT-7518
                 level.levelEvent(1505, clickedPos, 15);
             }
 
@@ -48,7 +_,7 @@
             boolean isFaceSturdy = blockState.isFaceSturdy(level, clickedPos, context.getClickedFace());
             if (isFaceSturdy && growWaterPlant(context.getItemInHand(), level, blockPos, context.getClickedFace())) {
                 if (!level.isClientSide) {
-                    context.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH);
+                    if (context.getPlayer() != null) context.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); // CraftBukkit - SPIGOT-7518
                     level.levelEvent(1505, blockPos, 15);
                 }
 
