From b380d6445b32a7694d92d8d4b20756ff6dc42377 Mon Sep 17 00:00:00 2001 From: Aikar 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 --- .../world/level/block/ChestBlock.java.patch | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/ChestBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/ChestBlock.java.patch index 844d9d8fa1..7b936f41f5 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/ChestBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/ChestBlock.java.patch @@ -26,13 +26,10 @@ } public Optional acceptSingle(ChestBlockEntity single) { -@@ -118,8 +101,40 @@ - @Override - public Optional acceptNone() { - return Optional.empty(); -+ } -+ }; -+ +@@ -121,6 +104,38 @@ + } + }; + + // CraftBukkit start + public static class DoubleInventory implements MenuProvider { + @@ -61,12 +58,13 @@ + @Override + public Component getDisplayName() { + return (Component) (this.tileentitychest.hasCustomName() ? this.tileentitychest.getDisplayName() : (this.tileentitychest1.hasCustomName() ? this.tileentitychest1.getDisplayName() : Component.translatable("container.chestDouble"))); - } - }; ++ } ++ }; + // CraftBukkit end - ++ @Override public MapCodec codec() { + return ChestBlock.CODEC; @@ -257,7 +272,7 @@ @Override @@ -94,3 +92,15 @@ public static DoubleBlockCombiner.Combiner opennessCombiner(final LidBlockEntity progress) { return new DoubleBlockCombiner.Combiner() { public Float2FloatFunction acceptDouble(ChestBlockEntity first, ChestBlockEntity second) { +@@ -321,6 +343,11 @@ + } + + private static boolean isCatSittingOnChest(LevelAccessor world, BlockPos pos) { ++ // Paper start - Option to disable chest cat detection ++ if (world.getMinecraftWorld().paperConfig().entities.behavior.disableChestCatDetection) { ++ return false; ++ } ++ // Paper end - Option to disable chest cat detection + List 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()) {