SPIGOT-1319: Add EntityBreedEvent

By: Ryan Michela <deltahat@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2016-06-18 22:00:39 -07:00
parent 0628968019
commit 8e8c7d72aa
4 changed files with 63 additions and 5 deletions

View File

@@ -1,6 +1,14 @@
--- a/net/minecraft/server/EntityAnimal.java
+++ b/net/minecraft/server/EntityAnimal.java
@@ -40,6 +40,9 @@
@@ -7,6 +7,7 @@
protected Block bA;
private int bx;
private EntityHuman by;
+ public ItemStack breedItem; // CraftBukkit - Add breedItem variable
public EntityAnimal(World world) {
super(world);
@@ -40,6 +41,9 @@
}
@@ -10,7 +18,7 @@
public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable(damagesource)) {
return false;
@@ -48,6 +51,7 @@
@@ -48,6 +52,7 @@
return super.damageEntity(damagesource, f);
}
}
@@ -18,3 +26,11 @@
public float a(BlockPosition blockposition) {
return this.world.getType(blockposition.down()).getBlock() == Blocks.GRASS ? 10.0F : this.world.n(blockposition) - 0.5F;
@@ -120,6 +125,7 @@
public void c(EntityHuman entityhuman) {
this.bx = 600;
this.by = entityhuman;
+ this.breedItem = entityhuman.inventory.getItemInHand(); // CraftBukkit
this.world.broadcastEntityEffect(this, (byte) 18);
}