From 57039f74ad3f3ad30e9e517629bba8d02ee4a9e0 Mon Sep 17 00:00:00 2001 From: Gugle Date: Fri, 12 Apr 2024 18:56:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E5=85=81=E8=AE=B8=E5=AF=B9=E5=90=91?= =?UTF-8?q?=E6=94=BE=E7=BD=AE=E6=BA=9C=E6=A7=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/dev/dubhe/anvilcraft/block/ChuteBlock.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/dev/dubhe/anvilcraft/block/ChuteBlock.java b/common/src/main/java/dev/dubhe/anvilcraft/block/ChuteBlock.java index 8a6a63198..cbca4595b 100644 --- a/common/src/main/java/dev/dubhe/anvilcraft/block/ChuteBlock.java +++ b/common/src/main/java/dev/dubhe/anvilcraft/block/ChuteBlock.java @@ -195,9 +195,14 @@ public void onRemove(@NotNull BlockState state, @NotNull Level level, @NotNull B } @Override - public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { + @SuppressWarnings("deprecation") + public void onPlace(@NotNull BlockState state, @NotNull Level level, @NotNull BlockPos pos, @NotNull BlockState oldState, boolean movedByPiston) { BlockState facingState = level.getBlockState(pos.relative(state.getValue(FACING))); if (facingState.is(ModBlocks.CHUTE.get()) || facingState.is(ModBlocks.SIMPLE_CHUTE.get())) { + if (facingState.getValue(FACING).getOpposite() == state.getValue(FACING)) { + level.destroyBlock(pos, true); + return; + } BlockState newState = ModBlocks.SIMPLE_CHUTE.getDefaultState(); newState = newState .setValue(SimpleChuteBlock.FACING, facingState.getValue(FACING))