mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
85c79bdde0
By: Parker Hawke <hawkeboyz2@hotmail.com>
32 lines
1.7 KiB
Diff
32 lines
1.7 KiB
Diff
--- a/net/minecraft/world/item/ItemBoneMeal.java
|
|
+++ b/net/minecraft/world/item/ItemBoneMeal.java
|
|
@@ -34,13 +34,19 @@
|
|
|
|
@Override
|
|
public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
|
|
+ // CraftBukkit start - extract bonemeal application logic to separate, static method
|
|
+ return applyBonemeal(itemactioncontext);
|
|
+ }
|
|
+
|
|
+ public static EnumInteractionResult applyBonemeal(ItemActionContext itemactioncontext) {
|
|
+ // CraftBukkit end
|
|
World world = itemactioncontext.getLevel();
|
|
BlockPosition blockposition = itemactioncontext.getClickedPos();
|
|
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);
|
|
}
|
|
|