Skip to content
This repository has been archived by the owner on May 13, 2021. It is now read-only.

Commit

Permalink
Should (finally) solve #19 and #23
Browse files Browse the repository at this point in the history
  • Loading branch information
TehNut committed Aug 28, 2015
1 parent 854fea9 commit 087f93d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package tehnut.morechisels.item.chisel;

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
Expand All @@ -8,6 +9,7 @@
import net.minecraft.util.StatCollector;
import tehnut.morechisels.ModInformation;
import tehnut.morechisels.item.ItemChiselBase;
import tehnut.morechisels.registry.RecipeRegistry;
import tehnut.morechisels.util.Utils;

import java.awt.*;
Expand All @@ -26,6 +28,9 @@ public ItemChiselGem(String name, int durability, String hexColor, boolean setDi
this.setDisplayName = setDisplayName;
this.name = name;
this.hexColor = hexColor;

GameRegistry.registerItem(this, "ItemChiselGem" + name);
RecipeRegistry.addConfiguredChiselRecipe(this, "gem" + name, true);
}

@SideOnly(Side.CLIENT)
Expand Down
15 changes: 2 additions & 13 deletions src/main/java/tehnut/morechisels/registry/ItemRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,17 @@
import tehnut.morechisels.item.chisel.ItemChiselGem;

public class ItemRegistry {

// Items
public static Item chiselGem[];

public static int gemChiselCount = 0;

public static void registerItems() {
// Gems
chiselGem = new Item[ConfigHandler.gemChiselWhitelist.length];

for (String ore : OreDictionary.getOreNames()) {
if (ore.startsWith("gem")) {
String gem = ore.substring(3);

for (String whitelist : ConfigHandler.gemChiselWhitelist) {
String[] splitWhitelist = whitelist.split(":");

if (gem.equals(splitWhitelist[0])) {
chiselGem[gemChiselCount] = new ItemChiselGem(splitWhitelist[0], Integer.parseInt(splitWhitelist[1]), splitWhitelist[2], true);
registerOreItem(chiselGem[gemChiselCount], "ItemChisel" + splitWhitelist[0], "gem" + splitWhitelist[0]);
gemChiselCount++;
}
if (gem.equals(splitWhitelist[0]))
new ItemChiselGem(splitWhitelist[0], Integer.parseInt(splitWhitelist[1]), splitWhitelist[2], true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,11 @@
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import team.chisel.config.Configurations;
import tehnut.morechisels.ConfigHandler;

public class RecipeRegistry {

public static void registerRecipes() {
for (int i = 0; i < ItemRegistry.chiselGem.length; i++) {
String[] gemType = ConfigHandler.gemChiselWhitelist[i].split(":");

addConfiguredChiselRecipe(ItemRegistry.chiselGem[i], "gem" + gemType[0], true);
}
// Do stuff
}

/**
Expand Down

0 comments on commit 087f93d

Please sign in to comment.