Archive incari-client (client, 26.3, clean)
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
package incari.features.oldanimations;
|
||||
|
||||
import incari.framework.Category;
|
||||
import incari.framework.Module;
|
||||
import incari.framework.event.Events;
|
||||
import incari.framework.event.HeldItem;
|
||||
import incari.framework.setting.BooleanSetting;
|
||||
|
||||
/**
|
||||
* 1.7 Animations: first person as 1.7 drew it. The block-hit (attacking while blocking, eating or
|
||||
* drawing a bow swings the arm, as it did before 1.8), flat items held smaller and tilted, the
|
||||
* fishing rod the other way round, and 1.7's sword-blocking pose on servers where swords block.
|
||||
* Only the drawing changes: nothing more is sent to the server.
|
||||
*/
|
||||
public final class OldAnimations extends Module {
|
||||
|
||||
final BooleanSetting blockHit = settings()
|
||||
.bool("block-hit", "Block-hit swing", true)
|
||||
.describedAs("Attacking while an item's in use swings your arm, as 1.7 drew it.");
|
||||
final BooleanSetting items = settings()
|
||||
.bool("items", "1.7 item positions", true)
|
||||
.describedAs("Swords, tools and other flat items held as in 1.7.");
|
||||
final BooleanSetting rod = settings()
|
||||
.bool("rod", "1.7 fishing rod", true)
|
||||
.describedAs("The fishing rod points the way it did in 1.7.");
|
||||
final BooleanSetting swordBlock = settings()
|
||||
.bool("sword-block", "1.7 sword blocking", true)
|
||||
.describedAs("A blocking sword takes 1.7's pose (on servers where swords block).");
|
||||
|
||||
/** 1.7 Animations, off until the player turns it on. */
|
||||
public OldAnimations() {
|
||||
super(
|
||||
"oldanimations",
|
||||
"1.7 Animations",
|
||||
"Draws your hands and items in first person as 1.7 did.",
|
||||
Category.VISUAL);
|
||||
on(Events.HELD_ITEM, this::onHeldItem);
|
||||
}
|
||||
|
||||
private void onHeldItem(HeldItem item) {
|
||||
item.setSwingWhileUsing(blockHit.get());
|
||||
item.setLegacyItems(items.get());
|
||||
item.setLegacyRod(rod.get());
|
||||
item.setLegacyBlock(swordBlock.get());
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/** 1.7 Animations (ADR 0053): 1.7's block-hit swing and held-item poses. */
|
||||
@NullMarked
|
||||
package incari.features.oldanimations;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package incari.features.oldanimations;
|
||||
|
||||
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.oldanimations", 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.oldanimations..");
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package incari.features.oldanimations;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import incari.framework.event.HeldItem;
|
||||
import incari.framework.setting.BooleanSetting;
|
||||
import incari.framework.testing.TestGame;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class OldAnimationsTest {
|
||||
|
||||
private final OldAnimations module = new OldAnimations();
|
||||
private final TestGame game = new TestGame(module);
|
||||
|
||||
@Test
|
||||
void asksForEveryOldPoseByDefault() {
|
||||
module.setEnabled(true);
|
||||
HeldItem item = game.heldItem(true, false, true);
|
||||
assertThat(item.swingWhileUsing()).isTrue();
|
||||
assertThat(item.legacyItems()).isTrue();
|
||||
assertThat(item.legacyRod()).isTrue();
|
||||
assertThat(item.legacyBlock()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void eachCanBeTurnedOff() {
|
||||
module.setEnabled(true);
|
||||
((BooleanSetting) module.settings().get("block-hit")).set(false);
|
||||
((BooleanSetting) module.settings().get("rod")).set(false);
|
||||
HeldItem item = game.heldItem(true, false, false);
|
||||
assertThat(item.swingWhileUsing()).isFalse();
|
||||
assertThat(item.legacyRod()).isFalse();
|
||||
assertThat(item.legacyItems()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void offChangesNothing() {
|
||||
HeldItem item = game.heldItem(true, false, false);
|
||||
assertThat(item.legacyItems()).isFalse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user