diff options
Diffstat (limited to 'nms-patches')
-rw-r--r-- | nms-patches/EntityAnimal.patch | 20 | ||||
-rw-r--r-- | nms-patches/PathfinderGoalBreed.patch | 25 | ||||
-rw-r--r-- | nms-patches/PathfinderGoalMakeLove.patch | 14 |
3 files changed, 54 insertions, 5 deletions
diff --git a/nms-patches/EntityAnimal.patch b/nms-patches/EntityAnimal.patch index aae4904d..03998da2 100644 --- a/nms-patches/EntityAnimal.patch +++ b/nms-patches/EntityAnimal.patch @@ -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); + } + diff --git a/nms-patches/PathfinderGoalBreed.patch b/nms-patches/PathfinderGoalBreed.patch index 3f74b1ac..e928ca43 100644 --- a/nms-patches/PathfinderGoalBreed.patch +++ b/nms-patches/PathfinderGoalBreed.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/PathfinderGoalBreed.java +++ b/net/minecraft/server/PathfinderGoalBreed.java -@@ -69,6 +69,11 @@ +@@ -69,11 +69,23 @@ EntityAgeable entityageable = this.animal.createChild(this.partner); if (entityageable != null) { @@ -12,7 +12,19 @@ EntityHuman entityhuman = this.animal.getBreedCause(); if (entityhuman == null && this.partner.getBreedCause() != null) { -@@ -88,7 +93,7 @@ + entityhuman = this.partner.getBreedCause(); + } ++ // CraftBukkit start - call EntityBreedEvent ++ int experience = this.animal.getRandom().nextInt(7) + 1; ++ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityageable, animal, partner, entityhuman, this.animal.breedItem, experience); ++ if (entityBreedEvent.isCancelled()) { ++ return; ++ } ++ // CraftBukkit end + + if (entityhuman != null) { + entityhuman.b(StatisticList.C); +@@ -88,7 +100,7 @@ this.partner.resetLove(); entityageable.setAgeRaw(-24000); entityageable.setPositionRotation(this.animal.locX, this.animal.locY, this.animal.locZ, 0.0F, 0.0F); @@ -21,3 +33,12 @@ Random random = this.animal.getRandom(); for (int i = 0; i < 7; ++i) { +@@ -103,7 +115,7 @@ + } + + if (this.a.getGameRules().getBoolean("doMobLoot")) { +- this.a.addEntity(new EntityExperienceOrb(this.a, this.animal.locX, this.animal.locY, this.animal.locZ, random.nextInt(7) + 1)); ++ this.a.addEntity(new EntityExperienceOrb(this.a, this.animal.locX, this.animal.locY, this.animal.locZ, entityBreedEvent.getExperience())); // CraftBukkit - use event experience + } + + } diff --git a/nms-patches/PathfinderGoalMakeLove.patch b/nms-patches/PathfinderGoalMakeLove.patch index 400761c0..d7269cd0 100644 --- a/nms-patches/PathfinderGoalMakeLove.patch +++ b/nms-patches/PathfinderGoalMakeLove.patch @@ -1,6 +1,18 @@ --- a/net/minecraft/server/PathfinderGoalMakeLove.java +++ b/net/minecraft/server/PathfinderGoalMakeLove.java -@@ -87,7 +87,7 @@ +@@ -80,6 +80,11 @@ + + private void i() { + EntityVillager entityvillager = this.b.b((EntityAgeable) this.c); ++ // CraftBukkit start - call EntityBreedEvent ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityvillager, this.b, this.c, null, null, 0).isCancelled()) { ++ return; ++ } ++ // CraftBukkit end + + this.c.setAgeRaw(6000); + this.b.setAgeRaw(6000); +@@ -87,7 +92,7 @@ this.b.s(false); entityvillager.setAgeRaw(-24000); entityvillager.setPositionRotation(this.b.locX, this.b.locY, this.b.locZ, 0.0F, 0.0F); |