mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
42 lines
3.2 KiB
Diff
42 lines
3.2 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 286f34eef22a85be3fe9747dc3c3f9a7d51f437c..ff2b97e4feff3eefe50d2715437a68a8b16281fc 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/EnchantmentTableBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/EnchantmentTableBlock.java
|
|
@@ -43,6 +43,10 @@ public class EnchantmentTableBlock extends BaseEntityBlock {
|
|
}
|
|
|
|
public static boolean isValidBookShelf(Level world, BlockPos tablePos, BlockPos providerOffset) {
|
|
+ // Purpur Start
|
|
+ if(org.purpurmc.purpur.PurpurConfig.allowTransparentBlocksInEnchantmentBox){
|
|
+ return world.getBlockState(tablePos.offset(providerOffset)).is(BlockTags.ENCHANTMENT_POWER_PROVIDER) && !world.getBlockState(tablePos.offset(providerOffset.getX() / 2, providerOffset.getY(), providerOffset.getZ() / 2)).isSuffocating(world, providerOffset);
|
|
+ } // Purpur end
|
|
return world.getBlockState(tablePos.offset(providerOffset)).is(BlockTags.ENCHANTMENT_POWER_PROVIDER) && world.getBlockState(tablePos.offset(providerOffset.getX() / 2, providerOffset.getY(), providerOffset.getZ() / 2)).is(BlockTags.ENCHANTMENT_POWER_TRANSMITTER);
|
|
}
|
|
|
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
index c3878aed434bdf490cbaf45064fa5a6c5814476f..81409df1af15b68971b1efd203b9ad8d87ca7b6e 100644
|
|
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
|
@@ -415,6 +415,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;
|
|
@@ -438,6 +439,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);
|