Villagers farming can bypass mob-griefing gamerule

This commit is contained in:
William Blake Galbreath
2020-04-24 09:39:27 -05:00
parent 6098e53926
commit 6daa61aea9
2 changed files with 52 additions and 6 deletions

View File

@@ -1,18 +1,18 @@
From 9364b8f841ab37a40be7f8102b2f7d2ee728f8da Mon Sep 17 00:00:00 2001
From 46b921754cc8fa9dcb95827411be3110b692ede7 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 24 Apr 2020 09:33:11 -0500
Subject: [PATCH] Entities pick up loot bypass mob-griefing gamerule
---
src/main/java/net/minecraft/server/EntityInsentient.java | 6 +-----
src/main/java/net/minecraft/server/EntityInsentient.java | 2 +-
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
2 files changed, 3 insertions(+), 5 deletions(-)
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index 15a5fb71..8edbe341 100644
index 15a5fb71..6e37acaa 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -525,7 +521,7 @@ public abstract class EntityInsentient extends EntityLiving {
@@ -525,7 +525,7 @@ public abstract class EntityInsentient extends EntityLiving {
public void movementTick() {
super.movementTick();
this.world.getMethodProfiler().enter("looting");
@@ -22,7 +22,7 @@ index 15a5fb71..8edbe341 100644
Iterator iterator = list.iterator();
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index ef34a348..6a61094f 100644
index ef34a348..f4ac3143 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -209,6 +209,7 @@ public class PurpurWorldConfig {

View File

@@ -0,0 +1,46 @@
From 872711bd898c69801bb8971a3a3424b7a4f3271a Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Fri, 24 Apr 2020 09:37:29 -0500
Subject: [PATCH] Villagers farming can bypass mob-griefing gamerule
---
src/main/java/net/minecraft/server/BehaviorFarm.java | 2 +-
src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/main/java/net/minecraft/server/BehaviorFarm.java b/src/main/java/net/minecraft/server/BehaviorFarm.java
index e05e9772..cf3126a6 100644
--- a/src/main/java/net/minecraft/server/BehaviorFarm.java
+++ b/src/main/java/net/minecraft/server/BehaviorFarm.java
@@ -20,7 +20,7 @@ public class BehaviorFarm extends Behavior<EntityVillager> {
}
protected boolean a(WorldServer worldserver, EntityVillager entityvillager) {
- if (!worldserver.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
+ if (!worldserver.getGameRules().getBoolean(GameRules.MOB_GRIEFING) && !worldserver.purpurConfig.villagerFarmingBypassMobGriefing) {
return false;
} else if (entityvillager.getVillagerData().getProfession() != VillagerProfession.FARMER) {
return false;
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index f4ac3143..117f2095 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -912,6 +912,7 @@ public class PurpurWorldConfig {
public boolean villagerCanBeLeashed = false;
public int villagerSpawnIronGolemRadius = 0;
public int villagerSpawnIronGolemLimit = 0;
+ public boolean villagerFarmingBypassMobGriefing = false;
private void villagerSettings() {
villagerRidable = getBoolean("mobs.villager.ridable", villagerRidable);
villagerRidableInWater = getBoolean("mobs.villager.ridable-in-water", villagerRidableInWater);
@@ -922,6 +923,7 @@ public class PurpurWorldConfig {
villagerCanBeLeashed = getBoolean("mobs.villager.can-be-leashed", villagerCanBeLeashed);
villagerSpawnIronGolemRadius = getInt("mobs.villager.spawn-iron-golem.radius", villagerSpawnIronGolemRadius);
villagerSpawnIronGolemLimit = getInt("mobs.villager.spawn-iron-golem.limit", villagerSpawnIronGolemLimit);
+ villagerFarmingBypassMobGriefing = getBoolean("mobs.villager.bypass-mob-griefing", villagerFarmingBypassMobGriefing);
}
public boolean villagerTraderRidable = false;
--
2.24.0