From dff594d0b0e6a747e31ce1d0388b9c6560a4e712 Mon Sep 17 00:00:00 2001 From: halogly Date: Sun, 31 Aug 2025 17:16:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=89=93=E7=81=AB=E7=9F=B3?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E5=92=8C=E5=BF=BD=E7=95=A5=E6=BD=9C=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../behavior/FlintAndSteelItemBehavior.java | 5 +- .../bukkit/util/InteractUtils.java | 274 ------------------ 2 files changed, 2 insertions(+), 277 deletions(-) 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 c397786d1..ab6521101 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 @@ -89,8 +89,7 @@ public class FlintAndSteelItemBehavior extends ItemBehavior { return InteractionResult.PASS; } // 且没有shift或者忽略潜行的可交互方块 - if (!player.isSecondaryUseActive() || InteractUtils.isIgnoreSneaking((Player) player.platformPlayer(), vanillaBlockState, - context.getHitResult(), (Item) context.getItem())) { + if (!player.isSecondaryUseActive()) { player.playSound(FLINT_SOUND, firePos, SoundSource.BLOCK, 1f, RandomUtils.generateRandomFloat(0.8f, 1.2f)); } } else { @@ -111,7 +110,7 @@ public class FlintAndSteelItemBehavior extends ItemBehavior { // 客户端觉得这玩意可交互,就会忽略声音 if (InteractUtils.isInteractable((Player) player.platformPlayer(), vanillaBlockState, context.getHitResult(), (Item) context.getItem())) { // 如果按住了shift,则代表尝试对侧面方块点火 - if (player.isSecondaryUseActive() && !InteractUtils.isIgnoreSneaking((Player) player.platformPlayer(), vanillaBlockState, context.getHitResult(), (Item) context.getItem())) { + if (player.isSecondaryUseActive()) { // 如果底部不能燃烧,则燃烧点位为侧面,需要补发 if (!belowCanBurn) { player.playSound(FLINT_SOUND, firePos, SoundSource.BLOCK, 1f, RandomUtils.generateRandomFloat(0.8f, 1.2f)); diff --git a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/util/InteractUtils.java b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/util/InteractUtils.java index 06f112fb5..975ae37d8 100644 --- a/bukkit/src/main/java/net/momirealms/craftengine/bukkit/util/InteractUtils.java +++ b/bukkit/src/main/java/net/momirealms/craftengine/bukkit/util/InteractUtils.java @@ -738,280 +738,6 @@ public final class InteractUtils { } return false; }); - // 蜡烛 - registerSneakBypass(BlockKeys.CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.WHITE_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.LIGHT_GRAY_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.GRAY_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.BLACK_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.BROWN_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.RED_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.ORANGE_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.YELLOW_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.LIME_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.GREEN_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.CYAN_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.LIGHT_BLUE_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.BLUE_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.PURPLE_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.MAGENTA_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - registerSneakBypass(BlockKeys.PINK_CANDLE, (player, item, blockState, result) -> { - if (blockState instanceof Candle candle) { - Key id = item.vanillaId(); - if (!candle.isLit()) { - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - } - return false; - }); - // 蜡烛蛋糕 - registerSneakBypass(BlockKeys.CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.WHITE_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.LIGHT_GRAY_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.GRAY_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.BLACK_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.BROWN_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.RED_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.ORANGE_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.YELLOW_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.LIME_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.GREEN_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.CYAN_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.LIGHT_BLUE_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.BLUE_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.PURPLE_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.MAGENTA_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); - registerSneakBypass(BlockKeys.PINK_CANDLE_CAKE, (player, item, blockState, result) -> { - if (blockState instanceof Lightable lightable && !(lightable.isLit())) { - Key id = item.vanillaId(); - return ItemKeys.FLINT_AND_STEEL.equals(id); - } - return canEat(player); - }); } // 消耗