@@ -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