Just some quick work before going out yet again for Christmas

This commit is contained in:
pahimar 2013-12-23 08:41:34 -05:00
parent 6dee38c4e1
commit 0e47572bac

View file

@ -2,14 +2,13 @@ package com.pahimar.ee3.recipe;
import com.pahimar.ee3.emc.EmcRegistry; import com.pahimar.ee3.emc.EmcRegistry;
import com.pahimar.ee3.emc.EmcValue; import com.pahimar.ee3.emc.EmcValue;
import com.pahimar.ee3.helper.LogHelper;
import com.pahimar.ee3.item.ModItems; import com.pahimar.ee3.item.ModItems;
import com.pahimar.ee3.lib.Compare;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.TreeMap;
/** /**
* Equivalent-Exchange-3 * Equivalent-Exchange-3
@ -20,94 +19,47 @@ import java.util.Random;
*/ */
public class CalcinationManager public class CalcinationManager
{ {
// Helper stacks
private static ItemStack ASH_DUST_STACK = new ItemStack(ModItems.alchemicalDust.itemID, 1, 0);
private static ItemStack VERDANT_DUST_STACK = new ItemStack(ModItems.alchemicalDust.itemID, 1, 1);
private static ItemStack AZURE_DUST_STACK = new ItemStack(ModItems.alchemicalDust.itemID, 1, 2);
private static ItemStack MINIUM_DUST_STACK = new ItemStack(ModItems.alchemicalDust.itemID, 1, 3);
private static ItemStack AMARANTHINE_DUST_STACK = new ItemStack(ModItems.alchemicalDust.itemID, 1, 4);
private static ItemStack IRIDESCENT_DUST_STACK = new ItemStack(ModItems.alchemicalDust.itemID, 1, 5);
private static Random random = new Random(); private static Random random = new Random();
public static List<ItemStack> getCalcinationResult(ItemStack itemStack) public static List<ItemStack> getCalcinationResult(ItemStack calcinedStack)
{ {
ItemStack stack = itemStack.copy(); ItemStack itemStack = calcinedStack.copy();
List<ItemStack> calcinationResults = new ArrayList<ItemStack>(); List<ItemStack> calcinationResults = new ArrayList<ItemStack>();
EmcValue emcValue = EmcRegistry.getInstance().getEmcValue(itemStack); TreeMap<EmcValue, ItemStack> sortedItems = new TreeMap<EmcValue, ItemStack>();
EmcValue ashEmcValue = EmcRegistry.getInstance().getEmcValue(ASH_DUST_STACK); for (ItemStack dustStack : ModItems.alchemicalDust.getSubTypes())
EmcValue verdantEmcValue = EmcRegistry.getInstance().getEmcValue(VERDANT_DUST_STACK);
EmcValue azureEmcValue = EmcRegistry.getInstance().getEmcValue(AZURE_DUST_STACK);
EmcValue miniumEmcValue = EmcRegistry.getInstance().getEmcValue(MINIUM_DUST_STACK);
EmcValue amarathineEmcValue = EmcRegistry.getInstance().getEmcValue(AMARANTHINE_DUST_STACK);
EmcValue iridescentEmcValue = EmcRegistry.getInstance().getEmcValue(IRIDESCENT_DUST_STACK);
if (emcValue != null)
{ {
if (emcValue.compareTo(ashEmcValue) < Compare.EQUALS) if (EmcRegistry.getInstance().hasEmcValue(dustStack))
{ {
LogHelper.debug("1"); sortedItems.put(EmcRegistry.getInstance().getEmcValue(dustStack), dustStack);
} }
else if (emcValue.equals(ashEmcValue)) }
if (EmcRegistry.getInstance().hasEmcValue(itemStack))
{
if (sortedItems.containsKey(EmcRegistry.getInstance().getEmcValue(itemStack)))
{ {
LogHelper.debug("1"); calcinationResults.add(sortedItems.get(EmcRegistry.getInstance().getEmcValue(itemStack)));
calcinationResults.add(ASH_DUST_STACK.copy());
} }
else if (emcValue.compareTo(ashEmcValue) == Compare.GREATER_THAN && emcValue.compareTo(verdantEmcValue) == Compare.LESSER_THAN) else
{ {
LogHelper.debug("1,2"); sortedItems.put(EmcRegistry.getInstance().getEmcValue(itemStack), itemStack);
}
else if (emcValue.equals(verdantEmcValue)) TreeMap<EmcValue, ItemStack> lessThanMap = new TreeMap<EmcValue, ItemStack>(sortedItems.headMap(EmcRegistry.getInstance().getEmcValue(itemStack)));
{
LogHelper.debug("2"); if (lessThanMap.size() == 0)
calcinationResults.add(VERDANT_DUST_STACK.copy()); {
} calcinationResults.add(new ItemStack(ModItems.alchemicalDust, 1, 0));
else if (emcValue.compareTo(verdantEmcValue) == Compare.GREATER_THAN && emcValue.compareTo(azureEmcValue) == Compare.LESSER_THAN) }
{ else
LogHelper.debug("2,3"); {
} calcinationResults.add(lessThanMap.lastEntry().getValue());
else if (emcValue.equals(azureEmcValue)) }
{
LogHelper.debug("3");
calcinationResults.add(AZURE_DUST_STACK.copy());
}
else if (emcValue.compareTo(azureEmcValue) == Compare.GREATER_THAN && emcValue.compareTo(miniumEmcValue) == Compare.LESSER_THAN)
{
LogHelper.debug("3,4");
}
else if (emcValue.equals(miniumEmcValue))
{
LogHelper.debug("4");
calcinationResults.add(MINIUM_DUST_STACK.copy());
}
else if (emcValue.compareTo(miniumEmcValue) == Compare.GREATER_THAN && emcValue.compareTo(amarathineEmcValue) == Compare.LESSER_THAN)
{
LogHelper.debug("4,5");
}
else if (emcValue.equals(amarathineEmcValue))
{
LogHelper.debug("5");
calcinationResults.add(AMARANTHINE_DUST_STACK.copy());
}
else if (emcValue.compareTo(amarathineEmcValue) == Compare.GREATER_THAN && emcValue.compareTo(iridescentEmcValue) == Compare.LESSER_THAN)
{
LogHelper.debug("5,6");
}
else if (emcValue.equals(iridescentEmcValue))
{
LogHelper.debug("6");
calcinationResults.add(IRIDESCENT_DUST_STACK.copy());
}
else if (emcValue.compareTo(iridescentEmcValue) == Compare.GREATER_THAN)
{
LogHelper.debug("6");
calcinationResults.add(IRIDESCENT_DUST_STACK.copy());
} }
} }
else else
{ {
calcinationResults.add(ASH_DUST_STACK.copy()); calcinationResults.add(new ItemStack(ModItems.alchemicalDust, 1, 0));
} }
return calcinationResults; return calcinationResults;