| 
									
										
										
										
											2015-05-25 20:37:24 +10:00
										 |  |  | --- a/net/minecraft/server/EntityVillager.java
 | 
					
						
							|  |  |  | +++ b/net/minecraft/server/EntityVillager.java
 | 
					
						
							| 
									
										
										
										
											2019-06-21 20:00:00 +10:00
										 |  |  | @@ -16,6 +16,16 @@
 | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |  import java.util.function.BiPredicate; | 
					
						
							|  |  |  |  import java.util.stream.Collectors; | 
					
						
							| 
									
										
										
										
											2016-05-10 21:47:39 +10:00
										 |  |  |  import javax.annotation.Nullable; | 
					
						
							|  |  |  | +// CraftBukkit start
 | 
					
						
							| 
									
										
										
										
											2016-03-01 08:32:46 +11:00
										 |  |  | +import org.bukkit.Bukkit;
 | 
					
						
							| 
									
										
										
										
											2016-05-10 21:47:39 +10:00
										 |  |  | +import org.bukkit.craftbukkit.entity.CraftVillager;
 | 
					
						
							| 
									
										
										
										
											2018-11-14 14:10:22 +11:00
										 |  |  | +import org.bukkit.craftbukkit.event.CraftEventFactory;
 | 
					
						
							| 
									
										
										
										
											2016-03-01 08:32:46 +11:00
										 |  |  | +import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe;
 | 
					
						
							|  |  |  | +import org.bukkit.entity.Villager;
 | 
					
						
							| 
									
										
										
										
											2018-11-14 14:10:22 +11:00
										 |  |  | +import org.bukkit.event.entity.EntityTransformEvent;
 | 
					
						
							| 
									
										
										
										
											2016-03-01 08:32:46 +11:00
										 |  |  | +import org.bukkit.event.entity.VillagerAcquireTradeEvent;
 | 
					
						
							|  |  |  | +import org.bukkit.event.entity.VillagerReplenishTradeEvent;
 | 
					
						
							| 
									
										
										
										
											2016-05-10 21:47:39 +10:00
										 |  |  | +// CraftBukkit end
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |  public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder { | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2019-07-20 09:00:00 +10:00
										 |  |  | @@ -60,7 +70,7 @@
 | 
					
						
							| 
									
										
										
										
											2014-11-26 08:32:16 +11:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |      @Override | 
					
						
							|  |  |  |      public BehaviorController<EntityVillager> getBehaviorController() { | 
					
						
							|  |  |  | -        return super.getBehaviorController();
 | 
					
						
							|  |  |  | +        return (BehaviorController<EntityVillager>) super.getBehaviorController(); // CraftBukkit - decompile error
 | 
					
						
							|  |  |  |      } | 
					
						
							| 
									
										
										
										
											2016-03-01 08:32:46 +11:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |      @Override | 
					
						
							| 
									
										
										
										
											2019-07-20 09:00:00 +10:00
										 |  |  | @@ -124,7 +134,7 @@
 | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |      @Override | 
					
						
							|  |  |  |      protected void mobTick() { | 
					
						
							|  |  |  |          this.world.getMethodProfiler().enter("brain"); | 
					
						
							|  |  |  | -        this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this);
 | 
					
						
							|  |  |  | +        this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error
 | 
					
						
							|  |  |  |          this.world.getMethodProfiler().exit(); | 
					
						
							| 
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 |  |  |          if (!this.et() && this.bB > 0) { | 
					
						
							|  |  |  |              --this.bB; | 
					
						
							| 
									
										
										
										
											2019-07-20 09:00:00 +10:00
										 |  |  | @@ -134,7 +144,7 @@
 | 
					
						
							| 
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 |  |  |                      this.bC = false; | 
					
						
							| 
									
										
										
										
											2018-07-20 16:04:37 +10:00
										 |  |  |                  } | 
					
						
							|  |  |  |   | 
					
						
							|  |  |  | -                this.addEffect(new MobEffect(MobEffects.REGENERATION, 200, 0));
 | 
					
						
							|  |  |  | +                this.addEffect(new MobEffect(MobEffects.REGENERATION, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.VILLAGER_TRADE); // CraftBukkit
 | 
					
						
							|  |  |  |              } | 
					
						
							|  |  |  |          } | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 |  |  | @@ -353,7 +363,14 @@
 | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |              while (iterator.hasNext()) { | 
					
						
							|  |  |  |                  MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next(); | 
					
						
							| 
									
										
										
										
											2016-03-01 08:32:46 +11:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2019-05-14 10:00:00 +10:00
										 |  |  | -                merchantrecipe.increaseSpecialPrice(-MathHelper.d((float) i * merchantrecipe.getPriceMultiplier()));
 | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  | +                // CraftBukkit start
 | 
					
						
							| 
									
										
										
										
											2019-05-14 10:00:00 +10:00
										 |  |  | +                int bonus = -MathHelper.d((float) i * merchantrecipe.getPriceMultiplier());
 | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  | +                VillagerReplenishTradeEvent event = new VillagerReplenishTradeEvent((Villager) this.getBukkitEntity(), merchantrecipe.asBukkit(), bonus);
 | 
					
						
							|  |  |  | +                Bukkit.getPluginManager().callEvent(event);
 | 
					
						
							|  |  |  | +                if (!event.isCancelled()) {
 | 
					
						
							| 
									
										
										
										
											2019-05-14 10:00:00 +10:00
										 |  |  | +                    merchantrecipe.increaseSpecialPrice(event.getBonus());
 | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  | +                }
 | 
					
						
							|  |  |  | +                // CraftBukkit end
 | 
					
						
							| 
									
										
										
										
											2018-11-14 14:10:22 +11:00
										 |  |  |              } | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |          } | 
					
						
							| 
									
										
										
										
											2018-11-14 14:10:22 +11:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2019-12-18 08:00:00 +11:00
										 |  |  | @@ -661,7 +678,12 @@
 | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |              entitywitch.setCustomNameVisible(this.getCustomNameVisible()); | 
					
						
							| 
									
										
										
										
											2018-11-14 14:10:22 +11:00
										 |  |  |          } | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |   | 
					
						
							|  |  |  | -        this.world.addEntity(entitywitch);
 | 
					
						
							|  |  |  | +        // CraftBukkit start
 | 
					
						
							|  |  |  | +        if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
 | 
					
						
							|  |  |  | +            return;
 | 
					
						
							|  |  |  | +        }
 | 
					
						
							|  |  |  | +        this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
 | 
					
						
							|  |  |  | +        // CraftBukkit end
 | 
					
						
							|  |  |  |          this.die(); | 
					
						
							| 
									
										
										
										
											2018-11-14 14:17:25 +11:00
										 |  |  |      } | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2019-12-18 08:00:00 +11:00
										 |  |  | @@ -811,7 +833,7 @@
 | 
					
						
							| 
									
										
										
										
											2019-06-21 20:00:00 +10:00
										 |  |  |      } | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2019-06-21 20:00:00 +10:00
										 |  |  |      private void b(long i) { | 
					
						
							| 
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 |  |  | -        this.bo.setMemory(MemoryModuleType.GOLEM_LAST_SEEN_TIME, (Object) i);
 | 
					
						
							|  |  |  | +        this.bo.setMemory(MemoryModuleType.GOLEM_LAST_SEEN_TIME, i); // CraftBukkit - decompile error
 | 
					
						
							| 
									
										
										
										
											2019-06-21 20:00:00 +10:00
										 |  |  |      } | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2019-06-21 20:00:00 +10:00
										 |  |  |      private boolean c(long i) { | 
					
						
							| 
									
										
										
										
											2019-12-18 08:00:00 +11:00
										 |  |  | @@ -860,7 +882,7 @@
 | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |   | 
					
						
							| 
									
										
										
										
											2019-06-21 20:00:00 +10:00
										 |  |  |                  if (entityirongolem != null) { | 
					
						
							|  |  |  |                      if (entityirongolem.a((GeneratorAccess) this.world, EnumMobSpawn.MOB_SUMMONED) && entityirongolem.a((IWorldReader) this.world)) { | 
					
						
							|  |  |  | -                        this.world.addEntity(entityirongolem);
 | 
					
						
							|  |  |  | +                        this.world.addEntity(entityirongolem, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE); // CraftBukkit
 | 
					
						
							|  |  |  |                          return entityirongolem; | 
					
						
							|  |  |  |                      } | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2019-12-18 08:00:00 +11:00
										 |  |  | @@ -922,13 +944,13 @@
 | 
					
						
							| 
									
										
										
										
											2019-06-21 20:00:00 +10:00
										 |  |  |      @Override | 
					
						
							| 
									
										
										
										
											2019-12-11 09:00:00 +11:00
										 |  |  |      public void entitySleep(BlockPosition blockposition) { | 
					
						
							|  |  |  |          super.entitySleep(blockposition); | 
					
						
							|  |  |  | -        this.bo.setMemory(MemoryModuleType.LAST_SLEPT, (Object) MinecraftSerializableLong.a(this.world.getTime()));
 | 
					
						
							|  |  |  | +        this.bo.setMemory(MemoryModuleType.LAST_SLEPT, MinecraftSerializableLong.a(this.world.getTime())); // CraftBukkit - decompile error
 | 
					
						
							|  |  |  |      } | 
					
						
							|  |  |  |   | 
					
						
							|  |  |  |      @Override | 
					
						
							|  |  |  |      public void entityWakeup() { | 
					
						
							|  |  |  |          super.entityWakeup(); | 
					
						
							|  |  |  | -        this.bo.setMemory(MemoryModuleType.LAST_WOKEN, (Object) MinecraftSerializableLong.a(this.world.getTime()));
 | 
					
						
							|  |  |  | +        this.bo.setMemory(MemoryModuleType.LAST_WOKEN, MinecraftSerializableLong.a(this.world.getTime())); // CraftBukkit - decompile error
 | 
					
						
							| 
									
										
										
										
											2019-04-23 12:00:00 +10:00
										 |  |  |      } | 
					
						
							|  |  |  |   | 
					
						
							| 
									
										
										
										
											2019-06-21 20:00:00 +10:00
										 |  |  |      private boolean d(long i) { |