mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Add BlockState.parse, the inverse of key(), for hosts that read block states from JSON
This commit is contained in:
1 parent
c5a54558fa
commit
09df1af88e
2 files changed
+37
-1
No files matched your search
@@ -31,6 +31,20 @@ class ApiValuesTest {
|
||||
assertThrows(IllegalArgumentException.class, () -> new ResourceKey<>("test:value", int.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
void blockStatesParseWhatTheirKeyWrites() {
|
||||
var log = new BlockState("minecraft:oak_log").withProperty("waterlogged", "false").withProperty("axis", "y");
|
||||
|
||||
assertEquals(log, BlockState.parse(log.key()));
|
||||
assertEquals(log, BlockState.parse("minecraft:oak_log[waterlogged=false,axis=y]"));
|
||||
assertEquals(new BlockState("minecraft:stone"), BlockState.parse("minecraft:stone"));
|
||||
assertEquals(new BlockState("minecraft:stone"), BlockState.parse("minecraft:stone[]"));
|
||||
assertThrows(IllegalArgumentException.class, () -> BlockState.parse("minecraft:oak_log[axis=y"));
|
||||
assertThrows(IllegalArgumentException.class, () -> BlockState.parse("minecraft:oak_log[axis]"));
|
||||
assertThrows(IllegalArgumentException.class, () -> BlockState.parse("minecraft:oak_log[axis=y,axis=x]"));
|
||||
assertThrows(IllegalArgumentException.class, () -> BlockState.parse("stone"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void moduleInfoRequiresANameAndVersion() {
|
||||
var info = ModuleInfo.of("example:moss", "Moss", "1.0.0");
|
||||
|
||||
Reference in new issue
Block a user