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,16 @@
# blockoutline: Block Outline
Outlines the block you're looking at in your own color and width, with an optional faint fill. Only you see it. ([ADR 0061](../../docs/adr/0061-cosmetics.md))
| Setting | Kind | Default |
| --- | --- | --- |
| Color | color | `#A9DCFF` |
| Opacity | 10-100% | 90% |
| Width | 1-6 pixels | 2.5 |
| Fill | on/off | off |
| Fill color | color (when Fill is on) | `#A9DCFF` |
| Fill opacity | 5-60% (when Fill is on) | 20% |
```sh
./gradlew :features:blockoutline:check
```
@@ -0,0 +1,16 @@
plugins {
`java-library`
}
// Block Outline (ADR 0061): the outline of the block the crosshair is on, in a color and width of the player's, filled if they like.
// 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,65 @@
package incari.features.blockoutline;
import incari.framework.Category;
import incari.framework.Module;
import incari.framework.event.Events;
import incari.framework.setting.BooleanSetting;
import incari.framework.setting.ColorSetting;
import incari.framework.setting.FloatSetting;
import incari.framework.setting.IntSetting;
/**
* Block Outline: the outline round the block the crosshair is on, in the player's color and width,
* its faces filled faintly if they like. The game's thin dark line comes back when it's off.
*/
public final class BlockOutline extends Module {
final ColorSetting color = settings().color("color", "Color", 0xA9DCFF).describedAs("The outline's color.");
final IntSetting opacity = settings()
.integer("opacity", "Opacity", 10, 100, 90)
.formattedAs(value -> value + "%")
.describedAs("How solid the outline is.");
final FloatSetting width =
settings().decimal("width", "Width", 1, 6, 0.5F, 2.5F).describedAs("How thick the outline is, in pixels.");
final BooleanSetting fill = settings().bool("fill", "Fill", false).describedAs("Shades the block's faces too.");
final ColorSetting fillColor = settings()
.color("fill-color", "Fill color", 0xA9DCFF)
.describedAs("The shade's color.")
.visibleWhen(fill::get);
final IntSetting fillOpacity = settings()
.integer("fill-opacity", "Fill opacity", 5, 60, 20)
.formattedAs(value -> value + "%")
.describedAs("How strong the shade is.")
.visibleWhen(fill::get);
/** Block Outline, off until the player turns it on. */
public BlockOutline() {
super(
"blockoutline",
"Block Outline",
"Draws the outline of the block you look at in your own color and width.",
Category.VISUAL);
on(Events.TICK, this::apply);
}
private void apply() {
int fillArgb = fill.get() ? withOpacity(fillColor.get(), fillOpacity.get()) : 0;
system().game().overrideBlockOutline(withOpacity(color.get(), opacity.get()), width.get(), fillArgb);
}
@Override
protected void onEnable() {
apply();
}
@Override
protected void onDisable() {
system().game().overrideBlockOutline(0, 0, 0);
}
/** {@code argb}'s color at {@code percent} opacity, never fully clear (0 means the game's own). */
static int withOpacity(int argb, int percent) {
int alpha = Math.max(1, Math.round(percent * 255 / 100.0F));
return alpha << 24 | (argb & 0xFFFFFF);
}
}
@@ -0,0 +1,5 @@
/** Block Outline (ADR 0061): the outline of the block the crosshair is on, in a color and width of the player's, filled if they like. */
@NullMarked
package incari.features.blockoutline;
import org.jspecify.annotations.NullMarked;
@@ -0,0 +1,35 @@
package incari.features.blockoutline;
import static org.assertj.core.api.Assertions.assertThat;
import incari.framework.testing.TestGame;
import org.junit.jupiter.api.Test;
class BlockOutlineTest {
private final BlockOutline module = new BlockOutline();
private final TestGame game = new TestGame(module);
@Test
void outlinesInThePlayersColorWhileOnAndTheGamesAfter() {
module.setEnabled(true);
assertThat(game.outlineColor).isEqualTo(0xE6A9DCFF);
assertThat(game.outlineWidth).isEqualTo(2.5F);
assertThat(game.outlineFill).isZero();
module.fill.set(true);
module.color.set(0xFF0000);
game.tick();
assertThat(game.outlineColor & 0xFFFFFF).isEqualTo(0xFF0000);
assertThat(game.outlineFill).isEqualTo(0x33A9DCFF);
module.setEnabled(false);
assertThat(game.outlineColor).isZero();
}
@Test
void anOpacityNeverClearsTheColor() {
assertThat(BlockOutline.withOpacity(0xFF123456, 0) >>> 24).isEqualTo(1);
assertThat(BlockOutline.withOpacity(0x123456, 100)).isEqualTo(0xFF123456);
}
}
@@ -0,0 +1,24 @@
package incari.features.blockoutline;
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.blockoutline", 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.blockoutline..");
}