Archive incari-client (client, 26.3, clean)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# oldtextures: Old Textures
|
||||
|
||||
Turns the game's Programmer Art pack (pre-1.14 textures) on and off, and follows the pack if you switch it in Resource Packs. Each change reloads resources. ([ADR 0055](../../docs/adr/0055-built-in-packs-and-old-textures.md))
|
||||
|
||||
No settings besides the toggle key.
|
||||
|
||||
```sh
|
||||
./gradlew :features:oldtextures:check
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
}
|
||||
|
||||
// Old Textures (ADR 0055): the game's Programmer Art pack, turned on and off as a module.
|
||||
// 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)
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package incari.features.oldtextures;
|
||||
|
||||
import incari.framework.Category;
|
||||
import incari.framework.Module;
|
||||
|
||||
/**
|
||||
* Old Textures: the game's own Programmer Art pack, the textures from before 1.14. The module is
|
||||
* the pack's switch ({@link Module#followPack}): turning it on turns the pack on in the Resource
|
||||
* Packs screen, and turning the pack on or off there turns the module with it. Each change reloads
|
||||
* the game's resources, as the screen's would.
|
||||
*/
|
||||
public final class OldTextures extends Module {
|
||||
|
||||
/** The game's id for Programmer Art. */
|
||||
static final String PROGRAMMER_ART = "programmer_art";
|
||||
|
||||
/** Old Textures, on only if Programmer Art is. */
|
||||
public OldTextures() {
|
||||
super(
|
||||
"oldtextures",
|
||||
"Old Textures",
|
||||
"The textures from before 1.14 (the game's Programmer Art).",
|
||||
Category.VISUAL);
|
||||
followPack(PROGRAMMER_ART);
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/** Old Textures (ADR 0055): the game's Programmer Art pack, turned on and off as a module. */
|
||||
@NullMarked
|
||||
package incari.features.oldtextures;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package incari.features.oldtextures;
|
||||
|
||||
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.oldtextures", 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.oldtextures..");
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package incari.features.oldtextures;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import incari.framework.testing.TestGame;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class OldTexturesTest {
|
||||
|
||||
private final OldTextures module = new OldTextures();
|
||||
private final TestGame game = new TestGame(module);
|
||||
|
||||
@Test
|
||||
void turnsProgrammerArtOnAndOff() {
|
||||
module.setEnabled(true);
|
||||
assertThat(game.selectedPacks).containsExactly("programmer_art");
|
||||
module.setEnabled(false);
|
||||
assertThat(game.selectedPacks).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
void followsProgrammerArtInTheResourcePacksScreen() {
|
||||
game.selectedPacks.add("programmer_art");
|
||||
game.tick();
|
||||
assertThat(module.isEnabled()).isTrue();
|
||||
game.selectedPacks.remove("programmer_art");
|
||||
game.tick();
|
||||
assertThat(module.isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void leavesHighContrastAlone() {
|
||||
game.selectedPacks.add("high_contrast");
|
||||
game.tick();
|
||||
assertThat(module.isEnabled()).isFalse();
|
||||
module.setEnabled(true);
|
||||
assertThat(game.selectedPacks).containsExactlyInAnyOrder("high_contrast", "programmer_art");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user