Skip to content

Commit

Permalink
Fixed #21 + some minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dries007 committed Mar 15, 2017
1 parent 5503e61 commit 06c3e37
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -5,7 +5,7 @@ DoubleDoorDevelopment Core

Download from our [website](http://doubledoordev.net/) or our [jenkins server](https://jenkins.dries007.net/view/D3_mods/)

Big thanks to @mallrat208 for updating to 1.9 / 1.10
Big thanks to @mallrat208 for updating to 1.9 / 1.10 / 1.11.2

Materials
---------
Expand Down
Expand Up @@ -50,7 +50,7 @@
public class CoreConstants
{
public static final String MODID = "d3core";
public static final String NAME = "D³ Core";
public static final String NAME = "D³Core";
public static final String BASE_URL = "http://doubledoordev.net/";
public static final String PERKS_URL = BASE_URL + "perks.json";
public static final String UPDATE_URL = BASE_URL + MODID + ".json";
Expand Down
24 changes: 22 additions & 2 deletions src/main/java/net/doubledoordev/d3core/util/Materials.java
Expand Up @@ -93,11 +93,17 @@ public static void load() throws IOException
continue;
}
ItemStack stack = new ItemStack(item, stacksize, meta);
if (stack.isEmpty()) // Technically, the previous if should have failed, but I'm not taking chances here.
{
D3Core.getLogger().error("Entry in materials.json {} invalid. Item {}:{} does not exist.", entry, mod, name);
stop = true;
continue;
}
itemStackMap.put(entry.getKey().toLowerCase(), stack);
}
if (stop)
{
D3Core.getLogger().error("The proper format for materials.json entries is (in regex): {}", CoreConstants.PATTERN_ITEMSTACK.pattern());
D3Core.getLogger().fatal("The proper format for materials.json entries is (in regex): {}", CoreConstants.PATTERN_ITEMSTACK.pattern());
RuntimeException e = new RuntimeException("You have invalid entries in your materials.json file. Check the log for more info.");
e.setStackTrace(new StackTraceElement[0]); // No need for this
throw e;
Expand All @@ -106,8 +112,22 @@ public static void load() throws IOException
for (ToolMaterial material : ToolMaterial.values())
{
ItemStack stack = itemStackMap.get(material.name().toLowerCase());
if (stack == ItemStack.EMPTY || material.getRepairItemStack() != ItemStack.EMPTY) continue;
if (stack == null) continue; // null if no entry in map

if (!material.getRepairItemStack().isEmpty()) // No longer allowed by Forge.
{
D3Core.getLogger().fatal("Material {} already has {} as repair material. You cannot override it.", material.name(), material.getRepairItemStack());
stop = true;
continue;
}
material.setRepairItem(stack);
}
if (stop)
{
D3Core.getLogger().fatal("You tried to set the repair stack of a ToolMaterial that already has one. This is not allowed by Forge.");
RuntimeException e = new RuntimeException("You tried to set the repair stack of a ToolMaterial that already has one. This is not allowed by Forge. Check the log for more info.");
e.setStackTrace(new StackTraceElement[0]); // No need for this
throw e;
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
@@ -1,7 +1,7 @@
{
"modListVersion": 2,
"modList": [{
"modid": "D3Core",
"modid": "d3core",
"name": "D³Core",
"description": "${description}",
"version": "${version}",
Expand Down

0 comments on commit 06c3e37

Please sign in to comment.