craftbukkit/nms-patches/net/minecraft/world/item/ItemFishingRod.patch

38 lines
2.5 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/item/ItemFishingRod.java
+++ b/net/minecraft/world/item/ItemFishingRod.java
2021-06-11 15:00:00 +10:00
@@ -12,6 +12,8 @@
2021-03-16 09:00:00 +11:00
import net.minecraft.world.level.World;
2021-06-11 15:00:00 +10:00
import net.minecraft.world.level.gameevent.GameEvent;
+import org.bukkit.event.player.PlayerFishEvent; // CraftBukkit
+
2020-06-25 10:00:00 +10:00
public class ItemFishingRod extends Item implements ItemVanishable {
2018-07-15 10:00:00 +10:00
public ItemFishingRod(Item.Info item_info) {
2021-06-11 15:00:00 +10:00
@@ -34,12 +36,23 @@
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
world.a((Entity) entityhuman, GameEvent.FISHING_ROD_REEL_IN, (Entity) entityhuman);
} else {
2021-06-11 15:00:00 +10:00
- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
+ // world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
2015-02-26 22:41:06 +00:00
if (!world.isClientSide) {
2019-04-23 12:00:00 +10:00
i = EnchantmentManager.c(itemstack);
int j = EnchantmentManager.b(itemstack);
2016-12-21 07:00:00 +11:00
2019-04-23 12:00:00 +10:00
- world.addEntity(new EntityFishingHook(entityhuman, world, j, i));
2016-12-21 07:00:00 +11:00
+ // CraftBukkit start
2019-04-23 12:00:00 +10:00
+ EntityFishingHook entityfishinghook = new EntityFishingHook(entityhuman, world, j, i);
2018-07-15 10:00:00 +10:00
+ 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);
2016-11-17 12:41:03 +11:00
+
+ if (playerFishEvent.isCancelled()) {
2021-06-11 15:00:00 +10:00
+ entityhuman.fishing = null;
2021-03-16 09:00:00 +11:00
+ return InteractionResultWrapper.pass(itemstack);
2016-11-17 12:41:03 +11:00
+ }
2021-06-11 15:00:00 +10:00
+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
2019-04-23 12:00:00 +10:00
+ world.addEntity(entityfishinghook);
2016-11-17 12:41:03 +11:00
+ // CraftBukkit end
}
2016-12-21 07:00:00 +11:00
2019-12-11 09:00:00 +11:00
entityhuman.b(StatisticList.ITEM_USED.b(this));