diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch new file mode 100644 index 0000000000..e7042e73eb --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/item/FishingRodItem.java.patch @@ -0,0 +1,34 @@ +--- a/net/minecraft/world/item/FishingRodItem.java ++++ b/net/minecraft/world/item/FishingRodItem.java +@@ -11,7 +11,10 @@ + 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 FishingRodItem(Item.Properties item_properties) { + super(item_properties); +@@ -39,7 +43,18 @@ + i = EnchantmentHelper.getFishingSpeedBonus(itemstack); + int j = EnchantmentHelper.getFishingLuckBonus(itemstack); + +- level.addFreshEntity(new FishingHook(player, level, j, i)); ++ // 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)); |