SuperflatPreset implements Serializable { public SuperflatPreset(int biome, List<Layer> layers, Map<Structure, Map<String, String>> structures) { this.biome = biome; this.layers = layers; structuresMap = structures.entrySet().stream().collect(toMap(Entry::getKey, entry -> new HashMap<>(entry.getValue()))); } SuperflatPreset(int biome, List<Layer> layers, Map<Structure, Map<String, String>> structures); int getBiome(); void setBiome(int biome); List<Layer> getLayers(); void setLayers(List<Layer> layers); Map<Structure, Map<String, String>> getStructures(); void setStructures(Map<Structure, Map<String, String>> structures); String toMinecraft1_12_2(); CompoundTag toMinecraft1_15_2(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static SuperflatPreset fromMinecraft1_12_2(String str); @SuppressWarnings("unchecked") // Guaranteed by Minecraft static SuperflatPreset fromMinecraft1_15_2(CompoundTag tag); static Builder builder(int biome, Structure... structures);  }
@Test public void testSuperflatPreset() { SuperflatPreset superflatPreset = new SuperflatPreset(BIOME_PLAINS, ImmutableList.of(new Layer(MC_BEDROCK, 1), new Layer(MC_STONE, 10), new Layer(MC_DIRT, 4), new Layer(MC_GRASS_BLOCK, 1)), ImmutableMap.of(BIOME_1, emptyMap(), LAKE, emptyMap(), VILLAGE, emptyMap())); String mc112Representation = superflatPreset.toMinecraft1_12_2(); System.out.println(mc112Representation); SuperflatPreset superflatPreset2 = SuperflatPreset.fromMinecraft1_12_2(mc112Representation); CompoundTag mc113Representation = superflatPreset2.toMinecraft1_15_2(); System.out.println(mc113Representation); SuperflatPreset superflatPreset3 = SuperflatPreset.fromMinecraft1_15_2(mc113Representation); Assert.assertEquals(superflatPreset, superflatPreset2); Assert.assertEquals(superflatPreset2, superflatPreset3); }