Skip to content

Commit 07c520d

Browse files
authored
Merge pull request #49 from dshadowwolf/v3
Fix integration issues
2 parents 597ba14 + c4fd793 commit 07c520d

File tree

4 files changed

+13
-25
lines changed

4 files changed

+13
-25
lines changed

src/main/java/com/mcmoddev/orespawn/api/plugin/PluginLoader.java

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public PluginData(String modId, String resourcePath, IOreSpawnPlugin plugin) {
4545
}
4646
}
4747

48-
private List<PluginData> dataStore = new ArrayList<>();
48+
private static List<PluginData> dataStore = new ArrayList<>();
4949

5050
private String getAnnotationItem(String item, final ASMData asmData) {
5151
if (asmData.getAnnotationInfo().get(item) != null) {
@@ -60,16 +60,13 @@ public void load(FMLPreInitializationEvent event) {
6060
final String modId = getAnnotationItem("modid", asmDataItem);
6161
final String resourceBase = getAnnotationItem("resourcePath", asmDataItem);
6262
final String clazz = asmDataItem.getClassName();
63-
64-
if ( event.getModMetadata().modId.equals(modId) ) {
65-
IOreSpawnPlugin integration;
66-
try {
67-
integration = Class.forName(clazz).asSubclass(IOreSpawnPlugin.class).newInstance();
68-
PluginData pd = new PluginData( modId, resourceBase, integration);
69-
dataStore.add(pd);
70-
} catch (final Exception ex) {
71-
OreSpawn.LOGGER.error("Couldn't load integrations for " + modId, ex);
72-
}
63+
IOreSpawnPlugin integration;
64+
try {
65+
integration = Class.forName(clazz).asSubclass(IOreSpawnPlugin.class).newInstance();
66+
PluginData pd = new PluginData( modId, resourceBase, integration);
67+
dataStore.add(pd);
68+
} catch (final Exception ex) {
69+
OreSpawn.LOGGER.error("Couldn't load integrations for " + modId, ex);
7370
}
7471
}
7572
}
@@ -81,11 +78,7 @@ public void register() {
8178
public void scanResources(PluginData pd) {
8279
String base = String.format("assets/%s/%s", pd.modId, pd.resourcePath);
8380
URL resURL = getClass().getClassLoader().getResource(base);
84-
if( resURL == null ) {
85-
// nothing to load!
86-
return;
87-
}
88-
81+
8982
URI uri;
9083
try {
9184
uri = resURL.toURI();
@@ -106,14 +99,11 @@ public void scanResources(PluginData pd) {
10699
myPath = Paths.get(uri);
107100
}
108101

109-
if( !myPath.toFile().exists() ) {
110-
return;
111-
}
112-
113102
Stream<Path> walk = Files.walk(myPath, 1);
114103
for (Iterator<Path> it = walk.iterator(); it.hasNext();){
115104
Path p = it.next();
116105
String name = p.getFileName().toString();
106+
117107
if( "json".equals(FilenameUtils.getExtension(name)) ) {
118108
InputStream reader = null;
119109
Path target = Paths.get(".","orespawn","os3",String.format("%s.json", pd.modId));
@@ -123,6 +113,7 @@ public void scanResources(PluginData pd) {
123113
walk.close();
124114
return;
125115
}
116+
126117
reader = Files.newInputStream(p);
127118
FileUtils.copyInputStreamToFile(reader, target.toFile());
128119
IOUtils.closeQuietly(reader);

src/main/java/com/mcmoddev/orespawn/data/Config.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ public static void loadConfig() {
2727

2828
public static boolean getBoolean(String keyname) {
2929
if( knownKeys.contains(keyname) && boolVals.containsKey(keyname) ) {
30-
// if(keyname.equals(Constants.RETROGEN_KEY) || keyname.equals(Constants.FORCE_RETROGEN_KEY)) {
31-
// return false;
32-
// }
3330
return boolVals.get(keyname);
3431
}
3532
return false;

src/main/java/com/mcmoddev/orespawn/data/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ private ConfigNames() {}
2929
public static final String METADATA = "metaData";
3030
public static final String BIOMES = "biomes";
3131
public static final String STATE = "state";
32-
public static final String REPLACEMENT = "replacement_block";
32+
public static final String REPLACEMENT = "replace_block";
3333
public static final String FEATURE = "feature";
3434
public static final String PARAMETERS = "parameters";
3535
public static final String FILE_VERSION = "version";

src/main/java/com/mcmoddev/orespawn/json/os3/readers/OS3V1Reader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void parseJson(JsonObject entries, String fileName) {
4343

4444
OreBuilder oreB = spawn.newOreBuilder();
4545

46-
String oreName = ore.get(ConfigNames.ORES).getAsString();
46+
String oreName = ore.get(ConfigNames.BLOCK).getAsString();
4747

4848
if (ore.has(ConfigNames.STATE)) {
4949
String stateString = ore.get(ConfigNames.STATE).getAsString();

0 commit comments

Comments
 (0)