more stuff #1

Merged
YeahAkis merged 17 commits from YeahAkis/tweaks:main into main 2025-12-03 20:11:54 +01:00
2 changed files with 16 additions and 0 deletions
Showing only changes of commit 37310b3d61 - Show all commits

View File

@@ -15,6 +15,9 @@ public class Tweaks implements ModInitializer {
public static final GameRules.Key<GameRules.IntRule> SHIELD_AXE_COOLDOWN =
GameRuleRegistry.register("shieldAxeCooldown", GameRules.Category.PLAYER, GameRuleFactory.createIntRule(100, 0, Integer.MAX_VALUE));
public static final GameRules.Key<GameRules.IntRule> CRITICAL_MULTIPLIER =
GameRuleRegistry.register("criticalHitMultiplier", GameRules.Category.PLAYER, GameRuleFactory.createIntRule(150, 0, Integer.MAX_VALUE));
@Override
public void onInitialize() {
}

View File

@@ -26,4 +26,17 @@ public abstract class PlayerEntityMixin {
}
return original;
}
@ModifyConstant(
method = "attack",
constant = @Constant(floatValue = 1.5F)
)
private float modifyCriticalMultiplier(float original) {
PlayerEntity player = (PlayerEntity)(Object)this;
if (player.getWorld() != null && player.getWorld() instanceof ServerWorld serverWorld) {
GameRules.IntRule rule = serverWorld.getGameRules().get(Tweaks.CRITICAL_MULTIPLIER);
return rule.get() / 100.0F;
}
return original;
}
}