PaperMC/nms-patches/BehaviorMakeLove.patch
2019-12-11 09:00:00 +11:00

31 lines
1.7 KiB
Diff

--- a/net/minecraft/server/BehaviorMakeLove.java
+++ b/net/minecraft/server/BehaviorMakeLove.java
@@ -100,6 +100,11 @@
private Optional<EntityVillager> a(EntityVillager entityvillager, EntityVillager entityvillager1) {
EntityVillager entityvillager2 = entityvillager.createChild(entityvillager1);
+ // CraftBukkit start - call EntityBreedEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityvillager2, entityvillager, entityvillager1, null, null, 0).isCancelled()) {
+ return Optional.empty();
+ }
+ // CraftBukkit end
if (entityvillager2 == null) {
return Optional.empty();
@@ -108,7 +113,7 @@
entityvillager1.setAgeRaw(6000);
entityvillager2.setAgeRaw(-24000);
entityvillager2.setPositionRotation(entityvillager.locX(), entityvillager.locY(), entityvillager.locZ(), 0.0F, 0.0F);
- entityvillager.world.addEntity(entityvillager2);
+ entityvillager.world.addEntity(entityvillager2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
entityvillager.world.broadcastEntityEffect(entityvillager2, (byte) 12);
return Optional.of(entityvillager2);
}
@@ -117,6 +122,6 @@
private void a(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
GlobalPos globalpos = GlobalPos.create(worldserver.getWorldProvider().getDimensionManager(), blockposition);
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.HOME, (Object) globalpos);
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.HOME, globalpos); // CraftBukkit - decompile error
}
}