Add BlockData#getAsString(boolean) to hide unspecified states

By: Parker Hawke <hawkeboyz2@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot
2018-12-16 18:21:29 -05:00
parent 7114dbbb9d
commit 42831b84cd
4 changed files with 93 additions and 15 deletions

View File

@@ -152,4 +152,21 @@ public class BlockDataTest extends AbstractTestingBase {
Assert.assertTrue(one.matches(two));
Assert.assertFalse(two.matches(one));
}
@Test
public void testGetAsString() {
String dataString = "minecraft:chest[facing=east,waterlogged=true]";
BlockData data = CraftBlockData.newData(null, dataString);
Assert.assertThat(data.getAsString(true), is(dataString));
Assert.assertThat(data.getAsString(false), is("minecraft:chest[facing=east,type=single,waterlogged=true]"));
}
@Test
public void testGetAsString2() {
Chest data = (Chest) CraftBlockData.fromData(Blocks.CHEST.getBlockData().set(BlockChest.FACING, EnumDirection.EAST));
Assert.assertThat(data.getAsString(true), is("minecraft:chest[facing=east,type=single,waterlogged=false]"));
Assert.assertThat(data.getAsString(false), is("minecraft:chest[facing=east,type=single,waterlogged=false]"));
}
}