@@ -5,10 +5,10 @@ Subject: [PATCH] Villagers follow emerald blocks
55
66
77diff --git a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
8- index 75d8fe03558ba38caf46c826dfea5208f88bde52..46022a0aabc9c319deeb75913d356eeb74f1a12c 100644
8+ index 4bb7a8955182d786a09fd2667b37a93373ff47be..bead2f6800bdc404228500c12caf326559fa47de 100644
99--- a/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
1010+++ b/net/minecraft/world/entity/ai/attributes/DefaultAttributes.java
11- @@ -162 ,7 +162 ,7 @@ public class DefaultAttributes {
11+ @@ -164 ,7 +164 ,7 @@ public class DefaultAttributes {
1212 .put(EntityType.VILLAGER, Villager.createAttributes().build())
1313 .put(EntityType.VINDICATOR, Vindicator.createAttributes().build())
1414 .put(EntityType.WARDEN, Warden.createAttributes().build())
@@ -18,10 +18,10 @@ index 75d8fe03558ba38caf46c826dfea5208f88bde52..46022a0aabc9c319deeb75913d356eeb
1818 .put(EntityType.WITHER, WitherBoss.createAttributes().build())
1919 .put(EntityType.WITHER_SKELETON, AbstractSkeleton.createAttributes().build())
2020diff --git a/net/minecraft/world/entity/ai/goal/TemptGoal.java b/net/minecraft/world/entity/ai/goal/TemptGoal.java
21- index 438d6347778a94b4fe430320b268a2d67afa209a..f88f618d34fb343b31de3af1a875d6633703df71 100644
21+ index dae935cc68e2e571d50e56ac8913c099a11cf771..a805c9426630c2c46db9d0dd536f1d16769395d3 100644
2222--- a/net/minecraft/world/entity/ai/goal/TemptGoal.java
2323+++ b/net/minecraft/world/entity/ai/goal/TemptGoal.java
24- @@ -58 ,7 +58 ,7 @@ public class TemptGoal extends Goal {
24+ @@ -71 ,7 +71 ,7 @@ public class TemptGoal extends Goal {
2525 }
2626
2727 private boolean shouldFollow(LivingEntity entity) {
@@ -31,10 +31,10 @@ index 438d6347778a94b4fe430320b268a2d67afa209a..f88f618d34fb343b31de3af1a875d663
3131
3232 @Override
3333diff --git a/net/minecraft/world/entity/npc/AbstractVillager.java b/net/minecraft/world/entity/npc/AbstractVillager.java
34- index 1d3381f1481bb2b192bb78462c85c2a185d94ad5..e574c38e1c1c13fc2f96340138f784697cef8c48 100644
34+ index f8782cdcf3015cad2693663a3c222bd60822f45b..d1a77544df7bcaa5f1dbca3139324107d687ae0d 100644
3535--- a/net/minecraft/world/entity/npc/AbstractVillager.java
3636+++ b/net/minecraft/world/entity/npc/AbstractVillager.java
37- @@ -35,6 +35,7 @@ import net.minecraft.world.level.portal.TeleportTransition ;
37+ @@ -35,6 +35,7 @@ import net.minecraft.world.level.storage.ValueOutput ;
3838 import net.minecraft.world.phys.Vec3;
3939
4040 public abstract class AbstractVillager extends AgeableMob implements InventoryCarrier, Npc, Merchant {
@@ -43,26 +43,26 @@ index 1d3381f1481bb2b192bb78462c85c2a185d94ad5..e574c38e1c1c13fc2f96340138f78469
4343 public static final int VILLAGER_SLOT_OFFSET = 300;
4444 private static final int VILLAGER_INVENTORY_SIZE = 8;
4545diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
46- index b2687ee9494d491971fa4124382b214d7c3ba9be..005af720a6385056f09f939813e97c10a7414a91 100644
46+ index b91c7bdfa4df80bf52ed714efc877a30cdcb3f36..4a68a8124716a57801f2d42a87e4d68c99d2f348 100644
4747--- a/net/minecraft/world/entity/npc/Villager.java
4848+++ b/net/minecraft/world/entity/npc/Villager.java
49- @@ -268 ,6 +268 ,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
49+ @@ -269 ,6 +269 ,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
5050 @Override
5151 protected void registerGoals() {
5252 this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this));
5353+ if (level().purpurConfig.villagerFollowEmeraldBlock) this.goalSelector.addGoal(3, new net.minecraft.world.entity.ai.goal.TemptGoal(this, 1.0D, TEMPT_ITEMS, false)); // Purpur - Villagers follow emerald blocks
5454 }
5555 // Purpur end - Ridables
5656
57- @@ -276 ,6 +277 ,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
57+ @@ -277 ,6 +278 ,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
5858 public void initAttributes() {
5959 this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.villagerMaxHealth);
6060 this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.villagerScale);
6161+ this.getAttribute(Attributes.TEMPT_RANGE).setBaseValue(this.level().purpurConfig.villagerTemptRange); // Purpur - Villagers follow emerald blocks
6262 }
6363 // Purpur end - Configurable entity base attributes
6464
65- @@ -344 ,7 +346 ,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
65+ @@ -345 ,7 +347 ,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
6666 }
6767
6868 public static AttributeSupplier.Builder createAttributes() {
@@ -72,10 +72,10 @@ index b2687ee9494d491971fa4124382b214d7c3ba9be..005af720a6385056f09f939813e97c10
7272
7373 public boolean assignProfessionWhenSpawned() {
7474diff --git a/net/minecraft/world/entity/npc/WanderingTrader.java b/net/minecraft/world/entity/npc/WanderingTrader.java
75- index 4abc4037a059b9c1dc58bf7a776e6269c5188868..e726893a3ddf49bdfd2d190477bccf6e33de1847 100644
75+ index 28c86505efa994f9c7657538f5ffdf12772fb0a9..2917820bf01b1a2ca7301a7099b7b3dcd6c3ee67 100644
7676--- a/net/minecraft/world/entity/npc/WanderingTrader.java
7777+++ b/net/minecraft/world/entity/npc/WanderingTrader.java
78- @@ -87 ,9 +87 ,16 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
78+ @@ -88 ,9 +88 ,16 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
7979 @Override
8080 public void initAttributes() {
8181 this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.wanderingTraderMaxHealth);
@@ -92,7 +92,7 @@ index 4abc4037a059b9c1dc58bf7a776e6269c5188868..e726893a3ddf49bdfd2d190477bccf6e
9292 @Override
9393 protected void registerGoals() {
9494 this.goalSelector.addGoal(0, new FloatGoal(this));
95- @@ -124 ,6 +131 ,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
95+ @@ -125 ,6 +132 ,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
9696 this.goalSelector.addGoal(1, new PanicGoal(this, 0.5));
9797 this.goalSelector.addGoal(1, new LookAtTradingPlayerGoal(this));
9898 this.goalSelector.addGoal(2, new WanderingTrader.WanderToPositionGoal(this, 2.0, 0.35));
0 commit comments