feat: 适配 26.4 并新增横向流动水不产生碎冰规则
build / build (push) Canceled after 0s

- gradle.properties 切换到 26.4-snapshot-4 / Loom 1.19-SNAPSHOT / Loader 0.20.0 / Fabric API 0.163.0+26.4 / Carpet 26.4-beta-3
- 新增规则 noBrittleIceFromFlowingWater,默认关闭
- LiquidBlock#shouldSpreadLiquid 用 WrapOperation 拦截碎冰替换:只有竖直下落的水(FlowingFluid#isFalling)才允许把邻接蓝冰转成碎冰,横向流动的水跳过
- 补 zh_cn/en_us 规则名与描述
This commit is contained in:
AxTps committed 2026-10-17 14:26:21 +08:00
1 parent 0df145927f
commit f9a198a892
6 files changed
+66 -8

No files matched your search

+6 -6
View File
@@ -5,13 +5,13 @@ org.gradle.configuration-cache=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=26.1.2
loader_version=0.19.5
loom_version=1.18-SNAPSHOT
minecraft_version=26.4-snapshot-4
loader_version=0.20.0
loom_version=1.19-SNAPSHOT
# Mod Properties
mod_version = 0.25.0
mod_version = 0.26.0-26.4
maven_group = com.github.zly2006
archives_base_name = carpet-sls-addition
# Dependencies
fabric_version=0.155.3+26.1.2
carpet_core_version=26.1+v260401
fabric_version=0.163.0+26.4
carpet_core_version=26.4-beta-3+v261013
@@ -83,4 +83,7 @@ public class SLSCarpetSettings {
@Rule(categories = {SLSA, RuleCategory.FEATURE})
public static boolean slsBoardEnabled = false;
@Rule(categories = {SLSA, RuleCategory.FEATURE})
public static boolean noBrittleIceFromFlowingWater = false;
}
@@ -0,0 +1,50 @@
package com.github.zly2006.carpetslsaddition.mixin.block;
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.FluidState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
/**
* 26.4 快照加入的“碎冰”(Brittle Ice)机制:
* LiquidBlock#shouldSpreadLiquid 中,水流方块任意水平方向的邻居是蓝冰时,
* 会把当前水流方块替换为碎冰。
*
* 开启 noBrittleIceFromFlowingWater 规则后:
* 仅当当前水方块处于“下落”状态(FlowingFluid#isFalling,即非水源且流体等级=8)时,
* 才允许它被替换为碎冰;纯横向流动的水不再触发该替换,以保护蓝冰水道。
*
* 实现方式:用 WrapOperation 包住 shouldSpreadLiquid 里对 Level#setBlockAndUpdate 的调用,
* 只在「目标方块是 BRITTLE_ICE」且「当前水不是下落状态」时跳过该次设置,其余调用原样放行。
*/
@Mixin(LiquidBlock.class)
public class MixinFlowingWaterBrittleIce {
@WrapOperation(
method = "shouldSpreadLiquid",
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;setBlockAndUpdate(Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Z")
)
private boolean wrapSetBlockAndUpdate(Level level, BlockPos pos, BlockState newState,
Operation<Boolean> original) {
if (SLSCarpetSettings.noBrittleIceFromFlowingWater
&& newState.is(Blocks.BRITTLE_ICE)) {
FluidState current = level.getFluidState(pos);
if (!isFalling(current)) {
return false; // 跳过把这块水替换成碎冰
}
}
return original.call(level, pos, newState);
}
private static boolean isFalling(FluidState fluid) {
if (!(fluid.getType() instanceof FlowingFluid flowing)) return false;
return flowing.isFalling(fluid);
}
}
@@ -76,5 +76,7 @@
"carpet.rule.stackableVehicles.name": "Stackable vehicles",
"carpet.rule.stackableVehicles.desc": "Minecarts and boats can stack up to 64, auto-merging on pickup",
"carpet.rule.slsBoardEnabled.name": "Enable boards",
"carpet.rule.slsBoardEnabled.desc": "Allow players to use /slsboard to show death/mining leaderboards"
"carpet.rule.slsBoardEnabled.desc": "Allow players to use /slsboard to show death/mining leaderboards",
"carpet.rule.noBrittleIceFromFlowingWater.name": "No brittle ice from flowing water",
"carpet.rule.noBrittleIceFromFlowingWater.desc": "Only water flowing straight down onto blue ice forms brittle ice. Horizontally flowing water will not."
}
@@ -76,5 +76,7 @@
"carpet.rule.stackableVehicles.name": "载具可堆叠",
"carpet.rule.stackableVehicles.desc": "矿车和船的物品可以堆叠到64,拾取时自动合并",
"carpet.rule.slsBoardEnabled.name": "启用榜单",
"carpet.rule.slsBoardEnabled.desc": "允许玩家用 /slsboard 显示死亡榜/挖掘榜"
"carpet.rule.slsBoardEnabled.desc": "允许玩家用 /slsboard 显示死亡榜/挖掘榜",
"carpet.rule.noBrittleIceFromFlowingWater.name": "横向流动水不产生碎冰",
"carpet.rule.noBrittleIceFromFlowingWater.desc": "只有竖直向下的水流接触蓝冰时才会产生碎冰,横向流动的水不再转化"
}
@@ -12,6 +12,7 @@
"block.MixinDecoratedPotBlock",
"block.MixinTrialSpawnerData",
"block.MixinTrialSpawnerState",
"block.MixinFlowingWaterBrittleIce",
"item.SlotMixin",
"carpet.MixinEntityPlayerMPFake",
"carpet.MixinPlayerCommand",