Skip to content

Commit

Permalink
Fix ignore item bug.
Browse files Browse the repository at this point in the history
12345-mcpython committed Feb 24, 2024
1 parent 41474ce commit 86bb6eb
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ mod_name=Stack One Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=Apache License 2.0
# The mod version. See https://semver.org/
mod_version=1.20.1-1.0.4
mod_version=1.20.1-1.0.5
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
11 changes: 7 additions & 4 deletions src/main/java/com/laosun/stackone/IgnoreItem.java
Original file line number Diff line number Diff line change
@@ -25,18 +25,20 @@ public static ArrayList<String> getIgnoreItems() {
if (!file.isFile()) {
try {
if (!file.createNewFile()) {
LOGGER.error("Fail to create file!");
throw new IOException("Failed to create file!");
}
} catch (IOException e) {
LOGGER.error("Fail to create file!");
LOGGER.error("Failed to create file!");
e.printStackTrace();
}
}
char[] a1 = null;
try (FileReader fileReader = new FileReader(file);) {
a1 = new char[(int) file.length()];
fileReader.read(a1);
} catch (IOException e) {
LOGGER.error("Fail to open file!");
LOGGER.error("Failed to open file!");
e.printStackTrace();
}

Gson gson = new Gson();
@@ -52,7 +54,8 @@ public static ArrayList<String> getIgnoreItems() {
}

} catch (Exception e) {
LOGGER.error("JSON has syntax error!");
LOGGER.error("Failed to read JSON file!");
e.printStackTrace();
}
return ignoreItems;
}
2 changes: 1 addition & 1 deletion src/main/java/com/laosun/stackone/StackOneMod.java
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ public StackOneMod() {
private void commonSetup(final FMLCommonSetupEvent event) {
ArrayList<String> ignoreItems = IgnoreItem.getIgnoreItems();
for (Item i : ForgeRegistries.ITEMS) {
if (ignoreItems.contains(i.builtInRegistryHolder().key().toString())) {
if (ignoreItems.contains(i.builtInRegistryHolder().key().location().toString())) {
continue;
}
Field a;

0 comments on commit 86bb6eb

Please sign in to comment.