mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-08-27 04:37:47 +00:00
probe
This commit is contained in:
@@ -529,6 +529,23 @@ public final class StubPlatform implements IrisPlatform {
|
||||
}
|
||||
}
|
||||
|
||||
private record StubEntityType(String key) implements PlatformEntityType {
|
||||
@Override
|
||||
public String namespace() {
|
||||
return "minecraft";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String spawnCategory() {
|
||||
return "monster";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object nativeHandle() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class StubRegistries implements PlatformRegistries {
|
||||
@Override
|
||||
public PlatformBlockState block(String key) {
|
||||
@@ -567,7 +584,7 @@ public final class StubPlatform implements IrisPlatform {
|
||||
|
||||
@Override
|
||||
public PlatformEntityType entity(String key) {
|
||||
return null;
|
||||
return key != null && key.startsWith("minecraft:") ? new StubEntityType(key) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,6 +8,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -78,4 +80,12 @@ public final class GenerationProbeTest {
|
||||
"IRIS_GENPROBE_RESULT version=1 status=PASS dimension=underworld warmup_chunks=2 measured_chunks=4 successful_chunks=6 failed_chunks=0 engine_ready_ms=5.000 first_chunk_ms=6.000 measured_median_ms=10.000 measured_p95_ms=20.000 measured_max_ms=30.000 measured_total_ms=40.000 measured_cps=100.000 signature=0123456789abcdef",
|
||||
result.machineLine());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void offlineProbeResolvesVanillaEntitiesWithoutInventingExternalKeys() {
|
||||
StubPlatform platform = new StubPlatform(new File("/tmp/iris-probe-test"));
|
||||
|
||||
assertNotNull(platform.registries().entity("minecraft:slime"));
|
||||
assertNull(platform.registries().entity("external:missing"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user