Another attempt at fixing the MCPC+ and EE3 gson bug

This commit is contained in:
pahimar 2013-12-31 01:37:42 -05:00
parent e0a2395c72
commit 31cb980a52
2 changed files with 3 additions and 22 deletions

View file

@ -108,7 +108,7 @@ public class RecipeMapping implements JsonSerializer<RecipeMapping>, JsonDeseria
{
JsonObject jsonRecipeMapping = new JsonObject();
Gson gsonWrappedStack = (new GsonBuilder()).registerTypeAdapter(WrappedStack.class, new WrappedStack()).create();
Gson gsonWrappedStack = new Gson();
JsonArray jsonArray = new JsonArray();
for (WrappedStack inputStack : recipeMapping.inputWrappedStacks)

View file

@ -453,14 +453,7 @@ public class WrappedStack implements Comparable<WrappedStack>, JsonDeserializer<
jsonWrappedStack.addProperty("className", wrappedStack.className);
jsonWrappedStack.addProperty("stackSize", wrappedStack.stackSize);
if (gsonWrappedStack != null)
{
jsonWrappedStack.add("wrappedStack", gsonWrappedStack.toJsonTree(wrappedStack.wrappedStack));
}
else
{
jsonWrappedStack.add("wrappedStack", JsonNull.INSTANCE);
}
jsonWrappedStack.add("wrappedStack", gsonWrappedStack.toJsonTree(wrappedStack.wrappedStack));
return jsonWrappedStack;
}
@ -493,19 +486,7 @@ public class WrappedStack implements Comparable<WrappedStack>, JsonDeserializer<
{
if (className != null)
{
if (className.equalsIgnoreCase(Item.class.getSimpleName()))
{
stackObject = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), Item.class);
}
else if (className.equalsIgnoreCase(Block.class.getSimpleName()))
{
stackObject = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), Block.class);
}
else if (className.equalsIgnoreCase(Fluid.class.getSimpleName()))
{
stackObject = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), Fluid.class);
}
else if (className.equalsIgnoreCase(ItemStack.class.getSimpleName()))
if (className.equalsIgnoreCase(ItemStack.class.getSimpleName()))
{
ItemStack itemStack = gsonSerializer.fromJson(jsonWrappedStack.get("wrappedStack"), ItemStack.class);