Fair bit of rewriting of CustomWrappedStack (now just WrappedStack).
Will make for easier API related stuffs
This commit is contained in:
parent
d02df4759d
commit
79eafef777
24 changed files with 1042 additions and 808 deletions
|
@ -4,16 +4,16 @@ import java.util.List;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
public class RecipeMapping
|
public class RecipeMapping
|
||||||
{
|
{
|
||||||
private static Gson gsonSerializer = new Gson();
|
private static Gson gsonSerializer = new Gson();
|
||||||
|
|
||||||
public final CustomWrappedStack outputWrappedStack;
|
public final WrappedStack outputWrappedStack;
|
||||||
public final List<CustomWrappedStack> inputWrappedStacks;
|
public final List<WrappedStack> inputWrappedStacks;
|
||||||
|
|
||||||
public RecipeMapping(CustomWrappedStack outputWrappedStack, List<CustomWrappedStack> inputWrappedStacks) {
|
public RecipeMapping(WrappedStack outputWrappedStack, List<WrappedStack> inputWrappedStacks) {
|
||||||
this.outputWrappedStack = outputWrappedStack;
|
this.outputWrappedStack = outputWrappedStack;
|
||||||
this.inputWrappedStacks = inputWrappedStacks;
|
this.inputWrappedStacks = inputWrappedStacks;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,16 +3,16 @@ package com.pahimar.ee3.api;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import com.pahimar.ee3.emc.EmcValue;
|
import com.pahimar.ee3.emc.EmcValue;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
public class StackValueMapping {
|
public class StackValueMapping {
|
||||||
|
|
||||||
private static Gson gsonSerializer = new Gson();
|
private static Gson gsonSerializer = new Gson();
|
||||||
|
|
||||||
public final CustomWrappedStack customWrappedStack;
|
public final WrappedStack customWrappedStack;
|
||||||
public final EmcValue emcValue;
|
public final EmcValue emcValue;
|
||||||
|
|
||||||
public StackValueMapping(CustomWrappedStack customWrappedStack, EmcValue emcValue) {
|
public StackValueMapping(WrappedStack customWrappedStack, EmcValue emcValue) {
|
||||||
this.customWrappedStack = customWrappedStack;
|
this.customWrappedStack = customWrappedStack;
|
||||||
this.emcValue = emcValue;
|
this.emcValue = emcValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
import com.pahimar.ee3.emc.EmcRegistry;
|
import com.pahimar.ee3.emc.EmcRegistry;
|
||||||
import com.pahimar.ee3.emc.EmcType;
|
import com.pahimar.ee3.emc.EmcType;
|
||||||
import com.pahimar.ee3.emc.EmcValue;
|
import com.pahimar.ee3.emc.EmcValue;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
import com.pahimar.ee3.item.OreStack;
|
import com.pahimar.ee3.item.OreStack;
|
||||||
import com.pahimar.ee3.item.crafting.RecipeRegistry;
|
import com.pahimar.ee3.item.crafting.RecipeRegistry;
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class ItemTooltipEventHandler {
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void handleItemTooltipEvent(ItemTooltipEvent event) {
|
public void handleItemTooltipEvent(ItemTooltipEvent event) {
|
||||||
|
|
||||||
CustomWrappedStack stack = new CustomWrappedStack(event.itemStack);
|
WrappedStack stack = new WrappedStack(event.itemStack);
|
||||||
if (debug) {
|
if (debug) {
|
||||||
event.toolTip.add(EnumChatFormatting.AQUA + "ID: " + event.itemStack.itemID + ", Meta: " + event.itemStack.getItemDamage());
|
event.toolTip.add(EnumChatFormatting.AQUA + "ID: " + event.itemStack.itemID + ", Meta: " + event.itemStack.getItemDamage());
|
||||||
if (stack.getWrappedStack() instanceof OreStack) {
|
if (stack.getWrappedStack() instanceof OreStack) {
|
||||||
|
|
|
@ -6,15 +6,15 @@ import java.util.List;
|
||||||
import com.pahimar.ee3.emc.EmcRegistry;
|
import com.pahimar.ee3.emc.EmcRegistry;
|
||||||
import com.pahimar.ee3.emc.EmcType;
|
import com.pahimar.ee3.emc.EmcType;
|
||||||
import com.pahimar.ee3.emc.EmcValue;
|
import com.pahimar.ee3.emc.EmcValue;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
public class EmcHelper {
|
public class EmcHelper {
|
||||||
|
|
||||||
public static List<CustomWrappedStack> filterStacksByEmc(List<CustomWrappedStack> unfilteredStacks, EmcValue filterValue) {
|
public static List<WrappedStack> filterStacksByEmc(List<WrappedStack> unfilteredStacks, EmcValue filterValue) {
|
||||||
|
|
||||||
List<CustomWrappedStack> filteredStacks = new ArrayList<CustomWrappedStack>();
|
List<WrappedStack> filteredStacks = new ArrayList<WrappedStack>();
|
||||||
|
|
||||||
for (CustomWrappedStack stack : unfilteredStacks) {
|
for (WrappedStack stack : unfilteredStacks) {
|
||||||
|
|
||||||
if (EmcRegistry.hasEmcValue(stack)) {
|
if (EmcRegistry.hasEmcValue(stack)) {
|
||||||
|
|
||||||
|
@ -38,15 +38,15 @@ public class EmcHelper {
|
||||||
return filteredStacks;
|
return filteredStacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<CustomWrappedStack> filterStacksByEmcAndRange(float start, float end, EmcValue filterValue) {
|
public static List<WrappedStack> filterStacksByEmcAndRange(float start, float end, EmcValue filterValue) {
|
||||||
return filterStacksByEmc(EmcRegistry.getStacksInRange(start, end), filterValue);
|
return filterStacksByEmc(EmcRegistry.getStacksInRange(start, end), filterValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EmcValue computeEmcValueFromList(List<CustomWrappedStack> wrappedStacks) {
|
public static EmcValue computeEmcValueFromList(List<WrappedStack> wrappedStacks) {
|
||||||
|
|
||||||
float[] computedSubValues = new float[EmcType.TYPES.length];
|
float[] computedSubValues = new float[EmcType.TYPES.length];
|
||||||
|
|
||||||
for (CustomWrappedStack wrappedStack : wrappedStacks) {
|
for (WrappedStack wrappedStack : wrappedStacks) {
|
||||||
|
|
||||||
EmcValue wrappedStackValue = EmcRegistry.getEmcValue(wrappedStack);
|
EmcValue wrappedStackValue = EmcRegistry.getEmcValue(wrappedStack);
|
||||||
|
|
||||||
|
|
71
common/com/pahimar/ee3/core/helper/FluidHelper.java
Normal file
71
common/com/pahimar/ee3/core/helper/FluidHelper.java
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
package com.pahimar.ee3.core.helper;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import com.pahimar.ee3.lib.Compare;
|
||||||
|
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
public class FluidHelper {
|
||||||
|
|
||||||
|
public static int compare(FluidStack fluidStack1, FluidStack fluidStack2) {
|
||||||
|
return comparator.compare(fluidStack1, fluidStack2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toString(FluidStack fluidStack) {
|
||||||
|
|
||||||
|
if (fluidStack != null) {
|
||||||
|
return String.format("%sxfluidStack.%s", fluidStack.amount, fluidStack.getFluid().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return "fluidStack[null]";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Comparator<FluidStack> comparator = new Comparator<FluidStack>() {
|
||||||
|
|
||||||
|
public int compare(FluidStack fluidStack1, FluidStack fluidStack2) {
|
||||||
|
|
||||||
|
if (fluidStack1 != null) {
|
||||||
|
if (fluidStack2 != null) {
|
||||||
|
if (fluidStack1.fluidID == fluidStack2.fluidID) {
|
||||||
|
if (fluidStack1.amount == fluidStack2.amount) {
|
||||||
|
if (fluidStack1.tag != null) {
|
||||||
|
if (fluidStack2.tag != null) {
|
||||||
|
return (fluidStack1.tag.hashCode() - fluidStack2.tag.hashCode());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.LESSER_THAN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (fluidStack2.tag != null) {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.EQUALS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (fluidStack1.amount - fluidStack2.amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (fluidStack1.fluidID - fluidStack2.fluidID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.LESSER_THAN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (fluidStack2 != null) {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.EQUALS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
|
@ -91,9 +91,22 @@ public class ItemHelper {
|
||||||
* The second ItemStack being tested for equality
|
* The second ItemStack being tested for equality
|
||||||
* @return true if the two ItemStacks are equivalent, false otherwise
|
* @return true if the two ItemStacks are equivalent, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean compare(ItemStack first, ItemStack second) {
|
public static boolean equals(ItemStack first, ItemStack second) {
|
||||||
|
|
||||||
return (ItemStackComparator.compare(first, second) == 0);
|
return (comparator.compare(first, second) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int compare(ItemStack itemStack1, ItemStack itemStack2) {
|
||||||
|
return comparator.compare(itemStack1, itemStack2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toString(ItemStack itemStack) {
|
||||||
|
|
||||||
|
if (itemStack != null) {
|
||||||
|
return String.format("%sxitemStack[%s:%s:%s:%s]", itemStack.stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getUnlocalizedName(), itemStack.getItem().getClass().getCanonicalName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return "itemStack[null]";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasColor(ItemStack itemStack) {
|
public static boolean hasColor(ItemStack itemStack) {
|
||||||
|
@ -147,7 +160,7 @@ public class ItemHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Comparator<ItemStack> ItemStackComparator = new Comparator<ItemStack>() {
|
public static Comparator<ItemStack> comparator = new Comparator<ItemStack>() {
|
||||||
|
|
||||||
public int compare(ItemStack itemStack1, ItemStack itemStack2) {
|
public int compare(ItemStack itemStack1, ItemStack itemStack2) {
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.item.crafting.ShapelessRecipes;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
|
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
import com.pahimar.ee3.item.EnergyStack;
|
import com.pahimar.ee3.item.EnergyStack;
|
||||||
import com.pahimar.ee3.item.OreStack;
|
import com.pahimar.ee3.item.OreStack;
|
||||||
|
|
||||||
|
@ -34,9 +34,9 @@ public class RecipeHelper {
|
||||||
* @return List of elements that constitute the input of the given IRecipe.
|
* @return List of elements that constitute the input of the given IRecipe.
|
||||||
* Could be an ItemStack or an Arraylist
|
* Could be an ItemStack or an Arraylist
|
||||||
*/
|
*/
|
||||||
public static ArrayList<CustomWrappedStack> getRecipeInputs(IRecipe recipe) {
|
public static ArrayList<WrappedStack> getRecipeInputs(IRecipe recipe) {
|
||||||
|
|
||||||
ArrayList<CustomWrappedStack> recipeInputs = new ArrayList<CustomWrappedStack>();
|
ArrayList<WrappedStack> recipeInputs = new ArrayList<WrappedStack>();
|
||||||
|
|
||||||
if (recipe instanceof ShapedRecipes) {
|
if (recipe instanceof ShapedRecipes) {
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public class RecipeHelper {
|
||||||
itemStack.stackSize = 1;
|
itemStack.stackSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
recipeInputs.add(new CustomWrappedStack(itemStack));
|
recipeInputs.add(new WrappedStack(itemStack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class RecipeHelper {
|
||||||
itemStack.stackSize = 1;
|
itemStack.stackSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
recipeInputs.add(new CustomWrappedStack(itemStack));
|
recipeInputs.add(new WrappedStack(itemStack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,10 +84,10 @@ public class RecipeHelper {
|
||||||
* If the element is a list, then it is an OreStack
|
* If the element is a list, then it is an OreStack
|
||||||
*/
|
*/
|
||||||
if (shapedOreRecipe.getInput()[i] instanceof ArrayList) {
|
if (shapedOreRecipe.getInput()[i] instanceof ArrayList) {
|
||||||
CustomWrappedStack oreStack = new CustomWrappedStack(shapedOreRecipe.getInput()[i]);
|
WrappedStack oreStack = new WrappedStack(shapedOreRecipe.getInput()[i]);
|
||||||
|
|
||||||
if (oreStack.getWrappedStack() instanceof OreStack) {
|
if (oreStack.getWrappedStack() instanceof OreStack) {
|
||||||
recipeInputs.add(new CustomWrappedStack(shapedOreRecipe.getInput()[i]));
|
recipeInputs.add(new WrappedStack(shapedOreRecipe.getInput()[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (shapedOreRecipe.getInput()[i] instanceof ItemStack) {
|
else if (shapedOreRecipe.getInput()[i] instanceof ItemStack) {
|
||||||
|
@ -98,7 +98,7 @@ public class RecipeHelper {
|
||||||
itemStack.stackSize = 1;
|
itemStack.stackSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
recipeInputs.add(new CustomWrappedStack(itemStack));
|
recipeInputs.add(new WrappedStack(itemStack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ public class RecipeHelper {
|
||||||
for (Object object : shapelessOreRecipe.getInput()) {
|
for (Object object : shapelessOreRecipe.getInput()) {
|
||||||
|
|
||||||
if (object instanceof ArrayList) {
|
if (object instanceof ArrayList) {
|
||||||
recipeInputs.add(new CustomWrappedStack(object));
|
recipeInputs.add(new WrappedStack(object));
|
||||||
}
|
}
|
||||||
else if (object instanceof ItemStack) {
|
else if (object instanceof ItemStack) {
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class RecipeHelper {
|
||||||
itemStack.stackSize = 1;
|
itemStack.stackSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
recipeInputs.add(new CustomWrappedStack(itemStack));
|
recipeInputs.add(new WrappedStack(itemStack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,20 +135,20 @@ public class RecipeHelper {
|
||||||
* List of objects for collating
|
* List of objects for collating
|
||||||
* @return A sorted, collated List of CustomWrappedStacks
|
* @return A sorted, collated List of CustomWrappedStacks
|
||||||
*/
|
*/
|
||||||
public static List<CustomWrappedStack> collateInputStacks(List<?> uncollatedStacks) {
|
public static List<WrappedStack> collateInputStacks(List<?> uncollatedStacks) {
|
||||||
|
|
||||||
List<CustomWrappedStack> collatedStacks = new ArrayList<CustomWrappedStack>();
|
List<WrappedStack> collatedStacks = new ArrayList<WrappedStack>();
|
||||||
|
|
||||||
CustomWrappedStack stack = null;
|
WrappedStack stack = null;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
for (Object object : uncollatedStacks) {
|
for (Object object : uncollatedStacks) {
|
||||||
|
|
||||||
found = false;
|
found = false;
|
||||||
|
|
||||||
if (CustomWrappedStack.canBeWrapped(object)) {
|
if (WrappedStack.canBeWrapped(object)) {
|
||||||
|
|
||||||
stack = new CustomWrappedStack(object);
|
stack = new WrappedStack(object);
|
||||||
|
|
||||||
if (collatedStacks.isEmpty()) {
|
if (collatedStacks.isEmpty()) {
|
||||||
collatedStacks.add(stack);
|
collatedStacks.add(stack);
|
||||||
|
@ -158,7 +158,7 @@ public class RecipeHelper {
|
||||||
for (int i = 0; i < collatedStacks.size(); i++) {
|
for (int i = 0; i < collatedStacks.size(); i++) {
|
||||||
if (collatedStacks.get(i).getWrappedStack() != null) {
|
if (collatedStacks.get(i).getWrappedStack() != null) {
|
||||||
if (stack.getWrappedStack() instanceof ItemStack && collatedStacks.get(i).getWrappedStack() instanceof ItemStack) {
|
if (stack.getWrappedStack() instanceof ItemStack && collatedStacks.get(i).getWrappedStack() instanceof ItemStack) {
|
||||||
if (ItemHelper.compare((ItemStack) stack.getWrappedStack(), (ItemStack) collatedStacks.get(i).getWrappedStack())) {
|
if (ItemHelper.equals((ItemStack) stack.getWrappedStack(), (ItemStack) collatedStacks.get(i).getWrappedStack())) {
|
||||||
collatedStacks.get(i).setStackSize(collatedStacks.get(i).getStackSize() + stack.getStackSize());
|
collatedStacks.get(i).setStackSize(collatedStacks.get(i).getStackSize() + stack.getStackSize());
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,13 @@ import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
public class EmcBlackList {
|
public class EmcBlackList {
|
||||||
|
|
||||||
private static EmcBlackList emcBlackList = null;
|
private static EmcBlackList emcBlackList = null;
|
||||||
|
|
||||||
private ArrayList<CustomWrappedStack> stackBlackList = new ArrayList<CustomWrappedStack>();
|
private ArrayList<WrappedStack> stackBlackList = new ArrayList<WrappedStack>();
|
||||||
|
|
||||||
private EmcBlackList() {
|
private EmcBlackList() {
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class EmcBlackList {
|
||||||
return emcBlackList;
|
return emcBlackList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CustomWrappedStack> getBlackList() {
|
public List<WrappedStack> getBlackList() {
|
||||||
|
|
||||||
return stackBlackList;
|
return stackBlackList;
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@ public class EmcBlackList {
|
||||||
|
|
||||||
boolean wasAdded = false;
|
boolean wasAdded = false;
|
||||||
|
|
||||||
if (CustomWrappedStack.canBeWrapped(object)) {
|
if (WrappedStack.canBeWrapped(object)) {
|
||||||
|
|
||||||
CustomWrappedStack wrappedStack = new CustomWrappedStack(object);
|
WrappedStack wrappedStack = new WrappedStack(object);
|
||||||
wrappedStack.setStackSize(1);
|
wrappedStack.setStackSize(1);
|
||||||
|
|
||||||
if (!stackBlackList.contains(wrappedStack)) {
|
if (!stackBlackList.contains(wrappedStack)) {
|
||||||
|
@ -52,9 +52,9 @@ public class EmcBlackList {
|
||||||
|
|
||||||
public boolean contains(Object object) {
|
public boolean contains(Object object) {
|
||||||
|
|
||||||
if (CustomWrappedStack.canBeWrapped(object)) {
|
if (WrappedStack.canBeWrapped(object)) {
|
||||||
|
|
||||||
CustomWrappedStack wrappedStack = new CustomWrappedStack(object);
|
WrappedStack wrappedStack = new WrappedStack(object);
|
||||||
wrappedStack.setStackSize(1);
|
wrappedStack.setStackSize(1);
|
||||||
|
|
||||||
return stackBlackList.contains(wrappedStack);
|
return stackBlackList.contains(wrappedStack);
|
||||||
|
@ -67,9 +67,9 @@ public class EmcBlackList {
|
||||||
|
|
||||||
boolean wasRemoved = false;
|
boolean wasRemoved = false;
|
||||||
|
|
||||||
if (CustomWrappedStack.canBeWrapped(object)) {
|
if (WrappedStack.canBeWrapped(object)) {
|
||||||
|
|
||||||
CustomWrappedStack wrappedStack = new CustomWrappedStack(object);
|
WrappedStack wrappedStack = new WrappedStack(object);
|
||||||
wrappedStack.setStackSize(1);
|
wrappedStack.setStackSize(1);
|
||||||
|
|
||||||
if (stackBlackList.contains(wrappedStack)) {
|
if (stackBlackList.contains(wrappedStack)) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import com.google.common.collect.ImmutableSortedMap;
|
||||||
import com.pahimar.ee3.core.helper.EmcHelper;
|
import com.pahimar.ee3.core.helper.EmcHelper;
|
||||||
import com.pahimar.ee3.core.helper.LogHelper;
|
import com.pahimar.ee3.core.helper.LogHelper;
|
||||||
import com.pahimar.ee3.core.helper.RecipeHelper;
|
import com.pahimar.ee3.core.helper.RecipeHelper;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
import com.pahimar.ee3.item.OreStack;
|
import com.pahimar.ee3.item.OreStack;
|
||||||
import com.pahimar.ee3.item.crafting.RecipeRegistry;
|
import com.pahimar.ee3.item.crafting.RecipeRegistry;
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@ public class EmcRegistry {
|
||||||
|
|
||||||
private static EmcRegistry emcRegistry = null;
|
private static EmcRegistry emcRegistry = null;
|
||||||
|
|
||||||
private ImmutableSortedMap<CustomWrappedStack, EmcValue> stackMappings;
|
private ImmutableSortedMap<WrappedStack, EmcValue> stackMappings;
|
||||||
private ImmutableSortedMap<EmcValue, List<CustomWrappedStack>> valueMappings;
|
private ImmutableSortedMap<EmcValue, List<WrappedStack>> valueMappings;
|
||||||
|
|
||||||
public static void lazyInit() {
|
public static void lazyInit() {
|
||||||
|
|
||||||
|
@ -41,10 +41,10 @@ public class EmcRegistry {
|
||||||
|
|
||||||
// TODO Duplicate protection?
|
// TODO Duplicate protection?
|
||||||
|
|
||||||
ImmutableSortedMap.Builder<CustomWrappedStack, EmcValue> stackMappingsBuilder = ImmutableSortedMap.naturalOrder();
|
ImmutableSortedMap.Builder<WrappedStack, EmcValue> stackMappingsBuilder = ImmutableSortedMap.naturalOrder();
|
||||||
ImmutableSortedMap.Builder<EmcValue, List<CustomWrappedStack>> valueMappingsBuilder = ImmutableSortedMap.naturalOrder();
|
ImmutableSortedMap.Builder<EmcValue, List<WrappedStack>> valueMappingsBuilder = ImmutableSortedMap.naturalOrder();
|
||||||
|
|
||||||
Map<CustomWrappedStack, EmcValue> defaultValues = EmcValuesDefault.getDefaultValueMap();
|
Map<WrappedStack, EmcValue> defaultValues = EmcValuesDefault.getDefaultValueMap();
|
||||||
|
|
||||||
// Grab the default stack:value mappings
|
// Grab the default stack:value mappings
|
||||||
stackMappingsBuilder.putAll(defaultValues);
|
stackMappingsBuilder.putAll(defaultValues);
|
||||||
|
@ -57,7 +57,7 @@ public class EmcRegistry {
|
||||||
|
|
||||||
// Attempt auto-assignment
|
// Attempt auto-assignment
|
||||||
int passNumber = 0;
|
int passNumber = 0;
|
||||||
Map<CustomWrappedStack, EmcValue> computedStackValues = computeStackMappings();
|
Map<WrappedStack, EmcValue> computedStackValues = computeStackMappings();
|
||||||
|
|
||||||
while ((computedStackValues.size() > 0) && (passNumber < MAX_ATTEMPTED_ASSIGNMENT_PASSES)) {
|
while ((computedStackValues.size() > 0) && (passNumber < MAX_ATTEMPTED_ASSIGNMENT_PASSES)) {
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ public class EmcRegistry {
|
||||||
stackMappings = stackMappingsBuilder.build();
|
stackMappings = stackMappingsBuilder.build();
|
||||||
|
|
||||||
// Handle the value mappings
|
// Handle the value mappings
|
||||||
SortedMap<EmcValue, ArrayList<CustomWrappedStack>> tempValueMappings = new TreeMap<EmcValue, ArrayList<CustomWrappedStack>>();
|
SortedMap<EmcValue, ArrayList<WrappedStack>> tempValueMappings = new TreeMap<EmcValue, ArrayList<WrappedStack>>();
|
||||||
|
|
||||||
for (CustomWrappedStack stack : defaultValues.keySet()) {
|
for (WrappedStack stack : defaultValues.keySet()) {
|
||||||
EmcValue value = defaultValues.get(stack);
|
EmcValue value = defaultValues.get(stack);
|
||||||
|
|
||||||
if (tempValueMappings.containsKey(value)) {
|
if (tempValueMappings.containsKey(value)) {
|
||||||
|
@ -88,7 +88,7 @@ public class EmcRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tempValueMappings.put(value, new ArrayList<CustomWrappedStack>(Arrays.asList(stack)));
|
tempValueMappings.put(value, new ArrayList<WrappedStack>(Arrays.asList(stack)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,17 +96,17 @@ public class EmcRegistry {
|
||||||
valueMappings = valueMappingsBuilder.build();
|
valueMappings = valueMappingsBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<CustomWrappedStack, EmcValue> computeStackMappings() {
|
private static Map<WrappedStack, EmcValue> computeStackMappings() {
|
||||||
|
|
||||||
Map<CustomWrappedStack, EmcValue> computedStackMap = new HashMap<CustomWrappedStack, EmcValue>();
|
Map<WrappedStack, EmcValue> computedStackMap = new HashMap<WrappedStack, EmcValue>();
|
||||||
|
|
||||||
for (CustomWrappedStack recipeOutput : RecipeRegistry.getRecipeMappings().keySet()) {
|
for (WrappedStack recipeOutput : RecipeRegistry.getRecipeMappings().keySet()) {
|
||||||
|
|
||||||
if (!hasEmcValue(recipeOutput.getWrappedStack(), false) && !computedStackMap.containsKey(recipeOutput.getWrappedStack())) {
|
if (!hasEmcValue(recipeOutput.getWrappedStack(), false) && !computedStackMap.containsKey(recipeOutput.getWrappedStack())) {
|
||||||
|
|
||||||
EmcValue lowestValue = null;
|
EmcValue lowestValue = null;
|
||||||
|
|
||||||
for (List<CustomWrappedStack> recipeInputs : RecipeRegistry.getRecipeMappings().get(recipeOutput)) {
|
for (List<WrappedStack> recipeInputs : RecipeRegistry.getRecipeMappings().get(recipeOutput)) {
|
||||||
|
|
||||||
EmcValue computedValue = EmcHelper.computeEmcValueFromList(recipeInputs);
|
EmcValue computedValue = EmcHelper.computeEmcValueFromList(recipeInputs);
|
||||||
computedValue = EmcHelper.factorEmcValue(computedValue, recipeOutput.getStackSize());
|
computedValue = EmcHelper.factorEmcValue(computedValue, recipeOutput.getStackSize());
|
||||||
|
@ -119,7 +119,7 @@ public class EmcRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((lowestValue != null) && (lowestValue.getValue() > 0f)) {
|
if ((lowestValue != null) && (lowestValue.getValue() > 0f)) {
|
||||||
computedStackMap.put(new CustomWrappedStack(recipeOutput.getWrappedStack()), lowestValue);
|
computedStackMap.put(new WrappedStack(recipeOutput.getWrappedStack()), lowestValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,12 +131,12 @@ public class EmcRegistry {
|
||||||
|
|
||||||
lazyInit();
|
lazyInit();
|
||||||
|
|
||||||
if (CustomWrappedStack.canBeWrapped(object)) {
|
if (WrappedStack.canBeWrapped(object)) {
|
||||||
|
|
||||||
CustomWrappedStack stack = new CustomWrappedStack(object);
|
WrappedStack stack = new WrappedStack(object);
|
||||||
|
|
||||||
if (emcRegistry.stackMappings.containsKey(new CustomWrappedStack(stack.getWrappedStack()))) {
|
if (emcRegistry.stackMappings.containsKey(new WrappedStack(stack.getWrappedStack()))) {
|
||||||
return emcRegistry.stackMappings.containsKey(new CustomWrappedStack(stack.getWrappedStack()));
|
return emcRegistry.stackMappings.containsKey(new WrappedStack(stack.getWrappedStack()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -150,13 +150,13 @@ public class EmcRegistry {
|
||||||
|
|
||||||
OreStack oreStack = new OreStack(wrappedItemStack);
|
OreStack oreStack = new OreStack(wrappedItemStack);
|
||||||
|
|
||||||
if (emcRegistry.stackMappings.containsKey(new CustomWrappedStack(oreStack))) {
|
if (emcRegistry.stackMappings.containsKey(new WrappedStack(oreStack))) {
|
||||||
return emcRegistry.stackMappings.containsKey(new CustomWrappedStack(oreStack));
|
return emcRegistry.stackMappings.containsKey(new WrappedStack(oreStack));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (ItemStack itemStack : OreDictionary.getOres(OreDictionary.getOreID(wrappedItemStack))) {
|
for (ItemStack itemStack : OreDictionary.getOres(OreDictionary.getOreID(wrappedItemStack))) {
|
||||||
if (emcRegistry.stackMappings.containsKey(new CustomWrappedStack(itemStack))) {
|
if (emcRegistry.stackMappings.containsKey(new WrappedStack(itemStack))) {
|
||||||
return emcRegistry.stackMappings.containsKey(new CustomWrappedStack(itemStack));
|
return emcRegistry.stackMappings.containsKey(new WrappedStack(itemStack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ public class EmcRegistry {
|
||||||
// Else, scan for if there is a wildcard value for it
|
// Else, scan for if there is a wildcard value for it
|
||||||
else {
|
else {
|
||||||
|
|
||||||
for (CustomWrappedStack valuedStack : emcRegistry.stackMappings.keySet()) {
|
for (WrappedStack valuedStack : emcRegistry.stackMappings.keySet()) {
|
||||||
|
|
||||||
if (valuedStack.getWrappedStack() instanceof ItemStack) {
|
if (valuedStack.getWrappedStack() instanceof ItemStack) {
|
||||||
ItemStack valuedItemStack = (ItemStack) valuedStack.getWrappedStack();
|
ItemStack valuedItemStack = (ItemStack) valuedStack.getWrappedStack();
|
||||||
|
@ -193,10 +193,10 @@ public class EmcRegistry {
|
||||||
|
|
||||||
if (hasEmcValue(object, strict)) {
|
if (hasEmcValue(object, strict)) {
|
||||||
|
|
||||||
CustomWrappedStack stack = new CustomWrappedStack(object);
|
WrappedStack stack = new WrappedStack(object);
|
||||||
|
|
||||||
if (emcRegistry.stackMappings.containsKey(new CustomWrappedStack(stack.getWrappedStack()))) {
|
if (emcRegistry.stackMappings.containsKey(new WrappedStack(stack.getWrappedStack()))) {
|
||||||
return emcRegistry.stackMappings.get(new CustomWrappedStack(stack.getWrappedStack()));
|
return emcRegistry.stackMappings.get(new WrappedStack(stack.getWrappedStack()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@ -209,19 +209,19 @@ public class EmcRegistry {
|
||||||
|
|
||||||
OreStack oreStack = new OreStack(wrappedItemStack);
|
OreStack oreStack = new OreStack(wrappedItemStack);
|
||||||
|
|
||||||
if (emcRegistry.stackMappings.containsKey(new CustomWrappedStack(oreStack))) {
|
if (emcRegistry.stackMappings.containsKey(new WrappedStack(oreStack))) {
|
||||||
return emcRegistry.stackMappings.get(new CustomWrappedStack(oreStack));
|
return emcRegistry.stackMappings.get(new WrappedStack(oreStack));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
for (ItemStack itemStack : OreDictionary.getOres(OreDictionary.getOreID(wrappedItemStack))) {
|
for (ItemStack itemStack : OreDictionary.getOres(OreDictionary.getOreID(wrappedItemStack))) {
|
||||||
|
|
||||||
if (emcRegistry.stackMappings.containsKey(new CustomWrappedStack(itemStack))) {
|
if (emcRegistry.stackMappings.containsKey(new WrappedStack(itemStack))) {
|
||||||
if (lowestValue == null) {
|
if (lowestValue == null) {
|
||||||
lowestValue = emcRegistry.stackMappings.get(new CustomWrappedStack(itemStack));
|
lowestValue = emcRegistry.stackMappings.get(new WrappedStack(itemStack));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
EmcValue itemValue = emcRegistry.stackMappings.get(new CustomWrappedStack(itemStack));
|
EmcValue itemValue = emcRegistry.stackMappings.get(new WrappedStack(itemStack));
|
||||||
|
|
||||||
if (itemValue.compareTo(lowestValue) < 0) {
|
if (itemValue.compareTo(lowestValue) < 0) {
|
||||||
lowestValue = itemValue;
|
lowestValue = itemValue;
|
||||||
|
@ -235,7 +235,7 @@ public class EmcRegistry {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
for (CustomWrappedStack valuedStack : emcRegistry.stackMappings.keySet()) {
|
for (WrappedStack valuedStack : emcRegistry.stackMappings.keySet()) {
|
||||||
|
|
||||||
EmcValue stackValue = emcRegistry.stackMappings.get(valuedStack);
|
EmcValue stackValue = emcRegistry.stackMappings.get(valuedStack);
|
||||||
|
|
||||||
|
@ -265,27 +265,27 @@ public class EmcRegistry {
|
||||||
return getEmcValue(object, false);
|
return getEmcValue(object, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<CustomWrappedStack> getStacksInRange(int start, int finish) {
|
public static List<WrappedStack> getStacksInRange(int start, int finish) {
|
||||||
|
|
||||||
return getStacksInRange(new EmcValue(start), new EmcValue(finish));
|
return getStacksInRange(new EmcValue(start), new EmcValue(finish));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<CustomWrappedStack> getStacksInRange(float start, float finish) {
|
public static List<WrappedStack> getStacksInRange(float start, float finish) {
|
||||||
|
|
||||||
return getStacksInRange(new EmcValue(start), new EmcValue(finish));
|
return getStacksInRange(new EmcValue(start), new EmcValue(finish));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<CustomWrappedStack> getStacksInRange(EmcValue start, EmcValue finish) {
|
public static List<WrappedStack> getStacksInRange(EmcValue start, EmcValue finish) {
|
||||||
|
|
||||||
lazyInit();
|
lazyInit();
|
||||||
|
|
||||||
List<CustomWrappedStack> stacksInRange = new ArrayList<CustomWrappedStack>();
|
List<WrappedStack> stacksInRange = new ArrayList<WrappedStack>();
|
||||||
|
|
||||||
SortedMap<EmcValue, List<CustomWrappedStack>> tailMap = emcRegistry.valueMappings.tailMap(start);
|
SortedMap<EmcValue, List<WrappedStack>> tailMap = emcRegistry.valueMappings.tailMap(start);
|
||||||
SortedMap<EmcValue, List<CustomWrappedStack>> headMap = emcRegistry.valueMappings.headMap(finish);
|
SortedMap<EmcValue, List<WrappedStack>> headMap = emcRegistry.valueMappings.headMap(finish);
|
||||||
|
|
||||||
SortedMap<EmcValue, List<CustomWrappedStack>> smallerMap;
|
SortedMap<EmcValue, List<WrappedStack>> smallerMap;
|
||||||
SortedMap<EmcValue, List<CustomWrappedStack>> biggerMap;
|
SortedMap<EmcValue, List<WrappedStack>> biggerMap;
|
||||||
|
|
||||||
if (!tailMap.isEmpty() && !headMap.isEmpty()) {
|
if (!tailMap.isEmpty() && !headMap.isEmpty()) {
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ public class EmcRegistry {
|
||||||
|
|
||||||
lazyInit();
|
lazyInit();
|
||||||
|
|
||||||
for (CustomWrappedStack stack : emcRegistry.stackMappings.keySet()) {
|
for (WrappedStack stack : emcRegistry.stackMappings.keySet()) {
|
||||||
LogHelper.debug("Stack: " + stack + ", Value: " + emcRegistry.stackMappings.get(stack));
|
LogHelper.debug("Stack: " + stack + ", Value: " + emcRegistry.stackMappings.get(stack));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,12 +320,12 @@ public class EmcRegistry {
|
||||||
public static void printUnmappedStacks() {
|
public static void printUnmappedStacks() {
|
||||||
|
|
||||||
lazyInit();
|
lazyInit();
|
||||||
List<CustomWrappedStack> discoveredStacks = new ArrayList<CustomWrappedStack>(RecipeRegistry.getDiscoveredStacks());
|
List<WrappedStack> discoveredStacks = new ArrayList<WrappedStack>(RecipeRegistry.getDiscoveredStacks());
|
||||||
Collections.sort(discoveredStacks);
|
Collections.sort(discoveredStacks);
|
||||||
for (CustomWrappedStack stack : discoveredStacks) {
|
for (WrappedStack stack : discoveredStacks) {
|
||||||
if (!hasEmcValue(stack)) {
|
if (!hasEmcValue(stack)) {
|
||||||
if (RecipeRegistry.getRecipeMappings().get(stack).size() > 0) {
|
if (RecipeRegistry.getRecipeMappings().get(stack).size() > 0) {
|
||||||
for (List<CustomWrappedStack> recipeInputs : RecipeRegistry.getRecipeMappings().get(stack)) {
|
for (List<WrappedStack> recipeInputs : RecipeRegistry.getRecipeMappings().get(stack)) {
|
||||||
LogHelper.debug(stack + ": " + RecipeHelper.collateInputStacks(recipeInputs));
|
LogHelper.debug(stack + ": " + RecipeHelper.collateInputStacks(recipeInputs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,11 +340,11 @@ public class EmcRegistry {
|
||||||
|
|
||||||
lazyInit();
|
lazyInit();
|
||||||
|
|
||||||
List<CustomWrappedStack> unmappedStacks = new ArrayList<CustomWrappedStack>();
|
List<WrappedStack> unmappedStacks = new ArrayList<WrappedStack>();
|
||||||
|
|
||||||
for (CustomWrappedStack recipeOutput : RecipeRegistry.getRecipeMappings().keySet()) {
|
for (WrappedStack recipeOutput : RecipeRegistry.getRecipeMappings().keySet()) {
|
||||||
|
|
||||||
CustomWrappedStack unitStack = new CustomWrappedStack(recipeOutput.getWrappedStack());
|
WrappedStack unitStack = new WrappedStack(recipeOutput.getWrappedStack());
|
||||||
|
|
||||||
if (!hasEmcValue(unitStack)) {
|
if (!hasEmcValue(unitStack)) {
|
||||||
unmappedStacks.add(recipeOutput);
|
unmappedStacks.add(recipeOutput);
|
||||||
|
@ -353,9 +353,9 @@ public class EmcRegistry {
|
||||||
|
|
||||||
Collections.sort(unmappedStacks);
|
Collections.sort(unmappedStacks);
|
||||||
|
|
||||||
for (CustomWrappedStack recipeOutput : unmappedStacks) {
|
for (WrappedStack recipeOutput : unmappedStacks) {
|
||||||
|
|
||||||
for (List<CustomWrappedStack> recipeInputs : RecipeRegistry.getRecipeMappings().get(recipeOutput)) {
|
for (List<WrappedStack> recipeInputs : RecipeRegistry.getRecipeMappings().get(recipeOutput)) {
|
||||||
LogHelper.debug(String.format("Recipe Output: %s, Recipe Inputs: %s", recipeOutput, RecipeHelper.collateInputStacks(recipeInputs)));
|
LogHelper.debug(String.format("Recipe Output: %s, Recipe Inputs: %s", recipeOutput, RecipeHelper.collateInputStacks(recipeInputs)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,17 +9,17 @@ import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
import com.pahimar.ee3.item.OreStack;
|
import com.pahimar.ee3.item.OreStack;
|
||||||
|
|
||||||
public class EmcValuesDefault {
|
public class EmcValuesDefault {
|
||||||
|
|
||||||
private static EmcValuesDefault emcDefaultValues = null;
|
private static EmcValuesDefault emcDefaultValues = null;
|
||||||
private Map<CustomWrappedStack, EmcValue> valueMap;
|
private Map<WrappedStack, EmcValue> valueMap;
|
||||||
|
|
||||||
private EmcValuesDefault() {
|
private EmcValuesDefault() {
|
||||||
|
|
||||||
valueMap = new HashMap<CustomWrappedStack, EmcValue>();
|
valueMap = new HashMap<WrappedStack, EmcValue>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void lazyInit() {
|
private static void lazyInit() {
|
||||||
|
@ -33,71 +33,71 @@ public class EmcValuesDefault {
|
||||||
private void init() {
|
private void init() {
|
||||||
|
|
||||||
// OreDictionary assignment
|
// OreDictionary assignment
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.cobblestone))), new EmcValue(1));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.cobblestone))), new EmcValue(1));
|
||||||
for (int meta = 0; meta < 16; meta++) {
|
for (int meta = 0; meta < 16; meta++) {
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Item.dyePowder, 1, meta))), new EmcValue(8));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Item.dyePowder, 1, meta))), new EmcValue(8));
|
||||||
}
|
}
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.wood))), new EmcValue(32, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 4), new EmcComponent(EmcType.ESSENTIA, 1))));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.wood))), new EmcValue(32, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 4), new EmcComponent(EmcType.ESSENTIA, 1))));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.oreDiamond))), new EmcValue(8192));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreDiamond))), new EmcValue(8192));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.oreEmerald))), new EmcValue(8192));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreEmerald))), new EmcValue(8192));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.oreGold))), new EmcValue(2048));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreGold))), new EmcValue(2048));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.oreIron))), new EmcValue(256));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreIron))), new EmcValue(256));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.oreLapis))), new EmcValue(864));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreLapis))), new EmcValue(864));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.oreNetherQuartz))), new EmcValue(256));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreNetherQuartz))), new EmcValue(256));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.oreRedstone))), new EmcValue(32));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreRedstone))), new EmcValue(32));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.oreRedstoneGlowing))), new EmcValue(32));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.oreRedstoneGlowing))), new EmcValue(32));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.planks))), new EmcValue(8));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.planks))), new EmcValue(8));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Item.record11))), new EmcValue(2048));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Item.record11))), new EmcValue(2048));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.woodSingleSlab))), new EmcValue(4));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.woodSingleSlab))), new EmcValue(4));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.stairsWoodOak))), new EmcValue(12));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.stairsWoodOak))), new EmcValue(12));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Item.stick))), new EmcValue(4));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Item.stick))), new EmcValue(4));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.stone))), new EmcValue(1));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.stone))), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.leaves))), new EmcValue(1, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 4), new EmcComponent(EmcType.ESSENTIA, 1))));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.leaves))), new EmcValue(1, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 4), new EmcComponent(EmcType.ESSENTIA, 1))));
|
||||||
valueMap.put(new CustomWrappedStack(new OreStack(new ItemStack(Block.sapling))), new EmcValue(32, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 4), new EmcComponent(EmcType.ESSENTIA, 1))));
|
valueMap.put(new WrappedStack(new OreStack(new ItemStack(Block.sapling))), new EmcValue(32, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 4), new EmcComponent(EmcType.ESSENTIA, 1))));
|
||||||
|
|
||||||
// Fluids
|
// Fluids
|
||||||
valueMap.put(new CustomWrappedStack(Block.waterStill), new EmcValue(0.1f, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 1), new EmcComponent(EmcType.AMORPHOUS, 1))));
|
valueMap.put(new WrappedStack(Block.waterStill), new EmcValue(0.1f, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 1), new EmcComponent(EmcType.AMORPHOUS, 1))));
|
||||||
valueMap.put(new CustomWrappedStack(Block.lavaStill), new EmcValue(64, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 4), new EmcComponent(EmcType.AMORPHOUS, 1))));
|
valueMap.put(new WrappedStack(Block.lavaStill), new EmcValue(64, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 4), new EmcComponent(EmcType.AMORPHOUS, 1))));
|
||||||
|
|
||||||
/* Building Blocks */
|
/* Building Blocks */
|
||||||
valueMap.put(new CustomWrappedStack(Block.stone), new EmcValue(1));
|
valueMap.put(new WrappedStack(Block.stone), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Block.grass), new EmcValue(1, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 9), new EmcComponent(EmcType.ESSENTIA, 1))));
|
valueMap.put(new WrappedStack(Block.grass), new EmcValue(1, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 9), new EmcComponent(EmcType.ESSENTIA, 1))));
|
||||||
valueMap.put(new CustomWrappedStack(Block.dirt), new EmcValue(1));
|
valueMap.put(new WrappedStack(Block.dirt), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Block.cobblestone), new EmcValue(1));
|
valueMap.put(new WrappedStack(Block.cobblestone), new EmcValue(1));
|
||||||
// Bedrock (7:0)
|
// Bedrock (7:0)
|
||||||
valueMap.put(new CustomWrappedStack(Block.sand), new EmcValue(1, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 9), new EmcComponent(EmcType.AMORPHOUS, 1))));
|
valueMap.put(new WrappedStack(Block.sand), new EmcValue(1, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 9), new EmcComponent(EmcType.AMORPHOUS, 1))));
|
||||||
valueMap.put(new CustomWrappedStack(Block.gravel), new EmcValue(4, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 9), new EmcComponent(EmcType.AMORPHOUS, 1))));
|
valueMap.put(new WrappedStack(Block.gravel), new EmcValue(4, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 9), new EmcComponent(EmcType.AMORPHOUS, 1))));
|
||||||
valueMap.put(new CustomWrappedStack(Block.oreCoal), new EmcValue(32, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 4), new EmcComponent(EmcType.KINETIC, 1))));
|
valueMap.put(new WrappedStack(Block.oreCoal), new EmcValue(32, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 4), new EmcComponent(EmcType.KINETIC, 1))));
|
||||||
// Sponge (19:0)
|
// Sponge (19:0)
|
||||||
valueMap.put(new CustomWrappedStack(Block.glass), new EmcValue(1));
|
valueMap.put(new WrappedStack(Block.glass), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Block.sandStone), new EmcValue(4));
|
valueMap.put(new WrappedStack(Block.sandStone), new EmcValue(4));
|
||||||
valueMap.put(new CustomWrappedStack(Block.cobblestoneMossy), new EmcValue(1));
|
valueMap.put(new WrappedStack(Block.cobblestoneMossy), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Block.obsidian), new EmcValue(64));
|
valueMap.put(new WrappedStack(Block.obsidian), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Block.ice), new EmcValue(1));
|
valueMap.put(new WrappedStack(Block.ice), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Block.pumpkin), new EmcValue(144));
|
valueMap.put(new WrappedStack(Block.pumpkin), new EmcValue(144));
|
||||||
valueMap.put(new CustomWrappedStack(Block.netherrack), new EmcValue(1));
|
valueMap.put(new WrappedStack(Block.netherrack), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Block.slowSand), new EmcValue(49));
|
valueMap.put(new WrappedStack(Block.slowSand), new EmcValue(49));
|
||||||
valueMap.put(new CustomWrappedStack(new ItemStack(Block.stoneBrick, 1, 1)), new EmcValue(1));
|
valueMap.put(new WrappedStack(new ItemStack(Block.stoneBrick, 1, 1)), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(new ItemStack(Block.stoneBrick, 1, OreDictionary.WILDCARD_VALUE)), new EmcValue(1));
|
valueMap.put(new WrappedStack(new ItemStack(Block.stoneBrick, 1, OreDictionary.WILDCARD_VALUE)), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Block.mycelium), new EmcValue(1));
|
valueMap.put(new WrappedStack(Block.mycelium), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Block.whiteStone), new EmcValue(1));
|
valueMap.put(new WrappedStack(Block.whiteStone), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Block.hardenedClay), new EmcValue(256));
|
valueMap.put(new WrappedStack(Block.hardenedClay), new EmcValue(256));
|
||||||
|
|
||||||
/* Decoration Blocks */
|
/* Decoration Blocks */
|
||||||
valueMap.put(new CustomWrappedStack(Block.web), new EmcValue(12));
|
valueMap.put(new WrappedStack(Block.web), new EmcValue(12));
|
||||||
valueMap.put(new CustomWrappedStack(new ItemStack(Block.tallGrass.blockID, 1, OreDictionary.WILDCARD_VALUE)), new EmcValue(1, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 9), new EmcComponent(EmcType.ESSENTIA, 1))));
|
valueMap.put(new WrappedStack(new ItemStack(Block.tallGrass.blockID, 1, OreDictionary.WILDCARD_VALUE)), new EmcValue(1, Arrays.asList(new EmcComponent(EmcType.CORPOREAL, 9), new EmcComponent(EmcType.ESSENTIA, 1))));
|
||||||
valueMap.put(new CustomWrappedStack(Block.deadBush), new EmcValue(1));
|
valueMap.put(new WrappedStack(Block.deadBush), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Block.plantYellow), new EmcValue(16));
|
valueMap.put(new WrappedStack(Block.plantYellow), new EmcValue(16));
|
||||||
valueMap.put(new CustomWrappedStack(Block.plantRed), new EmcValue(16));
|
valueMap.put(new WrappedStack(Block.plantRed), new EmcValue(16));
|
||||||
valueMap.put(new CustomWrappedStack(Block.mushroomBrown), new EmcValue(32));
|
valueMap.put(new WrappedStack(Block.mushroomBrown), new EmcValue(32));
|
||||||
valueMap.put(new CustomWrappedStack(Block.mushroomRed), new EmcValue(32));
|
valueMap.put(new WrappedStack(Block.mushroomRed), new EmcValue(32));
|
||||||
valueMap.put(new CustomWrappedStack(Block.snow), new EmcValue(0.5f));
|
valueMap.put(new WrappedStack(Block.snow), new EmcValue(0.5f));
|
||||||
valueMap.put(new CustomWrappedStack(Block.cactus), new EmcValue(8));
|
valueMap.put(new WrappedStack(Block.cactus), new EmcValue(8));
|
||||||
// Stone Monster Egg (97:0)
|
// Stone Monster Egg (97:0)
|
||||||
// Cobblestone Monster Egg (97:1)
|
// Cobblestone Monster Egg (97:1)
|
||||||
// Stone Brick Monster Egg (97:2)
|
// Stone Brick Monster Egg (97:2)
|
||||||
valueMap.put(new CustomWrappedStack(Block.vine), new EmcValue(8));
|
valueMap.put(new WrappedStack(Block.vine), new EmcValue(8));
|
||||||
valueMap.put(new CustomWrappedStack(Block.waterlily), new EmcValue(16));
|
valueMap.put(new WrappedStack(Block.waterlily), new EmcValue(16));
|
||||||
// End Portal (120:0)
|
// End Portal (120:0)
|
||||||
// Skeleton Skull (397:0)
|
// Skeleton Skull (397:0)
|
||||||
// Wither Skeleton Skull (391:1)
|
// Wither Skeleton Skull (391:1)
|
||||||
|
@ -106,37 +106,37 @@ public class EmcValuesDefault {
|
||||||
// Creeper Head (397:4)
|
// Creeper Head (397:4)
|
||||||
|
|
||||||
/* Redstone */
|
/* Redstone */
|
||||||
valueMap.put(new CustomWrappedStack(Item.redstone), new EmcValue(32));
|
valueMap.put(new WrappedStack(Item.redstone), new EmcValue(32));
|
||||||
|
|
||||||
/* Transportation */
|
/* Transportation */
|
||||||
valueMap.put(new CustomWrappedStack(Item.saddle), new EmcValue(192));
|
valueMap.put(new WrappedStack(Item.saddle), new EmcValue(192));
|
||||||
|
|
||||||
/* Miscellaneous */
|
/* Miscellaneous */
|
||||||
valueMap.put(new CustomWrappedStack(Item.snowball), new EmcValue(0.25f));
|
valueMap.put(new WrappedStack(Item.snowball), new EmcValue(0.25f));
|
||||||
valueMap.put(new CustomWrappedStack(Item.bucketMilk), new EmcValue(832));
|
valueMap.put(new WrappedStack(Item.bucketMilk), new EmcValue(832));
|
||||||
valueMap.put(new CustomWrappedStack(Item.slimeBall), new EmcValue(24));
|
valueMap.put(new WrappedStack(Item.slimeBall), new EmcValue(24));
|
||||||
valueMap.put(new CustomWrappedStack(Item.bone), new EmcValue(24));
|
valueMap.put(new WrappedStack(Item.bone), new EmcValue(24));
|
||||||
valueMap.put(new CustomWrappedStack(Item.enderPearl), new EmcValue(1024));
|
valueMap.put(new WrappedStack(Item.enderPearl), new EmcValue(1024));
|
||||||
// Bottle o'Enchanting (384:0)
|
// Bottle o'Enchanting (384:0)
|
||||||
// Firework Star (402:0)
|
// Firework Star (402:0)
|
||||||
|
|
||||||
/* Foodstuffs */
|
/* Foodstuffs */
|
||||||
valueMap.put(new CustomWrappedStack(Item.appleRed), new EmcValue(128));
|
valueMap.put(new WrappedStack(Item.appleRed), new EmcValue(128));
|
||||||
valueMap.put(new CustomWrappedStack(Item.porkRaw), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.porkRaw), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.porkCooked), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.porkCooked), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.fishRaw), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.fishRaw), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.fishCooked), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.fishCooked), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.melon), new EmcValue(16));
|
valueMap.put(new WrappedStack(Item.melon), new EmcValue(16));
|
||||||
valueMap.put(new CustomWrappedStack(Item.beefRaw), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.beefRaw), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.beefCooked), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.beefCooked), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.chickenRaw), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.chickenRaw), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.chickenCooked), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.chickenCooked), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.rottenFlesh), new EmcValue(24));
|
valueMap.put(new WrappedStack(Item.rottenFlesh), new EmcValue(24));
|
||||||
valueMap.put(new CustomWrappedStack(Item.spiderEye), new EmcValue(128));
|
valueMap.put(new WrappedStack(Item.spiderEye), new EmcValue(128));
|
||||||
valueMap.put(new CustomWrappedStack(Item.carrot), new EmcValue(24));
|
valueMap.put(new WrappedStack(Item.carrot), new EmcValue(24));
|
||||||
valueMap.put(new CustomWrappedStack(Item.potato), new EmcValue(24));
|
valueMap.put(new WrappedStack(Item.potato), new EmcValue(24));
|
||||||
valueMap.put(new CustomWrappedStack(Item.bakedPotato), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.bakedPotato), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.poisonousPotato), new EmcValue(24));
|
valueMap.put(new WrappedStack(Item.poisonousPotato), new EmcValue(24));
|
||||||
|
|
||||||
/* Tools */
|
/* Tools */
|
||||||
// Name Tag (421:0)
|
// Name Tag (421:0)
|
||||||
|
@ -148,38 +148,38 @@ public class EmcValuesDefault {
|
||||||
// Chain Boots (305:0)
|
// Chain Boots (305:0)
|
||||||
|
|
||||||
/* Brewing */
|
/* Brewing */
|
||||||
valueMap.put(new CustomWrappedStack(Item.ghastTear), new EmcValue(4096));
|
valueMap.put(new WrappedStack(Item.ghastTear), new EmcValue(4096));
|
||||||
|
|
||||||
/* Materials */
|
/* Materials */
|
||||||
valueMap.put(new CustomWrappedStack(new ItemStack(Item.coal, 1, 0)), new EmcValue(32));
|
valueMap.put(new WrappedStack(new ItemStack(Item.coal, 1, 0)), new EmcValue(32));
|
||||||
valueMap.put(new CustomWrappedStack(new ItemStack(Item.coal, 1, 1)), new EmcValue(32));
|
valueMap.put(new WrappedStack(new ItemStack(Item.coal, 1, 1)), new EmcValue(32));
|
||||||
valueMap.put(new CustomWrappedStack(Item.diamond), new EmcValue(8192));
|
valueMap.put(new WrappedStack(Item.diamond), new EmcValue(8192));
|
||||||
valueMap.put(new CustomWrappedStack(Item.ingotIron), new EmcValue(256));
|
valueMap.put(new WrappedStack(Item.ingotIron), new EmcValue(256));
|
||||||
valueMap.put(new CustomWrappedStack(Item.ingotGold), new EmcValue(2048));
|
valueMap.put(new WrappedStack(Item.ingotGold), new EmcValue(2048));
|
||||||
valueMap.put(new CustomWrappedStack(Item.silk), new EmcValue(12));
|
valueMap.put(new WrappedStack(Item.silk), new EmcValue(12));
|
||||||
valueMap.put(new CustomWrappedStack(Item.feather), new EmcValue(48));
|
valueMap.put(new WrappedStack(Item.feather), new EmcValue(48));
|
||||||
valueMap.put(new CustomWrappedStack(Item.gunpowder), new EmcValue(192));
|
valueMap.put(new WrappedStack(Item.gunpowder), new EmcValue(192));
|
||||||
valueMap.put(new CustomWrappedStack(Item.seeds), new EmcValue(16));
|
valueMap.put(new WrappedStack(Item.seeds), new EmcValue(16));
|
||||||
valueMap.put(new CustomWrappedStack(Item.wheat), new EmcValue(24));
|
valueMap.put(new WrappedStack(Item.wheat), new EmcValue(24));
|
||||||
valueMap.put(new CustomWrappedStack(Item.flint), new EmcValue(4));
|
valueMap.put(new WrappedStack(Item.flint), new EmcValue(4));
|
||||||
valueMap.put(new CustomWrappedStack(Item.leather), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.leather), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.brick), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.brick), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.clay), new EmcValue(64));
|
valueMap.put(new WrappedStack(Item.clay), new EmcValue(64));
|
||||||
valueMap.put(new CustomWrappedStack(Item.reed), new EmcValue(32));
|
valueMap.put(new WrappedStack(Item.reed), new EmcValue(32));
|
||||||
valueMap.put(new CustomWrappedStack(Item.egg), new EmcValue(32));
|
valueMap.put(new WrappedStack(Item.egg), new EmcValue(32));
|
||||||
valueMap.put(new CustomWrappedStack(Item.glowstone), new EmcValue(384));
|
valueMap.put(new WrappedStack(Item.glowstone), new EmcValue(384));
|
||||||
valueMap.put(new CustomWrappedStack(new ItemStack(Item.dyePowder, 1, 4)), new EmcValue(864));
|
valueMap.put(new WrappedStack(new ItemStack(Item.dyePowder, 1, 4)), new EmcValue(864));
|
||||||
valueMap.put(new CustomWrappedStack(Item.blazeRod), new EmcValue(1536));
|
valueMap.put(new WrappedStack(Item.blazeRod), new EmcValue(1536));
|
||||||
valueMap.put(new CustomWrappedStack(Item.netherStalkSeeds), new EmcValue(24));
|
valueMap.put(new WrappedStack(Item.netherStalkSeeds), new EmcValue(24));
|
||||||
valueMap.put(new CustomWrappedStack(Item.emerald), new EmcValue(8192));
|
valueMap.put(new WrappedStack(Item.emerald), new EmcValue(8192));
|
||||||
valueMap.put(new CustomWrappedStack(Item.netherStar), new EmcValue(24576));
|
valueMap.put(new WrappedStack(Item.netherStar), new EmcValue(24576));
|
||||||
valueMap.put(new CustomWrappedStack(Item.netherrackBrick), new EmcValue(1));
|
valueMap.put(new WrappedStack(Item.netherrackBrick), new EmcValue(1));
|
||||||
valueMap.put(new CustomWrappedStack(Item.netherQuartz), new EmcValue(256));
|
valueMap.put(new WrappedStack(Item.netherQuartz), new EmcValue(256));
|
||||||
|
|
||||||
/* Equivalent Exchange 3 */
|
/* Equivalent Exchange 3 */
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<CustomWrappedStack, EmcValue> getDefaultValueMap() {
|
public static Map<WrappedStack, EmcValue> getDefaultValueMap() {
|
||||||
|
|
||||||
lazyInit();
|
lazyInit();
|
||||||
return emcDefaultValues.valueMap;
|
return emcDefaultValues.valueMap;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.pahimar.ee3.emc;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent-Exchange-3
|
* Equivalent-Exchange-3
|
||||||
|
@ -16,18 +16,18 @@ import com.pahimar.ee3.item.CustomWrappedStack;
|
||||||
*/
|
*/
|
||||||
public class EmcValuesIMC {
|
public class EmcValuesIMC {
|
||||||
|
|
||||||
private static Map<CustomWrappedStack, EmcValue> preAssignedValueMap = new TreeMap<CustomWrappedStack, EmcValue>();
|
private static Map<WrappedStack, EmcValue> preAssignedValueMap = new TreeMap<WrappedStack, EmcValue>();
|
||||||
private static Map<CustomWrappedStack, EmcValue> postAssignedValueMap = new TreeMap<CustomWrappedStack, EmcValue>();
|
private static Map<WrappedStack, EmcValue> postAssignedValueMap = new TreeMap<WrappedStack, EmcValue>();
|
||||||
|
|
||||||
public static Map<CustomWrappedStack, EmcValue> getPreAssignedValues() {
|
public static Map<WrappedStack, EmcValue> getPreAssignedValues() {
|
||||||
return preAssignedValueMap;
|
return preAssignedValueMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<CustomWrappedStack, EmcValue> getPostAssignedValues() {
|
public static Map<WrappedStack, EmcValue> getPostAssignedValues() {
|
||||||
return postAssignedValueMap;
|
return postAssignedValueMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPreAssignedValued(CustomWrappedStack wrappedStack, EmcValue emcValue) {
|
public static void addPreAssignedValued(WrappedStack wrappedStack, EmcValue emcValue) {
|
||||||
|
|
||||||
if (!preAssignedValueMap.containsKey(wrappedStack)) {
|
if (!preAssignedValueMap.containsKey(wrappedStack)) {
|
||||||
preAssignedValueMap.put(wrappedStack, emcValue);
|
preAssignedValueMap.put(wrappedStack, emcValue);
|
||||||
|
@ -37,7 +37,7 @@ public class EmcValuesIMC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addPostAssignedValued(CustomWrappedStack wrappedStack, EmcValue emcValue) {
|
public static void addPostAssignedValued(WrappedStack wrappedStack, EmcValue emcValue) {
|
||||||
|
|
||||||
if (!postAssignedValueMap.containsKey(wrappedStack)) {
|
if (!postAssignedValueMap.containsKey(wrappedStack)) {
|
||||||
postAssignedValueMap.put(wrappedStack, emcValue);
|
postAssignedValueMap.put(wrappedStack, emcValue);
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.pahimar.ee3.api.StackValueMapping;
|
||||||
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.emc.EmcValuesIMC;
|
import com.pahimar.ee3.emc.EmcValuesIMC;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
import com.pahimar.ee3.item.crafting.RecipesIMC;
|
import com.pahimar.ee3.item.crafting.RecipesIMC;
|
||||||
import com.pahimar.ee3.lib.Reference;
|
import com.pahimar.ee3.lib.Reference;
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
|
|
||||||
if (recipeMapping != null) {
|
if (recipeMapping != null) {
|
||||||
|
|
||||||
CustomWrappedStack outputWrappedStack = recipeMapping.outputWrappedStack;
|
WrappedStack outputWrappedStack = recipeMapping.outputWrappedStack;
|
||||||
List<CustomWrappedStack> inputWrappedStacks = recipeMapping.inputWrappedStacks;
|
List<WrappedStack> inputWrappedStacks = recipeMapping.inputWrappedStacks;
|
||||||
|
|
||||||
RecipesIMC.addRecipe(outputWrappedStack, inputWrappedStacks);
|
RecipesIMC.addRecipe(outputWrappedStack, inputWrappedStacks);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
|
|
||||||
if (stackValueMapping != null) {
|
if (stackValueMapping != null) {
|
||||||
|
|
||||||
CustomWrappedStack customWrappedStack = stackValueMapping.customWrappedStack;
|
WrappedStack customWrappedStack = stackValueMapping.customWrappedStack;
|
||||||
EmcValue emcValue = stackValueMapping.emcValue;
|
EmcValue emcValue = stackValueMapping.emcValue;
|
||||||
|
|
||||||
EmcValuesIMC.addPreAssignedValued(customWrappedStack, emcValue);
|
EmcValuesIMC.addPreAssignedValued(customWrappedStack, emcValue);
|
||||||
|
@ -123,7 +123,7 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
|
|
||||||
if (stackValueMapping != null) {
|
if (stackValueMapping != null) {
|
||||||
|
|
||||||
CustomWrappedStack customWrappedStack = stackValueMapping.customWrappedStack;
|
WrappedStack customWrappedStack = stackValueMapping.customWrappedStack;
|
||||||
EmcValue emcValue = stackValueMapping.emcValue;
|
EmcValue emcValue = stackValueMapping.emcValue;
|
||||||
|
|
||||||
EmcValuesIMC.addPostAssignedValued(customWrappedStack, emcValue);
|
EmcValuesIMC.addPostAssignedValued(customWrappedStack, emcValue);
|
||||||
|
@ -142,7 +142,7 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
if (imcMessage.getMessageType() == String.class) {
|
if (imcMessage.getMessageType() == String.class) {
|
||||||
|
|
||||||
// TODO What if it is an encoded ItemStack | OreStack | EnergyStack | FluidStack
|
// TODO What if it is an encoded ItemStack | OreStack | EnergyStack | FluidStack
|
||||||
CustomWrappedStack customWrappedStack = CustomWrappedStack.createFromJson(imcMessage.getStringValue());
|
WrappedStack customWrappedStack = WrappedStack.createFromJson(imcMessage.getStringValue());
|
||||||
|
|
||||||
if (customWrappedStack != null) {
|
if (customWrappedStack != null) {
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ public class InterModCommsHandler implements ITickHandler, IScheduledTickHandler
|
||||||
if (imcMessage.getMessageType() == String.class) {
|
if (imcMessage.getMessageType() == String.class) {
|
||||||
|
|
||||||
// TODO What if it is an encoded ItemStack | OreStack | EnergyStack | FluidStack
|
// TODO What if it is an encoded ItemStack | OreStack | EnergyStack | FluidStack
|
||||||
CustomWrappedStack customWrappedStack = CustomWrappedStack.createFromJson(imcMessage.getStringValue());
|
WrappedStack customWrappedStack = WrappedStack.createFromJson(imcMessage.getStringValue());
|
||||||
|
|
||||||
if (customWrappedStack != null) {
|
if (customWrappedStack != null) {
|
||||||
|
|
||||||
|
|
|
@ -1,399 +0,0 @@
|
||||||
package com.pahimar.ee3.item;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraftforge.fluids.Fluid;
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonSyntaxException;
|
|
||||||
import com.pahimar.ee3.core.helper.ItemHelper;
|
|
||||||
|
|
||||||
public class CustomWrappedStack implements Comparable<CustomWrappedStack> {
|
|
||||||
|
|
||||||
// Gson serializer for serializing to/deserializing from json
|
|
||||||
private static final Gson gsonSerializer = new Gson();
|
|
||||||
|
|
||||||
private int stackSize;
|
|
||||||
private final ItemStack itemStack;
|
|
||||||
private final OreStack oreStack;
|
|
||||||
private final EnergyStack energyStack;
|
|
||||||
private final FluidStack fluidStack;
|
|
||||||
|
|
||||||
private static final int ORE_DICTIONARY_NOT_FOUND = -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new CustomWrappedStack object which wraps the given input.
|
|
||||||
* Valid inputs would be ItemStacks or OreStacks. If something other than an
|
|
||||||
* ItemStack or an OreStack is used as input, nothing is wrapped and the
|
|
||||||
* size of the wrapped stack is set to -1 to indicate an invalid wrapped
|
|
||||||
* stack.
|
|
||||||
*
|
|
||||||
* @param object
|
|
||||||
* The newly created wrapped stack object
|
|
||||||
*/
|
|
||||||
public CustomWrappedStack(Object object) {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If we are given an Item or a Block, convert it to an ItemStack for
|
|
||||||
* further inspection
|
|
||||||
*/
|
|
||||||
if (object instanceof Item) {
|
|
||||||
object = new ItemStack((Item) object);
|
|
||||||
}
|
|
||||||
else if (object instanceof Block) {
|
|
||||||
object = new ItemStack((Block) object);
|
|
||||||
}
|
|
||||||
else if (object instanceof Fluid) {
|
|
||||||
object = new FluidStack((Fluid) object, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We are given an ItemStack to wrap
|
|
||||||
*/
|
|
||||||
if (object instanceof ItemStack) {
|
|
||||||
|
|
||||||
ItemStack itemStack = (ItemStack) object;
|
|
||||||
|
|
||||||
this.itemStack = itemStack.copy();
|
|
||||||
oreStack = null;
|
|
||||||
energyStack = null;
|
|
||||||
fluidStack = null;
|
|
||||||
stackSize = this.itemStack.stackSize;
|
|
||||||
this.itemStack.stackSize = 1;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Or we are given an OreStack to wrap
|
|
||||||
*/
|
|
||||||
else if (object instanceof OreStack) {
|
|
||||||
|
|
||||||
itemStack = null;
|
|
||||||
oreStack = (OreStack) object;
|
|
||||||
energyStack = null;
|
|
||||||
fluidStack = null;
|
|
||||||
stackSize = oreStack.stackSize;
|
|
||||||
oreStack.stackSize = 1;
|
|
||||||
}
|
|
||||||
else if (object instanceof ArrayList) {
|
|
||||||
|
|
||||||
itemStack = null;
|
|
||||||
|
|
||||||
ArrayList<?> objectList = (ArrayList<?>) object;
|
|
||||||
|
|
||||||
OreStack tempOreStack = getOreStackFromList(objectList);
|
|
||||||
|
|
||||||
if (tempOreStack != null) {
|
|
||||||
oreStack = new OreStack(tempOreStack.oreName, 1);
|
|
||||||
stackSize = tempOreStack.stackSize;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
oreStack = null;
|
|
||||||
stackSize = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
energyStack = null;
|
|
||||||
fluidStack = null;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Or we are given an EnergyStack to wrap
|
|
||||||
*/
|
|
||||||
else if (object instanceof EnergyStack) {
|
|
||||||
itemStack = null;
|
|
||||||
oreStack = null;
|
|
||||||
energyStack = (EnergyStack) object;
|
|
||||||
fluidStack = null;
|
|
||||||
stackSize = energyStack.stackSize;
|
|
||||||
energyStack.stackSize = 1;
|
|
||||||
}
|
|
||||||
else if (object instanceof FluidStack) {
|
|
||||||
itemStack = null;
|
|
||||||
oreStack = null;
|
|
||||||
energyStack = null;
|
|
||||||
fluidStack = (FluidStack) object;
|
|
||||||
stackSize = fluidStack.amount;
|
|
||||||
fluidStack.amount = 1;
|
|
||||||
}
|
|
||||||
else if (object instanceof CustomWrappedStack) {
|
|
||||||
CustomWrappedStack wrappedStack = (CustomWrappedStack) object;
|
|
||||||
|
|
||||||
itemStack = wrappedStack.itemStack;
|
|
||||||
oreStack = wrappedStack.oreStack;
|
|
||||||
energyStack = wrappedStack.energyStack;
|
|
||||||
fluidStack = wrappedStack.fluidStack;
|
|
||||||
stackSize = wrappedStack.stackSize;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Else, we are given something we cannot wrap
|
|
||||||
*/
|
|
||||||
else {
|
|
||||||
itemStack = null;
|
|
||||||
oreStack = null;
|
|
||||||
energyStack = null;
|
|
||||||
fluidStack = null;
|
|
||||||
stackSize = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the stack size of the wrapped stack, or -1 if we wrapped an
|
|
||||||
* invalid input
|
|
||||||
*
|
|
||||||
* @return The size of the wrapped stack
|
|
||||||
*/
|
|
||||||
public int getStackSize() {
|
|
||||||
|
|
||||||
return stackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the size of the wrapped stack
|
|
||||||
*
|
|
||||||
* @param stackSize
|
|
||||||
* The new size of the wrapped stack
|
|
||||||
*/
|
|
||||||
public void setStackSize(int stackSize) {
|
|
||||||
|
|
||||||
this.stackSize = stackSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the wrapped stack
|
|
||||||
*
|
|
||||||
* @return The wrapped ItemStack, OreStack, or EnergyStack, or null if
|
|
||||||
* something other than an ItemStack, OreStack, or EnergyStack was
|
|
||||||
* used to create this object
|
|
||||||
*/
|
|
||||||
public Object getWrappedStack() {
|
|
||||||
|
|
||||||
if (itemStack != null)
|
|
||||||
return itemStack;
|
|
||||||
else if (oreStack != null)
|
|
||||||
return oreStack;
|
|
||||||
else if (energyStack != null)
|
|
||||||
return energyStack;
|
|
||||||
else if (fluidStack != null)
|
|
||||||
return fluidStack;
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object object) {
|
|
||||||
|
|
||||||
if (!(object instanceof CustomWrappedStack)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomWrappedStack customWrappedStack = (CustomWrappedStack) object;
|
|
||||||
|
|
||||||
if ((this.getWrappedStack() instanceof ItemStack) && (customWrappedStack.getWrappedStack() instanceof ItemStack)) {
|
|
||||||
return (ItemHelper.compare(itemStack, customWrappedStack.itemStack) && (stackSize == customWrappedStack.itemStack.stackSize));
|
|
||||||
}
|
|
||||||
else if ((this.getWrappedStack() instanceof OreStack) && (customWrappedStack.getWrappedStack() instanceof OreStack)) {
|
|
||||||
return (oreStack.equals(customWrappedStack.getWrappedStack()) && (stackSize == customWrappedStack.stackSize));
|
|
||||||
}
|
|
||||||
else if ((this.getWrappedStack() instanceof EnergyStack) && (customWrappedStack.getWrappedStack() instanceof EnergyStack)) {
|
|
||||||
return (energyStack.equals(customWrappedStack.energyStack) && (stackSize == customWrappedStack.stackSize));
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
|
|
||||||
if (itemStack != null) {
|
|
||||||
try {
|
|
||||||
stringBuilder.append(String.format("%sxitemStack[%s:%s:%s:%s]", stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getUnlocalizedName(), itemStack.getItem().getClass().getCanonicalName()));
|
|
||||||
}
|
|
||||||
catch (ArrayIndexOutOfBoundsException e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (oreStack != null) {
|
|
||||||
stringBuilder.append(String.format("%dxoreDictionary.%s", stackSize, oreStack.oreName));
|
|
||||||
}
|
|
||||||
else if (energyStack != null) {
|
|
||||||
stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyStack.energyName));
|
|
||||||
}
|
|
||||||
else if (fluidStack != null) {
|
|
||||||
stringBuilder.append(String.format("%dxfluidStack.%s", stackSize, fluidStack.getFluid().getName()));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
stringBuilder.append("null");
|
|
||||||
}
|
|
||||||
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
|
|
||||||
int hashCode = 1;
|
|
||||||
|
|
||||||
hashCode = 37 * hashCode + stackSize;
|
|
||||||
|
|
||||||
if (itemStack != null) {
|
|
||||||
hashCode = 37 * hashCode + itemStack.itemID;
|
|
||||||
hashCode = 37 * hashCode + itemStack.getItemDamage();
|
|
||||||
}
|
|
||||||
else if (oreStack != null) {
|
|
||||||
if (oreStack.oreName != null) {
|
|
||||||
hashCode = 37 * hashCode + oreStack.oreName.hashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (energyStack != null) {
|
|
||||||
if (energyStack.energyName != null) {
|
|
||||||
hashCode = 37 * hashCode + energyStack.energyName.hashCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (fluidStack != null) {
|
|
||||||
// TODO FluidStack hash
|
|
||||||
}
|
|
||||||
|
|
||||||
return hashCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canBeWrapped(Object object) {
|
|
||||||
|
|
||||||
if (object instanceof CustomWrappedStack) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (object instanceof Item || object instanceof Block || object instanceof ItemStack) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (object instanceof OreStack) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (object instanceof List) {
|
|
||||||
if (getOreStackFromList((List<?>) object) != null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (object instanceof EnergyStack) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (object instanceof Fluid || object instanceof FluidStack) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
/*
|
|
||||||
* Sort order (class-wise) goes null, EnergyStack, OreStack, ItemStack
|
|
||||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
|
||||||
*/
|
|
||||||
public int compareTo(CustomWrappedStack customWrappedStack) {
|
|
||||||
|
|
||||||
if (this.getWrappedStack() instanceof EnergyStack) {
|
|
||||||
|
|
||||||
if (customWrappedStack.getWrappedStack() instanceof EnergyStack) {
|
|
||||||
if (energyStack.equals(customWrappedStack.energyStack))
|
|
||||||
return stackSize - customWrappedStack.stackSize;
|
|
||||||
else
|
|
||||||
return energyStack.compareTo(customWrappedStack.energyStack);
|
|
||||||
}
|
|
||||||
else if (customWrappedStack.getWrappedStack() instanceof OreStack)
|
|
||||||
return -1;
|
|
||||||
else if (customWrappedStack.getWrappedStack() instanceof ItemStack)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (this.getWrappedStack() instanceof OreStack) {
|
|
||||||
|
|
||||||
if (customWrappedStack.getWrappedStack() instanceof EnergyStack)
|
|
||||||
return 1;
|
|
||||||
else if (customWrappedStack.getWrappedStack() instanceof OreStack) {
|
|
||||||
if (oreStack.equals(customWrappedStack.oreStack))
|
|
||||||
return stackSize - customWrappedStack.stackSize;
|
|
||||||
else
|
|
||||||
return oreStack.compareTo(customWrappedStack.oreStack);
|
|
||||||
}
|
|
||||||
else if (customWrappedStack.getWrappedStack() instanceof ItemStack)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (this.getWrappedStack() instanceof ItemStack) {
|
|
||||||
|
|
||||||
if (customWrappedStack.getWrappedStack() instanceof EnergyStack)
|
|
||||||
return 1;
|
|
||||||
else if (customWrappedStack.getWrappedStack() instanceof OreStack)
|
|
||||||
return 1;
|
|
||||||
else if (customWrappedStack.getWrappedStack() instanceof ItemStack) {
|
|
||||||
if (ItemHelper.compare(itemStack, customWrappedStack.itemStack))
|
|
||||||
return stackSize - customWrappedStack.stackSize;
|
|
||||||
else
|
|
||||||
return ItemHelper.ItemStackComparator.compare(itemStack, customWrappedStack.itemStack);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (this.getWrappedStack() instanceof FluidStack) {
|
|
||||||
// TODO Finish this
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (customWrappedStack.getWrappedStack() != null)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static OreStack getOreStackFromList(List<?> objectList) {
|
|
||||||
|
|
||||||
for (Object listElement : objectList) {
|
|
||||||
if (listElement instanceof ItemStack) {
|
|
||||||
ItemStack stack = (ItemStack) listElement;
|
|
||||||
|
|
||||||
if (OreDictionary.getOreID(stack) != CustomWrappedStack.ORE_DICTIONARY_NOT_FOUND) {
|
|
||||||
return new OreStack(stack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Deserializes a CustomWrappedStack object from the given serialized json
|
|
||||||
* String
|
|
||||||
*
|
|
||||||
* @param jsonEmcValue
|
|
||||||
* Json encoded String representing a CustomWrappedStack object
|
|
||||||
* @return The CustomWrappedStack that was encoded as json, or null if a
|
|
||||||
* valid CustomWrappedStack could not be decoded from given String
|
|
||||||
*/
|
|
||||||
public static CustomWrappedStack createFromJson(String jsonCustomWrappedStack) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
return (CustomWrappedStack) gsonSerializer.fromJson(jsonCustomWrappedStack, CustomWrappedStack.class);
|
|
||||||
}
|
|
||||||
catch (JsonSyntaxException exception) {
|
|
||||||
// TODO Log something regarding the failed parse
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns this CustomWrappedStack as a json serialized String
|
|
||||||
*
|
|
||||||
* @return Json serialized String of this CustomWrappedStack
|
|
||||||
*/
|
|
||||||
public String toJson() {
|
|
||||||
|
|
||||||
return gsonSerializer.toJson(this);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,9 @@
|
||||||
package com.pahimar.ee3.item;
|
package com.pahimar.ee3.item;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import com.pahimar.ee3.lib.Compare;
|
||||||
|
|
||||||
public class EnergyStack implements Comparable<EnergyStack> {
|
public class EnergyStack implements Comparable<EnergyStack> {
|
||||||
|
|
||||||
public static final String VANILLA_SMELTING_ENERGY_NAME = "vanillaFuelValueUnits";
|
public static final String VANILLA_SMELTING_ENERGY_NAME = "vanillaFuelValueUnits";
|
||||||
|
@ -21,12 +25,7 @@ public class EnergyStack implements Comparable<EnergyStack> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
return String.format("%dxenergyStack.%s", stackSize, energyName);
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
|
|
||||||
stringBuilder.append(String.format("%dxenergyStack.%s", stackSize, energyName));
|
|
||||||
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -36,17 +35,7 @@ public class EnergyStack implements Comparable<EnergyStack> {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnergyStack energyStack = (EnergyStack) object;
|
return (this.compareTo((EnergyStack) object) == Compare.EQUALS);
|
||||||
|
|
||||||
if ((this.energyName != null) && (energyStack.energyName != null)) {
|
|
||||||
return (stackSize == energyStack.stackSize) && energyName.equalsIgnoreCase(energyStack.energyName);
|
|
||||||
}
|
|
||||||
else if ((this.energyName == null) && (energyStack.energyName == null)) {
|
|
||||||
return (stackSize == energyStack.stackSize);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean compareEnergyNames(EnergyStack energyStack1, EnergyStack energyStack2) {
|
public static boolean compareEnergyNames(EnergyStack energyStack1, EnergyStack energyStack2) {
|
||||||
|
@ -63,27 +52,40 @@ public class EnergyStack implements Comparable<EnergyStack> {
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(EnergyStack energyStack) {
|
public int compareTo(EnergyStack energyStack) {
|
||||||
|
|
||||||
if (energyStack != null) {
|
return comparator.compare(this, energyStack);
|
||||||
if ((this.energyName != null) && (energyStack.energyName != null)) {
|
}
|
||||||
if (this.energyName.equalsIgnoreCase(energyStack.energyName)) {
|
|
||||||
return (this.stackSize - energyStack.stackSize);
|
public static int compare(EnergyStack energyStack1, EnergyStack energyStack2) {
|
||||||
|
return comparator.compare(energyStack1, energyStack2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Comparator<EnergyStack> comparator = new Comparator<EnergyStack>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(EnergyStack energyStack1, EnergyStack energyStack2) {
|
||||||
|
|
||||||
|
if (energyStack1 != null) {
|
||||||
|
if (energyStack2 != null) {
|
||||||
|
if (energyStack1.energyName.equalsIgnoreCase(energyStack2.energyName)) {
|
||||||
|
return energyStack1.stackSize - energyStack2.stackSize;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return energyStack1.energyName.compareToIgnoreCase(energyStack2.energyName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return this.energyName.compareToIgnoreCase(energyStack.energyName);
|
return Compare.LESSER_THAN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((this.energyName != null) && (energyStack.energyName == null)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if ((this.energyName == null) && (energyStack.energyName != null)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
return (this.stackSize - energyStack.stackSize);
|
if (energyStack2 != null) {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.EQUALS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 1;
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,23 @@
|
||||||
package com.pahimar.ee3.item;
|
package com.pahimar.ee3.item;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
import com.pahimar.ee3.lib.Compare;
|
||||||
|
|
||||||
public class OreStack implements Comparable<OreStack> {
|
public class OreStack implements Comparable<OreStack> {
|
||||||
|
|
||||||
// Gson serializer for serializing to/deserializing from json
|
// Gson serializer for serializing to/deserializing from json
|
||||||
private static final Gson gsonSerializer = new Gson();
|
private static final Gson gsonSerializer = new Gson();
|
||||||
|
|
||||||
|
private static final int ORE_DICTIONARY_NOT_FOUND = -1;
|
||||||
|
|
||||||
public int oreId;
|
public int oreId;
|
||||||
public String oreName;
|
public String oreName;
|
||||||
public int stackSize;
|
public int stackSize;
|
||||||
|
@ -78,12 +83,7 @@ public class OreStack implements Comparable<OreStack> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
return String.format("%sxoreDictionary.%s[oreId:%s]", stackSize, oreName, oreId);
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
|
|
||||||
stringBuilder.append(String.format("%dxoreDictionary.%s[oreId:%s]", stackSize, oreName, oreId));
|
|
||||||
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -92,9 +92,7 @@ public class OreStack implements Comparable<OreStack> {
|
||||||
if (!(object instanceof OreStack))
|
if (!(object instanceof OreStack))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
OreStack oreStackObject = (OreStack) object;
|
return (comparator.compare(this, (OreStack) object) == Compare.EQUALS);
|
||||||
|
|
||||||
return (compareTo(oreStackObject) == 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean compareOreNames(OreStack oreStack1, OreStack oreStack2) {
|
public static boolean compareOreNames(OreStack oreStack1, OreStack oreStack2) {
|
||||||
|
@ -111,39 +109,7 @@ public class OreStack implements Comparable<OreStack> {
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(OreStack oreStack) {
|
public int compareTo(OreStack oreStack) {
|
||||||
|
|
||||||
if (oreStack != null) {
|
return comparator.compare(this, oreStack);
|
||||||
|
|
||||||
if (this.oreId != oreStack.oreId) {
|
|
||||||
if (this.oreId > oreStack.oreId) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ((this.oreName != null) && (oreStack.oreName != null)) {
|
|
||||||
if (this.oreName.equalsIgnoreCase(oreStack.oreName)) {
|
|
||||||
return (this.stackSize - oreStack.stackSize);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return this.oreName.compareToIgnoreCase(oreStack.oreName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ((this.oreName != null) && (oreStack.oreName == null)) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if ((this.oreName == null) && (oreStack.oreName != null)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return (this.stackSize - oreStack.stackSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,4 +142,58 @@ public class OreStack implements Comparable<OreStack> {
|
||||||
|
|
||||||
return gsonSerializer.toJson(this);
|
return gsonSerializer.toJson(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static OreStack getOreStackFromList(List<?> objectList) {
|
||||||
|
|
||||||
|
for (Object listElement : objectList) {
|
||||||
|
if (listElement instanceof ItemStack) {
|
||||||
|
ItemStack stack = (ItemStack) listElement;
|
||||||
|
|
||||||
|
if (OreDictionary.getOreID(stack) != ORE_DICTIONARY_NOT_FOUND) {
|
||||||
|
return new OreStack(stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int compare(OreStack oreStack1, OreStack oreStack2) {
|
||||||
|
return comparator.compare(oreStack1, oreStack2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Comparator<OreStack> comparator = new Comparator<OreStack>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(OreStack oreStack1, OreStack oreStack2) {
|
||||||
|
|
||||||
|
if (oreStack1 != null) {
|
||||||
|
if (oreStack2 != null) {
|
||||||
|
if (oreStack1.oreId == oreStack2.oreId) {
|
||||||
|
if (oreStack1.oreName.equalsIgnoreCase(oreStack2.oreName)) {
|
||||||
|
return oreStack1.stackSize - oreStack2.stackSize;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return oreStack1.oreName.compareToIgnoreCase(oreStack2.oreName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return oreStack1.oreId - oreStack2.oreId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.LESSER_THAN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (oreStack2 != null) {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.EQUALS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
523
common/com/pahimar/ee3/item/WrappedStack.java
Normal file
523
common/com/pahimar/ee3/item/WrappedStack.java
Normal file
|
@ -0,0 +1,523 @@
|
||||||
|
package com.pahimar.ee3.item;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonDeserializationContext;
|
||||||
|
import com.google.gson.JsonDeserializer;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
import com.pahimar.ee3.core.helper.FluidHelper;
|
||||||
|
import com.pahimar.ee3.core.helper.ItemHelper;
|
||||||
|
import com.pahimar.ee3.core.helper.LogHelper;
|
||||||
|
import com.pahimar.ee3.lib.Compare;
|
||||||
|
|
||||||
|
public class WrappedStack
|
||||||
|
implements Comparable<WrappedStack>, JsonDeserializer<WrappedStack> {
|
||||||
|
|
||||||
|
private static final Gson gsonSerializer = (new GsonBuilder()).registerTypeAdapter(WrappedStack.class, new WrappedStack()).create();
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private final String className;
|
||||||
|
|
||||||
|
private int stackSize;
|
||||||
|
private final Object wrappedStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public WrappedStack() {
|
||||||
|
|
||||||
|
className = null;
|
||||||
|
stackSize = -1;
|
||||||
|
wrappedStack = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
*/
|
||||||
|
public WrappedStack(Object object) {
|
||||||
|
|
||||||
|
if (object instanceof Item) {
|
||||||
|
object = new ItemStack((Item) object);
|
||||||
|
}
|
||||||
|
else if (object instanceof Block) {
|
||||||
|
object = new ItemStack((Block) object);
|
||||||
|
}
|
||||||
|
else if (object instanceof Fluid) {
|
||||||
|
object = new FluidStack((Fluid) object, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (object instanceof ItemStack) {
|
||||||
|
|
||||||
|
ItemStack itemStack = ((ItemStack) object).copy();
|
||||||
|
|
||||||
|
className = object.getClass().getSimpleName();
|
||||||
|
stackSize = itemStack.stackSize;
|
||||||
|
itemStack.stackSize = 1;
|
||||||
|
wrappedStack = itemStack;
|
||||||
|
}
|
||||||
|
else if (object instanceof OreStack) {
|
||||||
|
|
||||||
|
OreStack oreStack = (OreStack) object;
|
||||||
|
|
||||||
|
className = object.getClass().getSimpleName();
|
||||||
|
stackSize = oreStack.stackSize;
|
||||||
|
oreStack.stackSize = 1;
|
||||||
|
wrappedStack = oreStack;
|
||||||
|
}
|
||||||
|
else if (object instanceof ArrayList) {
|
||||||
|
|
||||||
|
ArrayList<?> objectList = (ArrayList<?>) object;
|
||||||
|
|
||||||
|
OreStack possibleOreStack = OreStack.getOreStackFromList(objectList);
|
||||||
|
|
||||||
|
if (possibleOreStack != null) {
|
||||||
|
|
||||||
|
className = possibleOreStack.getClass().getSimpleName();
|
||||||
|
stackSize = possibleOreStack.stackSize;
|
||||||
|
possibleOreStack.stackSize = 1;
|
||||||
|
wrappedStack = possibleOreStack;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
stackSize = -1;
|
||||||
|
className = null;
|
||||||
|
wrappedStack = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (object instanceof EnergyStack) {
|
||||||
|
|
||||||
|
EnergyStack energyStack = (EnergyStack) object;
|
||||||
|
|
||||||
|
className = object.getClass().getSimpleName();
|
||||||
|
stackSize = energyStack.stackSize;
|
||||||
|
energyStack.stackSize = 1;
|
||||||
|
wrappedStack = energyStack;
|
||||||
|
}
|
||||||
|
else if (object instanceof FluidStack) {
|
||||||
|
|
||||||
|
FluidStack fluidStack = (FluidStack) object;
|
||||||
|
|
||||||
|
className = object.getClass().getSimpleName();
|
||||||
|
stackSize = fluidStack.amount;
|
||||||
|
fluidStack.amount = 1;
|
||||||
|
wrappedStack = fluidStack;
|
||||||
|
}
|
||||||
|
else if (object instanceof WrappedStack) {
|
||||||
|
|
||||||
|
WrappedStack wrappedStack = (WrappedStack) object;
|
||||||
|
|
||||||
|
className = object.getClass().getSimpleName();
|
||||||
|
this.stackSize = wrappedStack.stackSize;
|
||||||
|
this.wrappedStack = wrappedStack.wrappedStack;
|
||||||
|
}
|
||||||
|
else if (object instanceof String) {
|
||||||
|
|
||||||
|
WrappedStack wrappedStack = createFromJson((String) object);
|
||||||
|
|
||||||
|
if (wrappedStack != null) {
|
||||||
|
|
||||||
|
className = object.getClass().getSimpleName();
|
||||||
|
stackSize = wrappedStack.stackSize;
|
||||||
|
this.wrappedStack = wrappedStack.wrappedStack;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
className = null;
|
||||||
|
stackSize = -1;
|
||||||
|
this.wrappedStack = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
className = null;
|
||||||
|
stackSize = -1;
|
||||||
|
wrappedStack = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getStackSize() {
|
||||||
|
|
||||||
|
return stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param stackSize
|
||||||
|
*/
|
||||||
|
public void setStackSize(int stackSize) {
|
||||||
|
|
||||||
|
this.stackSize = stackSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Object getWrappedStack() {
|
||||||
|
|
||||||
|
return wrappedStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param jsonWrappedObject
|
||||||
|
* @return
|
||||||
|
* @throws JsonParseException
|
||||||
|
*/
|
||||||
|
public static WrappedStack createFromJson(String jsonWrappedObject) throws JsonParseException {
|
||||||
|
|
||||||
|
try {
|
||||||
|
return (WrappedStack) gsonSerializer.fromJson(jsonWrappedObject, WrappedStack.class);
|
||||||
|
}
|
||||||
|
catch (JsonSyntaxException exception) {
|
||||||
|
LogHelper.warning(exception.getMessage());
|
||||||
|
}
|
||||||
|
catch (JsonParseException exception) {
|
||||||
|
LogHelper.warning(exception.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String toJson() {
|
||||||
|
|
||||||
|
return gsonSerializer.toJson(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sort order (class-wise) goes ItemStack, OreStack, EnergyStack,
|
||||||
|
* FluidStack, null
|
||||||
|
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int compareTo(WrappedStack wrappedStack) {
|
||||||
|
|
||||||
|
return comparator.compare(this, wrappedStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
|
||||||
|
int hashCode = 1;
|
||||||
|
hashCode = (37 * hashCode) + stackSize;
|
||||||
|
|
||||||
|
if (wrappedStack instanceof ItemStack) {
|
||||||
|
|
||||||
|
hashCode = (37 * hashCode) + ((ItemStack) wrappedStack).itemID;
|
||||||
|
hashCode = (37 * hashCode) + ((ItemStack) wrappedStack).getItemDamage();
|
||||||
|
|
||||||
|
if (((ItemStack) wrappedStack).getTagCompound() != null) {
|
||||||
|
hashCode = (37 * hashCode) + ((ItemStack) wrappedStack).getTagCompound().hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (wrappedStack instanceof OreStack) {
|
||||||
|
|
||||||
|
if (((OreStack) wrappedStack).oreName != null) {
|
||||||
|
hashCode = (37 * hashCode) + ((OreStack) wrappedStack).oreName.hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (wrappedStack instanceof EnergyStack) {
|
||||||
|
|
||||||
|
if (((EnergyStack) wrappedStack).energyName != null) {
|
||||||
|
hashCode = (37 * hashCode) + ((EnergyStack) wrappedStack).energyName.hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (wrappedStack instanceof FluidStack) {
|
||||||
|
|
||||||
|
hashCode = (37 * hashCode) + ((FluidStack) wrappedStack).hashCode();
|
||||||
|
|
||||||
|
if (((FluidStack) wrappedStack).tag != null) {
|
||||||
|
hashCode = (37 * hashCode) + ((FluidStack) wrappedStack).tag.hashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hashCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
|
||||||
|
if (!(object instanceof WrappedStack)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (this.compareTo((WrappedStack) object) == Compare.EQUALS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return a string representation of the object.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
if (wrappedStack instanceof ItemStack) {
|
||||||
|
ItemStack itemStack = (ItemStack) wrappedStack;
|
||||||
|
try {
|
||||||
|
stringBuilder.append(String.format("%sxitemStack[%s:%s:%s:%s]", stackSize, itemStack.itemID, itemStack.getItemDamage(), itemStack.getUnlocalizedName(), itemStack.getItem().getClass().getCanonicalName()));
|
||||||
|
}
|
||||||
|
catch (ArrayIndexOutOfBoundsException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (wrappedStack instanceof OreStack) {
|
||||||
|
OreStack oreStack = (OreStack) wrappedStack;
|
||||||
|
stringBuilder.append(String.format("%sxoreDictionary.%s[oreId:%s]", stackSize, oreStack.oreName, oreStack.oreId));
|
||||||
|
}
|
||||||
|
else if (wrappedStack instanceof EnergyStack) {
|
||||||
|
EnergyStack energyStack = (EnergyStack) wrappedStack;
|
||||||
|
stringBuilder.append(String.format("%sxenergyStack.%s", stackSize, energyStack.energyName));
|
||||||
|
}
|
||||||
|
else if (wrappedStack instanceof FluidStack) {
|
||||||
|
FluidStack fluidStack = (FluidStack) wrappedStack;
|
||||||
|
stringBuilder.append(String.format("%sxfluidStack.%s", stackSize, fluidStack.getFluid().getName()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stringBuilder.append("null");
|
||||||
|
}
|
||||||
|
|
||||||
|
return stringBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean canBeWrapped(Object object) {
|
||||||
|
|
||||||
|
if (object instanceof WrappedStack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (object instanceof Item || object instanceof Block || object instanceof ItemStack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (object instanceof OreStack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (object instanceof List) {
|
||||||
|
if (OreStack.getOreStackFromList((List<?>) object) != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (object instanceof EnergyStack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (object instanceof Fluid || object instanceof FluidStack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public WrappedStack deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {
|
||||||
|
|
||||||
|
if (!jsonElement.isJsonPrimitive()) {
|
||||||
|
|
||||||
|
JsonObject jsonWrappedStack = (JsonObject) jsonElement;
|
||||||
|
|
||||||
|
int stackSize = -1;
|
||||||
|
String className = null;
|
||||||
|
Object wrappedStack = null;
|
||||||
|
|
||||||
|
if (jsonWrappedStack.get("className") != null) {
|
||||||
|
className = jsonWrappedStack.get("className").getAsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonWrappedStack.get("stackSize") != null) {
|
||||||
|
stackSize = jsonWrappedStack.get("stackSize").getAsInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonWrappedStack.get("wrappedStack") != null && !jsonWrappedStack.get("wrappedStack").isJsonPrimitive()) {
|
||||||
|
|
||||||
|
if (className.equalsIgnoreCase(Item.class.getSimpleName())) {
|
||||||
|
|
||||||
|
Item item = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), Item.class);
|
||||||
|
|
||||||
|
wrappedStack = item;
|
||||||
|
}
|
||||||
|
else if (className.equalsIgnoreCase(Block.class.getSimpleName())) {
|
||||||
|
|
||||||
|
Block block = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), Block.class);
|
||||||
|
|
||||||
|
wrappedStack = block;
|
||||||
|
}
|
||||||
|
else if (className.equalsIgnoreCase(Fluid.class.getSimpleName())) {
|
||||||
|
|
||||||
|
Fluid fluid = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), Fluid.class);
|
||||||
|
|
||||||
|
wrappedStack = fluid;
|
||||||
|
}
|
||||||
|
else if (className.equalsIgnoreCase(ItemStack.class.getSimpleName())) {
|
||||||
|
|
||||||
|
ItemStack itemStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), ItemStack.class);
|
||||||
|
|
||||||
|
if (stackSize > 0) {
|
||||||
|
itemStack.stackSize = stackSize;
|
||||||
|
}
|
||||||
|
wrappedStack = itemStack;
|
||||||
|
}
|
||||||
|
else if (className.equalsIgnoreCase(OreStack.class.getSimpleName())) {
|
||||||
|
|
||||||
|
OreStack oreStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), OreStack.class);
|
||||||
|
|
||||||
|
if (stackSize > 0) {
|
||||||
|
oreStack.stackSize = stackSize;
|
||||||
|
}
|
||||||
|
wrappedStack = oreStack;
|
||||||
|
}
|
||||||
|
else if (className.equalsIgnoreCase(EnergyStack.class.getSimpleName())) {
|
||||||
|
|
||||||
|
EnergyStack energyStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), EnergyStack.class);
|
||||||
|
|
||||||
|
if (stackSize > 0) {
|
||||||
|
energyStack.stackSize = stackSize;
|
||||||
|
}
|
||||||
|
wrappedStack = energyStack;
|
||||||
|
}
|
||||||
|
else if (className.equalsIgnoreCase(FluidStack.class.getSimpleName())) {
|
||||||
|
|
||||||
|
FluidStack fluidStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), FluidStack.class);
|
||||||
|
|
||||||
|
if (stackSize > 0) {
|
||||||
|
fluidStack.amount = stackSize;
|
||||||
|
}
|
||||||
|
wrappedStack = fluidStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wrappedStack != null) {
|
||||||
|
return new WrappedStack(wrappedStack);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new JsonParseException(String.format("Unable to parse a wrappable stack object from the provided json: %s", jsonElement.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new JsonParseException(String.format("Unable to parse a wrappable stack object from the provided json: %s", jsonElement.toString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Comparator<WrappedStack> comparator = new Comparator<WrappedStack>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(WrappedStack wrappedStack1, WrappedStack wrappedStack2) {
|
||||||
|
|
||||||
|
if (wrappedStack1.wrappedStack instanceof ItemStack) {
|
||||||
|
if (wrappedStack2.wrappedStack instanceof ItemStack) {
|
||||||
|
return ItemHelper.compare((ItemStack) wrappedStack1.wrappedStack, (ItemStack) wrappedStack2.wrappedStack);
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof OreStack) {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof EnergyStack) {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof FluidStack) {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (wrappedStack1.wrappedStack instanceof OreStack) {
|
||||||
|
|
||||||
|
if (wrappedStack2.wrappedStack instanceof ItemStack) {
|
||||||
|
return Compare.LESSER_THAN;
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof OreStack) {
|
||||||
|
return OreStack.compare((OreStack) wrappedStack1.wrappedStack, (OreStack) wrappedStack2.wrappedStack);
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof EnergyStack) {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof FluidStack) {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (wrappedStack1.wrappedStack instanceof EnergyStack) {
|
||||||
|
|
||||||
|
if (wrappedStack2.wrappedStack instanceof ItemStack) {
|
||||||
|
return Compare.LESSER_THAN;
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof OreStack) {
|
||||||
|
return Compare.LESSER_THAN;
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof EnergyStack) {
|
||||||
|
return EnergyStack.compare((EnergyStack) wrappedStack1.wrappedStack, (EnergyStack) wrappedStack2.wrappedStack);
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof FluidStack) {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (wrappedStack1.wrappedStack instanceof FluidStack) {
|
||||||
|
|
||||||
|
if (wrappedStack2.wrappedStack instanceof ItemStack) {
|
||||||
|
return Compare.LESSER_THAN;
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof OreStack) {
|
||||||
|
return Compare.LESSER_THAN;
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof EnergyStack) {
|
||||||
|
return Compare.LESSER_THAN;
|
||||||
|
}
|
||||||
|
else if (wrappedStack2.wrappedStack instanceof FluidStack) {
|
||||||
|
return FluidHelper.compare((FluidStack) wrappedStack1.wrappedStack, (FluidStack) wrappedStack2.wrappedStack);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.GREATER_THAN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (wrappedStack1.wrappedStack == null) {
|
||||||
|
|
||||||
|
if (wrappedStack2.wrappedStack != null) {
|
||||||
|
return Compare.LESSER_THAN;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Compare.EQUALS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Compare.EQUALS;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent-Exchange-3
|
* Equivalent-Exchange-3
|
||||||
|
@ -18,23 +18,23 @@ import com.pahimar.ee3.item.CustomWrappedStack;
|
||||||
*/
|
*/
|
||||||
public class CustomWrappedRecipe {
|
public class CustomWrappedRecipe {
|
||||||
|
|
||||||
public CustomWrappedStack output;
|
public WrappedStack output;
|
||||||
public List<CustomWrappedStack> inputs;
|
public List<WrappedStack> inputs;
|
||||||
|
|
||||||
public CustomWrappedRecipe(CustomWrappedStack output, List<CustomWrappedStack> inputs) {
|
public CustomWrappedRecipe(WrappedStack output, List<WrappedStack> inputs) {
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.inputs = collateStacks(inputs);
|
this.inputs = collateStacks(inputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomWrappedRecipe(CustomWrappedStack output, CustomWrappedStack ... inputs) {
|
public CustomWrappedRecipe(WrappedStack output, WrappedStack ... inputs) {
|
||||||
this(output, Arrays.asList(inputs));
|
this(output, Arrays.asList(inputs));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<CustomWrappedStack> collateStacks(List<CustomWrappedStack> uncollatedStacks) {
|
private List<WrappedStack> collateStacks(List<WrappedStack> uncollatedStacks) {
|
||||||
|
|
||||||
List<CustomWrappedStack> collatedStacks = new ArrayList<CustomWrappedStack>();
|
List<WrappedStack> collatedStacks = new ArrayList<WrappedStack>();
|
||||||
|
|
||||||
for (CustomWrappedStack stack : uncollatedStacks) {
|
for (WrappedStack stack : uncollatedStacks) {
|
||||||
|
|
||||||
if (collatedStacks.isEmpty()) {
|
if (collatedStacks.isEmpty()) {
|
||||||
collatedStacks.add(stack);
|
collatedStacks.add(stack);
|
||||||
|
|
|
@ -12,22 +12,22 @@ import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
public class RecipeRegistry {
|
public class RecipeRegistry {
|
||||||
|
|
||||||
private static RecipeRegistry recipeRegistry = null;
|
private static RecipeRegistry recipeRegistry = null;
|
||||||
|
|
||||||
private Multimap<CustomWrappedStack, List<CustomWrappedStack>> recipeMap;
|
private Multimap<WrappedStack, List<WrappedStack>> recipeMap;
|
||||||
private List<CustomWrappedStack> discoveredStacks;
|
private List<WrappedStack> discoveredStacks;
|
||||||
|
|
||||||
public static Multimap<CustomWrappedStack, List<CustomWrappedStack>> getRecipeMappings() {
|
public static Multimap<WrappedStack, List<WrappedStack>> getRecipeMappings() {
|
||||||
|
|
||||||
lazyInit();
|
lazyInit();
|
||||||
return recipeRegistry.recipeMap;
|
return recipeRegistry.recipeMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<CustomWrappedStack> getDiscoveredStacks() {
|
public static List<WrappedStack> getDiscoveredStacks() {
|
||||||
|
|
||||||
lazyInit();
|
lazyInit();
|
||||||
return Collections.unmodifiableList(recipeRegistry.discoveredStacks);
|
return Collections.unmodifiableList(recipeRegistry.discoveredStacks);
|
||||||
|
@ -63,18 +63,18 @@ public class RecipeRegistry {
|
||||||
|
|
||||||
private void discoverStacks() {
|
private void discoverStacks() {
|
||||||
|
|
||||||
discoveredStacks = new ArrayList<CustomWrappedStack>();
|
discoveredStacks = new ArrayList<WrappedStack>();
|
||||||
|
|
||||||
// Scan stacks from known recipes
|
// Scan stacks from known recipes
|
||||||
for (CustomWrappedStack recipeOutput : recipeMap.keySet()) {
|
for (WrappedStack recipeOutput : recipeMap.keySet()) {
|
||||||
if (!discoveredStacks.contains(new CustomWrappedStack(recipeOutput.getWrappedStack()))) {
|
if (!discoveredStacks.contains(new WrappedStack(recipeOutput.getWrappedStack()))) {
|
||||||
discoveredStacks.add(new CustomWrappedStack(recipeOutput.getWrappedStack()));
|
discoveredStacks.add(new WrappedStack(recipeOutput.getWrappedStack()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (List<CustomWrappedStack> recipeInputList : recipeMap.get(recipeOutput)) {
|
for (List<WrappedStack> recipeInputList : recipeMap.get(recipeOutput)) {
|
||||||
for (CustomWrappedStack recipeInput : recipeInputList) {
|
for (WrappedStack recipeInput : recipeInputList) {
|
||||||
if (!discoveredStacks.contains(new CustomWrappedStack(recipeInput.getWrappedStack()))) {
|
if (!discoveredStacks.contains(new WrappedStack(recipeInput.getWrappedStack()))) {
|
||||||
discoveredStacks.add(new CustomWrappedStack(recipeInput.getWrappedStack()));
|
discoveredStacks.add(new WrappedStack(recipeInput.getWrappedStack()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ public class RecipeRegistry {
|
||||||
if (Item.itemsList[i] != null) {
|
if (Item.itemsList[i] != null) {
|
||||||
if (Item.itemsList[i].getHasSubtypes()) {
|
if (Item.itemsList[i].getHasSubtypes()) {
|
||||||
for (int meta = 0; meta < 16; meta++) {
|
for (int meta = 0; meta < 16; meta++) {
|
||||||
CustomWrappedStack wrappedItemStack = new CustomWrappedStack(new ItemStack(Item.itemsList[i].itemID, 1, meta));
|
WrappedStack wrappedItemStack = new WrappedStack(new ItemStack(Item.itemsList[i].itemID, 1, meta));
|
||||||
|
|
||||||
if (!discoveredStacks.contains(wrappedItemStack)) {
|
if (!discoveredStacks.contains(wrappedItemStack)) {
|
||||||
discoveredStacks.add(wrappedItemStack);
|
discoveredStacks.add(wrappedItemStack);
|
||||||
|
@ -93,7 +93,7 @@ public class RecipeRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CustomWrappedStack wrappedItemStack = new CustomWrappedStack(Item.itemsList[i]);
|
WrappedStack wrappedItemStack = new WrappedStack(Item.itemsList[i]);
|
||||||
|
|
||||||
if (!discoveredStacks.contains(wrappedItemStack)) {
|
if (!discoveredStacks.contains(wrappedItemStack)) {
|
||||||
discoveredStacks.add(wrappedItemStack);
|
discoveredStacks.add(wrappedItemStack);
|
||||||
|
@ -109,14 +109,14 @@ public class RecipeRegistry {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
// Sort the keys for output to console
|
// Sort the keys for output to console
|
||||||
SortedSet<CustomWrappedStack> set = new TreeSet<CustomWrappedStack>();
|
SortedSet<WrappedStack> set = new TreeSet<WrappedStack>();
|
||||||
set.addAll(recipeMap.keySet());
|
set.addAll(recipeMap.keySet());
|
||||||
|
|
||||||
for (CustomWrappedStack key : set) {
|
for (WrappedStack key : set) {
|
||||||
|
|
||||||
Collection<List<CustomWrappedStack>> recipeMappings = recipeMap.get(key);
|
Collection<List<WrappedStack>> recipeMappings = recipeMap.get(key);
|
||||||
|
|
||||||
for (List<CustomWrappedStack> recipeList : recipeMappings) {
|
for (List<WrappedStack> recipeList : recipeMappings) {
|
||||||
stringBuilder.append(String.format("Recipe Output: %s, Recipe Input: %s\n", key.toString(), recipeList.toString()));
|
stringBuilder.append(String.format("Recipe Output: %s, Recipe Input: %s\n", key.toString(), recipeList.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,13 +9,13 @@ import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
public class RecipesFluidContainers
|
public class RecipesFluidContainers
|
||||||
{
|
{
|
||||||
private static Multimap<CustomWrappedStack, List<CustomWrappedStack>> fluidContainerRecipes = null;
|
private static Multimap<WrappedStack, List<WrappedStack>> fluidContainerRecipes = null;
|
||||||
|
|
||||||
public static Multimap<CustomWrappedStack, List<CustomWrappedStack>> getFluidContainerRecipes() {
|
public static Multimap<WrappedStack, List<WrappedStack>> getFluidContainerRecipes() {
|
||||||
|
|
||||||
if (fluidContainerRecipes == null) {
|
if (fluidContainerRecipes == null) {
|
||||||
init();
|
init();
|
||||||
|
@ -35,7 +35,7 @@ public class RecipesFluidContainers
|
||||||
|
|
||||||
if (fluidBlock != null) {
|
if (fluidBlock != null) {
|
||||||
|
|
||||||
fluidContainerRecipes.put(new CustomWrappedStack(data.filledContainer), Arrays.asList(new CustomWrappedStack(fluidBlock), new CustomWrappedStack(data.emptyContainer)));
|
fluidContainerRecipes.put(new WrappedStack(data.filledContainer), Arrays.asList(new WrappedStack(fluidBlock), new WrappedStack(data.emptyContainer)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.pahimar.ee3.core.helper.RecipeHelper;
|
import com.pahimar.ee3.core.helper.RecipeHelper;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent-Exchange-3
|
* Equivalent-Exchange-3
|
||||||
|
@ -18,13 +18,13 @@ import com.pahimar.ee3.item.CustomWrappedStack;
|
||||||
*/
|
*/
|
||||||
public class RecipesIMC {
|
public class RecipesIMC {
|
||||||
|
|
||||||
private static Multimap<CustomWrappedStack, List<CustomWrappedStack>> imcRecipes = HashMultimap.create();
|
private static Multimap<WrappedStack, List<WrappedStack>> imcRecipes = HashMultimap.create();
|
||||||
|
|
||||||
public static Multimap<CustomWrappedStack, List<CustomWrappedStack>> getIMCRecipes() {
|
public static Multimap<WrappedStack, List<WrappedStack>> getIMCRecipes() {
|
||||||
return imcRecipes;
|
return imcRecipes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addRecipe(CustomWrappedStack recipeOutput, List<?> recipeInputs) {
|
public static void addRecipe(WrappedStack recipeOutput, List<?> recipeInputs) {
|
||||||
|
|
||||||
imcRecipes.put(recipeOutput, RecipeHelper.collateInputStacks(recipeInputs));
|
imcRecipes.put(recipeOutput, RecipeHelper.collateInputStacks(recipeInputs));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,100 +9,100 @@ import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
public class RecipesPotions {
|
public class RecipesPotions {
|
||||||
|
|
||||||
private static Multimap<CustomWrappedStack, List<CustomWrappedStack>> potionRecipes = null;
|
private static Multimap<WrappedStack, List<WrappedStack>> potionRecipes = null;
|
||||||
|
|
||||||
private static CustomWrappedStack reagentWater = new CustomWrappedStack(new ItemStack(Block.waterStill));
|
private static WrappedStack reagentWater = new WrappedStack(new ItemStack(Block.waterStill));
|
||||||
private static CustomWrappedStack reagentNetherWart = new CustomWrappedStack(new ItemStack(372, 1, 0));
|
private static WrappedStack reagentNetherWart = new WrappedStack(new ItemStack(372, 1, 0));
|
||||||
private static CustomWrappedStack reagentGlowstoneDust = new CustomWrappedStack(new ItemStack(Item.glowstone));
|
private static WrappedStack reagentGlowstoneDust = new WrappedStack(new ItemStack(Item.glowstone));
|
||||||
private static CustomWrappedStack reagentRedstoneDust = new CustomWrappedStack(new ItemStack(331, 1, 0));
|
private static WrappedStack reagentRedstoneDust = new WrappedStack(new ItemStack(331, 1, 0));
|
||||||
private static CustomWrappedStack reagentGunpowder = new CustomWrappedStack(new ItemStack(Item.gunpowder));
|
private static WrappedStack reagentGunpowder = new WrappedStack(new ItemStack(Item.gunpowder));
|
||||||
private static CustomWrappedStack reagentGoldenCarrot = new CustomWrappedStack(new ItemStack(Item.goldenCarrot));
|
private static WrappedStack reagentGoldenCarrot = new WrappedStack(new ItemStack(Item.goldenCarrot));
|
||||||
private static CustomWrappedStack reagentMagmaCream = new CustomWrappedStack(new ItemStack(Item.magmaCream));
|
private static WrappedStack reagentMagmaCream = new WrappedStack(new ItemStack(Item.magmaCream));
|
||||||
private static CustomWrappedStack reagentSugar = new CustomWrappedStack(new ItemStack(Item.sugar));
|
private static WrappedStack reagentSugar = new WrappedStack(new ItemStack(Item.sugar));
|
||||||
private static CustomWrappedStack reagentGlisteringMelon = new CustomWrappedStack(new ItemStack(Item.speckledMelon));
|
private static WrappedStack reagentGlisteringMelon = new WrappedStack(new ItemStack(Item.speckledMelon));
|
||||||
private static CustomWrappedStack reagentSpiderEye = new CustomWrappedStack(new ItemStack(Item.spiderEye));
|
private static WrappedStack reagentSpiderEye = new WrappedStack(new ItemStack(Item.spiderEye));
|
||||||
private static CustomWrappedStack reagentGhastTear = new CustomWrappedStack(new ItemStack(Item.ghastTear));
|
private static WrappedStack reagentGhastTear = new WrappedStack(new ItemStack(Item.ghastTear));
|
||||||
private static CustomWrappedStack reagentFermentedSpiderEye = new CustomWrappedStack(new ItemStack(Item.fermentedSpiderEye));
|
private static WrappedStack reagentFermentedSpiderEye = new WrappedStack(new ItemStack(Item.fermentedSpiderEye));
|
||||||
private static CustomWrappedStack reagentBlazePowder = new CustomWrappedStack(new ItemStack(Item.blazePowder));
|
private static WrappedStack reagentBlazePowder = new WrappedStack(new ItemStack(Item.blazePowder));
|
||||||
|
|
||||||
private static CustomWrappedStack bottleEmpty = new CustomWrappedStack(Item.glassBottle);
|
private static WrappedStack bottleEmpty = new WrappedStack(Item.glassBottle);
|
||||||
private static CustomWrappedStack bottleWater = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 0));
|
private static WrappedStack bottleWater = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 0));
|
||||||
|
|
||||||
private static CustomWrappedStack potionAwkward = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16));
|
private static WrappedStack potionAwkward = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16));
|
||||||
private static CustomWrappedStack potionThick = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 32));
|
private static WrappedStack potionThick = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 32));
|
||||||
private static CustomWrappedStack potionMundane = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 128));
|
private static WrappedStack potionMundane = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 128));
|
||||||
private static CustomWrappedStack potionMundaneExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 64));
|
private static WrappedStack potionMundaneExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 64));
|
||||||
private static CustomWrappedStack potionMundaneSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16512));
|
private static WrappedStack potionMundaneSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16512));
|
||||||
private static CustomWrappedStack potionMundaneSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16448));
|
private static WrappedStack potionMundaneSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16448));
|
||||||
|
|
||||||
private static CustomWrappedStack potionRegeneration = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8193));
|
private static WrappedStack potionRegeneration = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8193));
|
||||||
private static CustomWrappedStack potionRegenerationEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8225));
|
private static WrappedStack potionRegenerationEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8225));
|
||||||
private static CustomWrappedStack potionRegenerationExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8257));
|
private static WrappedStack potionRegenerationExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8257));
|
||||||
private static CustomWrappedStack potionRegenerationSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16385));
|
private static WrappedStack potionRegenerationSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16385));
|
||||||
private static CustomWrappedStack potionRegenerationSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16417));
|
private static WrappedStack potionRegenerationSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16417));
|
||||||
private static CustomWrappedStack potionRegenerationSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16449));
|
private static WrappedStack potionRegenerationSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16449));
|
||||||
|
|
||||||
private static CustomWrappedStack potionSwiftness = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8194));
|
private static WrappedStack potionSwiftness = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8194));
|
||||||
private static CustomWrappedStack potionSwiftnessEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8226));
|
private static WrappedStack potionSwiftnessEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8226));
|
||||||
private static CustomWrappedStack potionSwiftnessExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8258));
|
private static WrappedStack potionSwiftnessExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8258));
|
||||||
private static CustomWrappedStack potionSwiftnessSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16386));
|
private static WrappedStack potionSwiftnessSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16386));
|
||||||
private static CustomWrappedStack potionSwiftnessSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16418));
|
private static WrappedStack potionSwiftnessSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16418));
|
||||||
private static CustomWrappedStack potionSwiftnessSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16450));
|
private static WrappedStack potionSwiftnessSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16450));
|
||||||
|
|
||||||
private static CustomWrappedStack potionFireResist = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8195));
|
private static WrappedStack potionFireResist = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8195));
|
||||||
private static CustomWrappedStack potionFireResistExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8259));
|
private static WrappedStack potionFireResistExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8259));
|
||||||
private static CustomWrappedStack potionFireResistSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16387));
|
private static WrappedStack potionFireResistSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16387));
|
||||||
private static CustomWrappedStack potionFireResistSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16451));
|
private static WrappedStack potionFireResistSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16451));
|
||||||
|
|
||||||
private static CustomWrappedStack potionPoison = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8196));
|
private static WrappedStack potionPoison = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8196));
|
||||||
private static CustomWrappedStack potionPoisonEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8228));
|
private static WrappedStack potionPoisonEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8228));
|
||||||
private static CustomWrappedStack potionPoisonExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8260));
|
private static WrappedStack potionPoisonExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8260));
|
||||||
private static CustomWrappedStack potionPoisonSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16388));
|
private static WrappedStack potionPoisonSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16388));
|
||||||
private static CustomWrappedStack potionPoisonSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16420));
|
private static WrappedStack potionPoisonSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16420));
|
||||||
private static CustomWrappedStack potionPoisonSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16452));
|
private static WrappedStack potionPoisonSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16452));
|
||||||
|
|
||||||
private static CustomWrappedStack potionHealing = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8197));
|
private static WrappedStack potionHealing = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8197));
|
||||||
private static CustomWrappedStack potionHealingEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8229));
|
private static WrappedStack potionHealingEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8229));
|
||||||
private static CustomWrappedStack potionHealingSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16389));
|
private static WrappedStack potionHealingSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16389));
|
||||||
private static CustomWrappedStack potionHealingSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16421));
|
private static WrappedStack potionHealingSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16421));
|
||||||
|
|
||||||
private static CustomWrappedStack potionNightVision = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8198));
|
private static WrappedStack potionNightVision = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8198));
|
||||||
private static CustomWrappedStack potionNightVisionExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8262));
|
private static WrappedStack potionNightVisionExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8262));
|
||||||
private static CustomWrappedStack potionNightVisionSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16390));
|
private static WrappedStack potionNightVisionSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16390));
|
||||||
private static CustomWrappedStack potionNightVisionSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16454));
|
private static WrappedStack potionNightVisionSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16454));
|
||||||
|
|
||||||
private static CustomWrappedStack potionWeakness = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8200));
|
private static WrappedStack potionWeakness = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8200));
|
||||||
private static CustomWrappedStack potionWeaknessExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8264));
|
private static WrappedStack potionWeaknessExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8264));
|
||||||
private static CustomWrappedStack potionWeaknessSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16392));
|
private static WrappedStack potionWeaknessSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16392));
|
||||||
private static CustomWrappedStack potionWeaknessSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16456));
|
private static WrappedStack potionWeaknessSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16456));
|
||||||
|
|
||||||
private static CustomWrappedStack potionStrength = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8201));
|
private static WrappedStack potionStrength = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8201));
|
||||||
private static CustomWrappedStack potionStrengthEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8233));
|
private static WrappedStack potionStrengthEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8233));
|
||||||
private static CustomWrappedStack potionStrengthExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8265));
|
private static WrappedStack potionStrengthExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8265));
|
||||||
private static CustomWrappedStack potionStrengthSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16393));
|
private static WrappedStack potionStrengthSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16393));
|
||||||
private static CustomWrappedStack potionStrengthSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16425));
|
private static WrappedStack potionStrengthSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16425));
|
||||||
private static CustomWrappedStack potionStrengthSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16457));
|
private static WrappedStack potionStrengthSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16457));
|
||||||
|
|
||||||
private static CustomWrappedStack potionSlowness = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8202));
|
private static WrappedStack potionSlowness = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8202));
|
||||||
private static CustomWrappedStack potionSlownessExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8266));
|
private static WrappedStack potionSlownessExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8266));
|
||||||
private static CustomWrappedStack potionSlownessSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16394));
|
private static WrappedStack potionSlownessSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16394));
|
||||||
private static CustomWrappedStack potionSlownessSplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16458));
|
private static WrappedStack potionSlownessSplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16458));
|
||||||
|
|
||||||
private static CustomWrappedStack potionHarming = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8204));
|
private static WrappedStack potionHarming = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8204));
|
||||||
private static CustomWrappedStack potionHarmingEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8236));
|
private static WrappedStack potionHarmingEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8236));
|
||||||
private static CustomWrappedStack potionHarmingSplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16396));
|
private static WrappedStack potionHarmingSplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16396));
|
||||||
private static CustomWrappedStack potionHarmingSplashEnhanced = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16428));
|
private static WrappedStack potionHarmingSplashEnhanced = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16428));
|
||||||
|
|
||||||
private static CustomWrappedStack potionInvisibility = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8206));
|
private static WrappedStack potionInvisibility = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8206));
|
||||||
private static CustomWrappedStack potionInvisibilityExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 8270));
|
private static WrappedStack potionInvisibilityExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 8270));
|
||||||
private static CustomWrappedStack potionInvisibilitySplash = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16398));
|
private static WrappedStack potionInvisibilitySplash = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16398));
|
||||||
private static CustomWrappedStack potionInvisibilitySplashExtended = new CustomWrappedStack(new ItemStack(Item.potion.itemID, 1, 16462));
|
private static WrappedStack potionInvisibilitySplashExtended = new WrappedStack(new ItemStack(Item.potion.itemID, 1, 16462));
|
||||||
|
|
||||||
public static Multimap<CustomWrappedStack, List<CustomWrappedStack>> getPotionRecipes() {
|
public static Multimap<WrappedStack, List<WrappedStack>> getPotionRecipes() {
|
||||||
|
|
||||||
if (potionRecipes == null) {
|
if (potionRecipes == null) {
|
||||||
init();
|
init();
|
||||||
|
|
|
@ -10,13 +10,13 @@ import net.minecraft.item.crafting.IRecipe;
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.pahimar.ee3.core.helper.RecipeHelper;
|
import com.pahimar.ee3.core.helper.RecipeHelper;
|
||||||
import com.pahimar.ee3.item.CustomWrappedStack;
|
import com.pahimar.ee3.item.WrappedStack;
|
||||||
|
|
||||||
public class RecipesVanilla {
|
public class RecipesVanilla {
|
||||||
|
|
||||||
private static Multimap<CustomWrappedStack, List<CustomWrappedStack>> vanillaRecipes = null;
|
private static Multimap<WrappedStack, List<WrappedStack>> vanillaRecipes = null;
|
||||||
|
|
||||||
public static Multimap<CustomWrappedStack, List<CustomWrappedStack>> getVanillaRecipes() {
|
public static Multimap<WrappedStack, List<WrappedStack>> getVanillaRecipes() {
|
||||||
|
|
||||||
if (vanillaRecipes == null) {
|
if (vanillaRecipes == null) {
|
||||||
init();
|
init();
|
||||||
|
@ -38,11 +38,11 @@ public class RecipesVanilla {
|
||||||
|
|
||||||
if (recipeOutput != null) {
|
if (recipeOutput != null) {
|
||||||
|
|
||||||
ArrayList<CustomWrappedStack> recipeInputs = RecipeHelper.getRecipeInputs(recipe);
|
ArrayList<WrappedStack> recipeInputs = RecipeHelper.getRecipeInputs(recipe);
|
||||||
|
|
||||||
if (!recipeInputs.isEmpty())
|
if (!recipeInputs.isEmpty())
|
||||||
{
|
{
|
||||||
vanillaRecipes.put(new CustomWrappedStack(recipeOutput), recipeInputs);
|
vanillaRecipes.put(new WrappedStack(recipeOutput), recipeInputs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
common/com/pahimar/ee3/lib/Compare.java
Normal file
10
common/com/pahimar/ee3/lib/Compare.java
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package com.pahimar.ee3.lib;
|
||||||
|
|
||||||
|
public class Compare {
|
||||||
|
|
||||||
|
// Comparator stuff
|
||||||
|
public static final int LESSER_THAN = -1;
|
||||||
|
public static final int EQUALS = 0;
|
||||||
|
public static final int GREATER_THAN = 1;
|
||||||
|
|
||||||
|
}
|
|
@ -23,10 +23,4 @@ public class Reference {
|
||||||
public static final String SERVER_PROXY_CLASS = "com.pahimar.ee3.core.proxy.CommonProxy";
|
public static final String SERVER_PROXY_CLASS = "com.pahimar.ee3.core.proxy.CommonProxy";
|
||||||
public static final String CLIENT_PROXY_CLASS = "com.pahimar.ee3.core.proxy.ClientProxy";
|
public static final String CLIENT_PROXY_CLASS = "com.pahimar.ee3.core.proxy.ClientProxy";
|
||||||
public static final int VERSION_CHECK_ATTEMPTS = 3;
|
public static final int VERSION_CHECK_ATTEMPTS = 3;
|
||||||
|
|
||||||
// Comparator stuff
|
|
||||||
public static final int SMALLER_THAN = -1;
|
|
||||||
public static final int EQUAL_TO = 0;
|
|
||||||
public static final int LARGER_THAN = 1;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue