diff --git a/src/main/java/org/betterx/bclib/mixin/common/EnchantingTableBlockMixin.java b/src/main/java/org/betterx/bclib/mixin/common/EnchantingTableBlockMixin.java index dbad3515..cc72f506 100644 --- a/src/main/java/org/betterx/bclib/mixin/common/EnchantingTableBlockMixin.java +++ b/src/main/java/org/betterx/bclib/mixin/common/EnchantingTableBlockMixin.java @@ -1,12 +1,10 @@ package org.betterx.bclib.mixin.common; -import org.betterx.bclib.util.MethodReplace; import org.betterx.worlds.together.tag.v3.CommonBlockTags; import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.EnchantmentTableBlock; import org.spongepowered.asm.mixin.Mixin; @@ -23,10 +21,13 @@ public abstract class EnchantingTableBlockMixin extends Block { @Inject(method = "isValidBookShelf(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/BlockPos;)Z", at = @At("HEAD"), cancellable = true) private static void bclib_isBookshelf( Level level, - BlockPos blockPos, - BlockPos blockPos2, + BlockPos tablePos, + BlockPos delta, CallbackInfoReturnable info ) { - MethodReplace.addBlockReplace(Blocks.BOOKSHELF, state -> state.is(CommonBlockTags.BOOKSHELVES)); + if (level.getBlockState(tablePos.offset(delta)).is(CommonBlockTags.BOOKSHELVES) + && level.isEmptyBlock(tablePos.offset(delta.getX() / 2, delta.getY(), delta.getZ() / 2))) { + info.setReturnValue(true); + } } }