This commit is contained in:
pahimar 2013-05-26 20:09:29 -04:00
parent 163083bc89
commit 4acc41c2c8
3 changed files with 61 additions and 50 deletions

View file

@ -167,6 +167,6 @@ public class EquivalentExchange3 {
// Initialize the Addon Handler
AddonHandler.init();
DynEMC.getInstance().init();
DynEMC.getInstance();
}
}

View file

@ -19,9 +19,9 @@ import com.pahimar.ee3.item.CustomStackWrapper;
public class DynEMC {
private static final DynEMC dynEMC = new DynEMC();
private static DynEMC dynEMC = null;
private static final ArrayList<CustomStackWrapper> discoveredItems = new ArrayList<CustomStackWrapper>();
private ArrayList<CustomStackWrapper> discoveredItems = new ArrayList<CustomStackWrapper>();
private DynEMC() {
@ -29,13 +29,26 @@ public class DynEMC {
public static DynEMC getInstance() {
if (dynEMC == null) {
dynEMC = new DynEMC();
dynEMC.init();
}
return dynEMC;
}
public List<CustomStackWrapper> getDiscoveredItems() {
return discoveredItems;
}
public void init() {
private void init() {
ArrayList<ItemStack> subItems = new ArrayList<ItemStack>();
/*
* For every possible item (and sub item), add them to the discovered items list
*/
for (int i = 0; i < Item.itemsList.length; i++) {
if (Item.itemsList[i] != null) {
if (Item.itemsList[i].getHasSubtypes()) {
@ -65,23 +78,14 @@ public class DynEMC {
}
}
/**
* Now that we have discovered as many items as possible, trim out the items that are black listed
*/
for (CustomStackWrapper customStackWrapper : EMCBlackList.getInstance().getBlackListStacks()) {
while (discoveredItems.contains(customStackWrapper)) {
discoveredItems.remove(customStackWrapper);
}
}
for (CustomStackWrapper customStackWrapper : discoveredItems) {
ArrayList<IRecipe> recipes = RecipeHelper.getReverseRecipes(customStackWrapper.itemStack);
if (recipes.size() > 0) {
for (IRecipe recipe : recipes) {
LogHelper.log(Level.INFO, ItemUtil.toString(customStackWrapper.itemStack) + " <-- " + RecipeHelper.getRecipeInputs(recipe));
}
}
else {
LogHelper.log(Level.INFO, ItemUtil.toString(customStackWrapper.itemStack));
}
}
}
}

View file

@ -12,9 +12,9 @@ import com.pahimar.ee3.item.CustomStackWrapper;
public class EMCBlackList {
private static final EMCBlackList emcBlackList = new EMCBlackList();
private static EMCBlackList emcBlackList = null;
private static final ArrayList<CustomStackWrapper> stackBlackList = new ArrayList<CustomStackWrapper>();
private ArrayList<CustomStackWrapper> stackBlackList = new ArrayList<CustomStackWrapper>();
private EMCBlackList() {
@ -22,6 +22,12 @@ public class EMCBlackList {
public static EMCBlackList getInstance() {
if (emcBlackList == null) {
emcBlackList = new EMCBlackList();
emcBlackList.init();
}
return emcBlackList;
}
@ -126,37 +132,38 @@ public class EMCBlackList {
this.remove(id, OreDictionary.WILDCARD_VALUE);
}
static {
getInstance().add(Block.bed);
getInstance().add(Block.pistonExtension);
getInstance().add(Block.pistonMoving);
getInstance().add(Block.mobSpawner);
getInstance().add(Block.redstoneWire);
getInstance().add(Block.crops);
getInstance().add(Block.furnaceBurning);
getInstance().add(Block.signPost);
getInstance().add(Block.doorWood);
getInstance().add(Block.signWall);
getInstance().add(Block.doorIron);
getInstance().add(Block.torchRedstoneIdle);
getInstance().add(Block.reed);
getInstance().add(Block.portal);
getInstance().add(Block.cake);
getInstance().add(Block.redstoneRepeaterIdle);
getInstance().add(Block.redstoneRepeaterActive);
getInstance().add(Block.lockedChest);
getInstance().add(Block.pumpkinStem);
getInstance().add(Block.melonStem);
getInstance().add(Block.netherStalk);
getInstance().add(Block.brewingStand);
getInstance().add(Block.cauldron);
getInstance().add(Block.endPortal);
getInstance().add(Block.redstoneLampActive);
getInstance().add(Block.commandBlock);
getInstance().add(Block.carrot);
getInstance().add(Block.potato);
getInstance().add(Block.skull);
getInstance().add(Block.redstoneComparatorIdle);
getInstance().add(Block.redstoneComparatorActive);
private void init() {
add(Block.bed);
add(Block.pistonExtension);
add(Block.pistonMoving);
add(Block.mobSpawner);
add(Block.redstoneWire);
add(Block.crops);
add(Block.furnaceBurning);
add(Block.signPost);
add(Block.doorWood);
add(Block.signWall);
add(Block.doorIron);
add(Block.torchRedstoneIdle);
add(Block.reed);
add(Block.portal);
add(Block.cake);
add(Block.redstoneRepeaterIdle);
add(Block.redstoneRepeaterActive);
add(Block.lockedChest);
add(Block.pumpkinStem);
add(Block.melonStem);
add(Block.netherStalk);
add(Block.brewingStand);
add(Block.cauldron);
add(Block.endPortal);
add(Block.redstoneLampActive);
add(Block.commandBlock);
add(Block.carrot);
add(Block.potato);
add(Block.skull);
add(Block.redstoneComparatorIdle);
add(Block.redstoneComparatorActive);
}
}