Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-24 18:10:08 +01:00
Temporary fix for forge having terrible classpath issues.
Dieser Commit ist enthalten in:
Ursprung
484a1db500
Commit
f7670f7812
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
public class ResourceLoader {
|
||||
|
||||
private ResourceLoader() {
|
||||
}
|
||||
|
||||
public static URL getResource(Class clazz, String name) throws IOException {
|
||||
URL url = clazz.getResource(name);
|
||||
if (url == null) {
|
||||
try {
|
||||
return new URL("modjar://worldedit/" + clazz.getName().substring(0, clazz.getName().lastIndexOf('.')).replace(".", "/") + "/"
|
||||
+ name);
|
||||
} catch (Exception e) {
|
||||
// Not forge.
|
||||
}
|
||||
throw new IOException("Could not find " + name);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
import com.sk89q.worldedit.util.io.ResourceLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -74,7 +75,7 @@ public class BundledBlockData {
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter());
|
||||
Gson gson = gsonBuilder.create();
|
||||
URL url = BundledBlockData.class.getResource("blocks.json");
|
||||
URL url = ResourceLoader.getResource(BundledBlockData.class, "blocks.json");
|
||||
if (url == null) {
|
||||
throw new IOException("Could not find blocks.json");
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
import com.sk89q.worldedit.util.io.ResourceLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -74,7 +75,7 @@ public class BundledItemData {
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter());
|
||||
Gson gson = gsonBuilder.create();
|
||||
URL url = BundledItemData.class.getResource("items.json");
|
||||
URL url = ResourceLoader.getResource(BundledItemData.class,"items.json");
|
||||
if (url == null) {
|
||||
throw new IOException("Could not find items.json");
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.util.gson.VectorAdapter;
|
||||
import com.sk89q.worldedit.util.io.ResourceLoader;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
@ -74,7 +75,7 @@ public class LegacyMapper {
|
||||
GsonBuilder gsonBuilder = new GsonBuilder();
|
||||
gsonBuilder.registerTypeAdapter(Vector3.class, new VectorAdapter());
|
||||
Gson gson = gsonBuilder.disableHtmlEscaping().create();
|
||||
URL url = LegacyMapper.class.getResource("legacy.json");
|
||||
URL url = ResourceLoader.getResource(LegacyMapper.class, "legacy.json");
|
||||
if (url == null) {
|
||||
throw new IOException("Could not find legacy.json");
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren