Paper/patches/server/0044-Configurable-Disabling-Cat-Chest-Detection.patch

38 lines
2.0 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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 daf4c0bfc75476b34f8399c9b6685e83bbed5f9e..7d9414e42991f9e82d7892f71e0c0612a53617eb 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -191,4 +191,9 @@ public class PaperWorldConfig {
2021-06-11 14:02:28 +02:00
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
2021-06-12 02:57:04 +02:00
index 41186ae6c68e86f28e2858e17d926dcfdf30f9a2..eecb8c089b5f426b1395b47f714af32c210555ef 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
2021-06-12 02:57:04 +02:00
@@ -355,6 +355,11 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
2021-06-11 14:02:28 +02:00
}
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()) {