mirror of
https://github.com/ViaVersion/Mappings.git
synced 2025-01-20 21:21:22 +01:00
Include blocks
This commit is contained in:
parent
0e8b8f68e3
commit
a7b4d91a6a
Binary file not shown.
@ -19,24 +19,19 @@
|
||||
package com.viaversion.mappingsgenerator.extra;
|
||||
|
||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||
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;
|
||||
|
||||
import static com.viaversion.mappingsgenerator.util.JsonConverter.collectStringList;
|
||||
|
||||
public final class BlockStates1_13 {
|
||||
|
||||
public static void main(final String[] args) throws IOException {
|
||||
final JsonArray blockstates = MappingsLoader.load("mapping-1.13.json").getAsJsonArray("blockstates");
|
||||
final JsonObject mappings = MappingsLoader.load("mapping-1.13.json");
|
||||
final CompoundTag tag = new CompoundTag();
|
||||
final ListTag<StringTag> 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"));
|
||||
}
|
||||
}
|
||||
|
@ -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<StringTag> 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"));
|
||||
}
|
||||
}
|
@ -35,6 +35,14 @@ import java.util.Map;
|
||||
|
||||
public final class JsonConverter {
|
||||
|
||||
public static ListTag<StringTag> collectStringList(final JsonArray items) {
|
||||
final ListTag<StringTag> 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();
|
||||
|
Loading…
Reference in New Issue
Block a user