2011-07-03 06:28:29 +02:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
import org.bukkit.event.player.PlayerFishEvent; // CraftBukkit
|
|
|
|
|
|
|
|
public class ItemFishingRod extends Item {
|
|
|
|
|
|
|
|
public ItemFishingRod(int i) {
|
|
|
|
super(i);
|
2012-01-14 21:03:48 +01:00
|
|
|
this.setMaxDurability(64);
|
2011-11-20 09:01:14 +01:00
|
|
|
this.e(1);
|
2011-07-03 06:28:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
|
|
|
|
if (entityhuman.hookedFish != null) {
|
2012-03-01 11:49:23 +01:00
|
|
|
int i = entityhuman.hookedFish.k();
|
2011-07-03 06:28:29 +02:00
|
|
|
|
|
|
|
itemstack.damage(i, entityhuman);
|
2012-03-22 21:39:39 +01:00
|
|
|
entityhuman.C_();
|
2011-07-03 06:28:29 +02:00
|
|
|
} else {
|
|
|
|
// CraftBukkit start
|
2012-01-14 23:02:10 +01:00
|
|
|
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, PlayerFishEvent.State.FISHING);
|
2011-07-03 06:28:29 +02:00
|
|
|
world.getServer().getPluginManager().callEvent(playerFishEvent);
|
|
|
|
|
|
|
|
if (playerFishEvent.isCancelled()) {
|
|
|
|
return itemstack;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2011-11-20 09:01:14 +01:00
|
|
|
|
|
|
|
world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (c.nextFloat() * 0.4F + 0.8F));
|
2011-07-03 06:28:29 +02:00
|
|
|
if (!world.isStatic) {
|
2011-09-24 23:03:31 +02:00
|
|
|
world.addEntity(new EntityFishingHook(world, entityhuman));
|
2011-07-03 06:28:29 +02:00
|
|
|
}
|
|
|
|
|
2012-03-22 21:39:39 +01:00
|
|
|
entityhuman.C_();
|
2011-07-03 06:28:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return itemstack;
|
|
|
|
}
|
|
|
|
}
|