aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0045-Configurable-Disabling-Cat-Chest-Detection.patch
blob: f340deebe823f7b8a03b87316ea2092af6a0dcef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 01:13:45 -0600
Subject: [PATCH] Configurable Disabling Cat Chest Detection

Offers a gameplay feature to stop cats from blocking chests

diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 1b51f717ec2a0538d9037dd1d4328030bd9122c8..990757a8bbd27fa102c9b408246ed14d97a340dc 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -232,4 +232,9 @@ public class PaperWorldConfig {
     private void containerUpdateTickRate() {
         containerUpdateTickRate = getInt("container-update-tick-rate", 1);
     }
+
+    public boolean disableChestCatDetection;
+    private void disableChestCatDetection() {
+        disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false);
+    }
 }
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
index 306fd5b1893d8a68af2073978bab7e590e936ef5..db726697b00afdee6078849fd224263483349912 100644
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
@@ -362,6 +362,11 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
     }
 
     private static boolean isCatSittingOnChest(LevelAccessor world, BlockPos pos) {
+        // Paper start - Option to disable chest cat detection
+        if (((Level) world).paperConfig.disableChestCatDetection) {
+            return false;
+        }
+        // Paper end
         List<Cat> list = world.getEntitiesOfClass(Cat.class, new AABB((double) pos.getX(), (double) (pos.getY() + 1), (double) pos.getZ(), (double) (pos.getX() + 1), (double) (pos.getY() + 2), (double) (pos.getZ() + 1)));
 
         if (!list.isEmpty()) {