diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch new file mode 100644 index 0000000000..881e489080 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch @@ -0,0 +1,48 @@ +--- a/net/minecraft/world/item/BoneMealItem.java ++++ b/net/minecraft/world/item/BoneMealItem.java +@@ -33,16 +33,21 @@ + } + + @Override +- @Override +- public InteractionResult useOn(UseOnContext useoncontext) { +- Level level = useoncontext.getLevel(); +- BlockPos blockpos = useoncontext.getClickedPos(); +- BlockPos blockpos1 = blockpos.relative(useoncontext.getClickedFace()); ++ public InteractionResult useOn(UseOnContext context) { ++ // CraftBukkit start - extract bonemeal application logic to separate, static method ++ return applyBonemeal(context); ++ } + +- if (growCrop(useoncontext.getItemInHand(), level, blockpos)) { +- if (!level.isClientSide) { +- useoncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); +- level.levelEvent(1505, blockpos, 0); ++ public static InteractionResult applyBonemeal(UseOnContext itemactioncontext) { ++ // CraftBukkit end ++ Level world = itemactioncontext.getLevel(); ++ BlockPos blockposition = itemactioncontext.getClickedPos(); ++ BlockPos blockposition1 = blockposition.relative(itemactioncontext.getClickedFace()); ++ ++ if (growCrop(itemactioncontext.getItemInHand(), world, blockposition)) { ++ if (!world.isClientSide) { ++ if (itemactioncontext.getPlayer() != null) itemactioncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); // CraftBukkit - SPIGOT-7518 ++ world.levelEvent(1505, blockposition, 0); + } + + return InteractionResult.sidedSuccess(level.isClientSide); +@@ -50,10 +55,10 @@ + BlockState blockstate = level.getBlockState(blockpos); + boolean flag = blockstate.isFaceSturdy(level, blockpos, useoncontext.getClickedFace()); + +- if (flag && growWaterPlant(useoncontext.getItemInHand(), level, blockpos1, useoncontext.getClickedFace())) { +- if (!level.isClientSide) { +- useoncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); +- level.levelEvent(1505, blockpos1, 0); ++ if (flag && growWaterPlant(itemactioncontext.getItemInHand(), world, blockposition1, itemactioncontext.getClickedFace())) { ++ if (!world.isClientSide) { ++ if (itemactioncontext.getPlayer() != null) itemactioncontext.getPlayer().gameEvent(GameEvent.ITEM_INTERACT_FINISH); // CraftBukkit - SPIGOT-7518 ++ world.levelEvent(1505, blockposition1, 0); + } + + return InteractionResult.sidedSuccess(level.isClientSide); |