Paper/nms-patches/BehaviorMakeLove.patch

32 lines
1.7 KiB
Diff
Raw Normal View History

2019-04-23 04:00:00 +02:00
--- a/net/minecraft/server/BehaviorMakeLove.java
+++ b/net/minecraft/server/BehaviorMakeLove.java
2020-06-25 02:00:00 +02:00
@@ -93,6 +93,11 @@
2019-04-23 04:00:00 +02:00
2020-08-11 23:00:00 +02:00
private Optional<EntityVillager> b(WorldServer worldserver, EntityVillager entityvillager, EntityVillager entityvillager1) {
EntityVillager entityvillager2 = entityvillager.createChild(worldserver, entityvillager1);
2019-04-23 04:00:00 +02:00
+ // 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();
2020-06-25 02:00:00 +02:00
@@ -101,7 +106,7 @@
2019-04-23 04:00:00 +02:00
entityvillager1.setAgeRaw(6000);
entityvillager2.setAgeRaw(-24000);
2019-12-10 23:00:00 +01:00
entityvillager2.setPositionRotation(entityvillager.locX(), entityvillager.locY(), entityvillager.locZ(), 0.0F, 0.0F);
2020-08-11 23:00:00 +02:00
- worldserver.addAllEntities(entityvillager2);
+ worldserver.addAllEntities(entityvillager2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
worldserver.broadcastEntityEffect(entityvillager2, (byte) 12);
2019-04-23 04:00:00 +02:00
return Optional.of(entityvillager2);
}
2020-06-25 02:00:00 +02:00
@@ -110,6 +115,6 @@
2019-04-23 04:00:00 +02:00
private void a(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
2020-06-25 02:00:00 +02:00
GlobalPos globalpos = GlobalPos.create(worldserver.getDimensionKey(), blockposition);
2019-04-23 04:00:00 +02:00
2019-05-14 02:00:00 +02:00
- entityvillager.getBehaviorController().setMemory(MemoryModuleType.HOME, (Object) globalpos);
+ entityvillager.getBehaviorController().setMemory(MemoryModuleType.HOME, globalpos); // CraftBukkit - decompile error
2019-04-23 04:00:00 +02:00
}
}