- sturdyDecoratedPot:装饰陶罐不被投掷物击碎 & - unbreakableDecoratedPot:玩家挖掘陶罐时不产生裂纹效果 & - 新增 MixinDecoratedPotBlock(onProjectileHit 取消 + playerWillDestroy 不设 CRACKED) & - 补中英语言描述
This commit is contained in:
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})
|
||||
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;
|
||||
}
|
||||
+39
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user