Renaming some stuff, adding more functionality to the LogHelper, and ItemStack wild card detection for the vanilla Crafting Manager
This commit is contained in:
parent
a5209fab99
commit
c8b4c4e642
13 changed files with 172 additions and 92 deletions
|
@ -1,7 +1,6 @@
|
||||||
package com.pahimar.ee3;
|
package com.pahimar.ee3;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
@ -78,7 +77,7 @@ public class EquivalentExchange3 {
|
||||||
public void invalidFingerprint(FMLFingerprintViolationEvent event) {
|
public void invalidFingerprint(FMLFingerprintViolationEvent event) {
|
||||||
|
|
||||||
// Report (log) to the user that the version of Equivalent Exchange 3 they are using has been changed/tampered with
|
// Report (log) to the user that the version of Equivalent Exchange 3 they are using has been changed/tampered with
|
||||||
LogHelper.log(Level.SEVERE, Strings.INVALID_FINGERPRINT_MESSAGE);
|
LogHelper.severe(Strings.INVALID_FINGERPRINT_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ServerStarting
|
@ServerStarting
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.pahimar.ee3.client.audio;
|
package com.pahimar.ee3.client.audio;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||||
import net.minecraftforge.event.ForgeSubscribe;
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
|
|
||||||
|
@ -30,7 +28,7 @@ public class SoundHandler {
|
||||||
}
|
}
|
||||||
// If we cannot add the custom sound file to the pool, log the exception
|
// If we cannot add the custom sound file to the pool, log the exception
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
LogHelper.log(Level.WARNING, "Failed loading sound file: " + soundFile);
|
LogHelper.warning("Failed loading sound file: " + soundFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.pahimar.ee3.core.addons;
|
package com.pahimar.ee3.core.addons;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
@ -35,10 +33,10 @@ public class AddonRedPower2 {
|
||||||
RecipeHelper.addRecipe(new ItemStack(rp2Stone.blockID, 1, 3), stone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone);
|
RecipeHelper.addRecipe(new ItemStack(rp2Stone.blockID, 1, 3), stone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone, Block.cobblestone);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogHelper.log(Level.INFO, "Loaded RP2 World addon");
|
LogHelper.info("Loaded RP2 World addon");
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
LogHelper.log(Level.SEVERE, "Could not load RP2 World addon");
|
LogHelper.severe("Could not load RP2 World addon");
|
||||||
e.printStackTrace(System.err);
|
e.printStackTrace(System.err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.pahimar.ee3.core.handlers;
|
package com.pahimar.ee3.core.handlers;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
@ -248,7 +247,7 @@ public class EquivalencyHandler {
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (ArrayList<ItemStack> list : equivalencyList) {
|
for (ArrayList<ItemStack> list : equivalencyList) {
|
||||||
LogHelper.log(Level.INFO, "equivalencyList[" + i + "]: " + list.toString());
|
LogHelper.info("equivalencyList[" + i + "]: " + list.toString());
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,14 +104,14 @@ public class ItemUtil {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
for (int j = 0; j < collatedStacks.size(); j++) {
|
for (int j = 0; j < collatedStacks.size(); j++) {
|
||||||
if (unCollatedStacks.get(i).getItemStack() != null && collatedStacks.get(j).getItemStack() != null) {
|
if (unCollatedStacks.get(i).getWrappedStack() instanceof ItemStack && collatedStacks.get(j).getWrappedStack() instanceof ItemStack) {
|
||||||
if (compare(unCollatedStacks.get(i).getItemStack(), collatedStacks.get(j).getItemStack())) {
|
if (compare((ItemStack) unCollatedStacks.get(i).getWrappedStack(), (ItemStack) collatedStacks.get(j).getWrappedStack())) {
|
||||||
collatedStacks.get(j).setStackSize(collatedStacks.get(j).getStackSize() + 1);
|
collatedStacks.get(j).setStackSize(collatedStacks.get(j).getStackSize() + 1);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (unCollatedStacks.get(i).getOreStack() != null && collatedStacks.get(j).getOreStack() != null) {
|
else if (unCollatedStacks.get(i).getWrappedStack() instanceof OreStack && collatedStacks.get(j).getWrappedStack() instanceof OreStack) {
|
||||||
if (OreStack.compareStacks(unCollatedStacks.get(i).getOreStack(), collatedStacks.get(j).getOreStack())) {
|
if (OreStack.compareStacks((OreStack) unCollatedStacks.get(i).getWrappedStack(), (OreStack) collatedStacks.get(j).getWrappedStack())) {
|
||||||
collatedStacks.get(j).setStackSize(collatedStacks.get(j).getStackSize() + 1);
|
collatedStacks.get(j).setStackSize(collatedStacks.get(j).getStackSize() + 1);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,4 +30,38 @@ public class LogHelper {
|
||||||
eeLogger.log(logLevel, message);
|
eeLogger.log(logLevel, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void severe(String message) {
|
||||||
|
|
||||||
|
log(Level.SEVERE, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void warning(String message) {
|
||||||
|
|
||||||
|
log(Level.WARNING, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void info(String message) {
|
||||||
|
|
||||||
|
log(Level.INFO, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void config(String message) {
|
||||||
|
|
||||||
|
log(Level.CONFIG, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fine(String message) {
|
||||||
|
|
||||||
|
log(Level.FINE, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void finer(String message) {
|
||||||
|
|
||||||
|
log(Level.FINER, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void finest(String message) {
|
||||||
|
|
||||||
|
log(Level.FINEST, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,9 +133,13 @@ public class RecipeHelper {
|
||||||
return ItemUtil.collateStacks(getRecipeInputs(recipe));
|
return ItemUtil.collateStacks(getRecipeInputs(recipe));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<IRecipe> getReverseRecipes(CustomWrappedStack customStackWrapper) {
|
public static ArrayList<IRecipe> getReverseRecipes(CustomWrappedStack customWrappedStack) {
|
||||||
|
|
||||||
return getReverseRecipes(customStackWrapper.getItemStack());
|
if (customWrappedStack.getWrappedStack() instanceof ItemStack) {
|
||||||
|
return getReverseRecipes((ItemStack) customWrappedStack.getWrappedStack());
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ArrayList<IRecipe>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.pahimar.ee3.core.util;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.Configuration;
|
import net.minecraftforge.common.Configuration;
|
||||||
|
|
||||||
|
@ -123,10 +122,10 @@ public class VersionHelper implements Runnable {
|
||||||
public static void logResult() {
|
public static void logResult() {
|
||||||
|
|
||||||
if (result == CURRENT || result == OUTDATED) {
|
if (result == CURRENT || result == OUTDATED) {
|
||||||
LogHelper.log(Level.INFO, getResultMessage());
|
LogHelper.info(getResultMessage());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LogHelper.log(Level.WARNING, getResultMessage());
|
LogHelper.warning(getResultMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +191,7 @@ public class VersionHelper implements Runnable {
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
LogHelper.log(Level.INFO, LanguageRegistry.instance().getStringLocalization(Strings.VERSION_CHECK_INIT_LOG_MESSAGE) + " " + REMOTE_VERSION_XML_FILE);
|
LogHelper.info(LanguageRegistry.instance().getStringLocalization(Strings.VERSION_CHECK_INIT_LOG_MESSAGE) + " " + REMOTE_VERSION_XML_FILE);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
while (count < Reference.VERSION_CHECK_ATTEMPTS - 1 && (result == UNINITIALIZED || result == ERROR)) {
|
while (count < Reference.VERSION_CHECK_ATTEMPTS - 1 && (result == UNINITIALIZED || result == ERROR)) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -51,8 +50,55 @@ public class DynEMC {
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
|
|
||||||
populateItemList();
|
}
|
||||||
populateGraph();
|
|
||||||
|
/**
|
||||||
|
* Discovers all instances of ItemStacks with wild card meta values in the vanilla Crafting Manager
|
||||||
|
* @return A list of CustomWrappedStacks that contains all wild card meta ItemStacks in the vanilla Crafting Manager
|
||||||
|
*/
|
||||||
|
private ArrayList<CustomWrappedStack> findWildCards() {
|
||||||
|
|
||||||
|
ArrayList<CustomWrappedStack> wildCards = new ArrayList<CustomWrappedStack>();
|
||||||
|
|
||||||
|
for (Object recipe : CraftingManager.getInstance().getRecipeList()) {
|
||||||
|
|
||||||
|
if (recipe instanceof IRecipe) {
|
||||||
|
if (((IRecipe) recipe).getRecipeOutput() instanceof ItemStack) {
|
||||||
|
CustomWrappedStack recipeOutput = new CustomWrappedStack(((IRecipe) recipe).getRecipeOutput());
|
||||||
|
ArrayList<CustomWrappedStack> recipeInputs = RecipeHelper.getRecipeInputs((IRecipe) recipe);
|
||||||
|
ItemStack itemStack = null;
|
||||||
|
|
||||||
|
if (recipeOutput.getWrappedStack() instanceof ItemStack) {
|
||||||
|
|
||||||
|
itemStack = (ItemStack) recipeOutput.getWrappedStack();
|
||||||
|
|
||||||
|
if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && OreDictionary.getOreID(itemStack) == -1) {
|
||||||
|
|
||||||
|
if (!wildCards.contains(recipeOutput)) {
|
||||||
|
wildCards.add(recipeOutput);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (CustomWrappedStack inputStack : recipeInputs) {
|
||||||
|
|
||||||
|
if (inputStack.getWrappedStack() instanceof ItemStack) {
|
||||||
|
|
||||||
|
itemStack = (ItemStack) inputStack.getWrappedStack();
|
||||||
|
|
||||||
|
if (itemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE && OreDictionary.getOreID(itemStack) == -1) {
|
||||||
|
|
||||||
|
if (!wildCards.contains(inputStack)) {
|
||||||
|
wildCards.add(inputStack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return wildCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateItemList() {
|
private void populateItemList() {
|
||||||
|
@ -85,11 +131,15 @@ public class DynEMC {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CustomWrappedStack wrappedRecipeInput : RecipeHelper.getCollatedRecipeInputs((IRecipe) recipe)) {
|
for (CustomWrappedStack wrappedRecipeInput : RecipeHelper.getCollatedRecipeInputs((IRecipe) recipe)) {
|
||||||
if ((wrappedRecipeInput.getItemStack() != null) && (wrappedRecipeInput.getItemStack().getItemDamage() == OreDictionary.WILDCARD_VALUE)) {
|
if (wrappedRecipeInput.getWrappedStack() instanceof ItemStack) {
|
||||||
|
ItemStack wrappedItemStack = (ItemStack) wrappedRecipeInput.getWrappedStack();
|
||||||
|
if (wrappedItemStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
|
||||||
|
|
||||||
wrappedRecipeInput.setStackSize(1);
|
wrappedRecipeInput.setStackSize(1);
|
||||||
if (!discoveredItems.contains(wrappedRecipeInput)) {
|
|
||||||
discoveredItems.add(wrappedRecipeInput);
|
if (!discoveredItems.contains(wrappedRecipeInput)) {
|
||||||
|
discoveredItems.add(wrappedRecipeInput);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -111,10 +161,10 @@ public class DynEMC {
|
||||||
for (ItemStack itemStack : subItems) {
|
for (ItemStack itemStack : subItems) {
|
||||||
if (itemStack != null) {
|
if (itemStack != null) {
|
||||||
|
|
||||||
CustomWrappedStack customStackWrapper = new CustomWrappedStack(itemStack);
|
CustomWrappedStack customWrappedStack = new CustomWrappedStack(itemStack);
|
||||||
|
|
||||||
if (!discoveredItems.contains(customStackWrapper)) {
|
if (!discoveredItems.contains(customWrappedStack)) {
|
||||||
discoveredItems.add(customStackWrapper);
|
discoveredItems.add(customWrappedStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,9 +173,9 @@ public class DynEMC {
|
||||||
|
|
||||||
ItemStack itemStack = new ItemStack(Item.itemsList[i]);
|
ItemStack itemStack = new ItemStack(Item.itemsList[i]);
|
||||||
|
|
||||||
CustomWrappedStack customStackWrapper = new CustomWrappedStack(itemStack);
|
CustomWrappedStack customWrappedStack = new CustomWrappedStack(itemStack);
|
||||||
if (!discoveredItems.contains(customStackWrapper)) {
|
if (!discoveredItems.contains(customWrappedStack)) {
|
||||||
discoveredItems.add(customStackWrapper);
|
discoveredItems.add(customWrappedStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,10 +185,10 @@ public class DynEMC {
|
||||||
* Now that we have discovered as many items as possible, trim out the
|
* Now that we have discovered as many items as possible, trim out the
|
||||||
* items that are black listed
|
* items that are black listed
|
||||||
*/
|
*/
|
||||||
for (CustomWrappedStack customStackWrapper : EmcBlackList.getInstance().getBlackListStacks()) {
|
for (CustomWrappedStack customWrappedStack : EmcBlackList.getInstance().getBlackListStacks()) {
|
||||||
|
|
||||||
while (discoveredItems.contains(customStackWrapper)) {
|
while (discoveredItems.contains(customWrappedStack)) {
|
||||||
discoveredItems.remove(customStackWrapper);
|
discoveredItems.remove(customWrappedStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,8 +216,8 @@ public class DynEMC {
|
||||||
|
|
||||||
CustomWrappedStack recipeInput = null;
|
CustomWrappedStack recipeInput = null;
|
||||||
|
|
||||||
if (wrappedRecipeInput.getItemStack() != null) {
|
if (wrappedRecipeInput.getWrappedStack() instanceof ItemStack) {
|
||||||
ItemStack itemStack = wrappedRecipeInput.getItemStack();
|
ItemStack itemStack = (ItemStack) wrappedRecipeInput.getWrappedStack();
|
||||||
|
|
||||||
if (OreDictionary.getOreID(itemStack) != -1) {
|
if (OreDictionary.getOreID(itemStack) != -1) {
|
||||||
recipeInput = new CustomWrappedStack(new OreStack(itemStack));
|
recipeInput = new CustomWrappedStack(new OreStack(itemStack));
|
||||||
|
@ -176,8 +226,8 @@ public class DynEMC {
|
||||||
recipeInput = new CustomWrappedStack(itemStack);
|
recipeInput = new CustomWrappedStack(itemStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (wrappedRecipeInput.getOreStack() != null) {
|
else if (wrappedRecipeInput.getWrappedStack() instanceof OreStack) {
|
||||||
recipeInput = new CustomWrappedStack(wrappedRecipeInput.getOreStack());
|
recipeInput = new CustomWrappedStack((OreStack) wrappedRecipeInput.getWrappedStack());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -186,7 +236,7 @@ public class DynEMC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (NoSuchElementException e) {
|
catch (NoSuchElementException e) {
|
||||||
LogHelper.log(Level.SEVERE, e.getMessage() + ";\nFrom: [" + customWrappedStack + "]\nTo: [" + wrappedRecipeInput + "]");
|
LogHelper.severe(e.getMessage() + ";\nFrom: [" + customWrappedStack + "]\nTo: [" + wrappedRecipeInput + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,29 +297,29 @@ public class DynEMC {
|
||||||
|
|
||||||
public void printDebugDump() {
|
public void printDebugDump() {
|
||||||
|
|
||||||
LogHelper.log(Level.INFO, "***** START NODES *****");
|
LogHelper.info("***** START NODES *****");
|
||||||
Iterator<CustomWrappedStack> nodeIter = graph.iterator();
|
Iterator<CustomWrappedStack> nodeIter = graph.iterator();
|
||||||
while (nodeIter.hasNext()) {
|
while (nodeIter.hasNext()) {
|
||||||
CustomWrappedStack node = nodeIter.next();
|
CustomWrappedStack node = nodeIter.next();
|
||||||
LogHelper.log(Level.INFO, "Node: " + node);
|
LogHelper.info("Node: " + node);
|
||||||
}
|
}
|
||||||
LogHelper.log(Level.INFO, "***** END NODES *****");
|
LogHelper.info("***** END NODES *****");
|
||||||
|
|
||||||
LogHelper.log(Level.INFO, "***** START EDGES FROM *****");
|
LogHelper.info("***** START EDGES FROM *****");
|
||||||
nodeIter = graph.iterator();
|
nodeIter = graph.iterator();
|
||||||
while (nodeIter.hasNext()) {
|
while (nodeIter.hasNext()) {
|
||||||
CustomWrappedStack node = nodeIter.next();
|
CustomWrappedStack node = nodeIter.next();
|
||||||
Set<WeightedEdge<CustomWrappedStack>> edgesFrom = graph.edgesFrom(node);
|
Set<WeightedEdge<CustomWrappedStack>> edgesFrom = graph.edgesFrom(node);
|
||||||
for (WeightedEdge<CustomWrappedStack> edge : edgesFrom) {
|
for (WeightedEdge<CustomWrappedStack> edge : edgesFrom) {
|
||||||
LogHelper.log(Level.INFO, "Crafting Output: " + node);
|
LogHelper.info("Crafting Output: " + node);
|
||||||
LogHelper.log(Level.INFO, "Crafting Input: " + edge.getTarget());
|
LogHelper.info("Crafting Input: " + edge.getTarget());
|
||||||
LogHelper.log(Level.INFO, "Weight: " + edge.getWeight());
|
LogHelper.info("Weight: " + edge.getWeight());
|
||||||
LogHelper.log(Level.INFO, "");
|
LogHelper.info("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogHelper.log(Level.INFO, "***** END EDGES FROM *****");
|
LogHelper.info("***** END EDGES FROM *****");
|
||||||
|
|
||||||
LogHelper.log(Level.INFO, "***** START EDGES TO *****");
|
LogHelper.info("***** START EDGES TO *****");
|
||||||
nodeIter = graph.iterator();
|
nodeIter = graph.iterator();
|
||||||
while (nodeIter.hasNext()) {
|
while (nodeIter.hasNext()) {
|
||||||
CustomWrappedStack node = nodeIter.next();
|
CustomWrappedStack node = nodeIter.next();
|
||||||
|
@ -277,13 +327,13 @@ public class DynEMC {
|
||||||
Iterator<WeightedEdge<CustomWrappedStack>> edgeIter = edgesTo.iterator();
|
Iterator<WeightedEdge<CustomWrappedStack>> edgeIter = edgesTo.iterator();
|
||||||
while (edgeIter.hasNext()) {
|
while (edgeIter.hasNext()) {
|
||||||
WeightedEdge<CustomWrappedStack> edge = edgeIter.next();
|
WeightedEdge<CustomWrappedStack> edge = edgeIter.next();
|
||||||
LogHelper.log(Level.INFO, "From: " + node);
|
LogHelper.info("From: " + node);
|
||||||
LogHelper.log(Level.INFO, "To: " + edge.getTarget());
|
LogHelper.info("To: " + edge.getTarget());
|
||||||
LogHelper.log(Level.INFO, "Weight: " + edge.getWeight());
|
LogHelper.info("Weight: " + edge.getWeight());
|
||||||
LogHelper.log(Level.INFO, "");
|
LogHelper.info("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogHelper.log(Level.INFO, "***** END EDGES TO *****");
|
LogHelper.info("***** END EDGES TO *****");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -38,10 +38,10 @@ public class EmcBlackList {
|
||||||
|
|
||||||
public void add(ItemStack itemStack) {
|
public void add(ItemStack itemStack) {
|
||||||
|
|
||||||
CustomWrappedStack customStackWrapper = new CustomWrappedStack(itemStack);
|
CustomWrappedStack customWrappedStack = new CustomWrappedStack(itemStack);
|
||||||
|
|
||||||
if (!stackBlackList.contains(customStackWrapper)) {
|
if (!stackBlackList.contains(customWrappedStack)) {
|
||||||
stackBlackList.add(customStackWrapper);
|
stackBlackList.add(customWrappedStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,10 +97,10 @@ public class EmcBlackList {
|
||||||
|
|
||||||
public void remove(ItemStack itemStack) {
|
public void remove(ItemStack itemStack) {
|
||||||
|
|
||||||
CustomWrappedStack customStackWrapper = new CustomWrappedStack(itemStack);
|
CustomWrappedStack customWrappedStack = new CustomWrappedStack(itemStack);
|
||||||
|
|
||||||
while (stackBlackList.contains(customStackWrapper)) {
|
while (stackBlackList.contains(customWrappedStack)) {
|
||||||
stackBlackList.remove(customStackWrapper);
|
stackBlackList.remove(customWrappedStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,9 @@ public class EquivalencyGroup {
|
||||||
return containsMember(new CustomWrappedStack(itemStack));
|
return containsMember(new CustomWrappedStack(itemStack));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean containsMember(CustomWrappedStack customStackWrapper) {
|
public boolean containsMember(CustomWrappedStack customWrappedStack) {
|
||||||
|
|
||||||
return equivalentItems.contains(customStackWrapper);
|
return equivalentItems.contains(customWrappedStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMember(ItemStack itemStack) {
|
public void addMember(ItemStack itemStack) {
|
||||||
|
@ -45,10 +45,10 @@ public class EquivalencyGroup {
|
||||||
this.addMember(new CustomWrappedStack(itemStack));
|
this.addMember(new CustomWrappedStack(itemStack));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMember(CustomWrappedStack customStackWrapper) {
|
public void addMember(CustomWrappedStack customWrappedStack) {
|
||||||
|
|
||||||
if (!containsMember(customStackWrapper)) {
|
if (!containsMember(customWrappedStack)) {
|
||||||
equivalentItems.add(customStackWrapper);
|
equivalentItems.add(customWrappedStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,10 +62,10 @@ public class EquivalencyGroup {
|
||||||
removeMember(new CustomWrappedStack(itemStack));
|
removeMember(new CustomWrappedStack(itemStack));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMember(CustomWrappedStack customStackWrapper) {
|
public void removeMember(CustomWrappedStack customWrappedStack) {
|
||||||
|
|
||||||
while (containsMember(customStackWrapper)) {
|
while (containsMember(customWrappedStack)) {
|
||||||
equivalentItems.remove(customStackWrapper);
|
equivalentItems.remove(customWrappedStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ public class EquivalencyGroup {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
stringBuilder.append("Equivalent Group Members: ");
|
stringBuilder.append("Equivalent Group Members: ");
|
||||||
for (CustomWrappedStack customStackWrapper : equivalentItems) {
|
for (CustomWrappedStack customWrappedStack : equivalentItems) {
|
||||||
stringBuilder.append(String.format("%s ", customStackWrapper));
|
stringBuilder.append(String.format("%s ", customWrappedStack));
|
||||||
}
|
}
|
||||||
|
|
||||||
return stringBuilder.toString();
|
return stringBuilder.toString();
|
||||||
|
@ -104,8 +104,8 @@ public class EquivalencyGroup {
|
||||||
|
|
||||||
int hashCode = 1;
|
int hashCode = 1;
|
||||||
|
|
||||||
for (CustomWrappedStack customStackWrapper : equivalentItems) {
|
for (CustomWrappedStack customWrappedStack : equivalentItems) {
|
||||||
hashCode = 37 * hashCode + customStackWrapper.hashCode();
|
hashCode = 37 * hashCode + customWrappedStack.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
return hashCode;
|
return hashCode;
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.util.NoSuchElementException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import com.pahimar.ee3.core.util.LogHelper;
|
import com.pahimar.ee3.core.util.LogHelper;
|
||||||
|
|
||||||
|
@ -48,10 +47,10 @@ public class WeightedDirectedGraph<T> implements Iterable<T> {
|
||||||
|
|
||||||
if (!(graph.containsKey(from) && graph.containsKey(to))) {
|
if (!(graph.containsKey(from) && graph.containsKey(to))) {
|
||||||
if (!(graph.containsKey(from))) {
|
if (!(graph.containsKey(from))) {
|
||||||
LogHelper.log(Level.SEVERE, "From node doesn't exist: " + from.toString());
|
LogHelper.severe("From node doesn't exist: " + from.toString());
|
||||||
}
|
}
|
||||||
if (!(graph.containsKey(to))) {
|
if (!(graph.containsKey(to))) {
|
||||||
LogHelper.log(Level.SEVERE, "To node doesn't exist: " + to.toString());
|
LogHelper.severe("To node doesn't exist: " + to.toString());
|
||||||
}
|
}
|
||||||
throw new NoSuchElementException("Missing nodes from graph");
|
throw new NoSuchElementException("Missing nodes from graph");
|
||||||
}
|
}
|
||||||
|
@ -83,12 +82,12 @@ public class WeightedDirectedGraph<T> implements Iterable<T> {
|
||||||
|
|
||||||
if (!(graph.containsKey(from) && graph.containsKey(to))) {
|
if (!(graph.containsKey(from) && graph.containsKey(to))) {
|
||||||
if (!(graph.containsKey(from))) {
|
if (!(graph.containsKey(from))) {
|
||||||
LogHelper.log(Level.SEVERE, "From node doesn't exist: " + from.toString());
|
LogHelper.severe("From node doesn't exist: " + from.toString());
|
||||||
LogHelper.log(Level.SEVERE, "To node: " + to.toString());
|
LogHelper.severe("To node: " + to.toString());
|
||||||
}
|
}
|
||||||
if (!(graph.containsKey(to))) {
|
if (!(graph.containsKey(to))) {
|
||||||
LogHelper.log(Level.SEVERE, "To node doesn't exist: " + to.toString());
|
LogHelper.severe("To node doesn't exist: " + to.toString());
|
||||||
LogHelper.log(Level.SEVERE, "From node: " + from.toString());
|
LogHelper.severe("From node: " + from.toString());
|
||||||
}
|
}
|
||||||
throw new NoSuchElementException("Missing nodes from graph");
|
throw new NoSuchElementException("Missing nodes from graph");
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,14 +44,14 @@ public class CustomWrappedStack {
|
||||||
this.stackSize = stackSize;
|
this.stackSize = stackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItemStack() {
|
public Object getWrappedStack() {
|
||||||
|
|
||||||
return itemStack;
|
if (itemStack != null) {
|
||||||
}
|
return itemStack;
|
||||||
|
}
|
||||||
public OreStack getOreStack() {
|
else {
|
||||||
|
return oreStack;
|
||||||
return oreStack;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue