This commit is contained in:
Brian Neumann-Fopiano
2026-08-13 12:38:08 -04:00
parent 14b6280668
commit 1586b4bd1a
68 changed files with 733 additions and 211 deletions
@@ -19,6 +19,7 @@ public final class StubTileData extends TileData {
private static final Gson GSON = new GsonBuilder()
.disableHtmlEscaping()
.setStrictness(Strictness.LENIENT)
.setObjectToNumberStrategy(com.google.gson.ToNumberPolicy.LONG_OR_DOUBLE)
.create();
private final String blockKey;
@@ -32,6 +32,24 @@ public class StubTileDataTest {
assertEquals("minecraft:chests/ancient_city", decoded.getProperties().get("LootTable"));
}
@Test
public void modernIntegralPropertiesReencodeByteIdentical() throws Exception {
KMap<String, Object> properties = new KMap<>();
properties.put("LootTable", "minecraft:chests/ancient_city");
properties.put("LootTableSeed", -7205759403792793599L);
StubTileData original = StubTileData.fromProperties(
StubPlatform.blockStateForTest("minecraft:chest[facing=north]"), properties);
byte[] encoded = encode(original::toBinary);
StubTileData decoded;
try (DataInputStream input = new DataInputStream(new ByteArrayInputStream(encoded))) {
decoded = StubTileData.read(input);
}
assertArrayEquals(encoded, encode(decoded::toBinary));
assertEquals(-7205759403792793599L, decoded.getProperties().get("LootTableSeed"));
}
@Test
public void legacyLootablePayloadPreservesItsCompleteFrame() throws Exception {
byte[] payload = encode(output -> {