diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/world/item/ItemFishingRod.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/world/item/ItemFishingRod.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/item/ItemFishingRod.patch b/patch-remap/og/net/minecraft/world/item/ItemFishingRod.patch new file mode 100644 index 0000000000..e35b245432 --- /dev/null +++ b/patch-remap/og/net/minecraft/world/item/ItemFishingRod.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/world/item/ItemFishingRod.java ++++ b/net/minecraft/world/item/ItemFishingRod.java +@@ -11,6 +11,11 @@ + import net.minecraft.world.level.World; + import net.minecraft.world.level.gameevent.GameEvent; + ++// CraftBukkit start ++import org.bukkit.event.player.PlayerFishEvent; ++import org.bukkit.craftbukkit.CraftEquipmentSlot; ++// CraftBukkit end ++ + public class ItemFishingRod extends Item implements ItemVanishable { + + public ItemFishingRod(Item.Info item_info) { +@@ -33,12 +38,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(), CraftEquipmentSlot.getHand(enumhand), 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)); |