aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-10-17 01:39:50 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-10-17 01:39:50 +1000
commitd6bf108b40f0b281ff7c3c2bc91e43ed2b9883f7 (patch)
tree0f00f90ad75043f47aac4cf68431f038adc5071d /src/Java/gtPlusPlus/core
parentb1aa7032fe9e6bfedccf1bb08952c68100002489 (diff)
downloadGT5-Unofficial-d6bf108b40f0b281ff7c3c2bc91e43ed2b9883f7.tar.gz
GT5-Unofficial-d6bf108b40f0b281ff7c3c2bc91e43ed2b9883f7.tar.bz2
GT5-Unofficial-d6bf108b40f0b281ff7c3c2bc91e43ed2b9883f7.zip
+ Added Tesseract Generators and Terminals.
+ Added a handful of new, old textures from GT4. % Rewrote portions of the Blueprint item again, to try make it work better with NBT. + Added an Example NBT item for myself~ because I am a derp. + Added some custom textures for the Industrial Centrifuge. % Moved all the GT4 Tile Entities to their own loading class.
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_Workbench.java23
-rw-r--r--src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java4
-rw-r--r--src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java2
-rw-r--r--src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java108
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java225
-rw-r--r--src/Java/gtPlusPlus/core/lib/CORE.java5
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_General.java49
-rw-r--r--src/Java/gtPlusPlus/core/util/item/UtilsItems.java11
-rw-r--r--src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java11
10 files changed, 379 insertions, 63 deletions
diff --git a/src/Java/gtPlusPlus/core/container/Container_Workbench.java b/src/Java/gtPlusPlus/core/container/Container_Workbench.java
index 5ce6d0e1a2..b3b024f52c 100644
--- a/src/Java/gtPlusPlus/core/container/Container_Workbench.java
+++ b/src/Java/gtPlusPlus/core/container/Container_Workbench.java
@@ -188,8 +188,9 @@ public class Container_Workbench extends Container {
@Override
public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer){
+ if (!aPlayer.worldObj.isRemote){
if (aSlotIndex == 999 || aSlotIndex == -999){
- Utils.LOG_INFO("??? - "+aSlotIndex);
+ //Utils.LOG_INFO("??? - "+aSlotIndex);
}
if (aSlotIndex == slotOutput){
@@ -210,7 +211,7 @@ public class Container_Workbench extends Container {
Utils.LOG_INFO("Found a blueprint.");
ItemStack tempBlueprint = inventoryHolo.getStackInSlot(1);
ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem();
- if (inventoryHolo.getStackInSlot(0) != null){
+ if (inventoryHolo.getStackInSlot(0) != null && !tempItemBlueprint.hasBlueprint(tempBlueprint)){
Utils.LOG_INFO("Output slot was not empty.");
Utils.LOG_INFO("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one.");
tempItemBlueprint.setBlueprint(inventoryHolo.getStackInSlot(1), craftMatrix, inventoryHolo.getStackInSlot(0));
@@ -219,7 +220,12 @@ public class Container_Workbench extends Container {
Utils.LOG_INFO(UtilsItems.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint)));
}
else {
- Utils.LOG_INFO("Output slot was empty.");
+ if (tempItemBlueprint.hasBlueprint(tempBlueprint)){
+ Utils.LOG_INFO("Blueprint already holds a recipe.");
+ }
+ else {
+ Utils.LOG_INFO("Output slot was empty.");
+ }
}
}
else {
@@ -257,6 +263,7 @@ public class Container_Workbench extends Container {
Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the tool Grid");
}
}
+ }
//Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the Grid");
return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
}
@@ -267,7 +274,15 @@ public class Container_Workbench extends Container {
//craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj));
//Vanilla CraftingManager
- craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
+ Utils.LOG_INFO("checking crafting grid for a valid output.");
+ ItemStack temp = CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj);
+ if (temp != null){
+ Utils.LOG_INFO("Output found. "+temp.getDisplayName()+" x"+temp.stackSize);
+ inventoryHolo.setInventorySlotContents(slotOutput, temp);
+ }
+ else {
+ Utils.LOG_INFO("No Valid output found.");
+ }
}
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
index fd7fbf9645..e51dc157c6 100644
--- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
+++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java
@@ -42,7 +42,7 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSolarGenerators;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSteamCondenser;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSuperConductionPoint;
import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechTieredFluidTanks;
-import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechWorkbenches;
+import gtPlusPlus.xmod.gregtech.registration.gregtech.Gregtech4Content;
import java.util.LinkedList;
import java.util.Queue;
@@ -91,7 +91,7 @@ public class COMPAT_HANDLER {
GregtechDehydrator.run();
GregtechTieredFluidTanks.run();
GregtechIndustrialMultiTank.run();
- GregtechWorkbenches.run();
+ Gregtech4Content.run();
GregtechGeothermalThermalGenerator.run();
}
diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java
index affb56566d..275a67f571 100644
--- a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java
@@ -1,6 +1,7 @@
package gtPlusPlus.core.handler.Recipes;
import gtPlusPlus.core.handler.COMPAT_HANDLER;
+import gtPlusPlus.core.recipe.RECIPES_General;
import gtPlusPlus.core.recipe.RECIPES_MachineComponents;
import gtPlusPlus.core.recipe.RECIPES_Machines;
import gtPlusPlus.core.recipe.RECIPES_Shapeless;
@@ -23,6 +24,7 @@ public class RegistrationHandler {
RECIPES_Shapeless.RECIPES_LOAD();
RECIPES_MachineComponents.RECIPES_LOAD();
RECIPE_Batteries.RECIPES_LOAD();
+ RECIPES_General.RECIPES_LOAD();
//RECIPES_MTWRAPPER.run();
Utils.LOG_INFO("Loaded: "+recipesSuccess+" Failed: "+recipesFailed);
COMPAT_HANDLER.areInitItemsLoaded = true;
diff --git a/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java b/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java
index f3f4e40b66..90126b1e82 100644
--- a/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java
+++ b/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java
@@ -29,7 +29,7 @@ public interface IItemBlueprint {
* @param String Blueprint Name
* @return N/A
*/
- public void setBlueprintName(String name);
+ public void setBlueprintName(ItemStack stack, String name);
/**
* Does this itemstack hold a blueprint?
@@ -43,6 +43,6 @@ public interface IItemBlueprint {
* @param stack yourMetaItem
* @return the blueprints contents
*/
- public ItemStack[] getBlueprint(ItemStack stack);
+ public ItemStack[] getBlueprint(ItemStack stack);
}
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java
new file mode 100644
index 0000000000..86cd1c8046
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java
@@ -0,0 +1,108 @@
+package gtPlusPlus.core.item.base;
+
+import java.util.List;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.StatCollector;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+/*
+ *
+ *
+ Key Point: You can access the NBT compound data from the Item class (in those methods that pass an ItemStack), but the NBT compound can only be set on an ItemStack.
+
+ The steps to add NBT data to an ItemStack:
+ Create or otherwise get an ItemStack of the desired item
+ Create an NBTTagCompound and fill it with the appropriate data
+ Call ItemStack#setTagCompound() method to set it.
+
+ *
+ */
+
+public class BaseItemBrain extends Item{
+ // This is an array of all the types I am going to be adding.
+ String[] brainTypes = { "dead", "preserved", "fresh", "tasty" };
+
+ // This method allows us to have different language translation keys for
+ // each item we add.
+ @Override
+ public String getUnlocalizedName(ItemStack stack)
+ {
+ // This makes sure that the stack has a tag compound. This is how data
+ // is stored on items.
+ if (stack.hasTagCompound())
+ {
+ // This is the object holding all of the item data.
+ NBTTagCompound itemData = stack.getTagCompound();
+ // This checks to see if the item has data stored under the
+ // brainType key.
+ if (itemData.hasKey("brainType"))
+ {
+ // This retrieves data from the brainType key and uses it in
+ // the return value
+ return "item." + itemData.getString("brainType");
+ }
+ }
+ // This will be used if the item is obtained without nbt data on it.
+ return "item.nullBrain";
+ }
+
+
+ // This is a fun method which allows us to run some code when our item is
+ // shown in a creative tab. I am going to use it to add all the brain
+ // types.
+ @SuppressWarnings("unchecked")
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tab, List itemList)
+ {
+ // This creates a loop with a counter. It will go through once for
+ // every listing in brainTypes, and gives us a number associated
+ // with each listing.
+ for (int pos = 0; pos < brainTypes.length; pos++)
+ {
+ // This creates a new ItemStack instance. The item parameter
+ // supplied is this item.
+ ItemStack brainStack = new ItemStack(item);
+ // By default, a new ItemStack does not have any nbt compound data.
+ // We need to give it some.
+ brainStack.setTagCompound(new NBTTagCompound());
+ // Now we set the type of the item, brainType is the key, and
+ // brainTypes[pos] is grabbing a
+ // entry from the brainTypes array.
+ brainStack.getTagCompound().setString("brainType",
+ brainTypes[pos]);
+ // And this adds it to the itemList, which is a list of all items
+ // in the creative tab.
+ itemList.add(brainStack);
+ }
+ }
+
+ // This code will allow us to tell the items apart in game. You can change
+ @SuppressWarnings("unchecked")
+ // texture based on nbt data, but I won't be covering that.
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean isAdvanced){
+ if ( stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("brainType"))
+ {
+ // StatCollector is a class which allows us to handle string
+ // language translation. This requires that you fill out the
+ // translation in you language class.
+ tooltip.add(StatCollector.translateToLocal("tooltip.yourmod."
+ + stack.getTagCompound().getString("brainType") + ".desc"));
+ }
+ else // If the brain does not have valid tag data, a default message
+ {
+ tooltip.add(StatCollector.translateToLocal(
+ "tooltip.yourmod.nullbrain.desc"));
+ }
+ }
+}
+
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java
index a15616711d..b721672aa4 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java
@@ -4,6 +4,7 @@ import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.interfaces.IItemBlueprint;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.item.UtilsItems;
import gtPlusPlus.core.util.math.MathUtils;
import java.util.List;
@@ -21,49 +22,59 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class ItemBlueprint extends Item implements IItemBlueprint{
- protected String mName = "";
- protected boolean mHasBlueprint = false;
- private final int bpID;
-
- /**
- * The inventory of items the blueprint holds~
- */
- protected ItemStack[] blueprint = new ItemStack[9];
-
public ItemBlueprint(String unlocalizedName) {
this.setUnlocalizedName(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName);
this.setMaxStackSize(1);
this.setCreativeTab(AddToCreativeTab.tabMachines);
- this.bpID = MathUtils.randInt(0, 1000);
+ //this.bpID = MathUtils.randInt(0, 1000);
GameRegistry.registerItem(this, unlocalizedName);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- if (bpID >= 0){
- list.add(EnumChatFormatting.GRAY+"Technical Document No. "+bpID);
+ public void addInformation(ItemStack itemStack, EntityPlayer aPlayer, List list, boolean bool) {
+ //Create some NBT if it's not there, otherwise this does nothing.
+ if (!itemStack.hasTagCompound()){
+ createNBT(itemStack);
}
- if(mHasBlueprint){
- list.add(EnumChatFormatting.BLUE+"Currently holding a blueprint for "+mName);
+ //Set up some default variables.
+ int id = -1;
+ String name = "";
+ boolean blueprint = false;
+ //Get proper display vars from NBT if it's there
+ if (itemStack.hasTagCompound()){
+ //Utils.LOG_INFO("Found TagCompound");
+ id = (int) getNBT(itemStack, "mID");
+ name = (String) getNBT(itemStack, "mName");
+ blueprint = (boolean) getNBT(itemStack, "mBlueprint");
}
+ //Write to tooltip list for each viable setting.
+ if (itemStack.hasTagCompound()) {
+ if (id != -1){
+ list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id);
+ }
+ if(blueprint){
+ list.add(EnumChatFormatting.BLUE+"Currently holding a blueprint for "+name);
+ }
+ else {
+ list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything.");
+ }
+ }
else {
list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything.");
}
- super.addInformation(stack, aPlayer, list, bool);
+ super.addInformation(itemStack, aPlayer, list, bool);
}
-
+
@Override
public String getItemStackDisplayName(ItemStack p_77653_1_) {
- return "Blueprint";
+ return "Blueprint";
}
@Override
- public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
- itemStack.stackTagCompound = new NBTTagCompound();
- //this.inventory = null;
- //itemStack.stackTagCompound.set("pos_x", bed_X); TODO
+ public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
+ createNBT(itemStack);
}
@Override
@@ -74,38 +85,59 @@ public class ItemBlueprint extends Item implements IItemBlueprint{
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) {
//Let the player know what blueprint is held
- Utils.messagePlayer(par3Entity, "This is a placeholder.");
+ if (itemStack.hasTagCompound()) {
+ Utils.messagePlayer(par3Entity, "This Blueprint holds NBT data. "+"|"+getNBT(itemStack, "mID")+"|"+getNBT(itemStack, "mBlueprint")+"|"+getNBT(itemStack, "mName")+"|"+UtilsItems.getArrayStackNames(readItemsFromNBT(itemStack)));
+ }
+ else {
+ createNBT(itemStack);
+ Utils.messagePlayer(par3Entity, "This is a placeholder. "+getNBT(itemStack, "mID"));
+ }
+
+
return super.onItemRightClick(itemStack, world, par3Entity);
}
- public void readFromNBT(NBTTagCompound nbt){
- NBTTagList list = nbt.getTagList("Items", 10);
- blueprint = new ItemStack[INV_SIZE];
- for(int i = 0;i<list.tagCount();i++)
- {
- NBTTagCompound data = list.getCompoundTagAt(i);
- int slot = data.getInteger("Slot");
- if(slot >= 0 && slot < INV_SIZE)
+ public ItemStack[] readItemsFromNBT(ItemStack itemStack){
+ ItemStack[] blueprint = new ItemStack[9];
+ if (itemStack.hasTagCompound()){
+ NBTTagCompound nbt = itemStack.getTagCompound();
+ NBTTagList list = nbt.getTagList("Items", 10);
+ blueprint = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++)
{
- blueprint[slot] = ItemStack.loadItemStackFromNBT(data);
+ NBTTagCompound data = list.getCompoundTagAt(i);
+ int slot = data.getInteger("Slot");
+ if(slot >= 0 && slot < INV_SIZE)
+ {
+ blueprint[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
}
+ return blueprint;
}
+ return null;
}
- public void writeToNBT(NBTTagCompound nbt){
- NBTTagList list = new NBTTagList();
- for(int i = 0;i<INV_SIZE;i++)
- {
- ItemStack stack = blueprint[i];
- if(stack != null)
+ public ItemStack writeItemsToNBT(ItemStack itemStack, ItemStack[] craftingGrid){
+ ItemStack[] blueprint = craftingGrid;
+ if (itemStack.hasTagCompound()){
+ NBTTagCompound nbt = itemStack.getTagCompound();
+ NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++)
{
- NBTTagCompound data = new NBTTagCompound();
- stack.writeToNBT(data);
- data.setInteger("Slot", i);
- list.appendTag(data);
+ ItemStack stack = blueprint[i];
+ if(stack != null)
+ {
+ NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
}
+ nbt.setTag("Items", list);
+ itemStack.setTagCompound(nbt);
+ return itemStack;
}
- nbt.setTag("Items", list);
+ return null;
}
@Override
@@ -115,7 +147,15 @@ public class ItemBlueprint extends Item implements IItemBlueprint{
@Override
public boolean setBlueprint(ItemStack stack, IInventory craftingTable, ItemStack output) {
- if (!mHasBlueprint){
+ boolean hasBP = false;
+ ItemStack[] blueprint = new ItemStack[9];
+
+ if (stack.hasTagCompound()){
+ hasBP = (boolean) getNBT(stack, "mBlueprint");
+ blueprint = readItemsFromNBT(stack);
+ }
+
+ if (!hasBP){
try {
for (int o=0; o<craftingTable.getSizeInventory(); o++){
blueprint[o] = craftingTable.getStackInSlot(o);
@@ -123,9 +163,20 @@ public class ItemBlueprint extends Item implements IItemBlueprint{
blueprint[0].stackSize = 0;
}
}
+ writeItemsToNBT(stack, blueprint);
+ if (stack.hasTagCompound()){
+ if(stack.getTagCompound().getCompoundTag("Items") != null){
+ stack.stackTagCompound.setBoolean("mBlueprint", true);
+ }
+ else {
+ //Invalid BP saved?
+ }
+ hasBP = (boolean) getNBT(stack, "mBlueprint");
+ }
+
if (output != null){
- setBlueprintName(output.getDisplayName());
- return (mHasBlueprint = true);
+ setBlueprintName(stack, output.getDisplayName());
+ return (hasBP = true);
}
return false;
} catch (Throwable t){
@@ -136,17 +187,24 @@ public class ItemBlueprint extends Item implements IItemBlueprint{
}
@Override
- public void setBlueprintName(String name) {
- this.mName = name;
+ public void setBlueprintName(ItemStack stack, String name) {
+ stack.stackTagCompound.setString("mName", name);
}
@Override
public boolean hasBlueprint(ItemStack stack) {
- return mHasBlueprint;
+ if (stack.hasTagCompound()){
+ return (boolean) getNBT(stack, "mBlueprint");
+ }
+ return false;
}
@Override
public ItemStack[] getBlueprint(ItemStack stack) {
+ ItemStack[] blueprint = new ItemStack[9];
+ if (stack.hasTagCompound()){
+ blueprint = readItemsFromNBT(stack);
+ }
try {
ItemStack[] returnStack = new ItemStack[9];
for (int o=0; o<blueprint.length; o++){
@@ -161,4 +219,73 @@ public class ItemBlueprint extends Item implements IItemBlueprint{
}
}
+ public boolean createNBT(ItemStack itemStack){
+ if (itemStack.hasTagCompound()){
+ if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){
+ //No Blueprint and no name Set
+ Utils.LOG_INFO("No Blueprint and no name Set");
+ return false;
+ }
+ else if (itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){
+ //Has Blueprint but invalid name set
+ Utils.LOG_INFO("Has Blueprint but invalid name set");
+ //itemStack.stackTagCompound = null;
+ //createNBT(itemStack);
+ return false;
+ }
+ else if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && itemStack.stackTagCompound.getString("mName").equals("")){
+ //Has no Blueprint, but strangely has a name
+ Utils.LOG_INFO("Has no Blueprint, but strangely has a name");
+ //itemStack.stackTagCompound = null;
+ //createNBT(itemStack);
+ return false;
+ }
+ return false;
+ }
+ else if(!itemStack.hasTagCompound()){
+ int bpID = MathUtils.randInt(0, 1000);
+ boolean hasRecipe = false;
+ String recipeName = "";
+ Utils.LOG_INFO("Creating Blueprint, setting up it's NBT data. "+bpID);
+ itemStack.stackTagCompound = new NBTTagCompound();
+ itemStack.stackTagCompound.setInteger("mID", bpID);
+ itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe);
+ itemStack.stackTagCompound.setString("mName", recipeName);
+ return true;
+ }
+ else {
+ int bpID = MathUtils.randInt(0, 1000);
+ boolean hasRecipe = false;
+ String recipeName = "";
+ Utils.LOG_INFO("Creating a Blueprint, setting up it's NBT data. "+bpID);
+ itemStack.stackTagCompound = new NBTTagCompound();
+ itemStack.stackTagCompound.setInteger("mID", bpID);
+ itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe);
+ itemStack.stackTagCompound.setString("mName", recipeName);
+ return true;
+ }
+ }
+
+ public Object getNBT(ItemStack itemStack, String tagNBT){
+ if (!itemStack.hasTagCompound()){
+ return null;
+ }
+ Object o = null;
+ if (tagNBT.equals("mID")){
+ o = itemStack.stackTagCompound.getInteger(tagNBT);
+ }
+ else if (tagNBT.equals("mBlueprint")){
+ o = itemStack.stackTagCompound.getBoolean(tagNBT);
+ }
+ else if (tagNBT.equals("mName")){
+ o = itemStack.stackTagCompound.getString(tagNBT);
+ }
+ else if (tagNBT.equals("")){
+ //For More Tag Support
+ //o = itemStack.stackTagCompound.getInteger(tagNBT);
+ }
+ if (o != null)
+ return o;
+ return null; }
+
}
diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java
index 777bf16dc0..390071b539 100644
--- a/src/Java/gtPlusPlus/core/lib/CORE.java
+++ b/src/Java/gtPlusPlus/core/lib/CORE.java
@@ -6,7 +6,9 @@ import gtPlusPlus.core.util.networking.NetworkUtils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder;
import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
+import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator;
+import java.util.HashMap;
import java.util.Map;
import net.minecraft.util.EnumChatFormatting;
@@ -39,6 +41,9 @@ public class CORE {
* A List containing all the Materials, which are somehow in use by GT and therefor receive a specific Set of Items.
*/
public static final GT_Materials[] sMU_GeneratedMaterials = new GT_Materials[1000];
+
+ //Tesseract map
+ public static final Map<Integer, GT_MetaTileEntity_TesseractGenerator> sTesseractGenerators = new HashMap<Integer, GT_MetaTileEntity_TesseractGenerator>();
//GUIS
public enum GUI_ENUM
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java
new file mode 100644
index 0000000000..9a396334d4
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java
@@ -0,0 +1,49 @@
+package gtPlusPlus.core.recipe;
+
+import gregtech.api.enums.ItemList;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.util.item.UtilsItems;
+import gtPlusPlus.core.util.recipe.UtilsRecipe;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class RECIPES_General {
+
+ static ItemStack RECIPE_Paper = UtilsItems.getSimpleStack(Items.paper);
+ static ItemStack RECIPE_LapisDust = UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustLazurite", 2);
+ static ItemStack OUTPUT_Blueprint = UtilsItems.getSimpleStack(ModItems.itemBlueprintBase);
+ static ItemStack RECIPE_CraftingTable = UtilsItems.getSimpleStack(Item.getItemFromBlock(Blocks.crafting_table));
+ static ItemStack RECIPE_BronzePlate = UtilsItems.getItemStackOfAmountFromOreDictNoBroken("plateBronze", 1);
+ static ItemStack RECIPE_BasicCasingIC2;
+ static ItemStack OUTPUT_Workbench_Bronze = UtilsItems.getSimpleStack(Item.getItemFromBlock(ModBlocks.blockWorkbench));
+ static ItemStack NULL = null;
+
+ public static void RECIPES_LOAD(){
+
+ if (LoadedMods.Gregtech){
+ RECIPE_BasicCasingIC2 = ItemList.Casing_Gearbox_Bronze.get(1);
+ run();
+ }
+ }
+
+ private static void run(){
+
+
+ UtilsRecipe.recipeBuilder(
+ RECIPE_Paper, RECIPE_LapisDust, NULL,
+ RECIPE_Paper, RECIPE_LapisDust, NULL,
+ RECIPE_LapisDust, RECIPE_LapisDust, NULL,
+ OUTPUT_Blueprint);
+
+ UtilsRecipe.recipeBuilder(
+ RECIPE_BronzePlate, RECIPE_CraftingTable, RECIPE_BronzePlate,
+ RECIPE_BronzePlate, RECIPE_BasicCasingIC2, RECIPE_BronzePlate,
+ RECIPE_BronzePlate, RECIPE_BronzePlate, RECIPE_BronzePlate,
+ OUTPUT_Workbench_Bronze);
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java
index ec4e457489..64f06a078c 100644
--- a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java
+++ b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java
@@ -467,8 +467,15 @@ public class UtilsItems {
public static String getArrayStackNames(ItemStack[] aStack){
String itemNames = "Item Array: ";
for (ItemStack alph : aStack){
- String temp = itemNames;
- itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize;
+
+ if (alph != null){
+ String temp = itemNames;
+ itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize;
+ }
+ else {
+ String temp = itemNames;
+ itemNames = temp + ", " + "null" + " x" + "0";
+ }
}
return itemNames;
diff --git a/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java b/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java
index 997aaa95c9..727e40f570 100644
--- a/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java
+++ b/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java
@@ -101,7 +101,7 @@ public class UtilsRecipe {
try {
GameRegistry.addRecipe(new ShapedOreRecipe(resultItem.copy(), (Object[]) validSlots.toArray()));
- Utils.LOG_INFO("Success! Added a recipe for "+resultItem.toString());
+ Utils.LOG_INFO("Success! Added a recipe for "+resultItem.getDisplayName());
if (!COMPAT_HANDLER.areInitItemsLoaded){
RegistrationHandler.recipesSuccess++;
}
@@ -173,7 +173,7 @@ public class UtilsRecipe {
//GameRegistry.addRecipe(new ShapelessOreRecipe(Output, outputAmount), (Object[]) validSlots.toArray());
GameRegistry.addRecipe(new ShapelessOreRecipe(Output, (Object[]) validSlots.toArray()));
//GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2});
- Utils.LOG_INFO("Success! Added a recipe for "+Output.toString());
+ Utils.LOG_INFO("Success! Added a recipe for "+Output.getDisplayName());
RegistrationHandler.recipesSuccess++;
}
catch(RuntimeException k){
@@ -333,7 +333,7 @@ public class UtilsRecipe {
return;
}
- GT_ModHandler.addCraftingRecipe(OutputItem,
+ if (GT_ModHandler.addCraftingRecipe(OutputItem,
GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE |
GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED,
new Object[]{"ABC", "DEF", "GHI",
@@ -345,7 +345,10 @@ public class UtilsRecipe {
'F', InputItem6,
'G', InputItem7,
'H', InputItem8,
- 'I', InputItem9});
+ 'I', InputItem9})){
+ Utils.LOG_INFO("Success! Added a recipe for "+OutputItem.getDisplayName());
+ RegistrationHandler.recipesSuccess++;
+ }
}
public static void addShapelessGregtechRecipe(ItemStack OutputItem, Object... inputItems){