Small fixes
This commit is contained in:
parent
e41b59d506
commit
7d923ba04e
1 changed files with 7 additions and 4 deletions
|
@ -4,10 +4,13 @@ import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.server.packs.resources.Resource;
|
import net.minecraft.server.packs.resources.Resource;
|
||||||
import net.minecraft.server.packs.resources.ResourceManager;
|
import net.minecraft.server.packs.resources.ResourceManager;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import ru.bclib.BCLib;
|
import ru.bclib.BCLib;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -52,6 +55,8 @@ public class JsonFactory {
|
||||||
* @param location {@link ResourceLocation} to JSON file
|
* @param location {@link ResourceLocation} to JSON file
|
||||||
* @return {@link JsonObject}
|
* @return {@link JsonObject}
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
public static JsonObject getJsonObject(ResourceLocation location) {
|
public static JsonObject getJsonObject(ResourceLocation location) {
|
||||||
ResourceManager manager = Minecraft.getInstance().getResourceManager();
|
ResourceManager manager = Minecraft.getInstance().getResourceManager();
|
||||||
JsonObject obj = null;
|
JsonObject obj = null;
|
||||||
|
@ -65,10 +70,8 @@ public class JsonFactory {
|
||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex) {
|
catch (IOException ex) {}
|
||||||
BCLib.LOGGER.catching(ex);
|
return obj;
|
||||||
}
|
|
||||||
return obj == null ? new JsonObject() : obj;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JsonElement loadJson(File jsonFile) {
|
public static JsonElement loadJson(File jsonFile) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue