9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-30 12:29:15 +00:00

刚才的不够完美

This commit is contained in:
XiaoMoMi
2025-06-12 02:45:05 +08:00
parent f9adaeff00
commit 8b7383762a

View File

@@ -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<ItemStack>) 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));