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,11 @@
# fullbright: Fullbright
Lights caves and nights like day, for you only, as night vision would (no potion icon, Brightness slider untouched).
| Setting | Kind | Default |
| --- | --- | --- |
| Brightness | 10-100% | 100%: fully lit |
```sh
./gradlew :features:fullbright:check
```
@@ -0,0 +1,16 @@
plugins {
`java-library`
}
// Fullbright: the world fully lit, as night vision lights it.
// 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,43 @@
package incari.features.fullbright;
import incari.framework.Category;
import incari.framework.Module;
import incari.framework.event.Events;
import incari.framework.setting.IntSetting;
/**
* Fullbright: caves and nights as light as day, on this client only. The game's lightmap is lit as
* night vision lights it ({@code Game.overrideBrightness}), so there's no potion icon or particles,
* and the Brightness slider stays the player's. A real night vision effect still shows if stronger.
*/
public final class Fullbright extends Module {
final IntSetting level = settings()
.integer("level", "Brightness", 10, 100, 100)
.formattedAs(percent -> percent + "%")
.describedAs("100%: everything fully lit, as with night vision.");
/** Fullbright, off until the player turns it on. */
public Fullbright() {
super(
"fullbright",
"Fullbright",
"Lights up caves and nights as if it were day, on your screen only.",
Category.VISUAL);
on(Events.TICK, this::apply);
}
private void apply() {
system().game().overrideBrightness(level.get() / 100F);
}
@Override
protected void onEnable() {
apply();
}
@Override
protected void onDisable() {
system().game().overrideBrightness(0);
}
}
@@ -0,0 +1,5 @@
/** Fullbright: the world fully lit, as night vision lights it. */
@NullMarked
package incari.features.fullbright;
import org.jspecify.annotations.NullMarked;
@@ -0,0 +1,24 @@
package incari.features.fullbright;
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.fullbright", 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.fullbright..");
}
@@ -0,0 +1,26 @@
package incari.features.fullbright;
import static org.assertj.core.api.Assertions.assertThat;
import incari.framework.testing.TestGame;
import org.junit.jupiter.api.Test;
class FullbrightTest {
private final Fullbright module = new Fullbright();
private final TestGame game = new TestGame(module);
@Test
void lightsTheWorldWhileOnAndGivesTheGamesLightBack() {
assertThat(game.brightness).isZero();
module.setEnabled(true);
assertThat(game.brightness).isEqualTo(1F);
module.level.set(50);
game.tick();
assertThat(game.brightness).isEqualTo(0.5F);
module.setEnabled(false);
assertThat(game.brightness).isZero();
}
}