Skip to content

Commit 21b4d84

Browse files
committed
fixes for boneheaded mistakes
1 parent 55d904b commit 21b4d84

File tree

4 files changed

+15
-25
lines changed

4 files changed

+15
-25
lines changed

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

Lines changed: 13 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,14 @@ 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+
OreSpawn.LOGGER.fatal("Loaded plugin {} (modId: {}, resourcePath: {})", clazz, modId, resourceBase);
69+
} catch (final Exception ex) {
70+
OreSpawn.LOGGER.error("Couldn't load integrations for " + modId, ex);
7371
}
7472
}
7573
}
@@ -81,11 +79,8 @@ public void register() {
8179
public void scanResources(PluginData pd) {
8280
String base = String.format("assets/%s/%s", pd.modId, pd.resourcePath);
8381
URL resURL = getClass().getClassLoader().getResource(base);
84-
if( resURL == null ) {
85-
// nothing to load!
86-
return;
87-
}
88-
82+
OreSpawn.LOGGER.fatal("Got {} from getResource({})", resURL.toString(), base);
83+
8984
URI uri;
9085
try {
9186
uri = resURL.toURI();
@@ -106,14 +101,11 @@ public void scanResources(PluginData pd) {
106101
myPath = Paths.get(uri);
107102
}
108103

109-
if( !myPath.toFile().exists() ) {
110-
return;
111-
}
112-
113104
Stream<Path> walk = Files.walk(myPath, 1);
114105
for (Iterator<Path> it = walk.iterator(); it.hasNext();){
115106
Path p = it.next();
116107
String name = p.getFileName().toString();
108+
OreSpawn.LOGGER.fatal("path {} in walk", p.toString());
117109
if( "json".equals(FilenameUtils.getExtension(name)) ) {
118110
InputStream reader = null;
119111
Path target = Paths.get(".","orespawn","os3",String.format("%s.json", pd.modId));
@@ -123,6 +115,7 @@ public void scanResources(PluginData pd) {
123115
walk.close();
124116
return;
125117
}
118+
OreSpawn.LOGGER.fatal("Extracting {} to {}", p.toString(), target.toString());
126119
reader = Files.newInputStream(p);
127120
FileUtils.copyInputStreamToFile(reader, target.toFile());
128121
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)