mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 13:36:44 +01:00
Implement fishing experience. Adds BUKKIT-3348
This commit is contained in:
parent
fb0be1fc0a
commit
baaf8e1d86
1 changed files with 3 additions and 1 deletions
|
@ -333,6 +333,7 @@ public class EntityFishingHook extends Entity {
|
||||||
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
|
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
|
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
|
||||||
|
playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
|
||||||
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
this.world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||||
|
|
||||||
if (playerFishEvent.isCancelled()) {
|
if (playerFishEvent.isCancelled()) {
|
||||||
|
@ -353,7 +354,8 @@ public class EntityFishingHook extends Entity {
|
||||||
entityitem.motZ = d7 * d9;
|
entityitem.motZ = d7 * d9;
|
||||||
this.world.addEntity(entityitem);
|
this.world.addEntity(entityitem);
|
||||||
this.owner.a(StatisticList.B, 1);
|
this.owner.a(StatisticList.B, 1);
|
||||||
this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, this.random.nextInt(6) + 1));
|
// CraftBukkit - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
|
||||||
|
this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX, this.owner.locY + 0.5D, this.owner.locZ + 0.5D, playerFishEvent.getExpToDrop()));
|
||||||
b0 = 1;
|
b0 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue