Archive incari-client (client, 26.3, clean)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# norender: No Render
|
||||
|
||||
Leaves what costs frames out of the world drawn, on this client only. Made for bone meal farms:
|
||||
hundreds of items and sparkles can take a Chromebook to no frames at all. What's hidden is still
|
||||
there: items are still picked up, falling blocks still land.
|
||||
|
||||
| Setting | Kind | Default |
|
||||
| --- | --- | --- |
|
||||
| Items on the ground | Shown, Still (no bobbing or spinning), Hidden | Hidden |
|
||||
| One item per stack | On/off, while items are drawn: a stack as one item, not a pile of up to five | On |
|
||||
| Hide XP orbs | On/off | Off |
|
||||
| Hide falling blocks | On/off: sand, gravel, anvils until they land | Off |
|
||||
| Hide fireworks | On/off: rockets and their bursts | Off |
|
||||
| Hide bone meal sparkles | On/off: the green sparkles of bone meal and villagers | On |
|
||||
| Hide block bits | On/off: blocks breaking, the dust of running and landing | Off |
|
||||
| Hide explosions | On/off: explosions' smoke clouds | Off |
|
||||
| Hide all particles | On/off | Off |
|
||||
|
||||
The module holds a `NoRender` (`Game.overrideNoRender`); the client's `ModuleNoRender` checks it
|
||||
where the game draws items and entities and makes particles. Hidden entities aren't extracted at
|
||||
all, and hidden particles aren't made, so both cost nothing.
|
||||
|
||||
```sh
|
||||
./gradlew :features:norender:check
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
}
|
||||
|
||||
// No Render: leaves items on the ground, XP orbs and chosen particles out of the world drawn.
|
||||
// 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)
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
package incari.features.norender;
|
||||
|
||||
import incari.framework.Category;
|
||||
import incari.framework.Module;
|
||||
import incari.framework.game.NoRender;
|
||||
import incari.framework.game.NoRender.Items;
|
||||
import incari.framework.setting.BooleanSetting;
|
||||
import incari.framework.setting.ChoiceSetting;
|
||||
import incari.framework.setting.Setting;
|
||||
|
||||
/**
|
||||
* No Render: leaves what costs frames out of the world drawn, on this client only. Items on the
|
||||
* ground hidden or lying still, a stack as one item, and XP orbs, falling blocks, fireworks and the
|
||||
* particles the player picks hidden. What's hidden is still there, to pick up or hit. The choice is
|
||||
* handed to the game once per change, not per tick: the client checks it as it draws.
|
||||
*/
|
||||
public final class NoRenderModule extends Module {
|
||||
|
||||
final ChoiceSetting<Items> items = settings()
|
||||
.choice("items", "Items on the ground", Items.values(), Items.HIDDEN, Items::label)
|
||||
.describedAs("Still: no bobbing or spinning. Hidden: not drawn, but still picked up.");
|
||||
final BooleanSetting oneCopy = settings()
|
||||
.bool("one-copy", "One item per stack", true)
|
||||
.describedAs("Draws a stack on the ground as one item, not a pile of up to five.")
|
||||
.visibleWhen(() -> items.get() != Items.HIDDEN);
|
||||
final BooleanSetting orbs =
|
||||
settings().bool("orbs", "Hide XP orbs", false).describedAs("Experience orbs aren't drawn.");
|
||||
final BooleanSetting fallingBlocks = settings()
|
||||
.bool("falling-blocks", "Hide falling blocks", false)
|
||||
.describedAs("Falling sand, gravel and anvils aren't drawn until they land.");
|
||||
final BooleanSetting fireworks = settings()
|
||||
.bool("fireworks", "Hide fireworks", false)
|
||||
.describedAs("Firework rockets and their bursts aren't drawn.");
|
||||
final BooleanSetting growth = settings()
|
||||
.bool("growth", "Hide bone meal sparkles", true)
|
||||
.describedAs("The green sparkles of bone meal and villagers aren't drawn.");
|
||||
final BooleanSetting breaking = settings()
|
||||
.bool("breaking", "Hide block bits", false)
|
||||
.describedAs("The bits of blocks breaking, and the dust of running and landing.");
|
||||
final BooleanSetting explosions = settings()
|
||||
.bool("explosions", "Hide explosions", false)
|
||||
.describedAs("Explosions' smoke clouds aren't drawn.");
|
||||
final BooleanSetting allParticles = settings()
|
||||
.bool("all-particles", "Hide all particles", false)
|
||||
.describedAs("No particles at all: more frames, but no rain splashes, hits or potions.");
|
||||
|
||||
/** No Render, off until the player turns it on. */
|
||||
public NoRenderModule() {
|
||||
super("norender", "No Render", "Hides items on the ground and other things that cost frames.", Category.VISUAL);
|
||||
for (Setting<?> setting : settings()) {
|
||||
setting.onChange(this::changed);
|
||||
}
|
||||
}
|
||||
|
||||
private void changed() {
|
||||
if (isEnabled()) {
|
||||
system().game().overrideNoRender(choice());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onEnable() {
|
||||
system().game().overrideNoRender(choice());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDisable() {
|
||||
system().game().overrideNoRender(null);
|
||||
}
|
||||
|
||||
/** What the settings say, as the game takes it. */
|
||||
NoRender choice() {
|
||||
return new NoRender(
|
||||
items.get(),
|
||||
oneCopy.get(),
|
||||
orbs.get(),
|
||||
fallingBlocks.get(),
|
||||
fireworks.get(),
|
||||
growth.get(),
|
||||
breaking.get(),
|
||||
explosions.get(),
|
||||
allParticles.get());
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/** No Render: leaves items on the ground, XP orbs and chosen particles out of the world drawn. */
|
||||
@NullMarked
|
||||
package incari.features.norender;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package incari.features.norender;
|
||||
|
||||
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.norender", 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.norender..");
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package incari.features.norender;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import incari.framework.game.NoRender;
|
||||
import incari.framework.game.NoRender.Items;
|
||||
import incari.framework.testing.TestGame;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class NoRenderModuleTest {
|
||||
|
||||
private final NoRenderModule module = new NoRenderModule();
|
||||
private final TestGame game = new TestGame(module);
|
||||
|
||||
@Test
|
||||
void hidesItemsAndSparklesWhileOnAndNothingAfter() {
|
||||
assertThat(game.noRender).isNull();
|
||||
|
||||
module.setEnabled(true);
|
||||
assertThat(game.noRender)
|
||||
.isEqualTo(new NoRender(Items.HIDDEN, true, false, false, false, true, false, false, false));
|
||||
|
||||
module.setEnabled(false);
|
||||
assertThat(game.noRender).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void aChangedSettingReachesTheGameAtOnceButOnlyWhileOn() {
|
||||
module.setEnabled(true);
|
||||
module.items.set(Items.STILL);
|
||||
module.orbs.set(true);
|
||||
module.allParticles.set(true);
|
||||
assertThat(game.noRender).isNotNull();
|
||||
assertThat(game.noRender.items()).isEqualTo(Items.STILL);
|
||||
assertThat(game.noRender.orbs()).isTrue();
|
||||
assertThat(game.noRender.allParticles()).isTrue();
|
||||
|
||||
module.setEnabled(false);
|
||||
module.fireworks.set(true);
|
||||
assertThat(game.noRender).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void onePerStackIsOnlyOfferedWhileItemsAreDrawn() {
|
||||
assertThat(module.oneCopy.isVisible()).isFalse();
|
||||
module.items.set(Items.STILL);
|
||||
assertThat(module.oneCopy.isVisible()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void choicesAreKeptByTheirNames() {
|
||||
module.items.set(Items.STILL);
|
||||
assertThat(module.items.key()).isEqualTo("still");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user