aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/entity/npc/EntityVillagerTrader.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/og/net/minecraft/world/entity/npc/EntityVillagerTrader.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/npc/EntityVillagerTrader.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/entity/npc/EntityVillagerTrader.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/npc/EntityVillagerTrader.patch b/patch-remap/og/net/minecraft/world/entity/npc/EntityVillagerTrader.patch
new file mode 100644
index 0000000000..13fa1f829d
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/npc/EntityVillagerTrader.patch
@@ -0,0 +1,42 @@
+--- a/net/minecraft/world/entity/npc/EntityVillagerTrader.java
++++ b/net/minecraft/world/entity/npc/EntityVillagerTrader.java
+@@ -47,6 +47,13 @@
+ import net.minecraft.world.phys.Vec3D;
+ import org.apache.commons.lang3.tuple.Pair;
+
++// CraftBukkit start
++import org.bukkit.Bukkit;
++import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe;
++import org.bukkit.entity.AbstractVillager;
++import org.bukkit.event.entity.VillagerAcquireTradeEvent;
++// CraftBukkit end
++
+ public class EntityVillagerTrader extends EntityVillagerAbstract {
+
+ private static final int NUMBER_OF_TRADE_OFFERS = 5;
+@@ -56,6 +63,7 @@
+
+ public EntityVillagerTrader(EntityTypes<? extends EntityVillagerTrader> entitytypes, World world) {
+ super(entitytypes, world);
++ this.setDespawnDelay(48000); // CraftBukkit - set default from MobSpawnerTrader
+ }
+
+ @Override
+@@ -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
+ }
+
+ }