Moving some things around, and may have fixed the Gson issue with MCPC+
This commit is contained in:
parent
458ec07c21
commit
e0a2395c72
13 changed files with 91 additions and 44 deletions
|
@ -106,7 +106,6 @@ public class RecipeMapping implements JsonSerializer<RecipeMapping>, JsonDeseria
|
||||||
@Override
|
@Override
|
||||||
public JsonElement serialize(RecipeMapping recipeMapping, Type type, JsonSerializationContext context)
|
public JsonElement serialize(RecipeMapping recipeMapping, Type type, JsonSerializationContext context)
|
||||||
{
|
{
|
||||||
|
|
||||||
JsonObject jsonRecipeMapping = new JsonObject();
|
JsonObject jsonRecipeMapping = new JsonObject();
|
||||||
|
|
||||||
Gson gsonWrappedStack = (new GsonBuilder()).registerTypeAdapter(WrappedStack.class, new WrappedStack()).create();
|
Gson gsonWrappedStack = (new GsonBuilder()).registerTypeAdapter(WrappedStack.class, new WrappedStack()).create();
|
||||||
|
|
|
@ -16,10 +16,8 @@ import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class WrappedStack
|
public class WrappedStack implements Comparable<WrappedStack>, JsonDeserializer<WrappedStack>, JsonSerializer<WrappedStack>
|
||||||
implements Comparable<WrappedStack>, JsonDeserializer<WrappedStack>
|
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final Gson gsonSerializer = (new GsonBuilder()).registerTypeAdapter(WrappedStack.class, new WrappedStack()).create();
|
private static final Gson gsonSerializer = (new GsonBuilder()).registerTypeAdapter(WrappedStack.class, new WrappedStack()).create();
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
@ -245,7 +243,7 @@ public class WrappedStack
|
||||||
|
|
||||||
if (wrappedStack != null && wrappedStack.getWrappedStack() != null)
|
if (wrappedStack != null && wrappedStack.getWrappedStack() != null)
|
||||||
{
|
{
|
||||||
className = wrappedStack.getWrappedStack().getClass().getSimpleName();
|
className = wrappedStack.wrappedStack.getClass().getSimpleName();
|
||||||
this.stackSize = stackSize;
|
this.stackSize = stackSize;
|
||||||
this.wrappedStack = wrappedStack.wrappedStack;
|
this.wrappedStack = wrappedStack.wrappedStack;
|
||||||
}
|
}
|
||||||
|
@ -300,6 +298,7 @@ public class WrappedStack
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public String toJson()
|
public String toJson()
|
||||||
{
|
{
|
||||||
return gsonSerializer.toJson(this);
|
return gsonSerializer.toJson(this);
|
||||||
|
@ -445,6 +444,27 @@ public class WrappedStack
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonElement serialize(WrappedStack wrappedStack, Type type, JsonSerializationContext context)
|
||||||
|
{
|
||||||
|
JsonObject jsonWrappedStack = new JsonObject();
|
||||||
|
|
||||||
|
Gson gsonWrappedStack = new Gson();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
return jsonWrappedStack;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,8 +4,8 @@ import com.google.common.collect.ImmutableSortedMap;
|
||||||
import com.pahimar.ee3.api.OreStack;
|
import com.pahimar.ee3.api.OreStack;
|
||||||
import com.pahimar.ee3.api.WrappedStack;
|
import com.pahimar.ee3.api.WrappedStack;
|
||||||
import com.pahimar.ee3.helper.EmcHelper;
|
import com.pahimar.ee3.helper.EmcHelper;
|
||||||
import com.pahimar.ee3.item.crafting.RecipeRegistry;
|
|
||||||
import com.pahimar.ee3.lib.Compare;
|
import com.pahimar.ee3.lib.Compare;
|
||||||
|
import com.pahimar.ee3.recipe.RecipeRegistry;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,16 @@
|
||||||
package com.pahimar.ee3.handler;
|
package com.pahimar.ee3.handler;
|
||||||
|
|
||||||
import com.pahimar.ee3.block.ModBlocks;
|
|
||||||
import com.pahimar.ee3.configuration.ConfigurationSettings;
|
import com.pahimar.ee3.configuration.ConfigurationSettings;
|
||||||
import com.pahimar.ee3.helper.ItemStackNBTHelper;
|
import com.pahimar.ee3.helper.ItemStackNBTHelper;
|
||||||
import com.pahimar.ee3.item.ModItems;
|
|
||||||
import com.pahimar.ee3.item.crafting.RecipesAlchemicalBagDyes;
|
import com.pahimar.ee3.item.crafting.RecipesAlchemicalBagDyes;
|
||||||
|
import com.pahimar.ee3.item.crafting.RecipesEquivalentExchange;
|
||||||
import com.pahimar.ee3.lib.Strings;
|
import com.pahimar.ee3.lib.Strings;
|
||||||
import cpw.mods.fml.common.ICraftingHandler;
|
import cpw.mods.fml.common.ICraftingHandler;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalent-Exchange-3
|
* Equivalent-Exchange-3
|
||||||
|
@ -34,8 +30,7 @@ public class CraftingHandler implements ICraftingHandler
|
||||||
CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes());
|
CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes());
|
||||||
|
|
||||||
// Register our recipes
|
// Register our recipes
|
||||||
initBlockRecipes();
|
RecipesEquivalentExchange.init();
|
||||||
initItemRecipes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,28 +93,4 @@ public class CraftingHandler implements ICraftingHandler
|
||||||
openStone.damageItem(ConfigurationSettings.TRANSMUTE_COST_ITEM, player);
|
openStone.damageItem(ConfigurationSettings.TRANSMUTE_COST_ITEM, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initBlockRecipes()
|
|
||||||
{
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuel, 1, 0), new Object[]{"iii", "iii", "iii", 'i', new ItemStack(ModItems.alchemicalFuel, 1, 0)});
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuel, 1, 1), new Object[]{"iii", "iii", "iii", 'i', new ItemStack(ModItems.alchemicalFuel, 1, 1)});
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuel, 1, 2), new Object[]{"iii", "iii", "iii", 'i', new ItemStack(ModItems.alchemicalFuel, 1, 2)});
|
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.chalk), new Object[]{"bcb", "cbc", "bcb", 'b', new ItemStack(Item.dyePowder.itemID, 1, 15), 'c', new ItemStack(Item.clay)});
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.chalk), new Object[]{"cc", "cc", 'c', new ItemStack(ModItems.chalk)});
|
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.glassBell), new Object[]{"iii", "i i", "i i", 'i', Block.glass});
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.aludelBase), new Object[]{"iii", "sis", "iii", 'i', Item.ingotIron, 's', Block.stone});
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void initItemRecipes()
|
|
||||||
{
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 0), new ItemStack(ModBlocks.alchemicalFuel, 1, 0));
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 1), new ItemStack(ModBlocks.alchemicalFuel, 1, 1));
|
|
||||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 2), new ItemStack(ModBlocks.alchemicalFuel, 1, 2));
|
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModItems.inertStone), new Object[]{"sis", "igi", "sis", 's', Block.stone, 'i', Item.ingotIron, 'g', Item.ingotGold});
|
|
||||||
GameRegistry.addRecipe(new ItemStack(ModItems.miniumStone), new Object[]{"sss", "sis", "sss", 's', ModItems.miniumShard, 'i', ModItems.inertStone});
|
|
||||||
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ModItems.diviningRod), new Object[]{" s ", " s ", "s s", 's', Item.stick}));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import com.pahimar.ee3.api.OreStack;
|
||||||
import com.pahimar.ee3.api.WrappedStack;
|
import com.pahimar.ee3.api.WrappedStack;
|
||||||
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.item.crafting.RecipeRegistry;
|
import com.pahimar.ee3.recipe.RecipeRegistry;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
|
@ -9,8 +9,8 @@ import com.pahimar.ee3.api.WrappedStack;
|
||||||
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.crafting.RecipesIMC;
|
|
||||||
import com.pahimar.ee3.lib.Reference;
|
import com.pahimar.ee3.lib.Reference;
|
||||||
|
import com.pahimar.ee3.recipe.RecipesIMC;
|
||||||
import cpw.mods.fml.common.IScheduledTickHandler;
|
import cpw.mods.fml.common.IScheduledTickHandler;
|
||||||
import cpw.mods.fml.common.ITickHandler;
|
import cpw.mods.fml.common.ITickHandler;
|
||||||
import cpw.mods.fml.common.TickType;
|
import cpw.mods.fml.common.TickType;
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.pahimar.ee3.item.crafting;
|
||||||
|
|
||||||
|
import com.pahimar.ee3.block.ModBlocks;
|
||||||
|
import com.pahimar.ee3.item.ModItems;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
|
|
||||||
|
public class RecipesEquivalentExchange
|
||||||
|
{
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
initBlockRecipes();
|
||||||
|
initItemRecipes();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void initBlockRecipes()
|
||||||
|
{
|
||||||
|
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuel, 1, 0), new Object[]{"iii", "iii", "iii", 'i', new ItemStack(ModItems.alchemicalFuel, 1, 0)});
|
||||||
|
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuel, 1, 1), new Object[]{"iii", "iii", "iii", 'i', new ItemStack(ModItems.alchemicalFuel, 1, 1)});
|
||||||
|
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalFuel, 1, 2), new Object[]{"iii", "iii", "iii", 'i', new ItemStack(ModItems.alchemicalFuel, 1, 2)});
|
||||||
|
|
||||||
|
GameRegistry.addRecipe(new ItemStack(ModBlocks.chalk), new Object[]{"bcb", "cbc", "bcb", 'b', new ItemStack(Item.dyePowder.itemID, 1, 15), 'c', new ItemStack(Item.clay)});
|
||||||
|
GameRegistry.addRecipe(new ItemStack(ModBlocks.chalk), new Object[]{"cc", "cc", 'c', new ItemStack(ModItems.chalk)});
|
||||||
|
|
||||||
|
GameRegistry.addRecipe(new ItemStack(ModBlocks.glassBell), new Object[]{"iii", "i i", "i i", 'i', Block.glass});
|
||||||
|
GameRegistry.addRecipe(new ItemStack(ModBlocks.aludelBase), new Object[]{"iii", "sis", "iii", 'i', Item.ingotIron, 's', Block.stone});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void initItemRecipes()
|
||||||
|
{
|
||||||
|
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 0), new ItemStack(ModBlocks.alchemicalFuel, 1, 0));
|
||||||
|
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 1), new ItemStack(ModBlocks.alchemicalFuel, 1, 1));
|
||||||
|
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 2), new ItemStack(ModBlocks.alchemicalFuel, 1, 2));
|
||||||
|
|
||||||
|
GameRegistry.addRecipe(new ItemStack(ModItems.inertStone), new Object[]{"sis", "igi", "sis", 's', Block.stone, 'i', Item.ingotIron, 'g', Item.ingotGold});
|
||||||
|
GameRegistry.addRecipe(new ItemStack(ModItems.miniumStone), new Object[]{"sss", "sis", "sss", 's', ModItems.miniumShard, 'i', ModItems.inertStone});
|
||||||
|
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(new ItemStack(ModItems.diviningRod), new Object[]{" s ", " s ", "s s", 's', Item.stick}));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.pahimar.ee3.item.crafting;
|
||||||
|
|
||||||
|
public class RecipesTransmutationStones
|
||||||
|
{
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerTransmutationRecipes()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.pahimar.ee3.item.crafting;
|
package com.pahimar.ee3.recipe;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.pahimar.ee3.item.crafting;
|
package com.pahimar.ee3.recipe;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.pahimar.ee3.item.crafting;
|
package com.pahimar.ee3.recipe;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.pahimar.ee3.item.crafting;
|
package com.pahimar.ee3.recipe;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
|
@ -1,4 +1,4 @@
|
||||||
package com.pahimar.ee3.item.crafting;
|
package com.pahimar.ee3.recipe;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
Loading…
Reference in a new issue