Thought I would have gotten more done at work today :)
This commit is contained in:
parent
f0b08b431f
commit
3be12ee169
8 changed files with 35 additions and 24 deletions
|
@ -226,4 +226,8 @@ public class AddonIndustrialCraft2
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
/***
|
||||
* TODO Investigate ways to scope out IC2 recipes and auto-add them
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -76,11 +76,12 @@ public class OreStack implements Comparable<OreStack>
|
|||
*
|
||||
* @return The OreStack that was encoded as json, or null if a valid OreStack could not be decoded from given String
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static OreStack createFromJson(String jsonOreStack)
|
||||
{
|
||||
try
|
||||
{
|
||||
return (OreStack) gsonSerializer.fromJson(jsonOreStack, OreStack.class);
|
||||
return gsonSerializer.fromJson(jsonOreStack, OreStack.class);
|
||||
}
|
||||
catch (JsonSyntaxException exception)
|
||||
{
|
||||
|
@ -99,6 +100,7 @@ public class OreStack implements Comparable<OreStack>
|
|||
*
|
||||
* @return Json serialized String of this OreStack
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public String toJson()
|
||||
{
|
||||
return gsonSerializer.toJson(this);
|
||||
|
|
|
@ -126,6 +126,6 @@ public class RecipeMapping implements JsonSerializer<RecipeMapping>, JsonDeseria
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format("Output: %s, Input: %s", outputWrappedStack, inputWrappedStacks);
|
||||
return String.format("RecipeMapping[Output: %s, Input: %s]", outputWrappedStack, inputWrappedStacks);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class StackValueMapping implements JsonSerializer<StackValueMapping>, Jso
|
|||
emcValue = new EmcValue().deserialize(jsonStackValueMapping.get("emcValue").getAsJsonObject(), type, context);
|
||||
}
|
||||
|
||||
if (wrappedStack instanceof WrappedStack && emcValue instanceof EmcValue)
|
||||
if (wrappedStack != null && emcValue != null)
|
||||
{
|
||||
return new StackValueMapping(wrappedStack, emcValue);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.pahimar.ee3.emc;
|
||||
|
||||
import com.google.gson.*;
|
||||
import com.pahimar.ee3.helper.LogHelper;
|
||||
import com.pahimar.ee3.lib.Compare;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
@ -17,7 +18,6 @@ import java.util.List;
|
|||
*/
|
||||
public class EmcValue implements Comparable<EmcValue>, JsonDeserializer<EmcValue>, JsonSerializer<EmcValue>
|
||||
{
|
||||
|
||||
// Gson serializer for serializing to/deserializing from json
|
||||
private static final Gson gsonSerializer = (new GsonBuilder()).registerTypeAdapter(EmcValue.class, new EmcValue()).create();
|
||||
|
||||
|
@ -25,44 +25,37 @@ public class EmcValue implements Comparable<EmcValue>, JsonDeserializer<EmcValue
|
|||
|
||||
public EmcValue()
|
||||
{
|
||||
|
||||
this(new float[EmcType.TYPES.length]);
|
||||
}
|
||||
|
||||
public EmcValue(int value)
|
||||
{
|
||||
|
||||
this((float) value);
|
||||
}
|
||||
|
||||
public EmcValue(float value)
|
||||
{
|
||||
|
||||
this(value, EmcType.DEFAULT);
|
||||
}
|
||||
|
||||
public EmcValue(float value, EmcComponent component)
|
||||
{
|
||||
|
||||
this(value, component.type);
|
||||
}
|
||||
|
||||
public EmcValue(int value, EmcType emcType)
|
||||
{
|
||||
|
||||
this((float) value, emcType);
|
||||
}
|
||||
|
||||
public EmcValue(float value, EmcType emcType)
|
||||
{
|
||||
|
||||
this.components = new float[EmcType.TYPES.length];
|
||||
this.components[emcType.ordinal()] = value;
|
||||
}
|
||||
|
||||
public EmcValue(float[] components)
|
||||
{
|
||||
|
||||
this.components = components;
|
||||
}
|
||||
|
||||
|
@ -193,7 +186,11 @@ public class EmcValue implements Comparable<EmcValue>, JsonDeserializer<EmcValue
|
|||
}
|
||||
catch (JsonSyntaxException exception)
|
||||
{
|
||||
// TODO Log something regarding the failed parse
|
||||
LogHelper.severe(exception.getMessage());
|
||||
}
|
||||
catch (JsonParseException exception)
|
||||
{
|
||||
LogHelper.severe(exception.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -206,13 +203,11 @@ public class EmcValue implements Comparable<EmcValue>, JsonDeserializer<EmcValue
|
|||
*/
|
||||
public String toJson()
|
||||
{
|
||||
|
||||
return gsonSerializer.toJson(this);
|
||||
}
|
||||
|
||||
private static List<EmcComponent> collateComponents(List<EmcComponent> uncollatedComponents)
|
||||
{
|
||||
|
||||
Integer[] componentCount = new Integer[EmcType.TYPES.length];
|
||||
|
||||
for (EmcComponent emcComponent : uncollatedComponents)
|
||||
|
@ -245,7 +240,6 @@ public class EmcValue implements Comparable<EmcValue>, JsonDeserializer<EmcValue
|
|||
|
||||
private static int compareComponents(float[] first, float[] second)
|
||||
{
|
||||
|
||||
if (first.length == EmcType.TYPES.length && second.length == EmcType.TYPES.length)
|
||||
{
|
||||
|
||||
|
@ -268,7 +262,6 @@ public class EmcValue implements Comparable<EmcValue>, JsonDeserializer<EmcValue
|
|||
@Override
|
||||
public JsonElement serialize(EmcValue emcValue, Type type, JsonSerializationContext context)
|
||||
{
|
||||
|
||||
JsonObject jsonEmcValue = new JsonObject();
|
||||
|
||||
for (EmcType emcType : EmcType.TYPES)
|
||||
|
|
|
@ -132,6 +132,11 @@ public class ItemAlchemicalDust extends ItemEE
|
|||
{
|
||||
List<ItemStack> alchemicalDustStacks = new ArrayList<ItemStack>();
|
||||
|
||||
for (int meta = 0; meta < ALCHEMICAL_DUST_NAMES.length; meta++)
|
||||
{
|
||||
alchemicalDustStacks.add(new ItemStack(ModItems.alchemicalDust, 1, meta));
|
||||
}
|
||||
|
||||
return alchemicalDustStacks;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@ import net.minecraft.item.ItemStack;
|
|||
public class ModItems
|
||||
{
|
||||
// Mod item instances
|
||||
public static Item miniumShard;
|
||||
public static Item inertStone;
|
||||
public static Item miniumStone;
|
||||
public static Item philStone;
|
||||
public static Item alchemicalDust;
|
||||
public static Item alchemicalBag;
|
||||
public static Item alchemicalChalk;
|
||||
public static ItemEE miniumShard;
|
||||
public static ItemEE inertStone;
|
||||
public static ItemEE miniumStone;
|
||||
public static ItemEE philStone;
|
||||
public static ItemEE alchemicalDust;
|
||||
public static ItemEE alchemicalBag;
|
||||
public static ItemEE alchemicalChalk;
|
||||
|
||||
public static void init()
|
||||
{
|
||||
|
|
|
@ -2,6 +2,9 @@ package com.pahimar.ee3.recipe;
|
|||
|
||||
import com.pahimar.ee3.emc.EmcRegistry;
|
||||
import com.pahimar.ee3.emc.EmcValue;
|
||||
import com.pahimar.ee3.helper.ItemHelper;
|
||||
import com.pahimar.ee3.helper.LogHelper;
|
||||
import com.pahimar.ee3.item.ModItems;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -24,7 +27,11 @@ public class CalcinationManager
|
|||
|
||||
if (emcValue != null)
|
||||
{
|
||||
// TODO The magic happens here
|
||||
// TODO Get EmcValue of itemStack, add it list of EmcValues of the different dusts, sort it, determine position, and determine result from that
|
||||
for (ItemStack alchemicalDustStack : ModItems.alchemicalDust.getSubTypes())
|
||||
{
|
||||
LogHelper.debug(ItemHelper.toString(alchemicalDustStack));
|
||||
}
|
||||
}
|
||||
|
||||
return calcinationResults;
|
||||
|
|
Loading…
Reference in a new issue