mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 15:23:16 +00:00
Formatting and code readability cleanup (#5467)
* First pass reformatting code to be more readable (common still not done) * Replace google common collect calls with Java calls where possible * Remove a bunch of unnecessary parenthesis leaving clarifying ones * Add some missing @Nonnull annotations * Fix checking wrong type * Remove unnecessary continue/return statements and simplify comparision check * Pass exception instead of directly printing stack trace * Work on cleaning up common, through config so far * Work on cleaning up common, through integration so far * Work on cleaning up common, through network so far * Work on cleaning up common, through tier so far * Remove empty constructors that get created by default anyways * Work on cleaning up common, through transmitters so far * Work on cleaning up common, through utils so far * Finish cleaning up spacing for common
This commit is contained in:
1 parent
91ef2a5c3d
commit
0d4b50908f
909 files changed
+6234
-15623
No files matched your search
@@ -28,7 +28,6 @@ public final class BoxBlacklistParser {
|
||||
|
||||
private static void generateFiles() throws IOException {
|
||||
mekanismDir.mkdirs();
|
||||
|
||||
if (!boxBlacklistFile.exists()) {
|
||||
boxBlacklistFile.createNewFile();
|
||||
writeExamples();
|
||||
@@ -45,38 +44,31 @@ public final class BoxBlacklistParser {
|
||||
}
|
||||
|
||||
private static void readBlacklist() throws IOException {
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader((boxBlacklistFile)))) {
|
||||
try (BufferedReader reader = new BufferedReader(new FileReader(boxBlacklistFile))) {
|
||||
int entries = 0;
|
||||
|
||||
String readingLine;
|
||||
int line = 0;
|
||||
|
||||
while ((readingLine = reader.readLine()) != null) {
|
||||
line++;
|
||||
|
||||
if (readingLine.startsWith("#") || readingLine.trim().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] split = readingLine.split(" ");
|
||||
|
||||
if (split.length != 2 || !isInteger(split[split.length - 1])) {
|
||||
Mekanism.logger.error("BoxBlacklist.txt: Couldn't parse blacklist data on line " + line);
|
||||
continue;
|
||||
}
|
||||
|
||||
String blockName = split[0].trim();
|
||||
|
||||
Block block = Block.getBlockFromName(blockName);
|
||||
|
||||
if (block == null) {
|
||||
Mekanism.logger.error("BoxBlacklist.txt: Couldn't find specified block on line " + line);
|
||||
continue;
|
||||
}
|
||||
|
||||
MekanismAPI.addBoxBlacklist(block, Integer.parseInt(split[split.length - 1]));
|
||||
entries++;
|
||||
|
||||
}
|
||||
Mekanism.logger.info("Finished loading Cardboard Box blacklist (loaded " + entries + " entries)");
|
||||
}
|
||||
@@ -84,14 +76,11 @@ public final class BoxBlacklistParser {
|
||||
|
||||
private static void writeExamples() throws IOException {
|
||||
try (BufferedWriter writer = new BufferedWriter(new FileWriter(boxBlacklistFile))) {
|
||||
|
||||
writer.append("# Use this file to tell Mekanism which blocks should not be picked up by a cardboard box.");
|
||||
writer.newLine();
|
||||
|
||||
writer.append("# Proper syntax is \"NAME META\". Example (for stone):");
|
||||
writer.newLine();
|
||||
|
||||
writer.append("# minecraft:stone 0");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user