mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
25f3b50f6b
By: md_5 <git@md-5.net>
37 lines
2.5 KiB
Diff
37 lines
2.5 KiB
Diff
--- a/net/minecraft/world/item/ItemFishingRod.java
|
|
+++ b/net/minecraft/world/item/ItemFishingRod.java
|
|
@@ -11,6 +11,8 @@
|
|
import net.minecraft.world.level.World;
|
|
import net.minecraft.world.level.gameevent.GameEvent;
|
|
|
|
+import org.bukkit.event.player.PlayerFishEvent; // CraftBukkit
|
|
+
|
|
public class ItemFishingRod extends Item implements ItemVanishable {
|
|
|
|
public ItemFishingRod(Item.Info item_info) {
|
|
@@ -33,12 +35,23 @@
|
|
world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
|
entityhuman.gameEvent(GameEvent.ITEM_INTERACT_FINISH);
|
|
} else {
|
|
- world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
|
+ // world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
|
if (!world.isClientSide) {
|
|
i = EnchantmentManager.getFishingSpeedBonus(itemstack);
|
|
int j = EnchantmentManager.getFishingLuckBonus(itemstack);
|
|
|
|
- world.addFreshEntity(new EntityFishingHook(entityhuman, world, j, i));
|
|
+ // CraftBukkit start
|
|
+ EntityFishingHook entityfishinghook = new EntityFishingHook(entityhuman, world, j, i);
|
|
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.FishHook) entityfishinghook.getBukkitEntity(), PlayerFishEvent.State.FISHING);
|
|
+ world.getCraftServer().getPluginManager().callEvent(playerFishEvent);
|
|
+
|
|
+ if (playerFishEvent.isCancelled()) {
|
|
+ entityhuman.fishing = null;
|
|
+ return InteractionResultWrapper.pass(itemstack);
|
|
+ }
|
|
+ world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
|
+ world.addFreshEntity(entityfishinghook);
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
|