From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Rhythmic Date: Sat, 15 Oct 2022 13:32:15 -0700 Subject: [PATCH] Allow Transparent Blocks In Enchanting Box diff --git a/src/main/java/net/minecraft/world/level/block/EnchantmentTableBlock.java b/src/main/java/net/minecraft/world/level/block/EnchantmentTableBlock.java index 37a888e5db65b927094b43775ae9d4098244f809..c4a91d7f1320027ee6a2b364303c01ebbacde584 100644 --- a/src/main/java/net/minecraft/world/level/block/EnchantmentTableBlock.java +++ b/src/main/java/net/minecraft/world/level/block/EnchantmentTableBlock.java @@ -42,6 +42,10 @@ public class EnchantmentTableBlock extends BaseEntityBlock { } public static boolean isValidBookShelf(Level world, BlockPos tablePos, BlockPos bookshelfOffset) { + // Purpur Start + if(org.purpurmc.purpur.PurpurConfig.allowTransparentBlocksInEnchantmentBox){ + return world.getBlockState(tablePos.offset(bookshelfOffset)).is(Blocks.BOOKSHELF) && !world.getBlockState(tablePos.offset(bookshelfOffset.getX() / 2, bookshelfOffset.getY(), bookshelfOffset.getZ() / 2)).isSuffocating(world, bookshelfOffset); + } // Purpur end return world.getBlockState(tablePos.offset(bookshelfOffset)).is(Blocks.BOOKSHELF) && world.isEmptyBlock(tablePos.offset(bookshelfOffset.getX() / 2, bookshelfOffset.getY(), bookshelfOffset.getZ() / 2)); } diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java index 134a594c6e1d63615124ec391718be236673e2f3..76cbfb7e900bf2698776f54cfe498f4b42965221 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java @@ -432,6 +432,7 @@ public class PurpurConfig { public static boolean allowInfinityMending = false; public static boolean allowCrossbowInfinity = false; public static boolean allowShearsLooting = false; + public static boolean allowTransparentBlocksInEnchantmentBox = false; public static boolean allowUnsafeEnchants = false; public static boolean allowInapplicableEnchants = true; public static boolean allowIncompatibleEnchants = true; @@ -455,6 +456,7 @@ public class PurpurConfig { allowInfinityMending = getBoolean("settings.enchantment.allow-infinity-and-mending-together", allowInfinityMending); allowCrossbowInfinity = getBoolean("settings.enchantment.allow-infinity-on-crossbow", allowCrossbowInfinity); allowShearsLooting = getBoolean("settings.enchantment.allow-looting-on-shears", allowShearsLooting); + allowTransparentBlocksInEnchantmentBox = getBoolean("settings.enchantment.allow-transparent-blocks-in-enchantment-box", allowTransparentBlocksInEnchantmentBox); allowUnsafeEnchants = getBoolean("settings.enchantment.anvil.allow-unsafe-enchants", allowUnsafeEnchants); allowInapplicableEnchants = getBoolean("settings.enchantment.anvil.allow-inapplicable-enchants", allowInapplicableEnchants); allowIncompatibleEnchants = getBoolean("settings.enchantment.anvil.allow-incompatible-enchants", allowIncompatibleEnchants);