Archive incari-client (client, 26.3, clean)

This commit is contained in:
2026-11-28 00:54:38 -06:00
parent 7a6174687f
commit 12838e838c
2383 changed files with 280266 additions and 0 deletions
@@ -0,0 +1,12 @@
# hitcolor: Hit Color
Changes the red flash of hurt mobs and players to your color. Only you see it. ([ADR 0061](../../docs/adr/0061-cosmetics.md))
| Setting | Kind | Default |
| --- | --- | --- |
| Color | color | `#5AB8FF` |
| Strength | 10-100% | 30%: the game's own strength |
```sh
./gradlew :features:hitcolor:check
```
@@ -0,0 +1,16 @@
plugins {
`java-library`
}
// Hit Color (ADR 0061): the tint on hurt mobs and players, in a color of the player's.
// A feature module: it sees the module framework and nothing else.
dependencies {
api(project(":framework"))
testImplementation(testFixtures(project(":framework")))
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
testImplementation(libs.assertj)
testImplementation(libs.archunit)
testRuntimeOnly(libs.junit.launcher)
}
@@ -0,0 +1,41 @@
package incari.features.hitcolor;
import incari.framework.Category;
import incari.framework.Module;
import incari.framework.event.Events;
import incari.framework.setting.ColorSetting;
import incari.framework.setting.IntSetting;
/**
* Hit Color: the flash a mob or player gives when hurt, in the player's color instead of the
* game's red. On this client only.
*/
public final class HitColor extends Module {
final ColorSetting color =
settings().color("color", "Color", 0x5AB8FF).describedAs("The color hurt mobs and players flash.");
final IntSetting strength = settings()
.integer("strength", "Strength", 10, 100, 30)
.formattedAs(value -> value + "%")
.describedAs("How strongly they're tinted. The game's red is 30%.");
/** Hit Color, off until the player turns it on. */
public HitColor() {
super("hitcolor", "Hit Color", "Changes the color hurt mobs and players flash.", Category.VISUAL);
on(Events.TICK, this::apply);
}
private void apply() {
system().game().overrideHitColor(color.get() & 0xFFFFFF, strength.get());
}
@Override
protected void onEnable() {
apply();
}
@Override
protected void onDisable() {
system().game().overrideHitColor(0, 0);
}
}
@@ -0,0 +1,5 @@
/** Hit Color (ADR 0061): the tint on hurt mobs and players, in a color of the player's. */
@NullMarked
package incari.features.hitcolor;
import org.jspecify.annotations.NullMarked;
@@ -0,0 +1,20 @@
package incari.features.hitcolor;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;
import com.tngtech.archunit.core.importer.ImportOption;
import com.tngtech.archunit.junit.AnalyzeClasses;
import com.tngtech.archunit.junit.ArchTest;
import com.tngtech.archunit.lang.ArchRule;
/** A feature sees the module framework and the JDK's basics: no game, platform or other feature. */
@AnalyzeClasses(packages = "incari.features.hitcolor", importOptions = ImportOption.DoNotIncludeTests.class)
class BoundaryTest {
@ArchTest
static final ArchRule onlyTheFramework = classes()
.should()
.onlyDependOnClassesThat()
.resideInAnyPackage(
"java.lang..", "java.util..", "org.jspecify..", "incari.framework..", "incari.features.hitcolor..");
}
@@ -0,0 +1,29 @@
package incari.features.hitcolor;
import static org.assertj.core.api.Assertions.assertThat;
import incari.framework.testing.TestGame;
import org.junit.jupiter.api.Test;
class HitColorTest {
private final HitColor module = new HitColor();
private final TestGame game = new TestGame(module);
@Test
void tintsInThePlayersColorWhileOn() {
module.setEnabled(true);
assertThat(game.hitColor).isEqualTo(0x5AB8FF);
assertThat(game.hitStrength).isEqualTo(30);
module.strength.set(100);
game.tick();
assertThat(game.hitStrength).isEqualTo(100);
// Black is a color like any other, not "off".
module.color.set(0);
game.tick();
assertThat(game.hitColor).isZero();
assertThat(game.hitStrength).isEqualTo(100);
module.setEnabled(false);
assertThat(game.hitStrength).isZero();
}
}