From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: jmp <jasonpenilla2@me.com>
Date: Wed, 2 Dec 2020 03:07:58 -0800
Subject: [PATCH] PaperPR - Config option for Piglins guarding chests


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 921253a06daa414aed7dc6824effc65db09ea7a5..319e12c843305e62c34b1b6e2fd198d02491ca12 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -704,6 +704,11 @@ public class PaperWorldConfig {
         zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs);
     }
 
+    public boolean piglinsGuardChests = true;
+    private void piglinsGuardChests() {
+        piglinsGuardChests = getBoolean("piglins-guard-chests", piglinsGuardChests);
+    }
+
     public boolean useEigencraftRedstone = false;
     private void useEigencraftRedstone() {
         useEigencraftRedstone = this.getBoolean("use-faster-eigencraft-redstone", false);
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAI.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAI.java
index 490e749db3fc60a06fbb51347491b1ed29f3eaa0..39451d6d7a5b8cb4a29c6b3a4787979d40144cd9 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAI.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAI.java
@@ -419,6 +419,7 @@ public class PiglinAI {
     }
 
     public static void a(EntityHuman entityhuman, boolean flag) {
+        if (!entityhuman.world.paperConfig.piglinsGuardChests) return; // Paper
         List<EntityPiglinAbstract> list = entityhuman.world.a(EntityPiglin.class, entityhuman.getBoundingBox().g(16.0D)); // CraftBukkit - decompile error
 
         list.stream().filter(PiglinAI::d).filter((entitypiglin) -> {
