@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/npc/EntityVillager.java
|
||||
+++ b/net/minecraft/world/entity/npc/EntityVillager.java
|
||||
@@ -91,6 +91,14 @@
|
||||
@@ -92,6 +92,14 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -149,7 +157,7 @@
|
||||
@@ -150,7 +158,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<EntityVillager> getBrain() {
|
||||
@@ -24,7 +24,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -232,7 +240,7 @@
|
||||
@@ -233,7 +241,7 @@
|
||||
this.increaseProfessionLevelOnUpdate = false;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,7 +368,13 @@
|
||||
@@ -361,7 +369,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
}
|
||||
|
||||
this.resendOffersToTradingPlayer();
|
||||
@@ -429,7 +443,13 @@
|
||||
@@ -430,7 +444,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,7 +509,7 @@
|
||||
@@ -490,7 +510,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -72,7 +72,7 @@
|
||||
Logger logger = EntityVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -833,7 +853,12 @@
|
||||
@@ -834,7 +854,12 @@
|
||||
}
|
||||
|
||||
entitywitch.setPersistenceRequired();
|
||||
@@ -86,16 +86,16 @@
|
||||
this.releaseAllPois();
|
||||
this.discard();
|
||||
} else {
|
||||
@@ -924,7 +949,7 @@
|
||||
@@ -933,7 +958,7 @@
|
||||
}).limit(5L).collect(Collectors.toList());
|
||||
|
||||
if (list1.size() >= j) {
|
||||
- if (SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EnumMobSpawn.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM).isPresent()) {
|
||||
+ if (SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EnumMobSpawn.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isPresent()) { // CraftBukkit
|
||||
- if (!SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EnumMobSpawn.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM).isEmpty()) {
|
||||
+ if (!SpawnUtil.trySpawnMob(EntityTypes.IRON_GOLEM, EnumMobSpawn.MOB_SUMMONED, worldserver, this.blockPosition(), 10, 8, 6, SpawnUtil.a.LEGACY_IRON_GOLEM, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_DEFENSE).isEmpty()) { // CraftBukkit
|
||||
list.forEach(SensorGolemLastSeen::golemDetected);
|
||||
}
|
||||
}
|
||||
@@ -981,7 +1006,7 @@
|
||||
@@ -990,7 +1015,7 @@
|
||||
@Override
|
||||
public void startSleeping(BlockPosition blockposition) {
|
||||
super.startSleeping(blockposition);
|
||||
@@ -104,7 +104,7 @@
|
||||
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
}
|
||||
@@ -989,7 +1014,7 @@
|
||||
@@ -998,7 +1023,7 @@
|
||||
@Override
|
||||
public void stopSleeping() {
|
||||
super.stopSleeping();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
|
||||
+++ b/net/minecraft/world/entity/npc/EntityVillagerAbstract.java
|
||||
@@ -36,8 +36,24 @@
|
||||
@@ -35,8 +35,24 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
private static final DataWatcherObject<Integer> DATA_UNHAPPY_COUNTER = DataWatcher.defineId(EntityVillagerAbstract.class, DataWatcherRegistry.INT);
|
||||
public static final int VILLAGER_SLOT_OFFSET = 300;
|
||||
private static final int VILLAGER_INVENTORY_SIZE = 8;
|
||||
@@ -45,7 +61,7 @@
|
||||
@@ -44,7 +60,7 @@
|
||||
private EntityHuman tradingPlayer;
|
||||
@Nullable
|
||||
protected MerchantRecipeList offers;
|
||||
@@ -34,8 +34,8 @@
|
||||
|
||||
public EntityVillagerAbstract(EntityTypes<? extends EntityVillagerAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -247,7 +263,16 @@
|
||||
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
|
||||
@@ -233,7 +249,16 @@
|
||||
MerchantRecipe merchantrecipe = ((VillagerTrades.IMerchantRecipeOption) arraylist.remove(this.random.nextInt(arraylist.size()))).getOffer(this, this.random);
|
||||
|
||||
if (merchantrecipe != null) {
|
||||
- merchantrecipelist.add(merchantrecipe);
|
||||
@@ -49,6 +49,6 @@
|
||||
+ merchantrecipelist.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
++j;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/npc/EntityVillagerTrader.java
|
||||
+++ b/net/minecraft/world/entity/npc/EntityVillagerTrader.java
|
||||
@@ -44,6 +44,13 @@
|
||||
import net.minecraft.world.level.World;
|
||||
@@ -47,6 +47,13 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
@@ -14,7 +14,7 @@
|
||||
public class EntityVillagerTrader extends EntityVillagerAbstract {
|
||||
|
||||
private static final int NUMBER_OF_TRADE_OFFERS = 5;
|
||||
@@ -53,6 +60,7 @@
|
||||
@@ -56,6 +63,7 @@
|
||||
|
||||
public EntityVillagerTrader(EntityTypes<? extends EntityVillagerTrader> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -22,21 +22,21 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,7 +138,16 @@
|
||||
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
|
||||
@@ -136,7 +144,16 @@
|
||||
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
|
||||
|
||||
if (merchantrecipe != null) {
|
||||
- merchantrecipelist.add(merchantrecipe);
|
||||
+ // CraftBukkit start
|
||||
+ VillagerAcquireTradeEvent event = new VillagerAcquireTradeEvent((AbstractVillager) getBukkitEntity(), merchantrecipe.asBukkit());
|
||||
+ // Suppress during worldgen
|
||||
+ if (this.valid) {
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (!event.isCancelled()) {
|
||||
+ merchantrecipelist.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (merchantrecipe != null) {
|
||||
- merchantrecipelist.add(merchantrecipe);
|
||||
+ // CraftBukkit start
|
||||
+ VillagerAcquireTradeEvent event = new VillagerAcquireTradeEvent((AbstractVillager) getBukkitEntity(), merchantrecipe.asBukkit());
|
||||
+ // Suppress during worldgen
|
||||
+ if (this.valid) {
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ if (!event.isCancelled()) {
|
||||
+ merchantrecipelist.add(CraftMerchantRecipe.fromBukkit(event.getRecipe()).toMinecraft());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user