aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch
new file mode 100644
index 0000000000..cc2d211ac0
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch
@@ -0,0 +1,42 @@
+--- a/net/minecraft/world/item/FishingRodItem.java
++++ b/net/minecraft/world/item/FishingRodItem.java
+@@ -11,7 +11,13 @@
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.gameevent.GameEvent;
+
+-public class FishingRodItem extends Item implements Vanishable {
++// CraftBukkit start
++import org.bukkit.event.player.PlayerFishEvent;
++import org.bukkit.craftbukkit.CraftEquipmentSlot;
++// CraftBukkit end
++
++public class FishingRodItem extends Item implements ItemVanishable {
++
+ public FishingRodItem(Item.Properties properties) {
+ super(properties);
+ }
+@@ -48,9 +40,21 @@
+ 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)
+ );
+ if (!level.isClientSide) {
+- int i = EnchantmentHelper.getFishingSpeedBonus(itemInHand);
+- int fishingLuckBonus = EnchantmentHelper.getFishingLuckBonus(itemInHand);
+- level.addFreshEntity(new FishingHook(player, level, fishingLuckBonus, i));
++ i = EnchantmentHelper.getFishingSpeedBonus(itemstack);
++ int j = EnchantmentHelper.getFishingLuckBonus(itemstack);
++
++ // CraftBukkit start
++ FishingHook entityfishinghook = new FishingHook(player, level, j, i);
++ PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) player.getBukkitEntity(), null, (org.bukkit.entity.FishHook) entityfishinghook.getBukkitEntity(), CraftEquipmentSlot.getHand(hand), PlayerFishEvent.State.FISHING);
++ level.getCraftServer().getPluginManager().callEvent(playerFishEvent);
++
++ if (playerFishEvent.isCancelled()) {
++ player.fishing = null;
++ return InteractionResultHolder.pass(itemstack);
++ }
++ level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.FISHING_BOBBER_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F));
++ level.addFreshEntity(entityfishinghook);
++ // CraftBukkit end
+ }
+
+ player.awardStat(Stats.ITEM_USED.get(this));