Archive incari-client (client, 26.3, clean)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
# glintcolor: Enchant Glint
|
||||
|
||||
Colors the enchantment shimmer on items and armor your way. Speed and strength stay the game's accessibility options. Only you see it. ([ADR 0061](../../docs/adr/0061-cosmetics.md))
|
||||
|
||||
| Setting | Kind | Default |
|
||||
| --- | --- | --- |
|
||||
| Color | color | `#7FC8FF` |
|
||||
|
||||
```sh
|
||||
./gradlew :features:glintcolor:check
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
}
|
||||
|
||||
// Enchant Glint (ADR 0061): the enchantment glint 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)
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package incari.features.glintcolor;
|
||||
|
||||
import incari.framework.Category;
|
||||
import incari.framework.Module;
|
||||
import incari.framework.event.Events;
|
||||
import incari.framework.setting.ColorSetting;
|
||||
|
||||
/**
|
||||
* Enchant Glint: the shimmer on enchanted items and armor in the player's color instead of purple.
|
||||
* Its speed and strength are the game's own accessibility options.
|
||||
*/
|
||||
public final class EnchantGlint extends Module {
|
||||
|
||||
final ColorSetting color = settings().color("color", "Color", 0x7FC8FF).describedAs("The glint's color.");
|
||||
|
||||
/** Enchant Glint, off until the player turns it on. */
|
||||
public EnchantGlint() {
|
||||
super("glintcolor", "Enchant Glint", "Colors the shimmer on enchanted items and armor.", Category.VISUAL);
|
||||
on(Events.TICK, this::apply);
|
||||
}
|
||||
|
||||
private void apply() {
|
||||
system().game().overrideGlintColor(color.get() & 0xFFFFFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEnable() {
|
||||
apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDisable() {
|
||||
system().game().overrideGlintColor(-1);
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/** Enchant Glint (ADR 0061): the enchantment glint in a color of the player's. */
|
||||
@NullMarked
|
||||
package incari.features.glintcolor;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package incari.features.glintcolor;
|
||||
|
||||
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.glintcolor", 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.glintcolor..");
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package incari.features.glintcolor;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import incari.framework.testing.TestGame;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class EnchantGlintTest {
|
||||
|
||||
private final EnchantGlint module = new EnchantGlint();
|
||||
private final TestGame game = new TestGame(module);
|
||||
|
||||
@Test
|
||||
void colorsTheGlintWhileOn() {
|
||||
module.setEnabled(true);
|
||||
assertThat(game.glintColor).isEqualTo(0x7FC8FF);
|
||||
module.color.set(0xFF8800);
|
||||
game.tick();
|
||||
assertThat(game.glintColor).isEqualTo(0xFF8800);
|
||||
module.setEnabled(false);
|
||||
assertThat(game.glintColor).isEqualTo(-1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user