mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-25 21:40:05 +00:00
Vwoop
This commit is contained in:
1 parent
55b7460b9a
commit
699247b1de
327 files changed
+30138
-3934
No files matched your search
-32
@@ -1,32 +0,0 @@
|
||||
package art.arcane.iris.core.commands;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class BukkitNativeStructureLocatePolicyTest {
|
||||
@Test
|
||||
public void nativeMonumentLocateIsUnavailable() {
|
||||
assertTrue(BukkitNativeStructureLocatePolicy.isUnavailable("minecraft:monument"));
|
||||
assertTrue(BukkitNativeStructureLocatePolicy.isUnavailable(" MINECRAFT:MONUMENT "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unrelatedAndNonCanonicalKeysRemainAvailable() {
|
||||
assertFalse(BukkitNativeStructureLocatePolicy.isUnavailable(null));
|
||||
assertFalse(BukkitNativeStructureLocatePolicy.isUnavailable(""));
|
||||
assertFalse(BukkitNativeStructureLocatePolicy.isUnavailable("minecraft:stronghold"));
|
||||
assertFalse(BukkitNativeStructureLocatePolicy.isUnavailable("minecraft:ocean_monument"));
|
||||
assertFalse(BukkitNativeStructureLocatePolicy.isUnavailable("minecraft:ocean_monuments"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejectionExplainsSafetyAndGenerationBehavior() {
|
||||
String message = BukkitNativeStructureLocatePolicy.unavailableMessage().toLowerCase();
|
||||
|
||||
assertTrue(message.contains("unavailable"));
|
||||
assertTrue(message.contains("stall the server thread"));
|
||||
assertTrue(message.contains("generation is unaffected"));
|
||||
}
|
||||
}
|
||||
+61
@@ -1,11 +1,14 @@
|
||||
package art.arcane.iris.core.commands;
|
||||
|
||||
import art.arcane.iris.engine.framework.NativeStructureGenerationPolicy;
|
||||
import art.arcane.iris.engine.object.NativeStructureGenerationStatus;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -21,6 +24,47 @@ public class IrisStructureLocateCommandContractTest {
|
||||
assertFalse(source.contains("at[2] + 8"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findRoutesOnlyExplicitNativeReplacementThroughIrisLocate() throws IOException {
|
||||
String source = Files.readString(Path.of(System.getProperty("iris.commandFindSource")));
|
||||
int methodStart = source.indexOf("public void structure(");
|
||||
int methodEnd = source.indexOf("private static Structure resolveNativeStructure", methodStart);
|
||||
String method = source.substring(methodStart, methodEnd);
|
||||
int nativeResolution = method.indexOf("resolveNativeStructure(structureKey)");
|
||||
int policyResolution = method.indexOf("NativeStructureGenerationPolicy.resolve(", nativeResolution);
|
||||
int replacementCheck = method.indexOf(
|
||||
"decision.status() == NativeStructureGenerationStatus.REPLACED_BY_IRIS", policyResolution);
|
||||
int replacementLocate = method.indexOf("locateIrisStructure(e, structureKey, commandSender)", replacementCheck);
|
||||
int capabilityCheck = method.indexOf("NativeStructureLocateCapability.isPaperUnavailable(structureKey)", replacementLocate);
|
||||
int genericIrisLookup = method.indexOf(
|
||||
"nativeStructure == null && IrisStructureLocator.isPlaced(e, structureKey)", capabilityCheck);
|
||||
int nativeLocate = method.indexOf("targetWorld.locateNearestStructure(", genericIrisLookup);
|
||||
assertTrue(nativeResolution >= 0);
|
||||
assertTrue(policyResolution > nativeResolution);
|
||||
assertTrue(replacementCheck > policyResolution);
|
||||
assertTrue(replacementLocate > replacementCheck);
|
||||
assertTrue(capabilityCheck > replacementLocate);
|
||||
assertTrue(genericIrisLookup > capabilityCheck);
|
||||
assertTrue(nativeLocate > policyResolution);
|
||||
assertTrue(method.contains("decision.status() != NativeStructureGenerationStatus.REPLACED_BY_IRIS"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findNativePolicyMessagesMatchModdedDiagnostics() {
|
||||
assertEquals(
|
||||
"Native structure minecraft:village_plains is disabled by this dimension's importedStructures settings.",
|
||||
NativeStructureGenerationPolicy.generationStatusMessage(
|
||||
"minecraft:village_plains", NativeStructureGenerationStatus.DISABLED_BY_PACK));
|
||||
assertEquals(
|
||||
"Native structure minecraft:ancient_city is replaced by an Iris placement in this pack and locates through that explicit replacement.",
|
||||
NativeStructureGenerationPolicy.generationStatusMessage(
|
||||
"minecraft:ancient_city", NativeStructureGenerationStatus.REPLACED_BY_IRIS));
|
||||
assertEquals(
|
||||
"Native structure minecraft:stronghold generates natively.",
|
||||
NativeStructureGenerationPolicy.generationStatusMessage(
|
||||
"minecraft:stronghold", NativeStructureGenerationStatus.GENERATE_NATIVE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void structureVerifyReportsDensityLimitAndUsesExactLocatedOrigin() throws IOException {
|
||||
String source = Files.readString(Path.of(System.getProperty("iris.commandStructureSource")));
|
||||
@@ -31,4 +75,21 @@ public class IrisStructureLocateCommandContractTest {
|
||||
assertFalse(source.contains("at[0] + 8"));
|
||||
assertFalse(source.contains("at[2] + 8"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void structureVerifyPartitionsPolicyBeforeNativeReachability() throws IOException {
|
||||
String source = Files.readString(Path.of(System.getProperty("iris.commandStructureSource")));
|
||||
int methodStart = source.indexOf("private void runVerification(");
|
||||
int methodEnd = source.indexOf("private void sendVerificationMessages(", methodStart);
|
||||
String method = source.substring(methodStart, methodEnd);
|
||||
int policyResolution = method.indexOf("NativeStructureGenerationPolicy.resolve(engine, keyName, false)");
|
||||
int nativeRequirement = method.indexOf("requiresNativeReachability |= decision.generate()", policyResolution);
|
||||
int reachabilityGuard = method.indexOf("if (requiresNativeReachability)", nativeRequirement);
|
||||
int reachabilityLookup = method.indexOf("StructureReachability.reachableKeys(engine)", reachabilityGuard);
|
||||
|
||||
assertTrue(policyResolution >= 0);
|
||||
assertTrue(nativeRequirement > policyResolution);
|
||||
assertTrue(reachabilityGuard > nativeRequirement);
|
||||
assertTrue(reachabilityLookup > reachabilityGuard);
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package art.arcane.iris.core.commands;
|
||||
|
||||
import art.arcane.volmlib.util.director.DirectorOrigin;
|
||||
import art.arcane.volmlib.util.director.annotations.Director;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class StudioScoreboardCommandTest {
|
||||
@Test
|
||||
public void scoreboardCommandIsPlayerScopedAndEntityScheduled() throws NoSuchMethodException {
|
||||
Method command = CommandStudio.class.getDeclaredMethod("scoreboard");
|
||||
Director director = command.getAnnotation(Director.class);
|
||||
|
||||
assertEquals(DirectorOrigin.PLAYER, director.origin());
|
||||
assertFalse(director.sync());
|
||||
assertTrue(List.of(director.aliases()).contains("board"));
|
||||
assertTrue(List.of(director.aliases()).contains("sidebar"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user