feat: 新增坚硬陶罐规则
build / build (push) Has been cancelled

- sturdyDecoratedPot:装饰陶罐不被投掷物击碎 & - unbreakableDecoratedPot:玩家挖掘陶罐时不产生裂纹效果 & - 新增 MixinDecoratedPotBlock(onProjectileHit 取消 + playerWillDestroy 不设 CRACKED) & - 补中英语言描述
This commit is contained in:
AxTps committed 2026-10-03 12:11:11 +08:00
1 parent ad89ab0574
commit bc472026f9
5 files changed
+54

No files matched your search

@@ -71,4 +71,10 @@ public class SLSCarpetSettings {
@Rule(categories = {SLSA, RuleCategory.FEATURE}) @Rule(categories = {SLSA, RuleCategory.FEATURE})
public static boolean turtleLocalNesting = false; public static boolean turtleLocalNesting = false;
@Rule(categories = {SLSA, RuleCategory.FEATURE})
public static boolean sturdyDecoratedPot = false;
@Rule(categories = {SLSA, RuleCategory.FEATURE})
public static boolean unbreakableDecoratedPot = false;
} }
@@ -0,0 +1,39 @@
package com.github.zly2006.carpetslsaddition.mixin.block;
import com.github.zly2006.carpetslsaddition.SLSCarpetSettings;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DecoratedPotBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(DecoratedPotBlock.class)
public class MixinDecoratedPotBlock {
// sturdyDecoratedPot:投掷物命中不碎。
@Inject(method = "onProjectileHit", at = @At("HEAD"), cancellable = true)
private void sturdyOnProjectileHit(Level level, BlockState state, BlockHitResult hit, Projectile projectile, CallbackInfo ci) {
if (SLSCarpetSettings.sturdyDecoratedPot) {
ci.cancel();
}
}
// unbreakableDecoratedPot:玩家挖掘时不设 CRACKED(无裂纹效果),仍正常挖掉。
@Redirect(
method = "playerWillDestroy",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/level/block/state/BlockState;setValue(Lnet/minecraft/world/level/block/state/properties/Property;Ljava/lang/Comparable;)Ljava/lang/Object;"
)
)
private Object noCrackOnPlayerBreak(BlockState state, net.minecraft.world.level.block.state.properties.Property property, Comparable value) {
if (SLSCarpetSettings.unbreakableDecoratedPot) {
return state;
}
return state.setValue(property, value);
}
}
@@ -52,6 +52,10 @@
"carpet.rule.armadilloImmediateDespawns.desc": "Armadillos will despawn immediately if they are 128 blocks away from the player.", "carpet.rule.armadilloImmediateDespawns.desc": "Armadillos will despawn immediately if they are 128 blocks away from the player.",
"carpet.rule.turtleLocalNesting.name": "Turtle Local Nesting", "carpet.rule.turtleLocalNesting.name": "Turtle Local Nesting",
"carpet.rule.turtleLocalNesting.desc": "Turtles carrying eggs will lay them on reachable sand near the closest local water source instead of returning to their birthplace.", "carpet.rule.turtleLocalNesting.desc": "Turtles carrying eggs will lay them on reachable sand near the closest local water source instead of returning to their birthplace.",
"carpet.rule.sturdyDecoratedPot.name": "Sturdy Decorated Pot",
"carpet.rule.sturdyDecoratedPot.desc": "Decorated pots are not shattered by projectiles.",
"carpet.rule.unbreakableDecoratedPot.name": "No Crack When Mining Pot",
"carpet.rule.unbreakableDecoratedPot.desc": "Breaking a decorated pot by a player does not produce the cracked effect.",
"carpet.rule.trialSpawnerCD.desc": "trialSpawnerCD.", "carpet.rule.trialSpawnerCD.desc": "trialSpawnerCD.",
"carpet.rule.skipTicksForJoblessVillager.extra.0": "Set to 0 to maintain the vanilla behavior", "carpet.rule.skipTicksForJoblessVillager.extra.0": "Set to 0 to maintain the vanilla behavior",
@@ -28,6 +28,10 @@
"carpet.rule.armadilloImmediateDespawns.desc": "当犰狳远离玩家128格时,立即消失", "carpet.rule.armadilloImmediateDespawns.desc": "当犰狳远离玩家128格时,立即消失",
"carpet.rule.turtleLocalNesting.name": "海龟就地筑巢", "carpet.rule.turtleLocalNesting.name": "海龟就地筑巢",
"carpet.rule.turtleLocalNesting.desc": "有蛋的海龟会在附近的水边沙滩下蛋,而不是返回出生地", "carpet.rule.turtleLocalNesting.desc": "有蛋的海龟会在附近的水边沙滩下蛋,而不是返回出生地",
"carpet.rule.sturdyDecoratedPot.name": "坚硬陶罐",
"carpet.rule.sturdyDecoratedPot.desc": "装饰陶罐不会被投掷物击碎",
"carpet.rule.unbreakableDecoratedPot.name": "挖掘陶罐无裂纹",
"carpet.rule.unbreakableDecoratedPot.desc": "玩家破坏装饰陶罐时不会产生裂纹效果",
"carpet.rule.obtainableReinforcedDeepSlate.desc": "当铁砧砸在9*64个深板岩的掉落物上时,可以获得强化深板岩", "carpet.rule.obtainableReinforcedDeepSlate.desc": "当铁砧砸在9*64个深板岩的掉落物上时,可以获得强化深板岩",
"carpet.rule.skipTicksForJoblessVillager.desc": "对于无业/傻子村民,执行设定数量的tick运算后,跳过1tick的运算", "carpet.rule.skipTicksForJoblessVillager.desc": "对于无业/傻子村民,执行设定数量的tick运算后,跳过1tick的运算",
@@ -9,6 +9,7 @@
"block.BlockPatternTestTransformInvoker", "block.BlockPatternTestTransformInvoker",
"block.MixinNetherPortal", "block.MixinNetherPortal",
"block.MixinRedstoneWireBlock", "block.MixinRedstoneWireBlock",
"block.MixinDecoratedPotBlock",
"block.MixinTrialSpawnerData", "block.MixinTrialSpawnerData",
"block.MixinTrialSpawnerState", "block.MixinTrialSpawnerState",
"carpet.MixinEntityPlayerMPFake", "carpet.MixinEntityPlayerMPFake",