13
0
geforkt von Mirrors/Paper

Configurable Disabling Cat Chest Detection

Offers a gameplay feature to stop cats from blocking chests
Dieser Commit ist enthalten in:
Aikar 2016-03-03 01:13:45 -06:00
Ursprung dd1cfc07db
Commit b380d6445b

Datei anzeigen

@ -26,13 +26,10 @@
}
public Optional<MenuProvider> acceptSingle(ChestBlockEntity single) {
@@ -118,8 +101,40 @@
@Override
public Optional<MenuProvider> 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<? extends ChestBlock> codec() {
return ChestBlock.CODEC;
@@ -257,7 +272,7 @@
@Override
@ -94,3 +92,15 @@
public static DoubleBlockCombiner.Combiner<ChestBlockEntity, Float2FloatFunction> opennessCombiner(final LidBlockEntity progress) {
return new DoubleBlockCombiner.Combiner<ChestBlockEntity, Float2FloatFunction>() {
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<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()) {