From a7b4d91a6a81a59cb743e3c5e50dbd43f8f99e51 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 14 Mar 2024 16:31:26 +0100 Subject: [PATCH] Include blocks --- ...Ids-1.20.3.nbt => items-blocks-1.20.3.nbt} | Bin 22238 -> 40707 bytes .../extra/BlockStates1_13.java | 17 ++++++----------- ...s1_20_3.java => ItemsAndBlocks1_20_3.java} | 16 ++++++++-------- .../mappingsgenerator/util/JsonConverter.java | 8 ++++++++ 4 files changed, 22 insertions(+), 19 deletions(-) rename output/extra/{itemIds-1.20.3.nbt => items-blocks-1.20.3.nbt} (54%) rename src/main/java/com/viaversion/mappingsgenerator/extra/{ItemIds1_20_3.java => ItemsAndBlocks1_20_3.java} (79%) diff --git a/output/extra/itemIds-1.20.3.nbt b/output/extra/items-blocks-1.20.3.nbt similarity index 54% rename from output/extra/itemIds-1.20.3.nbt rename to output/extra/items-blocks-1.20.3.nbt index 0f02d99b035c059cb1f7a3dcd9e0d95bb8c4d76b..4d60cfd514a4e4c5ee94b735e2ae50283c5a6d2d 100644 GIT binary patch delta 5896 zcmZu#X^b346|V6fGdsu5Jv%$=_3n5#>thppy@o)%Ih2biQer!xgoGeB)jc&c?d|FA z^s(bHKZXQQ6!-zoQ;-~xB92Ia5)rYS3PMDQ1Sm+BA|XYBa3w;BLxO;aK#Jg1S9MR1 z?H@ba_0{WFud3er-h2I<=M$g&@tzmncwlyhOsj^aZM!K#Cih<`d<-ro4#7VY0MG7u zIy=>;9&^Z~L3b$JJW*dwIjp6))NGOIjzf2tL5i;L+PbD&zN-ibUY}Tkixd0c)>p8k@vlgi7!|-&*hi|1{fFs!#;nvA!&7ijK3TZOa z(p{UGE^}ZacQlhWEsse>7jORIde*l3jGN_9-5|LZ^O)vYjvTt4u5Aw#)aF?x9Lw!} z|4fU~mZJJ@m!w=q(Pq~rIgc8K5)G$?JjsavN*7;&$8$el%k``s-RwwxXc`^`Gjz)& z8C+BAwhe9!d}P*N&h&M!%g_$XW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0>Yyrv-&J@gA}3BG-}aXZ$sJT2o4<^VhfWJP`$7}HnaL9AnEX6P>e;1In4 zuO8kDw_Q7rf0arggmp`(%+v9U+`EV8;gM^rXUpTbAg;m)l;0O?mm#4)RIb3erB|Tb z1o&;W3SX)=w&w6FVo;!u-sL8_q@Hh(&qGezJ delta 11 ScmZqP$8>Kk list = new ListTag<>(StringTag.class); - for (final JsonElement element : blockstates) { - list.add(new StringTag(element.getAsString())); - } - tag.put("blockstates", list); - MappingsOptimizer.write(tag, MappingsOptimizer.OUTPUT_DIR.resolve("blockstates-1.13.nbt")); + tag.put("blockstates", collectStringList(mappings.getAsJsonArray("blockstates"))); + MappingsOptimizer.write(tag, MappingsOptimizer.OUTPUT_DIR.resolve("extra/blockstates-1.13.nbt")); } } diff --git a/src/main/java/com/viaversion/mappingsgenerator/extra/ItemIds1_20_3.java b/src/main/java/com/viaversion/mappingsgenerator/extra/ItemsAndBlocks1_20_3.java similarity index 79% rename from src/main/java/com/viaversion/mappingsgenerator/extra/ItemIds1_20_3.java rename to src/main/java/com/viaversion/mappingsgenerator/extra/ItemsAndBlocks1_20_3.java index 4e3bab6..543bda7 100644 --- a/src/main/java/com/viaversion/mappingsgenerator/extra/ItemIds1_20_3.java +++ b/src/main/java/com/viaversion/mappingsgenerator/extra/ItemsAndBlocks1_20_3.java @@ -23,21 +23,21 @@ import com.github.steveice10.opennbt.tag.builtin.ListTag; import com.github.steveice10.opennbt.tag.builtin.StringTag; import com.google.gson.JsonArray; import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.viaversion.mappingsgenerator.MappingsLoader; import com.viaversion.mappingsgenerator.MappingsOptimizer; import java.io.IOException; -public final class ItemIds1_20_3 { +import static com.viaversion.mappingsgenerator.util.JsonConverter.collectStringList; + +public final class ItemsAndBlocks1_20_3 { public static void main(final String[] args) throws IOException { - final JsonArray items = MappingsLoader.load("mapping-1.20.3.json").getAsJsonArray("items"); + final JsonObject mappings = MappingsLoader.load("mapping-1.20.3.json"); final CompoundTag tag = new CompoundTag(); - final ListTag list = new ListTag<>(StringTag.class); - for (final JsonElement element : items) { - list.add(new StringTag(element.getAsString())); - } - tag.put("items", list); - MappingsOptimizer.write(tag, MappingsOptimizer.OUTPUT_DIR.resolve("itemIds-1.20.3.nbt")); + tag.put("items", collectStringList(mappings.getAsJsonArray("items"))); + tag.put("blocks", collectStringList(mappings.getAsJsonArray("blocks"))); + MappingsOptimizer.write(tag, MappingsOptimizer.OUTPUT_DIR.resolve("extra/items-blocks-1.20.3.nbt")); } } diff --git a/src/main/java/com/viaversion/mappingsgenerator/util/JsonConverter.java b/src/main/java/com/viaversion/mappingsgenerator/util/JsonConverter.java index 4c3c5ec..4047480 100644 --- a/src/main/java/com/viaversion/mappingsgenerator/util/JsonConverter.java +++ b/src/main/java/com/viaversion/mappingsgenerator/util/JsonConverter.java @@ -35,6 +35,14 @@ import java.util.Map; public final class JsonConverter { + public static ListTag collectStringList(final JsonArray items) { + final ListTag list = new ListTag<>(StringTag.class); + for (final JsonElement element : items) { + list.add(new StringTag(element.getAsString())); + } + return list; + } + public static Tag toTag(final JsonElement element) { if (element.isJsonObject()) { final JsonObject object = element.getAsJsonObject();