2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/item/ItemFishingRod.java
|
|
|
|
+++ b/net/minecraft/world/item/ItemFishingRod.java
|
2022-10-02 00:07:14 +02:00
|
|
|
@@ -11,6 +11,11 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.level.World;
|
2021-06-11 07:00:00 +02:00
|
|
|
import net.minecraft.world.level.gameevent.GameEvent;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2022-10-02 00:07:14 +02:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.event.player.PlayerFishEvent;
|
|
|
|
+import org.bukkit.craftbukkit.CraftEquipmentSlot;
|
|
|
|
+// CraftBukkit end
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2020-06-25 02:00:00 +02:00
|
|
|
public class ItemFishingRod extends Item implements ItemVanishable {
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
public ItemFishingRod(Item.Info item_info) {
|
2022-10-02 00:07:14 +02:00
|
|
|
@@ -33,12 +38,23 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
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));
|
2022-06-07 18:00:00 +02:00
|
|
|
entityhuman.gameEvent(GameEvent.ITEM_INTERACT_FINISH);
|
2014-11-25 22:32:16 +01:00
|
|
|
} else {
|
2021-11-21 23:00:00 +01:00
|
|
|
- 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));
|
2015-02-26 23:41:06 +01:00
|
|
|
if (!world.isClientSide) {
|
2021-11-21 23:00:00 +01:00
|
|
|
i = EnchantmentManager.getFishingSpeedBonus(itemstack);
|
|
|
|
int j = EnchantmentManager.getFishingLuckBonus(itemstack);
|
2016-12-20 21:00:00 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
- world.addFreshEntity(new EntityFishingHook(entityhuman, world, j, i));
|
2016-12-20 21:00:00 +01:00
|
|
|
+ // CraftBukkit start
|
2019-04-23 04:00:00 +02:00
|
|
|
+ EntityFishingHook entityfishinghook = new EntityFishingHook(entityhuman, world, j, i);
|
2022-10-02 00:07:14 +02:00
|
|
|
+ PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.FishHook) entityfishinghook.getBukkitEntity(), CraftEquipmentSlot.getHand(enumhand), PlayerFishEvent.State.FISHING);
|
2021-06-11 13:33:49 +02:00
|
|
|
+ world.getCraftServer().getPluginManager().callEvent(playerFishEvent);
|
2016-11-17 02:41:03 +01:00
|
|
|
+
|
|
|
|
+ if (playerFishEvent.isCancelled()) {
|
2021-06-11 07:00:00 +02:00
|
|
|
+ entityhuman.fishing = null;
|
2021-03-15 23:00:00 +01:00
|
|
|
+ return InteractionResultWrapper.pass(itemstack);
|
2016-11-17 02:41:03 +01:00
|
|
|
+ }
|
2021-11-21 23:00:00 +01:00
|
|
|
+ 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);
|
2016-11-17 02:41:03 +01:00
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
2016-12-20 21:00:00 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
entityhuman.awardStat(StatisticList.ITEM_USED.get(this));
|