Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ovh.roro;
- import com.google.gson.Gson;
- import com.google.gson.JsonObject;
- import net.minecraft.server.v1_8_R3.Block;
- import net.minecraft.server.v1_8_R3.Item;
- import org.bukkit.Material;
- import java.io.PrintWriter;
- public class ExportMaterials {
- public static void run() {
- try {
- JsonObject bukkitToVanilla = new JsonObject();
- JsonObject vanillaToBukkit = new JsonObject();
- for (Material material : Material.values()) {
- String bukkit = material.name();
- String vanilla = null;
- Item item = Item.getById(material.getId());
- if (item != null) {
- vanilla = Item.REGISTRY.c(item).a();
- }
- if (vanilla == null) {
- Block block = Block.getById(material.getId());
- if (block == null) {
- continue;
- }
- vanilla = Block.REGISTRY.c(block).a();
- }
- bukkitToVanilla.addProperty(bukkit, vanilla);
- vanillaToBukkit.addProperty(vanilla, bukkit);
- }
- Gson gson = new Gson();
- try (PrintWriter writer = new PrintWriter("bukkit_to_vanilla.json")) {
- gson.toJson(bukkitToVanilla, writer);
- writer.flush();
- }
- try (PrintWriter writer = new PrintWriter("vanilla_to_bukkit.json")) {
- gson.toJson(vanillaToBukkit, writer);
- writer.flush();
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement