aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch
new file mode 100644
index 0000000000..8dec6340c2
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/BoneMealItem.java.patch
@@ -0,0 +1,47 @@
+--- a/net/minecraft/world/item/BoneMealItem.java
++++ b/net/minecraft/world/item/BoneMealItem.java
+@@ -34,23 +34,31 @@
+
+ @Override
+ public InteractionResult useOn(UseOnContext context) {
+- 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);
+- level.levelEvent(1505, clickedPos, 0);
++ // CraftBukkit start - extract bonemeal application logic to separate, static method
++ return applyBonemeal(context);
++ }
++
++ 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);
+ } else {
+- BlockState blockState = level.getBlockState(clickedPos);
+- 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);
+- level.levelEvent(1505, blockPos, 0);
++ IBlockData iblockdata = world.getBlockState(blockposition);
++ boolean flag = iblockdata.isFaceSturdy(world, blockposition, itemactioncontext.getClickedFace());
++
++ 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);