3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00
Paper/src/main/java/net/minecraft/server/ItemFishingRod.java
2012-01-15 10:54:57 +01:00

40 Zeilen
1.2 KiB
Java

package net.minecraft.server;
import org.bukkit.event.player.PlayerFishEvent; // CraftBukkit
public class ItemFishingRod extends Item {
public ItemFishingRod(int i) {
super(i);
this.setMaxDurability(64);
this.e(1);
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.hookedFish != null) {
int i = entityhuman.hookedFish.j();
itemstack.damage(i, entityhuman);
entityhuman.s_();
} else {
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, PlayerFishEvent.State.FISHING);
world.getServer().getPluginManager().callEvent(playerFishEvent);
if (playerFishEvent.isCancelled()) {
return itemstack;
}
// CraftBukkit end
world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (c.nextFloat() * 0.4F + 0.8F));
if (!world.isStatic) {
world.addEntity(new EntityFishingHook(world, entityhuman));
}
entityhuman.s_();
}
return itemstack;
}
}