mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
Add config option for whether Nether Wart farming Villagers should throw extra Nether Warts at other Villagers
This commit is contained in:
@@ -87,6 +87,30 @@ index 0ff202c0d..b9c6011c8 100644
|
|||||||
itemstack.subtract(1);
|
itemstack.subtract(1);
|
||||||
if (itemstack.isEmpty()) {
|
if (itemstack.isEmpty()) {
|
||||||
inventorysubcontainer.setItem(j, ItemStack.b);
|
inventorysubcontainer.setItem(j, ItemStack.b);
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/BehaviorTradeVillager.java b/src/main/java/net/minecraft/server/BehaviorTradeVillager.java
|
||||||
|
index ad26ecd7f..6d8b6951c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/BehaviorTradeVillager.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/BehaviorTradeVillager.java
|
||||||
|
@@ -41,6 +41,11 @@ public class BehaviorTradeVillager extends Behavior<EntityVillager> {
|
||||||
|
if (entityvillager1.getVillagerData().getProfession() == VillagerProfession.FARMER && entityvillager.getInventory().a(Items.WHEAT) > Items.WHEAT.getMaxStackSize() / 2) {
|
||||||
|
a(entityvillager, ImmutableSet.of(Items.WHEAT), entityvillager1);
|
||||||
|
}
|
||||||
|
+ // Purpur start
|
||||||
|
+ if (worldserver.purpurConfig.villagerClericsFarmWarts && worldserver.purpurConfig.villagerClericFarmersThrowWarts && entityvillager.getVillagerData().getProfession() == VillagerProfession.CLERIC && entityvillager.getInventory().getAmount(Items.NETHER_WART) > Items.NETHER_WART.getMaxStackSize() / 2) {
|
||||||
|
+ tryThrowingItems(entityvillager, ImmutableSet.of(Items.NETHER_WART), entityvillager1);
|
||||||
|
+ }
|
||||||
|
+ // Purpur end
|
||||||
|
|
||||||
|
if (!this.b.isEmpty() && entityvillager.getInventory().a(this.b)) {
|
||||||
|
a(entityvillager, this.b, entityvillager1);
|
||||||
|
@@ -62,6 +67,7 @@ public class BehaviorTradeVillager extends Behavior<EntityVillager> {
|
||||||
|
}).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private static void tryThrowingItems(EntityVillager entityVillager, Set<Item> acceptableItems, EntityLiving targetEntity) { a(entityVillager, acceptableItems, targetEntity); } // Purpur - OBFHELPER
|
||||||
|
private static void a(EntityVillager entityvillager, Set<Item> set, EntityLiving entityliving) {
|
||||||
|
InventorySubcontainer inventorysubcontainer = entityvillager.getInventory();
|
||||||
|
ItemStack itemstack = ItemStack.b;
|
||||||
diff --git a/src/main/java/net/minecraft/server/Behaviors.java b/src/main/java/net/minecraft/server/Behaviors.java
|
diff --git a/src/main/java/net/minecraft/server/Behaviors.java b/src/main/java/net/minecraft/server/Behaviors.java
|
||||||
index 2d9186966..e376306bc 100644
|
index 2d9186966..e376306bc 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Behaviors.java
|
--- a/src/main/java/net/minecraft/server/Behaviors.java
|
||||||
@@ -146,10 +170,18 @@ index d882c1136..61b95d54c 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java
|
diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java
|
||||||
index 46b88056b..507352807 100644
|
index 46b88056b..64f1767f6 100644
|
||||||
--- a/src/main/java/net/minecraft/server/IInventory.java
|
--- a/src/main/java/net/minecraft/server/IInventory.java
|
||||||
+++ b/src/main/java/net/minecraft/server/IInventory.java
|
+++ b/src/main/java/net/minecraft/server/IInventory.java
|
||||||
@@ -45,6 +45,7 @@ public interface IInventory extends Clearable {
|
@@ -31,6 +31,7 @@ public interface IInventory extends Clearable {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ default int getAmount(Item item) { return this.a(item); } // Purpur - OBFHELPER
|
||||||
|
default int a(Item item) {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
@@ -45,6 +46,7 @@ public interface IInventory extends Clearable {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +190,7 @@ index 46b88056b..507352807 100644
|
|||||||
for (int i = 0; i < this.getSize(); ++i) {
|
for (int i = 0; i < this.getSize(); ++i) {
|
||||||
ItemStack itemstack = this.getItem(i);
|
ItemStack itemstack = this.getItem(i);
|
||||||
diff --git a/src/main/java/net/minecraft/server/SensorSecondaryPlaces.java b/src/main/java/net/minecraft/server/SensorSecondaryPlaces.java
|
diff --git a/src/main/java/net/minecraft/server/SensorSecondaryPlaces.java b/src/main/java/net/minecraft/server/SensorSecondaryPlaces.java
|
||||||
index 24173f0d3..13ff2a1a2 100644
|
index 24173f0d3..2d8e3e777 100644
|
||||||
--- a/src/main/java/net/minecraft/server/SensorSecondaryPlaces.java
|
--- a/src/main/java/net/minecraft/server/SensorSecondaryPlaces.java
|
||||||
+++ b/src/main/java/net/minecraft/server/SensorSecondaryPlaces.java
|
+++ b/src/main/java/net/minecraft/server/SensorSecondaryPlaces.java
|
||||||
@@ -12,6 +12,13 @@ public class SensorSecondaryPlaces extends Sensor<EntityVillager> {
|
@@ -12,6 +12,13 @@ public class SensorSecondaryPlaces extends Sensor<EntityVillager> {
|
||||||
@@ -166,17 +198,21 @@ index 24173f0d3..13ff2a1a2 100644
|
|||||||
|
|
||||||
protected void a(WorldServer worldserver, EntityVillager entityvillager) {
|
protected void a(WorldServer worldserver, EntityVillager entityvillager) {
|
||||||
+ // Purpur start - make sure clerics don't wander to soul sand when the option is off
|
+ // Purpur start - make sure clerics don't wander to soul sand when the option is off
|
||||||
|
+ BehaviorController<?> behaviorcontroller = entityvillager.getBehaviorController();
|
||||||
+ if (!worldserver.purpurConfig.villagerClericsFarmWarts && entityvillager.getVillagerData().getProfession() == VillagerProfession.CLERIC) {
|
+ if (!worldserver.purpurConfig.villagerClericsFarmWarts && entityvillager.getVillagerData().getProfession() == VillagerProfession.CLERIC) {
|
||||||
+ BehaviorController<?> brain = entityvillager.getBehaviorController();
|
+ behaviorcontroller.removeMemory(MemoryModuleType.SECONDARY_JOB_SITE);
|
||||||
+ brain.removeMemory(MemoryModuleType.SECONDARY_JOB_SITE);
|
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
ResourceKey<World> resourcekey = worldserver.getDimensionKey();
|
ResourceKey<World> resourcekey = worldserver.getDimensionKey();
|
||||||
BlockPosition blockposition = entityvillager.getChunkCoordinates();
|
BlockPosition blockposition = entityvillager.getChunkCoordinates();
|
||||||
List<GlobalPos> list = Lists.newArrayList();
|
List<GlobalPos> list = Lists.newArrayList();
|
||||||
@@ -32,7 +39,7 @@ public class SensorSecondaryPlaces extends Sensor<EntityVillager> {
|
@@ -29,10 +36,10 @@ public class SensorSecondaryPlaces extends Sensor<EntityVillager> {
|
||||||
BehaviorController<?> behaviorcontroller = entityvillager.getBehaviorController();
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- BehaviorController<?> behaviorcontroller = entityvillager.getBehaviorController();
|
||||||
|
+ //BehaviorController<?> behaviorcontroller = entityvillager.getBehaviorController(); // Purpur - move up
|
||||||
|
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
- behaviorcontroller.setMemory(MemoryModuleType.SECONDARY_JOB_SITE, (Object) list);
|
- behaviorcontroller.setMemory(MemoryModuleType.SECONDARY_JOB_SITE, (Object) list);
|
||||||
@@ -198,22 +234,24 @@ index 3c60da7ac..6493f220a 100644
|
|||||||
public static final VillagerProfession FISHERMAN = a("fisherman", VillagePlaceType.i, SoundEffects.ENTITY_VILLAGER_WORK_FISHERMAN);
|
public static final VillagerProfession FISHERMAN = a("fisherman", VillagePlaceType.i, SoundEffects.ENTITY_VILLAGER_WORK_FISHERMAN);
|
||||||
public static final VillagerProfession FLETCHER = a("fletcher", VillagePlaceType.j, SoundEffects.ENTITY_VILLAGER_WORK_FLETCHER);
|
public static final VillagerProfession FLETCHER = a("fletcher", VillagePlaceType.j, SoundEffects.ENTITY_VILLAGER_WORK_FLETCHER);
|
||||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
index 020a42a5e..3a4fcbb53 100644
|
index 020a42a5e..e1d1c2846 100644
|
||||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
@@ -1057,6 +1057,7 @@ public class PurpurWorldConfig {
|
@@ -1057,6 +1057,8 @@ public class PurpurWorldConfig {
|
||||||
public int villagerSpawnIronGolemLimit = 0;
|
public int villagerSpawnIronGolemLimit = 0;
|
||||||
public boolean villagerCanBreed = true;
|
public boolean villagerCanBreed = true;
|
||||||
public boolean villagerLobotomize1x1 = false;
|
public boolean villagerLobotomize1x1 = false;
|
||||||
+ public boolean villagerClericsFarmWarts = false;
|
+ public boolean villagerClericsFarmWarts = false;
|
||||||
|
+ public boolean villagerClericFarmersThrowWarts = true;
|
||||||
private void villagerSettings() {
|
private void villagerSettings() {
|
||||||
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
|
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
|
||||||
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
|
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
|
||||||
@@ -1069,6 +1070,7 @@ public class PurpurWorldConfig {
|
@@ -1069,6 +1071,8 @@ public class PurpurWorldConfig {
|
||||||
villagerSpawnIronGolemLimit = getInt("mobs.villager.spawn-iron-golem.limit", villagerSpawnIronGolemLimit);
|
villagerSpawnIronGolemLimit = getInt("mobs.villager.spawn-iron-golem.limit", villagerSpawnIronGolemLimit);
|
||||||
villagerCanBreed = getBoolean("mobs.villager.can-breed", villagerCanBreed);
|
villagerCanBreed = getBoolean("mobs.villager.can-breed", villagerCanBreed);
|
||||||
villagerLobotomize1x1 = getBoolean("mobs.villager.lobotomize-1x1", villagerLobotomize1x1);
|
villagerLobotomize1x1 = getBoolean("mobs.villager.lobotomize-1x1", villagerLobotomize1x1);
|
||||||
+ villagerClericsFarmWarts = getBoolean("mobs.villager.clerics-farm-warts", villagerClericsFarmWarts);
|
+ villagerClericsFarmWarts = getBoolean("mobs.villager.clerics-farm-warts", villagerClericsFarmWarts);
|
||||||
|
+ villagerClericFarmersThrowWarts = getBoolean("mobs.villager.cleric-wart-farmers-throw-warts-at-villagers", villagerClericFarmersThrowWarts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean villagerTraderRidable = false;
|
public boolean villagerTraderRidable = false;
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ index 3327dbbf8..57f3358b8 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
index 3a4fcbb53..184fa7446 100644
|
index e1d1c2846..fa98eef4f 100644
|
||||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||||
@@ -1175,12 +1175,14 @@ public class PurpurWorldConfig {
|
@@ -1177,12 +1177,14 @@ public class PurpurWorldConfig {
|
||||||
public boolean zombifiedPiglinJockeyOnlyBaby = true;
|
public boolean zombifiedPiglinJockeyOnlyBaby = true;
|
||||||
public double zombifiedPiglinJockeyChance = 0.05D;
|
public double zombifiedPiglinJockeyChance = 0.05D;
|
||||||
public boolean zombifiedPiglinJockeyTryExistingChickens = true;
|
public boolean zombifiedPiglinJockeyTryExistingChickens = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user