aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/npc/WanderingTraderSpawner.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/npc/WanderingTraderSpawner.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/npc/WanderingTraderSpawner.java.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/npc/WanderingTraderSpawner.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/npc/WanderingTraderSpawner.java.patch
new file mode 100644
index 0000000000..7be38ff45b
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/npc/WanderingTraderSpawner.java.patch
@@ -0,0 +1,47 @@
+--- a/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
++++ b/net/minecraft/world/entity/npc/WanderingTraderSpawner.java
+@@ -101,16 +110,17 @@
+ return false;
+ }
+
+- WanderingTrader wanderingTrader = EntityType.WANDERING_TRADER.spawn(serverLevel, blockPos2, MobSpawnType.EVENT);
+- if (wanderingTrader != null) {
+- for (int i1 = 0; i1 < 2; i1++) {
+- this.tryToSpawnLlamaFor(serverLevel, wanderingTrader, 4);
++ WanderingTrader entityvillagertrader = (WanderingTrader) EntityType.WANDERING_TRADER.spawn(serverLevel, blockposition2, EnumMobSpawn.EVENT, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
++
++ if (entityvillagertrader != null) {
++ for (int i = 0; i < 2; ++i) {
++ this.tryToSpawnLlamaFor(serverLevel, entityvillagertrader, 4);
+ }
+
+- this.serverLevelData.setWanderingTraderId(wanderingTrader.getUUID());
+- wanderingTrader.setDespawnDelay(48000);
+- wanderingTrader.setWanderTarget(blockPos1);
+- wanderingTrader.restrictTo(blockPos1, 16);
++ this.serverLevelData.setWanderingTraderId(entityvillagertrader.getUUID());
++ // entityvillagertrader.setDespawnDelay(48000); // CraftBukkit - moved to EntityVillagerTrader constructor. This lets the value be modified by plugins on CreatureSpawnEvent
++ entityvillagertrader.setWanderTarget(blockposition1);
++ entityvillagertrader.restrictTo(blockposition1, 16);
+ return true;
+ }
+ }
+@@ -120,11 +130,13 @@
+ }
+
+ private void tryToSpawnLlamaFor(ServerLevel serverLevel, WanderingTrader trader, int maxDistance) {
+- BlockPos blockPos = this.findSpawnPositionNear(serverLevel, trader.blockPosition(), maxDistance);
+- if (blockPos != null) {
+- TraderLlama traderLlama = EntityType.TRADER_LLAMA.spawn(serverLevel, blockPos, MobSpawnType.EVENT);
+- if (traderLlama != null) {
+- traderLlama.setLeashedTo(trader, true);
++ BlockPos blockposition = this.findSpawnPositionNear(serverLevel, trader.blockPosition(), maxDistance);
++
++ if (blockposition != null) {
++ TraderLlama entityllamatrader = (TraderLlama) EntityType.TRADER_LLAMA.spawn(serverLevel, blockposition, EnumMobSpawn.EVENT, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
++
++ if (entityllamatrader != null) {
++ entityllamatrader.setLeashedTo(trader, true);
+ }
+ }
+ }