From 8b7383762ae06aceb3b872e1b2e1cebbb3656b34 Mon Sep 17 00:00:00 2001 From: XiaoMoMi Date: Thu, 12 Jun 2025 02:45:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9A=E6=89=8D=E7=9A=84=E4=B8=8D=E5=A4=9F?= =?UTF-8?q?=E5=AE=8C=E7=BE=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../item/behavior/FlintAndSteelItemBehavior.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/FlintAndSteelItemBehavior.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/FlintAndSteelItemBehavior.java index 03b3b822a..9d46867ed 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/FlintAndSteelItemBehavior.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/item/behavior/FlintAndSteelItemBehavior.java @@ -81,7 +81,7 @@ public class FlintAndSteelItemBehavior extends ItemBehavior { } BlockData vanillaBlockState = BlockStateUtils.fromBlockData(immutableBlockState.vanillaBlockState().handle()); // 点击的是方块上面,则只需要判断shift和可交互 - if (context.getClickedFace() == Direction.UP) { + if (direction == Direction.UP) { // 客户端层面必须可交互 if (!InteractUtils.isInteractable((Player) player.platformPlayer(), vanillaBlockState, context.getHitResult(), (Item) context.getItem())) { @@ -141,6 +141,15 @@ public class FlintAndSteelItemBehavior extends ItemBehavior { if (BlockStateUtils.isBurnable(nearbyBlockState)) { return InteractionResult.PASS; } + try { + if (dir == Direction.DOWN && (boolean) CoreReflections.method$BlockStateBase$isFaceSturdy.invoke( + nearbyBlockState, context.getLevel().serverWorld(), LocationUtils.toBlockPos(relPos), CoreReflections.instance$Direction$UP, CoreReflections.instance$SupportType$FULL)) { + return InteractionResult.PASS; + } + } catch (ReflectiveOperationException e) { + CraftEngine.instance().logger().warn("Failed to call method$BlockStateBase$isFaceSturdy", e); + return InteractionResult.PASS; + } } } player.playSound(FLINT_SOUND, firePos, SoundSource.BLOCK, 1f, RandomUtils.generateRandomFloat(0.8f, 1.2f));