mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
42 lines
3.1 KiB
Diff
42 lines
3.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Rhythmic <mc.ADHDMC@gmail.com>
|
|
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 ca7cbcf9820ac0b34ebcc8f6b423d7b95fd7ce3a..b2bd04a5cef4443700dc0d4d0e6b3a31a10fc0cd 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
@@ -413,6 +413,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;
|
|
@@ -436,6 +437,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);
|