mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-27 10:59:07 +00:00
删除打火石交互和忽略潜行
This commit is contained in:
@@ -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<ItemStack>) 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<ItemStack>) context.getItem())) {
|
||||
// 如果按住了shift,则代表尝试对侧面方块点火
|
||||
if (player.isSecondaryUseActive() && !InteractUtils.isIgnoreSneaking((Player) player.platformPlayer(), vanillaBlockState, context.getHitResult(), (Item<ItemStack>) context.getItem())) {
|
||||
if (player.isSecondaryUseActive()) {
|
||||
// 如果底部不能燃烧,则燃烧点位为侧面,需要补发
|
||||
if (!belowCanBurn) {
|
||||
player.playSound(FLINT_SOUND, firePos, SoundSource.BLOCK, 1f, RandomUtils.generateRandomFloat(0.8f, 1.2f));
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
// 消耗
|
||||
|
||||
Reference in New Issue
Block a user