Registry should use a JsonObject

This commit is contained in:
TheMode 2021-06-11 18:05:21 +02:00
parent 4ec59b4bc9
commit 099b031875

View File

@ -1,16 +1,18 @@
package net.minestom.server.registry; package net.minestom.server.registry;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.minestom.server.instance.block.Block; import net.minestom.server.instance.block.Block;
public class Registry { public class Registry {
public static BlockEntry block(Block block) { public static BlockEntry block(Block block) {
return new BlockEntry("blocks.json"); return new BlockEntry(new JsonObject());
} }
public static class BlockEntry extends Entry { public static class BlockEntry extends Entry {
private BlockEntry(String resource) { private BlockEntry(JsonObject json) {
super(resource); super(json);
} }
public float destroySpeed() { public float destroySpeed() {
@ -48,26 +50,30 @@ public class Registry {
public static class Entry { public static class Entry {
private final String resource; private final JsonObject json;
private Entry(String resource) { private Entry(JsonObject json) {
this.resource = resource; this.json = json;
} }
public String getString(String path) { public String getString(String name) {
return null; return element(name).getAsString();
} }
public float getFloat(String path) { public float getFloat(String name) {
return 0; return element(name).getAsFloat();
} }
public int getInt(String path) { public int getInt(String name) {
return 0; return element(name).getAsInt();
} }
public boolean getBoolean(String path) { public boolean getBoolean(String name) {
return false; return element(name).getAsBoolean();
}
protected JsonElement element(String name) {
return json.get(name);
} }
} }
} }