aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r--src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java67
-rw-r--r--src/Java/gtPlusPlus/core/config/ConfigHandler.java1
-rw-r--r--src/Java/gtPlusPlus/core/container/box/LunchBoxContainer.java13
-rw-r--r--src/Java/gtPlusPlus/core/container/box/MagicBagContainer.java13
-rw-r--r--src/Java/gtPlusPlus/core/container/box/ToolBoxContainer.java15
-rw-r--r--src/Java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java116
-rw-r--r--src/Java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java11
-rw-r--r--src/Java/gtPlusPlus/core/gui/item/box/MagicBagGui.java11
-rw-r--r--src/Java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java11
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java40
-rw-r--r--src/Java/gtPlusPlus/core/inventories/box/LunchBoxInventory.java15
-rw-r--r--src/Java/gtPlusPlus/core/inventories/box/MagicBagInventory.java15
-rw-r--r--src/Java/gtPlusPlus/core/inventories/box/ToolBoxInventory.java16
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java37
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java1
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java31
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java52
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java2
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java15
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java11
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java59
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java328
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java243
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java11
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java13
-rw-r--r--src/Java/gtPlusPlus/core/lib/CORE.java1
-rw-r--r--src/Java/gtPlusPlus/core/material/ELEMENT.java2
-rw-r--r--src/Java/gtPlusPlus/core/material/Material.java52
-rw-r--r--src/Java/gtPlusPlus/core/material/MaterialGenerator.java13
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java54
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_General.java130
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java4
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotLunchBox.java30
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotMagicToolBag.java29
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotToolBox.java113
-rw-r--r--src/Java/gtPlusPlus/core/util/Utils.java42
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/FoodUtils.java60
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java648
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java31
39 files changed, 1968 insertions, 388 deletions
diff --git a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
index b089688193..8310fa3c23 100644
--- a/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
+++ b/src/Java/gtPlusPlus/core/block/base/BlockBaseModular.java
@@ -1,14 +1,19 @@
package gtPlusPlus.core.block.base;
+import java.util.HashMap;
+import java.util.Map;
+
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
+import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.TextureSet;
import gregtech.api.util.GT_OreDictUnificator;
-
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.item.base.itemblock.ItemBlockGtBlock;
import gtPlusPlus.core.item.base.itemblock.ItemBlockGtFrameBox;
import gtPlusPlus.core.lib.CORE;
@@ -34,6 +39,7 @@ public class BlockBaseModular extends BasicBlock {
this(material.getUnlocalizedName(), material.getLocalizedName(), net.minecraft.block.material.Material.iron,
blockType, colour, Math.min(Math.max(material.vTier, 1), 6));
blockMaterial = material;
+ registerComponent();
}
protected BlockBaseModular(final String unlocalizedName, final String blockMaterial,
@@ -47,8 +53,8 @@ public class BlockBaseModular extends BasicBlock {
this.thisBlockMaterial = blockMaterial;
this.thisBlockType = blockType.name().toUpperCase();
this.setBlockName(this.GetProperName());
-
- if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())) {
+ int fx = getBlockTypeMeta();
+ if (fx == 0) {
GameRegistry.registerBlock(this, ItemBlockGtBlock.class,
Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
GT_OreDictUnificator.registerOre(
@@ -56,7 +62,7 @@ public class BlockBaseModular extends BasicBlock {
.replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""),
ItemUtils.getSimpleStack(this));
}
- else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())) {
+ else if (fx == 1) {
GameRegistry.registerBlock(this, ItemBlockGtBlock.class,
Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
GT_OreDictUnificator.registerOre(
@@ -64,7 +70,7 @@ public class BlockBaseModular extends BasicBlock {
.replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""),
ItemUtils.getSimpleStack(this));
}
- else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())) {
+ else if (fx == 2) {
GameRegistry.registerBlock(this, ItemBlockGtBlock.class,
Utils.sanitizeString(blockType.getTexture() + unlocalizedName));
GT_OreDictUnificator.registerOre(
@@ -72,7 +78,47 @@ public class BlockBaseModular extends BasicBlock {
.replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""),
ItemUtils.getSimpleStack(this));
}
-
+ }
+
+ public boolean registerComponent() {
+ Logger.MATERIALS("Attempting to register "+this.getUnlocalizedName()+".");
+ if (this.blockMaterial == null) {
+ Logger.MATERIALS("Tried to register "+this.getUnlocalizedName()+" but the material was null.");
+ return false;
+ }
+ String aName = blockMaterial.getUnlocalizedName();
+ //Register Component
+ Map<String, ItemStack> aMap = Material.mComponentMap.get(aName);
+ if (aMap == null) {
+ aMap = new HashMap<String, ItemStack>();
+ }
+ int fx = getBlockTypeMeta();
+ String aKey = (fx == 0 ? OrePrefixes.block.name() : ( fx == 1 ? OrePrefixes.frameGt.name() : OrePrefixes.ore.name()));
+ ItemStack x = aMap.get(aKey);
+ if (x == null) {
+ aMap.put(aKey, ItemUtils.getSimpleStack(this));
+ Logger.MATERIALS("Registering a material component. Item: ["+aName+"] Map: ["+aKey+"]");
+ Material.mComponentMap.put(aName, aMap);
+ return true;
+ }
+ else {
+ //Bad
+ Logger.MATERIALS("Tried to double register a material component.");
+ return false;
+ }
+ }
+
+ public int getBlockTypeMeta() {
+ if (this.thisBlockType.equals(BlockTypes.STANDARD.name().toUpperCase())) {
+ return 0;
+ }
+ else if (this.thisBlockType.equals(BlockTypes.FRAME.name().toUpperCase())) {
+ return 1;
+ }
+ else if (this.thisBlockType.equals(BlockTypes.ORE.name().toUpperCase())) {
+ return 2;
+ }
+ return 0;
}
/**
@@ -153,4 +199,13 @@ public class BlockBaseModular extends BasicBlock {
return this.blockColour;
}
+ @Override
+ public int getBlockColor() {
+ if (this.blockColour == 0) {
+ return MathUtils.generateSingularRandomHexValue();
+ }
+
+ return this.blockColour;
+ }
+
}
diff --git a/src/Java/gtPlusPlus/core/config/ConfigHandler.java b/src/Java/gtPlusPlus/core/config/ConfigHandler.java
index 4c992ed8f4..d5a43ab883 100644
--- a/src/Java/gtPlusPlus/core/config/ConfigHandler.java
+++ b/src/Java/gtPlusPlus/core/config/ConfigHandler.java
@@ -66,6 +66,7 @@ public class ConfigHandler {
"Adds GT6 recipes for Sulfuric Acid. Should remove all pre-existing recipes.");
enableAnimatedTurbines = config.getBoolean("enableAnimatedTurbines", "gregtech", true,
"Gives GT Gas/Steam turbines animated textures while running.");
+ turbineCutoffBase = config.getInt("turbineCutoffBase", "gregtech", 75000, 0, Integer.MAX_VALUE, "Rotors below this durability will be removed, prevents NEI clutter. Minimum Durability is N * x, where N is the new value set and x is the turbine size, where 1 is Tiny and 4 is Huge. Set to 0 to disable.");
// Pipes & Cables
enableCustom_Pipes = config.getBoolean("enableCustom_Pipes", "gregtech", true,
diff --git a/src/Java/gtPlusPlus/core/container/box/LunchBoxContainer.java b/src/Java/gtPlusPlus/core/container/box/LunchBoxContainer.java
new file mode 100644
index 0000000000..8e56c661f2
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/container/box/LunchBoxContainer.java
@@ -0,0 +1,13 @@
+package gtPlusPlus.core.container.box;
+
+import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
+import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory;
+import gtPlusPlus.core.slots.SlotLunchBox;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class LunchBoxContainer extends ContainerBoxBase {
+ public LunchBoxContainer(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, CustomBoxInventory CustomBoxInventory) {
+ super(par1Player, inventoryPlayer, CustomBoxInventory, SlotLunchBox.class, gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS);
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/container/box/MagicBagContainer.java b/src/Java/gtPlusPlus/core/container/box/MagicBagContainer.java
new file mode 100644
index 0000000000..7820d56814
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/container/box/MagicBagContainer.java
@@ -0,0 +1,13 @@
+package gtPlusPlus.core.container.box;
+
+import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
+import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory;
+import gtPlusPlus.core.slots.SlotMagicToolBag;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class MagicBagContainer extends ContainerBoxBase {
+ public MagicBagContainer(EntityPlayer par1Player, InventoryPlayer inventoryPlayer, CustomBoxInventory CustomBoxInventory) {
+ super(par1Player, inventoryPlayer, CustomBoxInventory, SlotMagicToolBag.class, gtPlusPlus.core.item.tool.misc.box.MagicToolBag.SLOTS);
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/container/box/ToolBoxContainer.java b/src/Java/gtPlusPlus/core/container/box/ToolBoxContainer.java
new file mode 100644
index 0000000000..49719aa9ba
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/container/box/ToolBoxContainer.java
@@ -0,0 +1,15 @@
+package gtPlusPlus.core.container.box;
+
+import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
+import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory;
+import gtPlusPlus.core.item.tool.misc.box.UniversalToolBox;
+import gtPlusPlus.core.slots.SlotToolBox;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class ToolBoxContainer extends ContainerBoxBase {
+ public ToolBoxContainer(EntityPlayer par1Player, InventoryPlayer inventoryPlayer,
+ CustomBoxInventory CustomBoxInventory) {
+ super(par1Player, inventoryPlayer, CustomBoxInventory, SlotToolBox.class, UniversalToolBox.SLOTS);
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java b/src/Java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java
new file mode 100644
index 0000000000..97ec58bfa4
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/item/box/GuiBaseBox.java
@@ -0,0 +1,116 @@
+package gtPlusPlus.core.gui.item.box;
+
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL12;
+
+import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
+import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.client.renderer.OpenGlHelper;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.resources.I18n;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.util.ResourceLocation;
+
+public class GuiBaseBox extends GuiContainer {
+ /**
+ * x and y size of the inventory window in pixels. Defined as float, passed as
+ * int These are used for drawing the player model.
+ */
+ private float xSize_lo;
+ private float ySize_lo;
+
+ /**
+ * ResourceLocation takes 2 parameters: ModId, path to texture at the location:
+ * "src/minecraft/assets/modid/"
+ *
+ * I have provided a sample texture file that works with this tutorial. Download
+ * it from Forge_Tutorials/textures/gui/
+ */
+ private final ResourceLocation iconLocation;
+
+ /** The inventory to render on screen */
+ private final CustomBoxInventory inventory;
+
+ public GuiBaseBox(ContainerBoxBase containerItem, ResourceLocation aGuiTexture) {
+ super(containerItem);
+ this.inventory = containerItem.getInventoryObject();
+ this.iconLocation = aGuiTexture;
+ }
+
+ /**
+ * Draws the screen and all the components in it.
+ */
+ public void drawScreen(int par1, int par2, float par3) {
+ super.drawScreen(par1, par2, par3);
+ this.xSize_lo = (float) par1;
+ this.ySize_lo = (float) par2;
+ }
+
+ /**
+ * Draw the foreground layer for the GuiContainer (everything in front of the
+ * items)
+ */
+ protected void drawGuiContainerForegroundLayer(int par1, int par2) {
+ String s = this.inventory.hasCustomInventoryName() ? this.inventory.getInventoryName()
+ : I18n.format(this.inventory.getInventoryName());
+ this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 0, 4210752);
+ this.fontRendererObj.drawString(I18n.format("container.inventory"), 26, this.ySize - 96 + 4, 4210752);
+ }
+
+ /**
+ * Draw the background layer for the GuiContainer (everything behind the items)
+ */
+ protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ this.mc.getTextureManager().bindTexture(iconLocation);
+ int k = (this.width - this.xSize) / 2;
+ int l = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
+ int i1;
+ drawPlayerModel(k + 51, l + 75, 30, (float) (k + 51) - this.xSize_lo, (float) (l + 75 - 50) - this.ySize_lo,
+ this.mc.thePlayer);
+ }
+
+ /**
+ * This renders the player model in standard inventory position (in later
+ * versions of Minecraft / Forge, you can simply call
+ * GuiInventory.drawEntityOnScreen directly instead of copying this code)
+ */
+ public static void drawPlayerModel(int x, int y, int scale, float yaw, float pitch, EntityLivingBase entity) {
+ GL11.glEnable(GL11.GL_COLOR_MATERIAL);
+ GL11.glPushMatrix();
+ GL11.glTranslatef(x, y, 50.0F);
+ GL11.glScalef(-scale, scale, scale);
+ GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
+ float f2 = entity.renderYawOffset;
+ float f3 = entity.rotationYaw;
+ float f4 = entity.rotationPitch;
+ float f5 = entity.prevRotationYawHead;
+ float f6 = entity.rotationYawHead;
+ GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
+ RenderHelper.enableStandardItemLighting();
+ GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(-((float) Math.atan(pitch / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F);
+ entity.renderYawOffset = (float) Math.atan(yaw / 40.0F) * 20.0F;
+ entity.rotationYaw = (float) Math.atan(yaw / 40.0F) * 40.0F;
+ entity.rotationPitch = -((float) Math.atan(pitch / 40.0F)) * 20.0F;
+ entity.rotationYawHead = entity.rotationYaw;
+ entity.prevRotationYawHead = entity.rotationYaw;
+ GL11.glTranslatef(0.0F, entity.yOffset, 0.0F);
+ RenderManager.instance.playerViewY = 180.0F;
+ RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
+ entity.renderYawOffset = f2;
+ entity.rotationYaw = f3;
+ entity.rotationPitch = f4;
+ entity.prevRotationYawHead = f5;
+ entity.rotationYawHead = f6;
+ GL11.glPopMatrix();
+ RenderHelper.disableStandardItemLighting();
+ GL11.glDisable(GL12.GL_RESCALE_NORMAL);
+ OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java b/src/Java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java
new file mode 100644
index 0000000000..28e3913ac8
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/item/box/LunchBoxGui.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.gui.item.box;
+
+import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.util.ResourceLocation;
+
+public class LunchBoxGui extends GuiBaseBox {
+ public LunchBoxGui(ContainerBoxBase containerItem) {
+ super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png"));
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/gui/item/box/MagicBagGui.java b/src/Java/gtPlusPlus/core/gui/item/box/MagicBagGui.java
new file mode 100644
index 0000000000..958cdd3c70
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/item/box/MagicBagGui.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.gui.item.box;
+
+import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.util.ResourceLocation;
+
+public class MagicBagGui extends GuiBaseBox {
+ public MagicBagGui(ContainerBoxBase containerItem) {
+ super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png"));
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java b/src/Java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java
new file mode 100644
index 0000000000..c440c017e9
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/item/box/ToolBoxGui.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.gui.item.box;
+
+import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.util.ResourceLocation;
+
+public class ToolBoxGui extends GuiBaseBox {
+ public ToolBoxGui(ContainerBoxBase containerItem) {
+ super(containerItem, new ResourceLocation(CORE.MODID, "textures/gui/schematic_rocket_GS1.png"));
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
index 816b35ea4b..c02425afbf 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -11,14 +11,25 @@ import net.minecraft.world.World;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.container.*;
+import gtPlusPlus.core.container.box.LunchBoxContainer;
+import gtPlusPlus.core.container.box.MagicBagContainer;
+import gtPlusPlus.core.container.box.ToolBoxContainer;
import gtPlusPlus.core.gui.beta.Gui_ID_Registry;
import gtPlusPlus.core.gui.beta.MU_GuiId;
import gtPlusPlus.core.gui.item.GuiBaseBackpack;
import gtPlusPlus.core.gui.item.GuiBaseGrindle;
+import gtPlusPlus.core.gui.item.box.LunchBoxGui;
+import gtPlusPlus.core.gui.item.box.MagicBagGui;
+import gtPlusPlus.core.gui.item.box.ToolBoxGui;
import gtPlusPlus.core.gui.machine.*;
import gtPlusPlus.core.interfaces.IGuiManager;
import gtPlusPlus.core.inventories.BaseInventoryBackpack;
import gtPlusPlus.core.inventories.BaseInventoryGrindle;
+import gtPlusPlus.core.inventories.box.LunchBoxInventory;
+import gtPlusPlus.core.inventories.box.MagicBagInventory;
+import gtPlusPlus.core.inventories.box.ToolBoxInventory;
+import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
+import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory;
import gtPlusPlus.core.tileentities.base.TileEntityBase;
import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer;
import gtPlusPlus.core.tileentities.general.TileEntityFishTrap;
@@ -35,6 +46,9 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI7 = 6; // Trade table
public static final int GUI8 = 7; // Circuit Programmer
public static final int GUI9 = 8; // Grindle
+ public static final int GUI10 = 9; // Universal Toolbox
+ public static final int GUI11 = 10; // Auto Lunchbox
+ public static final int GUI12 = 11; // Bag for Magic Tools
public static void init() {
@@ -83,6 +97,16 @@ public class GuiHandler implements IGuiHandler {
if (ID == GUI9) {
return new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem()));
}
+ //Tool, lunch, magic
+ if (ID == GUI10) {
+ return new ToolBoxContainer(player, player.inventory, new ToolBoxInventory(player.getHeldItem()));
+ }
+ if (ID == GUI11) {
+ return new LunchBoxContainer(player, player.inventory, new LunchBoxInventory(player.getHeldItem()));
+ }
+ if (ID == GUI12) {
+ return new MagicBagContainer(player, player.inventory, new MagicBagInventory(player.getHeldItem()));
+ }
return null;
}
@@ -125,9 +149,21 @@ public class GuiHandler implements IGuiHandler {
}
if (ID == GUI9) {
- return new GuiBaseGrindle(
- new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem())));
+ return new GuiBaseGrindle(new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem())));
+ }
+
+
+ //Tool, lunch, magic
+ if (ID == GUI10) {
+ return new ToolBoxGui(new ToolBoxContainer(player, player.inventory, new ToolBoxInventory(player.getHeldItem())));
+ }
+ if (ID == GUI11) {
+ return new LunchBoxGui(new LunchBoxContainer(player, player.inventory, new LunchBoxInventory(player.getHeldItem())));
+ }
+ if (ID == GUI12) {
+ return new MagicBagGui(new MagicBagContainer(player, player.inventory, new MagicBagInventory(player.getHeldItem())));
}
+
return null;
}
diff --git a/src/Java/gtPlusPlus/core/inventories/box/LunchBoxInventory.java b/src/Java/gtPlusPlus/core/inventories/box/LunchBoxInventory.java
new file mode 100644
index 0000000000..03350a3c18
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/box/LunchBoxInventory.java
@@ -0,0 +1,15 @@
+package gtPlusPlus.core.inventories.box;
+
+import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory;
+import gtPlusPlus.core.slots.SlotLunchBox;
+import net.minecraft.item.ItemStack;
+
+public class LunchBoxInventory extends CustomBoxInventory {
+ public LunchBoxInventory(ItemStack stack) {
+ super(stack, "Lunch Box", gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS);
+ }
+ @Override
+ public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
+ return SlotLunchBox.isItemValid_STATIC(itemstack);
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/inventories/box/MagicBagInventory.java b/src/Java/gtPlusPlus/core/inventories/box/MagicBagInventory.java
new file mode 100644
index 0000000000..56b1835113
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/box/MagicBagInventory.java
@@ -0,0 +1,15 @@
+package gtPlusPlus.core.inventories.box;
+
+import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory;
+import gtPlusPlus.core.slots.SlotMagicToolBag;
+import net.minecraft.item.ItemStack;
+
+public class MagicBagInventory extends CustomBoxInventory {
+ public MagicBagInventory(ItemStack stack) {
+ super(stack, "Mystic Bag", gtPlusPlus.core.item.tool.misc.box.MagicToolBag.SLOTS);
+ }
+ @Override
+ public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
+ return SlotMagicToolBag.isItemValid_STATIC(itemstack);
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/inventories/box/ToolBoxInventory.java b/src/Java/gtPlusPlus/core/inventories/box/ToolBoxInventory.java
new file mode 100644
index 0000000000..30893aeb4b
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/box/ToolBoxInventory.java
@@ -0,0 +1,16 @@
+package gtPlusPlus.core.inventories.box;
+
+import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory;
+import gtPlusPlus.core.item.tool.misc.box.UniversalToolBox;
+import gtPlusPlus.core.slots.SlotToolBox;
+import net.minecraft.item.ItemStack;
+
+public class ToolBoxInventory extends CustomBoxInventory {
+ public ToolBoxInventory(ItemStack stack) {
+ super(stack, "Tool Box", UniversalToolBox.SLOTS);
+ }
+ @Override
+ public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
+ return SlotToolBox.isItemValid_STATIC(itemstack);
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index c86c10bb53..cc0b4325f3 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -49,6 +49,9 @@ import gtPlusPlus.core.item.init.ItemsFoods;
import gtPlusPlus.core.item.init.ItemsMultiTools;
import gtPlusPlus.core.item.materials.DustDecayable;
import gtPlusPlus.core.item.tool.misc.SandstoneHammer;
+import gtPlusPlus.core.item.tool.misc.box.AutoLunchBox;
+import gtPlusPlus.core.item.tool.misc.box.MagicToolBag;
+import gtPlusPlus.core.item.tool.misc.box.UniversalToolBox;
import gtPlusPlus.core.item.tool.misc.GregtechPump;
import gtPlusPlus.core.item.tool.staballoy.*;
import gtPlusPlus.core.item.wearable.WearableLoader;
@@ -282,6 +285,10 @@ public final class ModItems {
public static Fluid fluidZrF4;
+ public static Item boxTools;
+ public static Item boxFood;
+ public static Item boxMagic;
+
static {
Logger.INFO("Items!");
//Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon.
@@ -348,6 +355,12 @@ public final class ModItems {
backpack_Gray = new BaseItemBackpack("backpackGray", Utils.rgbtoHexValue(128, 128, 128));
backpack_Black = new BaseItemBackpack("backpackBlack", Utils.rgbtoHexValue(20, 20, 20));
backpack_White = new BaseItemBackpack("backpackWhite", Utils.rgbtoHexValue(240, 240, 240));
+
+
+ //Load Custom Box/bags
+ boxTools = new UniversalToolBox("Tool Box");
+ boxFood = new AutoLunchBox("Eatotron-9000");
+ boxMagic = new MagicToolBag("Mystic Bag");
itemBlueprintBase = new ItemBlueprint("itemBlueprint");
@@ -365,19 +378,19 @@ public final class ModItems {
* Try generate dusts for missing rare earth materials if they don't exist
*/
- if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGadolinium", 1) == null){
+ if (ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGadolinium", 1))){
ItemUtils.generateSpecialUseDusts("Gadolinium", "Gadolinium", Materials.Gadolinium.mElement.name(), Utils.rgbtoHexValue(226, 172, 9));
}
- if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustYtterbium", 1) == null){
+ if (ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustYtterbium", 1))){
ItemUtils.generateSpecialUseDusts("Ytterbium", "Ytterbium", Materials.Ytterbium.mElement.name(), Utils.rgbtoHexValue(Materials.Yttrium.mRGBa[0]-60, Materials.Yttrium.mRGBa[1]-60, Materials.Yttrium.mRGBa[2]-60));
}
- if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustSamarium", 1) == null){
+ if (ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustSamarium", 1))){
ItemUtils.generateSpecialUseDusts("Samarium", "Samarium", Materials.Samarium.mElement.name(), Utils.rgbtoHexValue(161, 168, 114));
}
- if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustLanthanum", 1) == null){
+ if (ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustLanthanum", 1))){
ItemUtils.generateSpecialUseDusts("Lanthanum", "Lanthanum", Materials.Lanthanum.mElement.name(), Utils.rgbtoHexValue(106, 127, 163));
}
- if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGermanium", 1) == null){
+ if (ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGermanium", 1))){
ItemUtils.generateSpecialUseDusts("Germanium", "Germanium", "Ge", ELEMENT.getInstance().GERMANIUM.getRgbAsHex());
}
@@ -621,8 +634,10 @@ public final class ModItems {
dustZrCl4 = ItemUtils.generateSpecialUseDusts("ZrCl4", "ZrCl4", "ZrCl4", Utils.rgbtoHexValue(180, 180, 180))[0]; //http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/39/036/39036750.pdf
dustCookedZrCl4 = ItemUtils.generateSpecialUseDusts("CookedZrCl4", "Cooked ZrCl4", "ZrCl4", Utils.rgbtoHexValue(180, 180, 180))[0]; //http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/39/036/39036750.pdf
//Zirconium Tetrafluoride
- GT_OreDictUnificator.registerOre("cellZrF4", ItemUtils.getItemStackOfAmountFromOreDict("cellZirconiumTetrafluoride", 1));
- GT_OreDictUnificator.registerOre("dustZrF4", ItemUtils.getItemStackOfAmountFromOreDict("dustZirconiumTetrafluoride", 1));
+ /*GT_OreDictUnificator.registerOre("cellZrF4", ItemUtils.getItemStackOfAmountFromOreDict("cellZirconiumTetrafluoride", 1));
+ GT_OreDictUnificator.registerOre("dustZrF4", ItemUtils.getItemStackOfAmountFromOreDict("dustZirconiumTetrafluoride", 1));*/
+ //GT_OreDictUnificator.registerOre("cellZrF4", ItemUtils.getItemStackOfAmountFromOreDict("cellZirconiumTetrafluoride", 1));
+ //GT_OreDictUnificator.registerOre("dustZrF4", ItemUtils.getItemStackOfAmountFromOreDict("dustZirconiumTetrafluoride", 1));
fluidZrF4 = FluidUtils.generateFluidNoPrefix("ZirconiumTetrafluoride", "Zirconium Tetrafluoride", 500, new short[]{170, 170, 140, 100}); //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride
//Coolant Salt
@@ -684,7 +699,7 @@ public final class ModItems {
toolGregtechPump.registerPumpType(3, "Ultimate Hand Pump", 512000, 3);
//Create Multi-tools
- ItemsMultiTools.load();
+ //ItemsMultiTools.load();
//Xp Fluids - Dev
if (!FluidRegistry.isFluidRegistered("mobessence")){
@@ -731,7 +746,6 @@ public final class ModItems {
// A plate of Meat.
if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateMeatRaw", 1) == null){
itemPlateRawMeat = new BaseItemPlate(meatRaw);
- RecipeUtils.generateMortarRecipe(ItemUtils.getSimpleStack(itemPlateRawMeat), ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 1));
ItemUtils.registerFuel(ItemUtils.getSimpleStack(itemPlateRawMeat), 100);
}
// A Block of Meat.
@@ -896,7 +910,10 @@ public final class ModItems {
//IC2 Exp
if (LoadedMods.IndustrialCraft2|| LOAD_ALL_CONTENT){
Logger.INFO("IndustrialCraft2 Found - Loading Resources.");
- RfEuBattery = new RF2EU_Battery();
+
+ if (LoadedMods.CoFHCore) {
+ RfEuBattery = new RF2EU_Battery();
+ }
//Baubles Mod Test
try {
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
index b07815fa60..ec0b490f63 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
@@ -105,6 +105,7 @@ public class BaseItemComponent extends Item{
ItemStack x = aMap.get(aKey);
if (x == null) {
aMap.put(aKey, ItemUtils.getSimpleStack(this));
+ Logger.MATERIALS("Registering a material component. Item: ["+componentMaterial.getUnlocalizedName()+"] Map: ["+aKey+"]");
Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap);
return true;
}
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
index df46dd2052..273995e181 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
@@ -2,18 +2,21 @@ package gtPlusPlus.core.item.base.dusts;
import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-
+import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.data.StringUtils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
@@ -80,6 +83,32 @@ public class BaseItemDustUnique extends Item{
if ((temp != null) && !temp.equals("")){
GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
}
+ registerComponent();
+ }
+
+ public boolean registerComponent() {
+ if (this.materialName == null) {
+ return false;
+ }
+ String aName = materialName;
+ //Register Component
+ Map<String, ItemStack> aMap = Material.mComponentMap.get(aName);
+ if (aMap == null) {
+ aMap = new HashMap<String, ItemStack>();
+ }
+ String aKey = OrePrefixes.dust.name();
+ ItemStack x = aMap.get(aKey);
+ if (x == null) {
+ aMap.put(aKey, ItemUtils.getSimpleStack(this));
+ Logger.MATERIALS("Registering a material component. Item: ["+aName+"] Map: ["+aKey+"]");
+ Material.mComponentMap.put(aName, aMap);
+ return true;
+ }
+ else {
+ //Bad
+ Logger.MATERIALS("Tried to double register a material component. ");
+ return false;
+ }
}
@Override
diff --git a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
index 08517776ec..2b3f477c56 100644
--- a/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
+++ b/src/Java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
@@ -1,6 +1,8 @@
package gtPlusPlus.core.item.base.ore;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -13,9 +15,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
-
+import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_OreDictUnificator;
-
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
@@ -52,6 +54,7 @@ public class BaseOreComponent extends Item{
//this.setTextureName(this.getCorrectTextures());
this.componentColour = material.getRgbAsHex();
GameRegistry.registerItem(this, this.unlocalName);
+ registerComponent();
GT_OreDictUnificator.registerOre(componentType.getComponent()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this));
if (LoadedMods.Thaumcraft) {
ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), GTPP_Aspects.METALLUM, 2);
@@ -61,6 +64,51 @@ public class BaseOreComponent extends Item{
}
}
+
+ public boolean registerComponent() {
+ Logger.MATERIALS("Attempting to register "+this.getUnlocalizedName()+".");
+ if (this.componentMaterial == null) {
+ Logger.MATERIALS("Tried to register "+this.getUnlocalizedName()+" but the material was null.");
+ return false;
+ }
+ //Register Component
+ Map<String, ItemStack> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName());
+ if (aMap == null) {
+ aMap = new HashMap<String, ItemStack>();
+ }
+ String aKey = "Invalid";
+ if (componentType == ComponentTypes.CRUSHED) {
+ aKey = OrePrefixes.crushed.name();
+ }
+ else if (componentType == ComponentTypes.CRUSHEDCENTRIFUGED) {
+ aKey = OrePrefixes.crushedCentrifuged.name();
+ }
+ else if (componentType == ComponentTypes.CRUSHEDPURIFIED) {
+ aKey = OrePrefixes.crushedPurified.name();
+ }
+ else if (componentType == ComponentTypes.DUST) {
+ aKey = OrePrefixes.dust.name();
+ }
+ else if (componentType == ComponentTypes.DUSTIMPURE) {
+ aKey = OrePrefixes.dustImpure.name();
+ }
+ else if (componentType == ComponentTypes.DUSTPURE) {
+ aKey = OrePrefixes.dustPure.name();
+ }
+
+ ItemStack x = aMap.get(aKey);
+ if (x == null) {
+ aMap.put(aKey, ItemUtils.getSimpleStack(this));
+ Logger.MATERIALS("Registering a material component. Item: ["+componentMaterial.getUnlocalizedName()+"] Map: ["+aKey+"]");
+ Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap);
+ return true;
+ }
+ else {
+ //Bad
+ Logger.MATERIALS("Tried to double register a material component. ");
+ return false;
+ }
+ }
public String getCorrectTextures(){
if (!CORE.ConfigSwitches.useGregtechTextures){
diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
index f0a0f9f4ea..b6a5dff2ac 100644
--- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
+++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
@@ -7,6 +7,7 @@ import gregtech.api.enums.GT_Values;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
public class BaseItemRod extends BaseItemComponent{
@@ -22,6 +23,7 @@ public class BaseItemRod extends BaseItemComponent{
final ItemStack stackStick = this.componentMaterial.getRod(1);
final ItemStack stackBolt = this.componentMaterial.getBolt(4);
+ if (ItemUtils.checkForInvalidItems(new ItemStack[] {stackStick, stackBolt}))
GT_Values.RA.addCutterRecipe(
stackStick,
stackBolt,
diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
index 0870683c46..9b232f95c5 100644
--- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
+++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
@@ -24,23 +24,20 @@ public class BaseItemRodLong extends BaseItemComponent{
private void addExtruderRecipe(){
Logger.WARNING("Adding recipe for Long "+this.materialName+" Rods");
- final String tempStick = this.unlocalName.replace("itemRodLong", "stick");
- final String tempStickLong = this.unlocalName.replace("itemRodLong", "stickLong");
- final ItemStack stackStick = ItemUtils.getItemStackOfAmountFromOreDict(tempStick, 1);
- final ItemStack stackLong = ItemUtils.getItemStackOfAmountFromOreDict(tempStickLong, 1);
-
- final ItemStack temp = stackStick;
- temp.stackSize = 2;
+ final ItemStack stackStick = this.componentMaterial.getRod(2);
+ final ItemStack stackLong = this.componentMaterial.getLongRod(1);
+ if (ItemUtils.checkForInvalidItems(new ItemStack[] {stackStick, stackLong}))
GT_Values.RA.addForgeHammerRecipe(
- temp,
+ stackStick,
stackLong,
(int) Math.max(this.componentMaterial.getMass(), 1L),
16);
+ if (ItemUtils.checkForInvalidItems(new ItemStack[] {stackStick, stackLong}))
GT_Values.RA.addCutterRecipe(
stackLong,
- temp,
+ stackStick,
null,
(int) Math.max(this.componentMaterial.getMass(), 1L),
4);
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java
new file mode 100644
index 0000000000..baed16db03
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+public class AutoLunchBox extends BaseBoxItem {
+
+ public final static int SLOTS = 9;
+
+ public AutoLunchBox(String displayName) {
+ super(displayName, new String[] {"Stores 9 pieces of food", "Food will automatically be eaten from slot 1, through to "+gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS}, gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS);
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java
new file mode 100644
index 0000000000..10a3ae5804
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java
@@ -0,0 +1,59 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+public class BaseBoxItem extends CoreItem {
+
+ private final int GUI;
+
+ public BaseBoxItem(String displayName, String[] description, int GUI_ID) {
+ super("item." + Utils.sanitizeString(displayName), displayName, AddToCreativeTab.tabTools, 1, 0,
+ modifyDescriptionStringArray(description), EnumRarity.uncommon, EnumChatFormatting.GRAY, false, null);
+ GUI = GUI_ID;
+ }
+
+ private static String[] modifyDescriptionStringArray(String[] array) {
+ String[] a = new String[array.length + 1];
+ for (int b = 0; b < array.length; b++) {
+ a[b] = array[b];
+ }
+ a[a.length - 1] = "Right Click to open";
+ return a;
+ }
+
+ // Without this method, your inventory will NOT work!!!
+ @Override
+ public int getMaxItemUseDuration(ItemStack stack) {
+ return 1; // return any value greater than zero
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) {
+ if (!world.isRemote) {
+ // If player not sneaking, open the inventory gui
+ if (!player.isSneaking()) {
+ player.openGui(GTplusplus.instance, GUI, world, (int) player.posX, (int) player.posY,
+ (int) player.posZ);
+ }
+ }
+ return itemstack;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister iconRegister) {
+ this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName().substring(5));
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java
new file mode 100644
index 0000000000..035859c388
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java
@@ -0,0 +1,328 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import gregtech.api.enums.Materials;
+import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class ContainerBoxBase extends Container {
+
+ /*
+ * Finally, in your Container class, you will need to check if the currently
+ * opened inventory's uniqueID is equal to the itemstack's uniqueID in the
+ * method 'transferStackInSlot' as well as check if the itemstack is the
+ * currently equipped item in the method 'slotClick'. In both cases, you'll need
+ * to prevent the itemstack from being moved or it will cause bad things to
+ * happen.
+ */
+
+ /**
+ * Step 3: Create a custom Container for your Inventory
+ */
+
+ /*
+ * There's a LOT of code in this one, but read through all of the comments
+ * carefully and it should become clear what everything does. As a bonus, one of
+ * my previous tutorials is included within!
+ * "How to Properly Override Shift-Clicking" is here and better than ever! At
+ * least in my opinion. If you're like me, and you find no end of frustration
+ * trying to figure out which f-ing index you should use for which slots in your
+ * container when overriding transferStackInSlot, or if your following the
+ * original tutorial, then read on.
+ */
+
+ /**
+ * The Item Inventory for this Container, only needed if you want to reference
+ * isUseableByPlayer
+ */
+ private final CustomBoxInventory inventory;
+ /**
+ * Using these will make transferStackInSlot easier to understand and implement
+ * INV_START is the index of the first slot in the Player's Inventory, so our
+ * CustomBoxInventory's number of slots (e.g. 5 slots is array indices 0-4, so
+ * start at 5) Notice how we don't have to remember how many slots we made? We
+ * can just use CustomBoxInventory.INV_SIZE and if we ever change it, the
+ * Container updates automatically.
+ */
+ private final int INV_START, INV_END, HOTBAR_START, HOTBAR_END;
+
+ // If you're planning to add armor slots, put those first like this:
+ // ARMOR_START = CustomBoxInventory.INV_SIZE, ARMOR_END = ARMOR_START+3,
+ // INV_START = ARMOR_END+1, and then carry on like above.
+
+ private Slot generateSlot(final Constructor<?> aClazz, final IInventory base, final int id, final int x,
+ final int y) {
+ Slot aSlot;
+ try {
+ aSlot = (Slot) aClazz.newInstance(base, id, x, y);
+ if (aSlot != null) {
+ return aSlot;
+ }
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public ContainerBoxBase(EntityPlayer par1Player, InventoryPlayer inventoryPlayer,
+ CustomBoxInventory CustomBoxInventory, Class<?> aClazz, int aSlotCount) {
+
+ INV_START = aSlotCount;
+ INV_END = INV_START + 26;
+ HOTBAR_START = INV_END + 1;
+ HOTBAR_END = HOTBAR_START + 8;
+
+ this.inventory = CustomBoxInventory;
+ try {
+
+ Constructor<?> constructor;
+ constructor = aClazz.getConstructor(IInventory.class, int.class, int.class, int.class);
+
+ int i;
+
+ // ITEM INVENTORY - you'll need to adjust the slot locations to match your
+ // texture file
+ // I have them set vertically in columns of 4 to the right of the player model
+ for (i = 0; i < CustomBoxInventory.INV_SIZE; ++i) {
+ // You can make a custom Slot if you need different behavior,
+ // such as only certain item types can be put into this slot
+ // We made a custom slot to prevent our inventory-storing item
+ // from being stored within itself, but if you want to allow that and
+ // you followed my advice at the end of the above step, then you
+ // could get away with using the vanilla Slot class
+ this.addSlotToContainer(generateSlot(constructor, this.getInventoryObject(), i,
+ 80 + (18 * (int) (i / 4)), 8 + (18 * (i % 4))));
+ }
+
+ // If you want, you can add ARMOR SLOTS here as well, but you need to
+ // make a public version of SlotArmor. I won't be doing that in this tutorial.
+ /*
+ * for (i = 0; i < 4; ++i) { // These are the standard positions for survival
+ * inventory layout this.addSlotToContainer(new SlotArmor(this.player,
+ * inventoryPlayer, inventoryPlayer.getSizeInventory() - 1 - i, 8, 8 + i * 18,
+ * i)); }
+ */
+
+ // PLAYER INVENTORY - uses default locations for standard inventory texture file
+ for (i = 0; i < 3; ++i) {
+ for (int j = 0; j < 9; ++j) {
+ this.addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
+ }
+ }
+
+ // PLAYER ACTION BAR - uses default locations for standard action bar texture
+ // file
+ for (i = 0; i < 9; ++i) {
+ this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
+ }
+
+ } catch (NoSuchMethodException | SecurityException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer entityplayer) {
+ // be sure to return the inventory's isUseableByPlayer method
+ // if you defined special behavior there:
+ return getInventoryObject().isUseableByPlayer(entityplayer);
+ }
+
+ /**
+ * Called when a player shift-clicks on a slot. You must override this or you
+ * will crash when someone does that.
+ */
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int index) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) this.inventorySlots.get(index);
+
+ if (slot != null && slot.getHasStack()) {
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+
+ // If item is in our custom Inventory or armor slot
+ if (index < INV_START) {
+ // try to place in player inventory / action bar
+ if (!this.mergeItemStack(itemstack1, INV_START, HOTBAR_END + 1, true)) {
+ return null;
+ }
+
+ slot.onSlotChange(itemstack1, itemstack);
+ }
+ // Item is in inventory / hotbar, try to place in custom inventory or armor
+ // slots
+ else {
+ /*
+ * If your inventory only stores certain instances of Items, you can implement
+ * shift-clicking to your inventory like this:
+ *
+ * // Check that the item is the right type if (itemstack1.getItem() instanceof
+ * ItemCustom) { // Try to merge into your custom inventory slots // We use
+ * 'CustomBoxInventory.INV_SIZE' instead of INV_START just in case // you also
+ * add armor or other custom slots if (!this.mergeItemStack(itemstack1, 0,
+ * CustomBoxInventory.INV_SIZE, false)) { return null; } } // If you added armor
+ * slots, check them here as well: // Item being shift-clicked is armor - try to
+ * put in armor slot if (itemstack1.getItem() instanceof ItemArmor) { int type =
+ * ((ItemArmor) itemstack1.getItem()).armorType; if
+ * (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START + type + 1,
+ * false)) { return null; } } Otherwise, you have basically 2 choices: 1.
+ * shift-clicking between player inventory and custom inventory 2.
+ * shift-clicking between action bar and inventory
+ *
+ * Be sure to choose only ONE of the following implementations!!!
+ */
+ /**
+ * Implementation number 1: Shift-click into your custom inventory
+ */
+ if (index >= INV_START) {
+ // place in custom inventory
+ if (!this.mergeItemStack(itemstack1, 0, INV_START, false)) {
+ return null;
+ }
+ }
+
+ /**
+ * Implementation number 2: Shift-click items between action bar and inventory
+ */
+ // item is in player's inventory, but not in action bar
+ if (index >= INV_START && index < HOTBAR_START) {
+ // place in action bar
+ if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END + 1, false)) {
+ return null;
+ }
+ }
+ // item in action bar - place in player inventory
+ else if (index >= HOTBAR_START && index < HOTBAR_END + 1) {
+ if (!this.mergeItemStack(itemstack1, INV_START, INV_END + 1, false)) {
+ return null;
+ }
+ }
+ }
+
+ if (itemstack1.stackSize == 0) {
+ slot.putStack((ItemStack) null);
+ } else {
+ slot.onSlotChanged();
+ }
+
+ if (itemstack1.stackSize == itemstack.stackSize) {
+ return null;
+ }
+
+ slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
+ }
+
+ return itemstack;
+ }
+
+ /**
+ * You should override this method to prevent the player from moving the stack
+ * that opened the inventory, otherwise if the player moves it, the inventory
+ * will not be able to save properly
+ */
+ @Override
+ public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) {
+ // this will prevent the player from interacting with the item that opened the
+ // inventory:
+ if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) {
+ return null;
+ }
+ return super.slotClick(slot, button, flag, player);
+ }
+
+ /*
+ * Special note: If your custom inventory's stack limit is 1 and you allow
+ * shift-clicking itemstacks into it, you will need to override mergeStackInSlot
+ * to avoid losing all the items but one in a stack when you shift-click.
+ */
+ /**
+ * Vanilla mergeItemStack method doesn't correctly handle inventories whose max
+ * stack size is 1 when you shift-click into the inventory. This is a modified
+ * method I wrote to handle such cases. Note you only need it if your slot /
+ * inventory's max stack size is 1
+ */
+ @Override
+ protected boolean mergeItemStack(ItemStack stack, int start, int end, boolean backwards) {
+ boolean flag1 = false;
+ int k = (backwards ? end - 1 : start);
+ Slot slot;
+ ItemStack itemstack1;
+
+ if (stack.isStackable()) {
+ while (stack.stackSize > 0 && (!backwards && k < end || backwards && k >= start)) {
+ slot = (Slot) inventorySlots.get(k);
+ itemstack1 = slot.getStack();
+
+ if (!slot.isItemValid(stack)) {
+ k += (backwards ? -1 : 1);
+ continue;
+ }
+
+ if (itemstack1 != null && itemstack1.getItem() == stack.getItem()
+ && (!stack.getHasSubtypes() || stack.getItemDamage() == itemstack1.getItemDamage())
+ && ItemStack.areItemStackTagsEqual(stack, itemstack1)) {
+ int l = itemstack1.stackSize + stack.stackSize;
+
+ if (l <= stack.getMaxStackSize() && l <= slot.getSlotStackLimit()) {
+ stack.stackSize = 0;
+ itemstack1.stackSize = l;
+ getInventoryObject().markDirty();
+ flag1 = true;
+ } else if (itemstack1.stackSize < stack.getMaxStackSize() && l < slot.getSlotStackLimit()) {
+ stack.stackSize -= stack.getMaxStackSize() - itemstack1.stackSize;
+ itemstack1.stackSize = stack.getMaxStackSize();
+ getInventoryObject().markDirty();
+ flag1 = true;
+ }
+ }
+
+ k += (backwards ? -1 : 1);
+ }
+ }
+ if (stack.stackSize > 0) {
+ k = (backwards ? end - 1 : start);
+ while (!backwards && k < end || backwards && k >= start) {
+ slot = (Slot) inventorySlots.get(k);
+ itemstack1 = slot.getStack();
+
+ if (!slot.isItemValid(stack)) {
+ k += (backwards ? -1 : 1);
+ continue;
+ }
+
+ if (itemstack1 == null) {
+ int l = stack.stackSize;
+ if (l <= slot.getSlotStackLimit()) {
+ slot.putStack(stack.copy());
+ stack.stackSize = 0;
+ getInventoryObject().markDirty();
+ flag1 = true;
+ break;
+ } else {
+ putStackInSlot(k,
+ new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage()));
+ stack.stackSize -= slot.getSlotStackLimit();
+ getInventoryObject().markDirty();
+ flag1 = true;
+ }
+ }
+
+ k += (backwards ? -1 : 1);
+ }
+ }
+
+ return flag1;
+ }
+
+ public CustomBoxInventory getInventoryObject() {
+ return inventory;
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java
new file mode 100644
index 0000000000..0737e463d8
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java
@@ -0,0 +1,243 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+import java.util.UUID;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraftforge.common.util.Constants;
+
+public abstract class CustomBoxInventory implements IInventory {
+
+ private final String name;
+ protected String uniqueID;
+
+ /** Provides NBT Tag Compound to reference */
+ private final ItemStack invItem;
+
+ /** Defining your inventory size this way is handy */
+ public final int INV_SIZE;
+
+ /** Inventory's size must be same as number of slots you add to the Container class */
+ private ItemStack[] inventory;
+
+ /**
+ * @param itemstack - the ItemStack to which this inventory belongs
+ */
+ public CustomBoxInventory(ItemStack stack, String name2){
+ this(stack, name2, 8);
+ }
+
+ /**
+ * @param itemstack - the ItemStack to which this inventory belongs
+ */
+ public CustomBoxInventory(ItemStack stack, String name2, int slots)
+ {
+ invItem = stack;
+ name = name2;
+ INV_SIZE = slots;
+ inventory = new ItemStack[INV_SIZE];
+
+ /** initialize variable within the constructor: */
+ uniqueID = "";
+
+ if (!stack.hasTagCompound())
+ {
+ stack.setTagCompound(new NBTTagCompound());
+ // no tag compound means the itemstack does not yet have a UUID, so assign one:
+ uniqueID = UUID.randomUUID().toString();
+ }
+
+ /** When reading from NBT: */
+ if ("".equals(uniqueID))
+ {
+ // try to read unique ID from NBT
+ uniqueID = stack.getTagCompound().getString("uniqueID");
+ // if it's still "", assign a new one:
+ if ("".equals(uniqueID))
+ {
+ uniqueID = UUID.randomUUID().toString();
+ }
+ }
+
+ /** Writing to NBT: */
+ // just add this line:
+ stack.getTagCompound().setString("uniqueID", this.uniqueID);
+
+ // note that it's okay to use stack instead of invItem right there
+ // both reference the same memory location, so whatever you change using
+ // either reference will change in the other
+
+ // Read the inventory contents from NBT
+ readFromNBT(stack.getTagCompound());
+ }
+
+ @Override
+ public int getSizeInventory()
+ {
+ return inventory.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int slot)
+ {
+ return inventory[slot];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int slot, int amount)
+ {
+ ItemStack stack = getStackInSlot(slot);
+ if(stack != null)
+ {
+ if(stack.stackSize > amount)
+ {
+ stack = stack.splitStack(amount);
+ // Don't forget this line or your inventory will not be saved!
+ markDirty();
+ }
+ else
+ {
+ // this method also calls onInventoryChanged, so we don't need to call it again
+ setInventorySlotContents(slot, null);
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int slot)
+ {
+ ItemStack stack = getStackInSlot(slot);
+ setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ @Override
+ public void setInventorySlotContents(int slot, ItemStack stack)
+ {
+ inventory[slot] = stack;
+
+ if (stack != null && stack.stackSize > getInventoryStackLimit())
+ {
+ stack.stackSize = getInventoryStackLimit();
+ }
+
+ // Don't forget this line or your inventory will not be saved!
+ markDirty();
+ }
+
+ // 1.7.2+ renamed to getInventoryName
+ @Override
+ public String getInventoryName()
+ {
+ return name;
+ }
+
+ // 1.7.2+ renamed to hasCustomInventoryName
+ @Override
+ public boolean hasCustomInventoryName()
+ {
+ return name.length() > 0;
+ }
+
+ @Override
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ /**
+ * This is the method that will handle saving the inventory contents, as it is called (or should be called!)
+ * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also
+ * let you change things in your inventory without ever opening a Gui, if you want.
+ */
+ // 1.7.2+ renamed to markDirty
+ @Override
+ public void markDirty()
+ {
+ for (int i = 0; i < getSizeInventory(); ++i)
+ {
+ if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
+ inventory[i] = null;
+ }
+ }
+
+ // This line here does the work:
+ writeToNBT(invItem.getTagCompound());
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ {
+ return true;
+ }
+
+ // 1.7.2+ renamed to openInventory(EntityPlayer player)
+ @Override
+ public void openInventory() {}
+
+ // 1.7.2+ renamed to closeInventory(EntityPlayer player)
+ @Override
+ public void closeInventory() {}
+
+ /**
+ * This method doesn't seem to do what it claims to do, as
+ * items can still be left-clicked and placed in the inventory
+ * even when this returns false
+ */
+ @Override
+ public abstract boolean isItemValidForSlot(int slot, ItemStack itemstack);
+
+ /**
+ * A custom method to read our inventory from an ItemStack's NBT compound
+ */
+ public void readFromNBT(NBTTagCompound compound)
+ {
+ // Gets the custom taglist we wrote to this compound, if any
+ // 1.7.2+ change to compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND);
+ NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND);
+
+ for (int i = 0; i < items.tagCount(); ++i)
+ {
+ // 1.7.2+ change to items.getCompoundTagAt(i)
+ NBTTagCompound item = (NBTTagCompound) items.getCompoundTagAt(i);
+ int slot = item.getInteger("Slot");
+
+ // Just double-checking that the saved slot index is within our inventory array bounds
+ if (slot >= 0 && slot < getSizeInventory()) {
+ inventory[slot] = ItemStack.loadItemStackFromNBT(item);
+ }
+ }
+ }
+
+ /**
+ * A custom method to write our inventory to an ItemStack's NBT compound
+ */
+ public void writeToNBT(NBTTagCompound tagcompound)
+ {
+ // Create a new NBT Tag List to store itemstacks as NBT Tags
+ NBTTagList items = new NBTTagList();
+
+ for (int i = 0; i < getSizeInventory(); ++i)
+ {
+ // Only write stacks that contain items
+ if (getStackInSlot(i) != null)
+ {
+ // Make a new NBT Tag Compound to write the itemstack and slot index to
+ NBTTagCompound item = new NBTTagCompound();
+ item.setInteger("Slot", i);
+ // Writes the itemstack in slot(i) to the Tag Compound we just made
+ getStackInSlot(i).writeToNBT(item);
+
+ // add the tag compound to our tag list
+ items.appendTag(item);
+ }
+ }
+ // Add the TagList to the ItemStack's Tag Compound with the name "ItemInventory"
+ tagcompound.setTag("ItemInventory", items);
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java
new file mode 100644
index 0000000000..65b884bd51
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+public class MagicToolBag extends BaseBoxItem {
+
+ public final static int SLOTS = 24;
+
+ public MagicToolBag(String displayName) {
+ super(displayName, new String[] {"Can store magic tools from TC, BM, etc", "Please ask for additional mod support on Github"}, gtPlusPlus.core.item.tool.misc.box.MagicToolBag.SLOTS);
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java b/src/Java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java
new file mode 100644
index 0000000000..92b1382e01
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java
@@ -0,0 +1,13 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+import gtPlusPlus.core.handler.GuiHandler;
+
+public class UniversalToolBox extends BaseBoxItem {
+
+ public final static int SLOTS = 16;
+
+ public UniversalToolBox(String displayName) {
+ super(displayName, new String[] {"Can store tools from Gregtech, IC2, BC, Forestry", "Please ask for additional mod support on Github"}, GuiHandler.GUI10);
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java
index a6ffd96bbf..3c18e2f6f7 100644
--- a/src/Java/gtPlusPlus/core/lib/CORE.java
+++ b/src/Java/gtPlusPlus/core/lib/CORE.java
@@ -73,6 +73,7 @@ public class CORE {
public static final int GREG_FIRST_ID = 760;
public static final boolean MAIN_GREGTECH_5U_EXPERIMENTAL_FORK = Meta_GT_Proxy.areWeUsingGregtech5uExperimental();
public static final int GREGTECH_API_VERSION = GregTech_API.VERSION;
+ public static int turbineCutoffBase = 75000;
//GT++ Fake Player Profile
public static GameProfile gameProfile = new GameProfile(UUID.nameUUIDFromBytes("gtplusplus.core".getBytes()), "[GT++]");
diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java
index 675b04c14f..2c41789d9e 100644
--- a/src/Java/gtPlusPlus/core/material/ELEMENT.java
+++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java
@@ -134,7 +134,7 @@ public final class ELEMENT {
//Custom Isotopes
- public final Material LITHIUM7 = new Material("Lithium 7", MaterialState.LIQUID, TextureSet.SET_SHINY, Materials.Lithium.mRGBa, Materials.Lithium.mMeltingPoint, Materials.Lithium.mBlastFurnaceTemp, Materials.Lithium.getProtons(), Materials.Lithium.getNeutrons(), Materials.Lithium.mBlastFurnaceRequired, StringUtils.superscript("7Li"), 0, false);//Not a GT Inherited Material
+ public final Material LITHIUM7 = new Material("Lithium 7", MaterialState.SOLID, TextureSet.SET_SHINY, Materials.Lithium.mRGBa, Materials.Lithium.mMeltingPoint, Materials.Lithium.mBlastFurnaceTemp, Materials.Lithium.getProtons(), Materials.Lithium.getNeutrons(), Materials.Lithium.mBlastFurnaceRequired, StringUtils.superscript("7Li"), 0, false);//Not a GT Inherited Material
public final Material URANIUM232 = new Material("Uranium 232", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{88, 220, 103, 0}, 1132, 4131, 92, 140, false, StringUtils.superscript("232U"), 4);//Not a GT Inherited Material
public final Material URANIUM233 = new Material("Uranium 233", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, StringUtils.superscript("233U"), 2);//Not a GT Inherited Material
public final Material THORIUM232 = new Material("Thorium 232", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{15, 60, 15, 0}, Materials.Thorium.mMeltingPoint, Materials.Thorium.mBlastFurnaceTemp, 90, 142, false, StringUtils.superscript("232Th"), 1, false);//Not a GT Inherited Material
diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java
index c863da8064..5819374f4d 100644
--- a/src/Java/gtPlusPlus/core/material/Material.java
+++ b/src/Java/gtPlusPlus/core/material/Material.java
@@ -722,36 +722,49 @@ public class Material {
}
public final ItemStack getComponentByPrefix(OrePrefixes aPrefix, int stacksize) {
+ String aKey = aPrefix.name();
Map<String, ItemStack> g = mComponentMap.get(this.unlocalizedName);
if (g == null) {
Map<String, ItemStack> aMap = new HashMap<String, ItemStack>();
mComponentMap.put(unlocalizedName, aMap);
g = aMap;
}
- ItemStack i = g.get(aPrefix.name());
+ ItemStack i = g.get(aKey);
if (i != null) {
return ItemUtils.getSimpleStack(i, stacksize);
}
else {
- ItemStack u = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(aPrefix.name()+this.unlocalizedName, stacksize);
- String aKey = aPrefix.name();
- if (u != null) {
- g.put(aKey, u);
- mComponentMap.put(unlocalizedName, g);
- return u;
- }
- else {
- return ItemUtils.getSimpleStack(ModItems.AAA_Broken);
+ // Try get a GT Material
+ Materials Erf = MaterialUtils.getMaterial(this.unlocalizedName);
+ if (Erf != null && Erf != Materials._NULL) {
+ ItemStack Erg = ItemUtils.getOrePrefixStack(aPrefix, Erf, stacksize);
+ if (Erg != null) {
+ Logger.MATERIALS("Found \"" + aKey + this.unlocalizedName + "\" using backup GT Materials option.");
+ g.put(aKey, Erg);
+ mComponentMap.put(unlocalizedName, g);
+ return Erg;
+ }
+ } else {
+ ItemStack u = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(aKey + this.unlocalizedName, stacksize);
+ if (u != null) {
+ g.put(aKey, u);
+ mComponentMap.put(unlocalizedName, g);
+ return u;
+ }
}
+ //Logger.MATERIALS("Unabled to find \"" + aKey + this.unlocalizedName + "\"");
+ return ItemUtils.getErrorStack(stacksize);
}
+
}
final public Block getBlock(){
- return Block.getBlockFromItem(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("block"+this.unlocalizedName, 1).getItem());
+ return Block.getBlockFromItem(getBlock(1).getItem());
}
public final ItemStack getBlock(final int stacksize){
- return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("block"+this.unlocalizedName, stacksize);
+ ItemStack i = getComponentByPrefix(OrePrefixes.block, stacksize);
+ return i != null ? i : ItemUtils.getItemStackOfAmountFromOreDictNoBroken("block"+this.unlocalizedName, stacksize);
}
public final ItemStack getDust(final int stacksize){
@@ -858,22 +871,23 @@ public class Material {
return Blocks.stone;
}
public final ItemStack getCrushed(final int stacksize){
- return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("crushed"+this.unlocalizedName, stacksize);
+ return getComponentByPrefix(OrePrefixes.crushed, stacksize);
}
public final ItemStack getCrushedPurified(final int stacksize){
- return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("crushedPurified"+this.unlocalizedName, stacksize);
+ return getComponentByPrefix(OrePrefixes.crushedPurified, stacksize);
}
public final ItemStack getCrushedCentrifuged(final int stacksize){
- return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("crushedCentrifuged"+this.unlocalizedName, stacksize);
+ return getComponentByPrefix(OrePrefixes.crushedCentrifuged, stacksize);
}
public final ItemStack getDustPurified(final int stacksize){
- return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustPure"+this.unlocalizedName, stacksize);
+ return getComponentByPrefix(OrePrefixes.dustPure, stacksize);
}
public final ItemStack getDustImpure(final int stacksize){
- return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustImpure"+this.unlocalizedName, stacksize);
+ return getComponentByPrefix(OrePrefixes.dustImpure, stacksize);
}
- public final boolean hasSolidForm() {
- if (this.getDust(1) != null || this.getBlock(1) != null || this.getSmallDust(1) != null || this.getTinyDust(1) != null) {
+
+ public final boolean hasSolidForm() {
+ if (ItemUtils.checkForInvalidItems(new ItemStack[] {getDust(1), getBlock(1), getTinyDust(1), getSmallDust(1)})) {
return true;
}
return false;
diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java
index 4ed8f4ceb3..44c02bc70d 100644
--- a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java
+++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java
@@ -233,16 +233,7 @@ public class MaterialGenerator {
public static void generateNuclearMaterial(final Material matInfo, final boolean generatePlates){
try {
- final String unlocalizedName = matInfo.getUnlocalizedName();
- final String materialName = matInfo.getLocalizedName();
- final short[] C = matInfo.getRGBA();
- final int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]);
-
- int sRadiation = 0;
- if (matInfo.vRadiationLevel != 0){
- sRadiation = matInfo.vRadiationLevel;
- }
-
+
tempBlock = new BlockBaseModular(matInfo,BlockTypes.STANDARD);
temp = new BaseItemDust(matInfo);
temp = new BaseItemIngot(matInfo);
@@ -322,7 +313,7 @@ public class MaterialGenerator {
temp = new BaseItemPurifiedDust(matInfo);
Logger.MATERIALS("Generated all ore components for "+matInfo.getLocalizedName()+", now generating processing recipes.");
- RecipeGen_Ore.generateRecipes(matInfo);
+ new RecipeGen_Ore(matInfo);
} catch (final Throwable t){
Logger.MATERIALS("[Error] "+(matInfo != null ? matInfo.getLocalizedName() : "Null Material")+" failed to generate.");
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java
index 22ef27e8cd..bf9ead6f90 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java
@@ -123,6 +123,22 @@ public class RECIPES_GREGTECH {
FluidUtils.getFluidStack("molten.trinium", 136 * 144), 0, 20 * 3000,
2040*4);
}
+
+ //Eglin Steel
+ CORE.RA.addBlastSmelterRecipe(
+ new ItemStack[] {
+ ItemUtils.getGregtechCircuit(6),
+ ELEMENT.getInstance().IRON.getDust(4),
+ ALLOY.KANTHAL.getDust(1),
+ ALLOY.INVAR.getDust(5),
+ ELEMENT.getInstance().SULFUR.getDust(1),
+ ELEMENT.getInstance().CARBON.getDust(1),
+ ELEMENT.getInstance().SILICON.getDust(4)
+ },
+ ALLOY.EGLIN_STEEL.getFluid(16 * 144),
+ 0,
+ 20 * 45,
+ 120);
// Germanium Roasting
CORE.RA.addBlastSmelterRecipe(
@@ -432,16 +448,20 @@ public class RECIPES_GREGTECH {
// Raisins from Grapes
try {
+ ItemStack cropGrape = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cropGrape", 1);
+ ItemStack foodRaisins = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foodRaisins", 1);
+
+ if (cropGrape != null && foodRaisins != null)
CORE.RA.addDehydratorRecipe(new ItemStack[] {
- ItemUtils.getItemStackOfAmountFromOreDict("cropGrape", 1)
+ cropGrape
}, // Item
null, // Fluid input (slot 1)
null, // Fluid output (slot 2)
new ItemStack[] {
- ItemUtils.getItemStackOfAmountFromOreDict("foodRaisins", 1)
+ foodRaisins
}, // Output
- new int[] { 0 }, 10 * 20, // Time in ticks
- 8); // EU
+ new int[] { 0 }, 10, // Time in ticks
+ 2); // EU
}
catch (final NullPointerException e) {
@@ -547,7 +567,8 @@ public class RECIPES_GREGTECH {
FluidUtils.getFluidStack("hydrofluoricacid", 9 * 144),
null,
new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenChloride", 9),
- ItemUtils.getItemStackOfAmountFromOreDict("dustZrF4", 9) },
+ FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(9)
+ },
new int[] { 0 }, 120 * 20, // Time in ticks
500); // EU
@@ -559,7 +580,7 @@ public class RECIPES_GREGTECH {
FluidUtils.getFluidStack("hydrofluoricacid_gt5u", 18 * 144),
null,
new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenChloride", 9),
- ItemUtils.getItemStackOfAmountFromOreDict("dustZrF4", 9) },
+ FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.getDust(9) },
new int[] { 0 },
120 * 20, // Time in ticks
500); // EU
@@ -1069,14 +1090,19 @@ public class RECIPES_GREGTECH {
CI.emptyCells(2), 20 * 20);
}
- //Refine GT HF into GT++ HF
- GT_Values.RA.addChemicalRecipe(
- ItemUtils.getItemStackOfAmountFromOreDict("cellHydrofluoricAcid", 2),
- ItemUtils.getItemStackOfAmountFromOreDict("cellHydrofluoricAcid_GT5U", 5),
- null, // Fluid Input
- FluidUtils.getFluidStack("hydrofluoricacid", 6000), // Fluid Output
- CI.emptyCells(7),
- 2 * 20);
+ ItemStack temp_GT5u_SA = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellHydrofluoricAcid_GT5U", 5);
+ if (temp_GT5u_SA != null) {
+ //Refine GT HF into GT++ HF
+ GT_Values.RA.addChemicalRecipe(
+ ItemUtils.getItemStackOfAmountFromOreDict("cellHydrofluoricAcid", 2),
+ temp_GT5u_SA,
+ null, // Fluid Input
+ FluidUtils.getFluidStack("hydrofluoricacid", 6000), // Fluid Output
+ CI.emptyCells(7),
+ 2 * 20);
+ }
+
+
}
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java
index 70df48ed81..1a1dfe64d9 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java
@@ -1,6 +1,9 @@
package gtPlusPlus.core.recipe;
+import static gtPlusPlus.core.recipe.common.CI.bitsd;
import static gtPlusPlus.core.util.minecraft.ItemUtils.getSimpleStack;
+import static gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits.generatePipeRecipes;
+import static gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits.generateWireRecipes;
import gregtech.api.enums.*;
import gregtech.api.util.GT_ModHandler;
@@ -9,12 +12,16 @@ import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.item.ModItems;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.ALLOY;
+import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.material.nuclear.FLUORIDES;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.RecipeUtils;
import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials;
+import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -51,6 +58,7 @@ public class RECIPES_General {
run();
addCompressedObsidian();
addHandPumpRecipes();
+ migratedRecipes();
}
}
@@ -242,6 +250,7 @@ public class RECIPES_General {
ItemUtils.getSimpleStack(ModBlocks.blockNet, 2))){
Logger.INFO("Added a recipe for Nets.");
}
+
}
@@ -319,6 +328,127 @@ public class RECIPES_General {
}
+
+ private static void migratedRecipes() {
+
+ RecipeUtils.generateMortarRecipe(ItemUtils.getSimpleStack(ModItems.itemPlateRawMeat), ItemUtils.getItemStackOfAmountFromOreDict("dustMeatRaw", 1));
+
+ generateWireRecipes(ELEMENT.getInstance().ZIRCONIUM);
+ generateWireRecipes(ALLOY.HG1223);
+ generateWireRecipes(ALLOY.LEAGRISIUM);
+ generateWireRecipes(ALLOY.TRINIUM_TITANIUM);
+
+ GT_Materials[] g = new GT_Materials[] {
+ GT_Materials.Staballoy,
+ GT_Materials.Tantalloy60,
+ GT_Materials.Tantalloy61,
+ GT_Materials.Void,
+ GT_Materials.Potin,
+ GT_Materials.MaragingSteel300,
+ GT_Materials.MaragingSteel350,
+ GT_Materials.Inconel690,
+ GT_Materials.Inconel792,
+ GT_Materials.HastelloyX,
+ GT_Materials.TriniumNaquadahCarbonite,
+
+ };
+ for (GT_Materials e : g) {
+ if (e == GT_Materials.Void) {
+ if (!LoadedMods.Thaumcraft) {
+ continue;
+ }
+ }
+ int tVoltageMultiplier = (e.mBlastFurnaceTemp >= 2800) ? 64 : 16;
+ generatePipeRecipes(e.mDefaultLocalName, e.getMass(), tVoltageMultiplier);
+ }
+
+ Materials[] h = new Materials[] {
+ Materials.Europium,
+ Materials.Tungsten,
+ Materials.DarkSteel,
+ Materials.Clay,
+ Materials.Lead,
+
+ };
+
+ for (Materials e : h) {
+ if (e == Materials.DarkSteel) {
+ if (!LoadedMods.EnderIO) {
+ continue;
+ }
+ }
+ int tVoltageMultiplier = (e.mBlastFurnaceTemp >= 2800) ? 64 : 16;
+ generatePipeRecipes(e.mDefaultLocalName, e.getMass(), tVoltageMultiplier);
+ }
+
+
+ RecipeUtils.addShapedGregtechRecipe(
+ CI.component_Plate[4], "rotorGtStainlessSteel", CI.component_Plate[4],
+ CI.getTieredCircuitOreDictName(3), CI.machineHull_HV, CI.getTieredCircuitOreDictName(3),
+ CI.component_Plate[4], CI.electricPump_HV, CI.component_Plate[4],
+ GregtechItemList.Hatch_Air_Intake.get(1L, new Object[0]));
+
+ RecipeUtils.addShapedGregtechRecipe(CI.component_Plate[6], ALLOY.MARAGING250.getGear(1), CI.component_Plate[6],
+ CI.getTieredCircuitOreDictName(4), GregtechItemList.Casing_AdvancedVacuum.get(1),
+ CI.getTieredCircuitOreDictName(4), CI.component_Plate[5], ItemList.Hatch_Input_IV.get(1),
+ CI.component_Plate[5], GregtechItemList.Hatch_Input_Cryotheum.get(1L, new Object[0]));
+
+ RecipeUtils.addShapedGregtechRecipe(CI.component_Plate[5], ALLOY.MARAGING300.getGear(1), CI.component_Plate[5],
+ CI.getTieredCircuitOreDictName(4), GregtechItemList.Casing_Adv_BlastFurnace.get(1),
+ CI.getTieredCircuitOreDictName(4), CI.component_Plate[6], ItemList.Hatch_Input_IV.get(1),
+ CI.component_Plate[6], GregtechItemList.Hatch_Input_Pyrotheum.get(1L, new Object[0]));
+
+ RecipeUtils.addShapedGregtechRecipe(CI.component_Plate[8], ALLOY.PIKYONIUM.getGear(1), CI.component_Plate[9],
+ CI.getTieredCircuitOreDictName(7), GregtechItemList.Casing_Naq_Reactor_A.get(1),
+ CI.getTieredCircuitOreDictName(7), CI.component_Plate[9], ItemList.Hatch_Input_ZPM.get(1),
+ CI.component_Plate[8], GregtechItemList.Hatch_Input_Naquadah.get(1L, new Object[0]));
+
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_LV.get(1L, new Object[0]), bitsd,
+ new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_LV.get(1), Character.valueOf('P'),
+ GregtechItemList.Pollution_Cleaner_LV.get(1) });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_MV.get(1L, new Object[0]), bitsd,
+ new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_MV.get(1), Character.valueOf('P'),
+ GregtechItemList.Pollution_Cleaner_MV.get(1) });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_HV.get(1L, new Object[0]), bitsd,
+ new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_HV.get(1), Character.valueOf('P'),
+ GregtechItemList.Pollution_Cleaner_HV.get(1) });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_EV.get(1L, new Object[0]), bitsd,
+ new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_EV.get(1), Character.valueOf('P'),
+ GregtechItemList.Pollution_Cleaner_EV.get(1) });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_IV.get(1L, new Object[0]), bitsd,
+ new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_IV.get(1), Character.valueOf('P'),
+ GregtechItemList.Pollution_Cleaner_IV.get(1) });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_LuV.get(1L, new Object[0]), bitsd,
+ new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_LuV.get(1), Character.valueOf('P'),
+ GregtechItemList.Pollution_Cleaner_LuV.get(1) });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_ZPM.get(1L, new Object[0]), bitsd,
+ new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_ZPM.get(1), Character.valueOf('P'),
+ GregtechItemList.Pollution_Cleaner_ZPM.get(1) });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_UV.get(1L, new Object[0]), bitsd,
+ new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_UV.get(1), Character.valueOf('P'),
+ GregtechItemList.Pollution_Cleaner_UV.get(1) });
+ GT_ModHandler.addCraftingRecipe(GregtechItemList.Hatch_Muffler_Adv_MAX.get(1L, new Object[0]), bitsd,
+ new Object[] { "M", "P", Character.valueOf('M'), ItemList.Hatch_Muffler_MAX.get(1), Character.valueOf('P'),
+ GregtechItemList.Pollution_Cleaner_MAX.get(1) });
+
+
+
+
+
+
+
+
+
+
+
+ }
+
+
+
+
+
+
+
}
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
index f28929a66a..cf2e730cbe 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
@@ -1209,7 +1209,7 @@ public class RECIPES_Machines {
//Advanced Vacuum Freezer
ItemStack plate = ALLOY.HG1223.getPlateDouble(1);
ItemStack gear = ALLOY.INCOLOY_MA956.getGear(1);
- ItemStack frame = ALLOY.INCOLOY_DS.getFrameBox(1);
+ ItemStack frame = ALLOY.LAFIUM.getFrameBox(1);
ItemStack cell1 = ItemList.Reactor_Coolant_He_6.get(1);
ItemStack cell2 = ItemList.Reactor_Coolant_NaK_6.get(1);
@@ -1246,7 +1246,7 @@ public class RECIPES_Machines {
//Advanced Implosion Compressor
plate = ItemUtils.getItemStackOfAmountFromOreDict("plateAlloyIridium", 1);
gear = ALLOY.LEAGRISIUM.getGear(1);
- frame = ALLOY.HG1223.getFrameBox(1);
+ frame = ALLOY.CINOBITE.getFrameBox(1);
cell1 = ItemUtils.simpleMetaStack("IC2:reactorHeatSwitchDiamond:1", 1, 1);
cell2 = ItemUtils.simpleMetaStack("IC2:reactorVentGold:1", 1, 1);
diff --git a/src/Java/gtPlusPlus/core/slots/SlotLunchBox.java b/src/Java/gtPlusPlus/core/slots/SlotLunchBox.java
new file mode 100644
index 0000000000..bb82a28936
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/slots/SlotLunchBox.java
@@ -0,0 +1,30 @@
+package gtPlusPlus.core.slots;
+
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.minecraft.FoodUtils;
+
+public class SlotLunchBox extends SlotGtTool {
+
+ public SlotLunchBox(final IInventory base, final int x, final int y, final int z) {
+ super(base, x, y, z);
+ }
+
+ @Override
+ public boolean isItemValid(final ItemStack itemstack) {
+ return isItemValid_STATIC(itemstack);
+ }
+
+ public static boolean isItemValid_STATIC(final ItemStack itemstack) {
+ if ((itemstack.getItem() instanceof ItemFood) || (FoodUtils.isFood(itemstack))) {
+ Logger.WARNING(itemstack.getDisplayName() + " is a valid food.");
+ return true;
+ }
+ Logger.WARNING(itemstack.getDisplayName() + " is not a valid food.");
+ return false;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/slots/SlotMagicToolBag.java b/src/Java/gtPlusPlus/core/slots/SlotMagicToolBag.java
new file mode 100644
index 0000000000..d555f10a44
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/slots/SlotMagicToolBag.java
@@ -0,0 +1,29 @@
+package gtPlusPlus.core.slots;
+
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.minecraft.FoodUtils;
+
+public class SlotMagicToolBag extends SlotGtTool {
+
+ public SlotMagicToolBag(final IInventory base, final int x, final int y, final int z) {
+ super(base, x, y, z);
+ }
+
+ @Override
+ public boolean isItemValid(final ItemStack itemstack) {
+ return isItemValid_STATIC(itemstack);
+ }
+
+ public static boolean isItemValid_STATIC(final ItemStack itemstack) {
+ if ((itemstack.getItem() instanceof ItemFood) || (FoodUtils.isFood(itemstack))) {
+ Logger.WARNING(itemstack.getDisplayName() + " is a valid food.");
+ return true;
+ }
+ Logger.WARNING(itemstack.getDisplayName() + " is not a valid food.");
+ return false;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/slots/SlotToolBox.java b/src/Java/gtPlusPlus/core/slots/SlotToolBox.java
new file mode 100644
index 0000000000..c6d025fd21
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/slots/SlotToolBox.java
@@ -0,0 +1,113 @@
+package gtPlusPlus.core.slots;
+
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemTool;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+
+public class SlotToolBox extends SlotGtTool {
+
+ private static final AutoMap<Class> mSupportedCustomTools = new AutoMap<Class>();
+
+ static {
+ //Look for Supported custom tool types
+ Class temp;
+
+ //IHL Pumps
+ temp = ReflectionUtils.getClassByName("ihl.handpump.IHLHandPump");
+ if (temp != null) {
+ mSupportedCustomTools.put(temp);
+ temp = null;
+ }
+
+ //IC2 Electrics
+ temp = ReflectionUtils.getClassByName("ic2.api.item.IElectricItem");
+ if (temp != null) {
+ mSupportedCustomTools.put(temp);
+ temp = null;
+ }
+
+ //IC2 Boxables
+ temp = ReflectionUtils.getClassByName(" ic2.api.item.IBoxable");
+ if (temp != null) {
+ mSupportedCustomTools.put(temp);
+ temp = null;
+ }
+
+ //Tinkers Tools
+ temp = ReflectionUtils.getClassByName("tconstruct.library.tools.Weapon");
+ if (temp != null) {
+ mSupportedCustomTools.put(temp);
+ temp = null;
+ }
+ //BattleGear Weapons
+ temp = ReflectionUtils.getClassByName("mods.battlegear2.api.weapons.IBattlegearWeapon");
+ if (temp != null) {
+ mSupportedCustomTools.put(temp);
+ temp = null;
+ }
+
+
+ //OpenMods
+ String[] OpenModsContent = new String[] {"openblocks.common.item.ItemDevNull", "openblocks.common.item.ItemHangGlider", "openblocks.common.item.ItemWrench", "openblocks.common.item.ItemSleepingBag"};
+ for (String t : OpenModsContent) {
+ temp = ReflectionUtils.getClassByName(t);
+ if (temp != null) {
+ mSupportedCustomTools.put(temp);
+ temp = null;
+ }
+ }
+
+ //GC Wrench
+ temp = ReflectionUtils.getClassByName("micdoodle8.mods.galacticraft.core.items.ItemUniversalWrench");
+ if (temp != null) {
+ mSupportedCustomTools.put(temp);
+ temp = null;
+ }
+
+ //EIO
+ String[] EioContent = new String[] {"crazypants.enderio.api.tool.ITool", "crazypants.enderio.item.ItemMagnet", "crazypants.enderio.item.ItemConduitProbe"};
+ for (String t : EioContent) {
+ temp = ReflectionUtils.getClassByName(t);
+ if (temp != null) {
+ mSupportedCustomTools.put(temp);
+ temp = null;
+ }
+ }
+
+ //Forestry
+ temp = ReflectionUtils.getClassByName("forestry.core.items.ItemForestryTool");
+ if (temp != null) {
+ mSupportedCustomTools.put(temp);
+ temp = null;
+ }
+ }
+
+ public SlotToolBox(final IInventory base, final int x, final int y, final int z) {
+ super(base, x, y, z);
+ }
+
+ @Override
+ public boolean isItemValid(final ItemStack itemstack) {
+ return isItemValid_STATIC(itemstack);
+ }
+
+ public static boolean isItemValid_STATIC(final ItemStack itemstack) {
+ if ((itemstack.getItem() instanceof GT_MetaGenerated_Tool) || (itemstack.getItem() instanceof ItemTool)) {
+ Logger.WARNING(itemstack.getDisplayName() + " is a valid Tool.");
+ return true;
+ }
+ for (Class C : mSupportedCustomTools) {
+ if (C.isInstance(itemstack.getItem())) {
+ return true;
+ }
+ }
+ Logger.WARNING(itemstack.getDisplayName() + " is not a valid Tool.");
+ return false;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java
index 624ed35b60..e2220f74f8 100644
--- a/src/Java/gtPlusPlus/core/util/Utils.java
+++ b/src/Java/gtPlusPlus/core/util/Utils.java
@@ -40,6 +40,7 @@ import gregtech.api.util.GT_Utility;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.data.Pair;
import gtPlusPlus.core.item.ModItems;
import gtPlusPlus.core.lib.CORE;
@@ -544,6 +545,47 @@ public class Utils {
}
return null;
}
+
+ public static String sanitizeString(final String input, final char[] aDontRemove) {
+
+ String output;
+ AutoMap<String> aToRemoveMap = new AutoMap<String>();
+
+ aToRemoveMap.put(" ");
+ aToRemoveMap.put("-");
+ aToRemoveMap.put("_");
+ aToRemoveMap.put("~");
+ aToRemoveMap.put("?");
+ aToRemoveMap.put("!");
+ aToRemoveMap.put("@");
+ aToRemoveMap.put("#");
+ aToRemoveMap.put("$");
+ aToRemoveMap.put("%");
+ aToRemoveMap.put("^");
+ aToRemoveMap.put("&");
+ aToRemoveMap.put("*");
+ aToRemoveMap.put("(");
+ aToRemoveMap.put(")");
+ aToRemoveMap.put("{");
+ aToRemoveMap.put("}");
+ aToRemoveMap.put("[");
+ aToRemoveMap.put("]");
+ aToRemoveMap.put(" ");
+
+ for (String s : aToRemoveMap) {
+ for (char e : aDontRemove) {
+ if (s.charAt(0) == e) {
+ aToRemoveMap.remove("s");
+ }
+ }
+ }
+ output = input;
+ for (String A : aToRemoveMap) {
+ output = output.replace(A, "");
+ }
+ return output;
+
+ }
public static String sanitizeString(final String input) {
String temp;
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/FoodUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/FoodUtils.java
new file mode 100644
index 0000000000..a1c2bf6104
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/util/minecraft/FoodUtils.java
@@ -0,0 +1,60 @@
+package gtPlusPlus.core.util.minecraft;
+
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.init.Items;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+
+public class FoodUtils {
+
+ public static final Class IEdibleClass;
+
+ static {
+ IEdibleClass = ReflectionUtils.getClassByName("squeek.applecore.api.food.IEdible");
+ }
+
+ public static boolean isFood(ItemStack food) {
+
+ if (food == null) {
+ return false;
+ }
+
+ Item item = food.getItem();
+
+ if(item == null) {
+ return false;
+ }
+
+ EnumAction action = item.getItemUseAction(food);
+
+ if(item instanceof ItemBlock || action == EnumAction.eat || action == EnumAction.drink) {
+ if(getUnmodifiedFoodValues(food) > 0) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private static int getUnmodifiedFoodValues(ItemStack stack) {
+
+ if (stack == null) {
+ return 0;
+ }
+
+ Item item = stack.getItem();
+
+ if(item == null) {
+ return 0;
+ }
+
+ if(IEdibleClass.isInstance(item) || item instanceof ItemFood || item == Items.cake) {
+ return 1;
+ }
+
+ return 0;
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
index c7c38eab7d..1a3219bb90 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
@@ -6,6 +6,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
import net.minecraft.block.Block;
+import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemStack;
@@ -16,7 +17,8 @@ import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
-
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.api.objects.GregtechException;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.Pair;
import gtPlusPlus.api.objects.minecraft.BlockPos;
@@ -39,164 +41,173 @@ import net.minecraftforge.oredict.OreDictionary;
public class ItemUtils {
- public static ItemStack getSimpleStack(final Item x){
+ public static ItemStack getSimpleStack(final Item x) {
return getSimpleStack(x, 1);
}
- public static ItemStack getSimpleStack(final Block x){
+
+ public static ItemStack getSimpleStack(final Block x) {
return simpleMetaStack(Item.getItemFromBlock(x), 0, 1);
}
- public static ItemStack getSimpleStack(final Block x, int meta){
+
+ public static ItemStack getSimpleStack(final Block x, int meta) {
return simpleMetaStack(Item.getItemFromBlock(x), meta, 1);
}
- public static ItemStack getSimpleStack(final Item x, final int i){
+
+ public static ItemStack getSimpleStack(final Item x, final int i) {
try {
final ItemStack r = new ItemStack(x, i);
return r.copy();
- } catch(final Throwable e){
+ } catch (final Throwable e) {
return null;
}
}
- public static ItemStack getSimpleStack(final ItemStack x, final int i){
+
+ public static ItemStack getSimpleStack(final ItemStack x, final int i) {
try {
final ItemStack r = x.copy();
r.stackSize = i;
return r;
- } catch(final Throwable e){
+ } catch (final Throwable e) {
return null;
}
}
public static final int WILDCARD_VALUE = Short.MAX_VALUE;
- public static ItemStack getWildcardStack(final Item x){
+
+ public static ItemStack getWildcardStack(final Item x) {
final ItemStack y = new ItemStack(x, 1, WILDCARD_VALUE);
return y;
}
+ public static ItemStack getIC2Cell(final String S) {
+ final ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell" + S, 1);
- public static ItemStack getIC2Cell(final String S){
- final ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+S, 1);
-
- if (moreTemp == null){
+ if (moreTemp == null) {
final int cellID = 0;
- final ItemStack temp =GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID);
+ final ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID);
return temp != null ? temp : null;
}
return moreTemp;
}
- public static ItemStack getIC2Cell(final int meta){
+ public static ItemStack getIC2Cell(final int meta) {
final ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, meta);
return temp != null ? temp : null;
}
- public static ItemStack getEmptyCell(){
+ public static ItemStack getEmptyCell() {
return getEmptyCell(1);
}
- public static ItemStack getEmptyCell(int i){
+ public static ItemStack getEmptyCell(int i) {
if (ItemList.Cell_Empty.hasBeenSet()) {
return ItemList.Cell_Empty.get(i);
- }
+ }
final ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", i, 0);
return temp != null ? temp : null;
}
- public static void getItemForOreDict(final String FQRN, final String oreDictName, final String itemName, final int meta){
+ public static void getItemForOreDict(final String FQRN, final String oreDictName, final String itemName,
+ final int meta) {
try {
Item em = null;
final Item em1 = getItem(FQRN);
- //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta);
- if (em1 != null){
+ // Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta);
+ if (em1 != null) {
em = em1;
}
- if (em != null){
+ if (em != null) {
- final ItemStack metaStack = new ItemStack(em,1,meta);
+ final ItemStack metaStack = new ItemStack(em, 1, meta);
GT_OreDictUnificator.registerOre(oreDictName, metaStack);
- /*ItemStack itemStackWithMeta = new ItemStack(em,1,meta);
- GT_OreDictUnificator.registerOre(oreDictName, new ItemStack(itemStackWithMeta.getItem()));*/
+ /*
+ * ItemStack itemStackWithMeta = new ItemStack(em,1,meta);
+ * GT_OreDictUnificator.registerOre(oreDictName, new
+ * ItemStack(itemStackWithMeta.getItem()));
+ */
}
} catch (final NullPointerException e) {
- Logger.ERROR(itemName+" not found. [NULL]");
+ Logger.ERROR(itemName + " not found. [NULL]");
}
}
- public static void addItemToOreDictionary(final ItemStack stack, final String oreDictName){
+ public static void addItemToOreDictionary(final ItemStack stack, final String oreDictName) {
try {
GT_OreDictUnificator.registerOre(oreDictName, stack);
} catch (final NullPointerException e) {
- Logger.ERROR(stack.getDisplayName()+" not registered. [NULL]");
+ Logger.ERROR(stack.getDisplayName() + " not registered. [NULL]");
}
}
- public static ItemStack getItemStackWithMeta(final boolean MOD, final String FQRN, final String itemName, final int meta, final int itemstackSize){
- if (MOD){
+ public static ItemStack getItemStackWithMeta(final boolean MOD, final String FQRN, final String itemName,
+ final int meta, final int itemstackSize) {
+ if (MOD) {
try {
Item em = null;
final Item em1 = getItem(FQRN);
- //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta);
- if (em1 != null){
- if (null == em){
+ // Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta);
+ if (em1 != null) {
+ if (null == em) {
em = em1;
}
- if (em != null){
- final ItemStack metaStack = new ItemStack(em,itemstackSize,meta);
+ if (em != null) {
+ final ItemStack metaStack = new ItemStack(em, itemstackSize, meta);
return metaStack;
}
}
return null;
} catch (final NullPointerException e) {
- Logger.ERROR(itemName+" not found. [NULL]");
+ Logger.ERROR(itemName + " not found. [NULL]");
return null;
}
}
return null;
}
- public static ItemStack simpleMetaStack(final String FQRN, final int meta, final int itemstackSize){
+ public static ItemStack simpleMetaStack(final String FQRN, final int meta, final int itemstackSize) {
try {
Item em = null;
final Item em1 = getItem(FQRN);
- //Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta);
- if (em1 != null){
- if (null == em){
+ // Utils.LOG_WARNING("Found: "+em1.getUnlocalizedName()+":"+meta);
+ if (em1 != null) {
+ if (null == em) {
em = em1;
}
- if (em != null){
- final ItemStack metaStack = new ItemStack(em,itemstackSize,meta);
+ if (em != null) {
+ final ItemStack metaStack = new ItemStack(em, itemstackSize, meta);
return metaStack;
}
}
return null;
} catch (final NullPointerException e) {
- Logger.ERROR(FQRN+" not found. [NULL]");
+ Logger.ERROR(FQRN + " not found. [NULL]");
return null;
}
}
@SuppressWarnings("unused")
- public static ItemStack simpleMetaStack(final Item item, final int meta, final int size){
+ public static ItemStack simpleMetaStack(final Item item, final int meta, final int size) {
try {
- if (item == null){
+ if (item == null) {
return null;
}
Item em = item;
final Item em1 = item;
- Logger.WARNING("Found: "+em1.getUnlocalizedName()+":"+meta);
- if (em1 != null){
- if (null == em){
+ Logger.WARNING("Found: " + em1.getUnlocalizedName() + ":" + meta);
+ if (em1 != null) {
+ if (null == em) {
em = em1;
}
- if (em != null){
- final ItemStack metaStack = new ItemStack(em,size,meta);
+ if (em != null) {
+ final ItemStack metaStack = new ItemStack(em, size, meta);
return metaStack;
}
}
return null;
} catch (final NullPointerException e) {
- //Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]");
+ // Utils.LOG_ERROR(item.getUnlocalizedName()+" not found. [NULL]");
return null;
}
}
@@ -205,10 +216,10 @@ public class ItemUtils {
return simpleMetaStack(Item.getItemFromBlock(block), meta, size);
}
- public static ItemStack getCorrectStacktype(final String fqrn, final int stackSize){
+ public static ItemStack getCorrectStacktype(final String fqrn, final int stackSize) {
final String oreDict = "ore:";
ItemStack temp;
- if (fqrn.toLowerCase().contains(oreDict.toLowerCase())){
+ if (fqrn.toLowerCase().contains(oreDict.toLowerCase())) {
final String sanitizedName = fqrn.replace(oreDict, "");
temp = ItemUtils.getItemStack(sanitizedName, stackSize);
return temp;
@@ -217,17 +228,19 @@ public class ItemUtils {
String temp1;
String temp2;
temp1 = fqrnSplit[1];
- if (fqrnSplit.length < 3){temp2 = "0";}
- else {temp2 = fqrnSplit[2];}
+ if (fqrnSplit.length < 3) {
+ temp2 = "0";
+ } else {
+ temp2 = fqrnSplit[2];
+ }
temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, temp1, Integer.parseInt(temp2), stackSize);
return temp;
}
public static ItemStack getCorrectStacktype(final Object item_Input, final int stackSize) {
- if (item_Input instanceof String){
+ if (item_Input instanceof String) {
return getItemStackOfAmountFromOreDictNoBroken((String) item_Input, stackSize);
- }
- else if (item_Input instanceof ItemStack){
+ } else if (item_Input instanceof ItemStack) {
return (ItemStack) item_Input;
}
return null;
@@ -245,133 +258,160 @@ public class ItemUtils {
return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size);
}
- public static void generateSpawnEgg(final String entityModID, final String parSpawnName, final int colourEgg, final int colourOverlay){
- final Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName(CORE.MODID+":spawn_egg");
- GameRegistry.registerItem(itemSpawnEgg, "spawnEgg"+parSpawnName);
+ public static void generateSpawnEgg(final String entityModID, final String parSpawnName, final int colourEgg,
+ final int colourOverlay) {
+ final Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay)
+ .setUnlocalizedName("spawn_egg_" + parSpawnName.toLowerCase())
+ .setTextureName(CORE.MODID + ":spawn_egg");
+ GameRegistry.registerItem(itemSpawnEgg, "spawnEgg" + parSpawnName);
}
-
- public static ItemStack[] validItemsForOreDict(final String oredictName){
+ public static ItemStack[] validItemsForOreDict(final String oredictName) {
final List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName);
final ItemStack[] inputs = new ItemStack[validNames.size()];
- for (int i=0; i<validNames.size();i++){
+ for (int i = 0; i < validNames.size(); i++) {
inputs[i] = (ItemStack) validNames.get(i);
}
return inputs;
}
- public static ItemStack getItemStackOfAmountFromOreDict(final String oredictName, final int amount){
+ public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, final int amount) {
String mTemp = oredictName;
- //Banned Materials and replacements for GT5.8 compat.
- if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
- if (oredictName.toLowerCase().contains("rutile")){
- mTemp = oredictName.replace("Rutile", "Titanium");
+
+ if (oredictName.contains("-") || oredictName.contains("_")) {
+ mTemp = Utils.sanitizeString(mTemp, new char[] {'-', '_'});
+ }
+ else {
+ mTemp = Utils.sanitizeString(mTemp);
+ }
+
+ // Banned Materials and replacements for GT5.8 compat.
+
+ if (oredictName.toLowerCase().contains("ingotclay")) {
+ return getSimpleStack(Items.clay_ball, amount);
}
- if (oredictName.toLowerCase().contains("vanadiumsteel")){
- mTemp = oredictName.replace("VanadiumSteel", "StainlessSteel");
- }
+
+ if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ if (oredictName.toLowerCase().contains("rutile")) {
+ mTemp = oredictName.replace("Rutile", "Titanium");
+ }
+ if (oredictName.toLowerCase().contains("vanadiumsteel")) {
+ mTemp = oredictName.replace("VanadiumSteel", "StainlessSteel");
+ }
}
final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(mTemp);
- if (!oreDictList.isEmpty()){
+ if (!oreDictList.isEmpty()) {
final ItemStack returnValue = oreDictList.get(0).copy();
returnValue.stackSize = amount;
return returnValue;
}
- return getSimpleStack(ModItems.AAA_Broken, amount);
+ Logger.INFO("Failed to find `" + oredictName + "` in OD.");
+ return getErrorStack(amount);
+ //return getItemStackOfAmountFromOreDictNoBroken(mTemp, amount);
}
- public static ItemStack getItemStackOfAmountFromOreDictNoBroken(final String oredictName, final int amount){
- if (CORE.DEBUG){
- Logger.WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(1));
- Logger.WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(2));
- Logger.WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(3));
- Logger.WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(4));
- Logger.WARNING("Looking up: "+oredictName+" - from method: "+ReflectionUtils.getMethodName(5));
- }
+ public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, final int amount) {
+ if (CORE.DEBUG) {
+ Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(1));
+ Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(2));
+ Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(3));
+ Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(4));
+ Logger.WARNING("Looking up: " + oredictName + " - from method: " + ReflectionUtils.getMethodName(5));
+ }
+
+ try {
- try{
+ if (oredictName.contains("-") || oredictName.contains("_")) {
+ oredictName = Utils.sanitizeString(oredictName, new char[] {'-', '_'});
+ }
+ else {
+ oredictName = Utils.sanitizeString(oredictName);
+ }
- //Adds a check to grab dusts using GT methodology if possible.
+ // Adds a check to grab dusts using GT methodology if possible.
ItemStack returnValue = null;
- if (oredictName.toLowerCase().contains("dust")){
+ if (oredictName.toLowerCase().contains("dust")) {
final String MaterialName = oredictName.toLowerCase().replace("dust", "");
final Materials m = Materials.get(MaterialName);
returnValue = getGregtechDust(m, amount);
- if (returnValue != null){
+ if (returnValue != null) {
return returnValue;
}
}
- if (returnValue == null){
- returnValue = getItemStackOfAmountFromOreDict(oredictName, amount);
- if (returnValue != null){
- if ((returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass()) || (returnValue.getItem() != ModItems.AAA_Broken)){
- return returnValue.copy();
- }
+ /*if (returnValue == null) {
+ returnValue = getItemStackOfAmountFromOreDict(oredictName, amount);
+ if (ItemUtils.checkForInvalidItems(returnValue)) {
+ return returnValue.copy();
}
- }
- Logger.WARNING(oredictName+" was not valid.");
+ }*/
+ Logger.RECIPE(oredictName + " was not valid.");
return null;
- }
- catch (final Throwable t){
+ } catch (final Throwable t) {
return null;
}
}
- public static ItemStack getGregtechDust(final Materials material, final int amount){
+ public static ItemStack getGregtechDust(final Materials material, final int amount) {
final ItemStack returnValue = GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L);
- if (returnValue != null){
- if ((returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass()) || (returnValue.getItem() != ModItems.AAA_Broken)){
+ if (returnValue != null) {
+ if ((returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass())
+ || (returnValue.getItem() != ModItems.AAA_Broken)) {
return returnValue.copy();
}
}
- Logger.WARNING(material+" was not valid.");
+ Logger.WARNING(material + " was not valid.");
return null;
}
- //NullFormula
- public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName, final int Colour){
+ // NullFormula
+ public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName,
+ final int Colour) {
return generateSpecialUseDusts(unlocalizedName, materialName, "NullFormula", Colour);
}
- public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName, String mChemForm, final int Colour){
+ public static Item[] generateSpecialUseDusts(final String unlocalizedName, final String materialName,
+ String mChemForm, final int Colour) {
final Item[] output = {
- new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, mChemForm, Colour, "Dust"),
- new BaseItemDustUnique("itemDustSmall"+unlocalizedName, materialName, mChemForm, Colour, "Small"),
- new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, mChemForm, Colour, "Tiny")};
+ new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, mChemForm, Colour, "Dust"),
+ new BaseItemDustUnique("itemDustSmall" + unlocalizedName, materialName, mChemForm, Colour, "Small"),
+ new BaseItemDustUnique("itemDustTiny" + unlocalizedName, materialName, mChemForm, Colour, "Tiny") };
return output;
}
- public static Item generateSpecialUsePlate(final String internalName, final String displayName, final short[] rgb, final int radioactivity){
- return generateSpecialUsePlate(internalName, displayName, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), radioactivity);
+ public static Item generateSpecialUsePlate(final String internalName, final String displayName, final short[] rgb,
+ final int radioactivity) {
+ return generateSpecialUsePlate(internalName, displayName, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]),
+ radioactivity);
}
- public static Item generateSpecialUsePlate(final String internalName, final String displayName, final String mFormula, final short[] rgb, final int radioactivity){
- return generateSpecialUsePlate(internalName, displayName, mFormula, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), radioactivity);
+ public static Item generateSpecialUsePlate(final String internalName, final String displayName,
+ final String mFormula, final short[] rgb, final int radioactivity) {
+ return generateSpecialUsePlate(internalName, displayName, mFormula, Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]),
+ radioactivity);
}
- public static Item generateSpecialUsePlate(final String internalName, final String displayName, final int rgb, final int radioactivity){
+ public static Item generateSpecialUsePlate(final String internalName, final String displayName, final int rgb,
+ final int radioactivity) {
return new BaseItemPlate_OLD(internalName, displayName, rgb, radioactivity);
}
- public static Item generateSpecialUsePlate(final String internalName, final String displayName, final String mFormula, final int rgb, final int radioactivity){
+ public static Item generateSpecialUsePlate(final String internalName, final String displayName,
+ final String mFormula, final int rgb, final int radioactivity) {
return new BaseItemPlate_OLD(internalName, displayName, mFormula, rgb, radioactivity);
}
- public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust){
+ public static Item[] generateSpecialUseDusts(final Material material, final boolean onlyLargeDust) {
final String materialName = material.getLocalizedName();
final String unlocalizedName = Utils.sanitizeString(materialName);
final int Colour = material.getRgbAsHex();
Item[] output = null;
- if (onlyLargeDust == false){
- output = new Item[]{
- new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust"),
- new BaseItemDustUnique("itemDustSmall"+unlocalizedName, materialName, Colour, "Small"),
- new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, Colour, "Tiny")};
- } else{
- output = new Item[]{
- new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust")
- };
+ if (onlyLargeDust == false) {
+ output = new Item[] { new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, Colour, "Dust"),
+ new BaseItemDustUnique("itemDustSmall" + unlocalizedName, materialName, Colour, "Small"),
+ new BaseItemDustUnique("itemDustTiny" + unlocalizedName, materialName, Colour, "Tiny") };
+ } else {
+ output = new Item[] { new BaseItemDustUnique("itemDust" + unlocalizedName, materialName, Colour, "Dust") };
}
new RecipeGen_DustGeneration(material);
@@ -379,118 +419,99 @@ public class ItemUtils {
return output;
}
- public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final Materials material){
+ public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final Materials material) {
final ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material);
final int enchantLevel = material.mEnchantmentToolsLevel;
final Object enchant = new Pair(material.mEnchantmentTools, enchantLevel);
- return generateMultiPick(GT_Durability, customMaterial, material.mDefaultLocalName, material.mDurability, material.mRGBa, enchant);
+ return generateMultiPick(GT_Durability, customMaterial, material.mDefaultLocalName, material.mDurability,
+ material.mRGBa, enchant);
}
- public static MultiPickaxeBase generateMultiPick(final Material material){
+ public static MultiPickaxeBase generateMultiPick(final Material material) {
final ToolMaterial customMaterial = Utils.generateToolMaterial(material);
- return generateMultiPick(true, customMaterial, material.getLocalizedName(), (int) material.vDurability, material.getRGBA(), null);
+ return generateMultiPick(true, customMaterial, material.getLocalizedName(), (int) material.vDurability,
+ material.getRGBA(), null);
}
- public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final ToolMaterial customMaterial, final String name, final int durability, final short[] rgba, final Object enchantment){
- Logger.WARNING("Generating a Multi-Pick out of "+name);
+ public static MultiPickaxeBase generateMultiPick(final boolean GT_Durability, final ToolMaterial customMaterial,
+ final String name, final int durability, final short[] rgba, final Object enchantment) {
+ Logger.WARNING("Generating a Multi-Pick out of " + name);
final short[] rgb = rgba;
int dur = customMaterial.getMaxUses();
- Logger.WARNING("Determined durability for "+name+" is "+dur);
- if (GT_Durability){
- dur = durability*100;
- Logger.WARNING("Using gregtech durability value, "+name+" is now "+dur+".");
- }
- else if (dur <= 0){
+ Logger.WARNING("Determined durability for " + name + " is " + dur);
+ if (GT_Durability) {
+ dur = durability * 100;
+ Logger.WARNING("Using gregtech durability value, " + name + " is now " + dur + ".");
+ } else if (dur <= 0) {
dur = durability;
- Logger.WARNING("Determined durability too low, "+name+" is now "+dur+" based on the GT material durability.");
+ Logger.WARNING("Determined durability too low, " + name + " is now " + dur
+ + " based on the GT material durability.");
}
- if (dur <= 0){
- Logger.WARNING("Still too low, "+name+" will now go unused.");
+ if (dur <= 0) {
+ Logger.WARNING("Still too low, " + name + " will now go unused.");
return null;
}
Object enchant;
- if (enchantment != null){
- if (enchantment instanceof Pair){
+ if (enchantment != null) {
+ if (enchantment instanceof Pair) {
enchant = enchantment;
}
- }
- else {
+ } else {
enchant = null;
}
- final MultiPickaxeBase MP_Redstone = new MultiPickaxeBase(
- name+" Multipick",
- (customMaterial),
- dur,
- Utils.rgbtoHexValue(rgb[0],rgb[1],rgb[2]),
- enchantment);
+ final MultiPickaxeBase MP_Redstone = new MultiPickaxeBase(name + " Multipick", (customMaterial), dur,
+ Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]), enchantment);
- if (MP_Redstone.isValid){
+ if (MP_Redstone.isValid) {
return MP_Redstone;
}
Logger.WARNING("Pickaxe was not valid.");
return null;
}
-
-
-
-
-
- public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final Materials material){
+ public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final Materials material) {
final ToolMaterial customMaterial = Utils.generateToolMaterialFromGT(material);
- return generateMultiShovel(GT_Durability, customMaterial, material.mDefaultLocalName, material.mDurability, material.mRGBa);
+ return generateMultiShovel(GT_Durability, customMaterial, material.mDefaultLocalName, material.mDurability,
+ material.mRGBa);
}
- public static MultiSpadeBase generateMultiShovel(final Material material){
+ public static MultiSpadeBase generateMultiShovel(final Material material) {
final ToolMaterial customMaterial = Utils.generateToolMaterial(material);
- return generateMultiShovel(true, customMaterial, material.getLocalizedName(), (int) material.vDurability, material.getRGBA());
+ return generateMultiShovel(true, customMaterial, material.getLocalizedName(), (int) material.vDurability,
+ material.getRGBA());
}
- public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final ToolMaterial customMaterial, final String name, final int durability, final short[] rgba){
- Logger.WARNING("Generating a Multi-Spade out of "+name);
+ public static MultiSpadeBase generateMultiShovel(final boolean GT_Durability, final ToolMaterial customMaterial,
+ final String name, final int durability, final short[] rgba) {
+ Logger.WARNING("Generating a Multi-Spade out of " + name);
final short[] rgb = rgba;
int dur = customMaterial.getMaxUses();
- Logger.WARNING("Determined durability for "+name+" is "+dur);
- if (GT_Durability){
- dur = durability*100;
- Logger.WARNING("Using gregtech durability value, "+name+" is now "+dur+".");
- }
- else if (dur <= 0){
+ Logger.WARNING("Determined durability for " + name + " is " + dur);
+ if (GT_Durability) {
+ dur = durability * 100;
+ Logger.WARNING("Using gregtech durability value, " + name + " is now " + dur + ".");
+ } else if (dur <= 0) {
dur = durability;
- Logger.WARNING("Determined durability too low, "+name+" is now "+dur+" based on the GT material durability.");
+ Logger.WARNING("Determined durability too low, " + name + " is now " + dur
+ + " based on the GT material durability.");
}
- if (dur <= 0){
- Logger.WARNING("Still too low, "+name+" will now go unused.");
+ if (dur <= 0) {
+ Logger.WARNING("Still too low, " + name + " will now go unused.");
return null;
}
- final MultiSpadeBase MP_Redstone = new MultiSpadeBase(
- name+" Multispade",
- (customMaterial),
- dur,
- Utils.rgbtoHexValue(rgb[0],rgb[1],rgb[2])
- );
+ final MultiSpadeBase MP_Redstone = new MultiSpadeBase(name + " Multispade", (customMaterial), dur,
+ Utils.rgbtoHexValue(rgb[0], rgb[1], rgb[2]));
- if (MP_Redstone.isValid){
+ if (MP_Redstone.isValid) {
return MP_Redstone;
}
return null;
}
-
-
-
-
-
-
-
-
-
-
-
- public static BaseItemDecidust generateDecidust(final Materials material){
- if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){
+ public static BaseItemDecidust generateDecidust(final Materials material) {
+ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null) {
final Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material);
if (placeholder != null) {
generateDecidust(placeholder);
@@ -499,16 +520,16 @@ public class ItemUtils {
return null;
}
- public static BaseItemDecidust generateDecidust(final Material material){
- if ((material.getDust(1) != null) && MaterialUtils.hasValidRGBA(material.getRGBA())){
+ public static BaseItemDecidust generateDecidust(final Material material) {
+ if ((material.getDust(1) != null) && MaterialUtils.hasValidRGBA(material.getRGBA())) {
final BaseItemDecidust Decidust = new BaseItemDecidust(material);
return Decidust;
}
return null;
}
- public static BaseItemCentidust generateCentidust(final Materials material){
- if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){
+ public static BaseItemCentidust generateCentidust(final Materials material) {
+ if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null) {
final Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material);
if (placeholder != null) {
generateCentidust(placeholder);
@@ -517,53 +538,48 @@ public class ItemUtils {
return null;
}
- public static BaseItemCentidust generateCentidust(final Material material){
- if ((material.getDust(1) != null) && MaterialUtils.hasValidRGBA(material.getRGBA())){
+ public static BaseItemCentidust generateCentidust(final Material material) {
+ if ((material.getDust(1) != null) && MaterialUtils.hasValidRGBA(material.getRGBA())) {
final BaseItemCentidust Centidust = new BaseItemCentidust(material);
return Centidust;
}
return null;
}
- public static boolean isRadioactive(final String materialName){
+ public static boolean isRadioactive(final String materialName) {
int sRadiation = 0;
- if (materialName.toLowerCase().contains("uranium")){
+ if (materialName.toLowerCase().contains("uranium")) {
sRadiation = 2;
- }
- else if (materialName.toLowerCase().contains("plutonium")){
+ } else if (materialName.toLowerCase().contains("plutonium")) {
sRadiation = 4;
- }
- else if (materialName.toLowerCase().contains("thorium")){
+ } else if (materialName.toLowerCase().contains("thorium")) {
sRadiation = 1;
}
- if (sRadiation >= 1){
+ if (sRadiation >= 1) {
return true;
}
return false;
}
- public static int getRadioactivityLevel(final String materialName){
+ public static int getRadioactivityLevel(final String materialName) {
int sRadiation = 0;
- if (materialName.toLowerCase().contains("uranium")){
+ if (materialName.toLowerCase().contains("uranium")) {
sRadiation = 2;
- }
- else if (materialName.toLowerCase().contains("plutonium")){
+ } else if (materialName.toLowerCase().contains("plutonium")) {
sRadiation = 4;
- }
- else if (materialName.toLowerCase().contains("thorium")){
+ } else if (materialName.toLowerCase().contains("thorium")) {
sRadiation = 1;
}
return sRadiation;
}
-
- public static String getArrayStackNames(final FluidStack[] aStack){
+
+ public static String getArrayStackNames(final FluidStack[] aStack) {
String itemNames = "Fluid Array: ";
- for (final FluidStack alph : aStack){
- if (alph != null){
+ for (final FluidStack alph : aStack) {
+ if (alph != null) {
final String temp = itemNames;
itemNames = temp + ", " + alph.getLocalizedName() + " x" + alph.amount;
- }
- else {
+ } else {
final String temp = itemNames;
itemNames = temp + ", " + "null" + " x" + "0";
}
@@ -571,15 +587,14 @@ public class ItemUtils {
return itemNames;
}
- public static String getArrayStackNames(final ItemStack[] aStack){
+ public static String getArrayStackNames(final ItemStack[] aStack) {
String itemNames = "Item Array: ";
- for (final ItemStack alph : aStack){
+ for (final ItemStack alph : aStack) {
- if (alph != null){
+ if (alph != null) {
final String temp = itemNames;
itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize;
- }
- else {
+ } else {
final String temp = itemNames;
itemNames = temp + ", " + "null" + " x" + "0";
}
@@ -587,10 +602,10 @@ public class ItemUtils {
return itemNames;
}
- public static String[] getArrayStackNamesAsArray(final ItemStack[] aStack){
+ public static String[] getArrayStackNamesAsArray(final ItemStack[] aStack) {
final String[] itemNames = {};
int arpos = 0;
- for (final ItemStack alph : aStack){
+ for (final ItemStack alph : aStack) {
itemNames[arpos] = alph.getDisplayName();
arpos++;
}
@@ -598,9 +613,9 @@ public class ItemUtils {
}
- public static String getFluidArrayStackNames(final FluidStack[] aStack){
+ public static String getFluidArrayStackNames(final FluidStack[] aStack) {
String itemNames = "Fluid Array: ";
- for (final FluidStack alph : aStack){
+ for (final FluidStack alph : aStack) {
final String temp = itemNames;
itemNames = temp + ", " + alph.getFluid().getName() + " x" + alph.amount;
}
@@ -608,19 +623,21 @@ public class ItemUtils {
}
- public static ItemStack getGregtechCircuit(final int Meta){
- return ItemUtils.getItemStackWithMeta(LoadedMods.Gregtech, "gregtech:gt.integrated_circuit", "Gregtech Circuit", Meta, 0);
+ public static ItemStack getGregtechCircuit(final int Meta) {
+ return ItemUtils.getItemStackWithMeta(LoadedMods.Gregtech, "gregtech:gt.integrated_circuit", "Gregtech Circuit",
+ Meta, 0);
}
+
public static ItemStack[] getBlockDrops(final ArrayList<ItemStack> blockDrops) {
- if (blockDrops == null){
+ if (blockDrops == null) {
return null;
}
- if (blockDrops.isEmpty()){
+ if (blockDrops.isEmpty()) {
return null;
}
final ItemStack[] outputs = new ItemStack[blockDrops.size()];
short forCounter = 0;
- for (final ItemStack I : blockDrops){
+ for (final ItemStack I : blockDrops) {
outputs[forCounter++] = I;
}
return outputs;
@@ -628,7 +645,7 @@ public class ItemUtils {
private static Map<Item, String> mModidCache = new HashMap<Item, String>();
- private static String getModId(final Item item) {
+ private static String getModId(final Item item) {
if (mModidCache.containsKey(item)) {
return mModidCache.get(item);
}
@@ -639,15 +656,14 @@ public class ItemUtils {
final String modname = (id.modId == null ? id.name : id.modId);
value = ((id == null) || id.modId.equals("")) ? "minecraft" : modname;
}
- } catch (final Throwable t){
+ } catch (final Throwable t) {
try {
final UniqueIdentifier t2 = GameRegistry.findUniqueIdentifierFor(Block.getBlockFromItem(item));
if (t2 != null) {
final String modname = (t2.modId == null ? t2.name : t2.modId);
value = ((t2 == null) || t2.modId.equals("")) ? "minecraft" : modname;
}
- }
- catch (final Throwable t3){
+ } catch (final Throwable t3) {
t3.printStackTrace();
value = "bad modid";
}
@@ -662,14 +678,14 @@ public class ItemUtils {
return getModId(key.getItem());
}
- //Take 2 - GT/GT++ Dusts
- public static ItemStack getGregtechDust(final String oredictName, final int amount){
+ // Take 2 - GT/GT++ Dusts
+ public static ItemStack getGregtechDust(final String oredictName, final int amount) {
final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
- if (!oreDictList.isEmpty()){
+ if (!oreDictList.isEmpty()) {
ItemStack returnvalue;
- for (int xrc=0;xrc<oreDictList.size();xrc++){
+ for (int xrc = 0; xrc < oreDictList.size(); xrc++) {
final String modid = getModId(oreDictList.get(xrc).getItem());
- if (modid != null && (modid.equals("gregtech") || modid.equals(CORE.MODID))){
+ if (modid != null && (modid.equals("gregtech") || modid.equals(CORE.MODID))) {
returnvalue = oreDictList.get(xrc).copy();
returnvalue.stackSize = amount;
return returnvalue;
@@ -679,192 +695,202 @@ public class ItemUtils {
return getNonTinkersDust(oredictName, amount);
}
- //Anything But Tinkers Dust
- public static ItemStack getNonTinkersDust(final String oredictName, final int amount){
+ // Anything But Tinkers Dust
+ public static ItemStack getNonTinkersDust(final String oredictName, final int amount) {
final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
- if (!oreDictList.isEmpty()){
+ if (!oreDictList.isEmpty()) {
ItemStack returnvalue;
- for (int xrc=0;xrc<oreDictList.size();xrc++){
+ for (int xrc = 0; xrc < oreDictList.size(); xrc++) {
final String modid = getModId(oreDictList.get(xrc).getItem());
- if (modid != null && !modid.equals("tconstruct")){
+ if (modid != null && !modid.equals("tconstruct")) {
returnvalue = oreDictList.get(xrc).copy();
returnvalue.stackSize = amount;
return returnvalue;
}
}
}
- //If only Tinkers dust exists, bow down and just use it.
+ // If only Tinkers dust exists, bow down and just use it.
return getItemStackOfAmountFromOreDictNoBroken(oredictName, amount);
}
+ @Deprecated
public static ItemStack getGregtechOreStack(OrePrefixes mPrefix, Materials mMat, int mAmount) {
+ ItemStack aTemp = getOrePrefixStack(mPrefix, mMat, mAmount);
+ if (aTemp != null) {
+ return aTemp;
+ }
+
String mName = MaterialUtils.getMaterialName(mMat);
- String mItemName = mPrefix.name()+mName;
- //Utils.LOG_INFO("[Component Maker] Trying to get "+mItemName+".");
- ItemStack gregstack = ItemUtils.getItemStackOfAmountFromOreDict(mItemName, mAmount);
- if (gregstack == null){
- //Utils.LOG_INFO("[Component Maker] Failed to get "+mItemName+".");
+ String mItemName = mPrefix.name() + mName;
+ // Utils.LOG_INFO("[Component Maker] Trying to get "+mItemName+".");
+ ItemStack gregstack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(mItemName, mAmount);
+ if (gregstack == null) {
+ // Utils.LOG_INFO("[Component Maker] Failed to get "+mItemName+".");
return null;
- }
- //Utils.LOG_INFO("[Component Maker] Found "+mItemName+".");
+ }
+ // Utils.LOG_INFO("[Component Maker] Found "+mItemName+".");
return (gregstack);
}
-
public static ItemStack getOrePrefixStack(OrePrefixes mPrefix, Material mMat, int mAmount) {
String mName = Utils.sanitizeString(mMat.getLocalizedName());
- String mItemName = mPrefix.name()+mName;
- ItemStack gregstack = ItemUtils.getItemStackOfAmountFromOreDict(mItemName, mAmount);
- if (gregstack == null){
+ String mItemName = mPrefix.name() + mName;
+ ItemStack gregstack = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(mItemName, mAmount);
+ if (gregstack == null) {
return null;
- }
+ }
return (gregstack);
}
-
+
public static ItemStack getOrePrefixStack(OrePrefixes mPrefix, Materials mMat, int mAmount) {
ItemStack aGtStack = GT_OreDictUnificator.get(mPrefix, mMat, mAmount);
if (aGtStack == null) {
+ Logger.INFO(
+ "Failed to find `" + mPrefix + MaterialUtils.getMaterialName(mMat) + "` in OD. [Prefix Search]");
return getErrorStack(mAmount);
- }
- else {
+ } else {
return aGtStack;
}
}
public static ItemStack getErrorStack(int mAmount) {
+ //System.exit(1);
+ try {
+ new GregtechException("Logging - [Issue #999]");
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+
return getSimpleStack(ModItems.AAA_Broken, mAmount);
+ //return null;
}
- public static ItemStack[] getStackOfAllOreDictGroup(String oredictname){
+
+ public static ItemStack[] getStackOfAllOreDictGroup(String oredictname) {
final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictname);
- if (!oreDictList.isEmpty()){
- final ItemStack[] returnValues = new ItemStack[oreDictList.size()];
- for (int i=0;i<oreDictList.size();i++){
- if (oreDictList.get(i) != null){
- returnValues[i] = oreDictList.get(i);
+ if (!oreDictList.isEmpty()) {
+ final ItemStack[] returnValues = new ItemStack[oreDictList.size()];
+ for (int i = 0; i < oreDictList.size(); i++) {
+ if (oreDictList.get(i) != null) {
+ returnValues[i] = oreDictList.get(i);
}
- }
- return returnValues.length>0 ? returnValues : null;
- }
- else {
+ }
+ return returnValues.length > 0 ? returnValues : null;
+ } else {
return null;
}
}
- public static boolean registerFuel(ItemStack aBurnable, int burn){
+ public static boolean registerFuel(ItemStack aBurnable, int burn) {
return CORE.burnables.add(new Pair<Integer, ItemStack>(burn, aBurnable));
}
-
/**
* Quick Block Name Lookup that is friendly to servers and locale.
*/
private static volatile Map<String, String> mLocaleCache = new HashMap<String, String>();
+
public static String getLocalizedNameOfBlock(BlockPos pos) {
Block block = pos.world.getBlock(pos.xPos, pos.yPos, pos.zPos);
int metaData = pos.world.getBlockMetadata(pos.xPos, pos.yPos, pos.zPos);
- return getLocalizedNameOfBlock(block, metaData);
+ return getLocalizedNameOfBlock(block, metaData);
}
-
+
public synchronized static String getLocalizedNameOfBlock(Block block, int meta) {
if (block == null || meta < 0) {
return "Bad Block";
}
- String mCacheKey = block.getUnlocalizedName()+":"+meta;
+ String mCacheKey = block.getUnlocalizedName() + ":" + meta;
if (mLocaleCache.containsKey(mCacheKey)) {
- //Recache the key if it's invalid.
+ // Recache the key if it's invalid.
if (mLocaleCache.get(mCacheKey).toLowerCase().contains(".name")) {
mLocaleCache.remove(mCacheKey);
String mNew = ItemUtils.simpleMetaStack(block, meta, 1).getDisplayName();
- //Logger.INFO("Re-caching "+mNew+" into locale cache.");
+ // Logger.INFO("Re-caching "+mNew+" into locale cache.");
mLocaleCache.put(mCacheKey, mNew);
}
return mLocaleCache.get(mCacheKey);
- }
- else {
+ } else {
Item item = Item.getItemFromBlock(block);
if (item == null) {
return "Bad Item";
- }
+ }
String unlocalizedName = item.getUnlocalizedName(new ItemStack(block, 1, meta));
- String blockName = StatCollector.translateToLocal(unlocalizedName + ".name");
+ String blockName = StatCollector.translateToLocal(unlocalizedName + ".name");
if (blockName.toLowerCase().contains(".name")) {
blockName = ItemUtils.simpleMetaStack(block, meta, 1).getDisplayName();
- }
+ }
mLocaleCache.put(mCacheKey, blockName);
return blockName;
- }
+ }
}
-
-
public static boolean checkForInvalidItems(ItemStack mInput) {
- return checkForInvalidItems(new ItemStack[] {mInput});
+ return checkForInvalidItems(new ItemStack[] { mInput });
}
-
+
public static boolean checkForInvalidItems(ItemStack[] mInput) {
return checkForInvalidItems(mInput, new ItemStack[] {});
}
-
+
/**
*
* @param mInputs
- * @return {@link Boolean} - True if {@link ItemStack}[] only contains valid items.
+ * @return {@link Boolean} - True if {@link ItemStack}[] only contains valid
+ * items.
*/
public static boolean checkForInvalidItems(ItemStack[] mInputs, ItemStack[] mOutputs) {
if (mInputs == null || mOutputs == null) {
return false;
- }
+ }
+
if (mInputs.length > 0) {
for (ItemStack stack : mInputs) {
if (stack != null) {
- if (stack.getItem() != null) {
- if (stack.getItem() == ModItems.AAA_Broken || stack.getItem().getClass() == ModItems.AAA_Broken.getClass()){
+ if (stack.getItem() != null) {
+ if (stack.getItem() == ModItems.AAA_Broken
+ || stack.getItem().getClass() == ModItems.AAA_Broken.getClass()) {
return false;
- }
- else if (stack.getItem() == ModItems.ZZZ_Empty || stack.getItem().getClass() == ModItems.ZZZ_Empty.getClass()){
+ } else if (stack.getItem() == ModItems.ZZZ_Empty
+ || stack.getItem().getClass() == ModItems.ZZZ_Empty.getClass()) {
return false;
- }
- else {
+ } else {
continue;
}
- }
- else {
+ } else {
continue;
}
- }
- else {
- continue;
+ } else {
+ return false;
}
}
- }
+ }
if (mOutputs.length > 0) {
for (ItemStack stack : mOutputs) {
if (stack != null) {
- if (stack.getItem() != null) {
- if (stack.getItem() == ModItems.AAA_Broken || stack.getItem().getClass() == ModItems.AAA_Broken.getClass()){
+ if (stack.getItem() != null) {
+ if (stack.getItem() == ModItems.AAA_Broken
+ || stack.getItem().getClass() == ModItems.AAA_Broken.getClass()) {
return false;
- }
- else if (stack.getItem() == ModItems.ZZZ_Empty || stack.getItem().getClass() == ModItems.ZZZ_Empty.getClass()){
+ } else if (stack.getItem() == ModItems.ZZZ_Empty
+ || stack.getItem().getClass() == ModItems.ZZZ_Empty.getClass()) {
return false;
- }
- else {
+ } else {
continue;
}
- }
- else {
+ } else {
continue;
}
- }
- else {
- continue;
+ } else {
+ return false;
}
}
}
-
+
return true;
}
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
index 91c546ca30..a5f5c778bf 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java
@@ -14,6 +14,7 @@ import net.minecraft.item.crafting.IRecipe;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
+import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.interfaces.RunnableWithInfo;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
@@ -23,6 +24,7 @@ import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler;
import gtPlusPlus.core.handler.Recipes.RegistrationHandler;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
@@ -30,6 +32,20 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
public class RecipeUtils {
public static int mInvalidID = 1;
public static boolean recipeBuilder(final Object slot_1, final Object slot_2, final Object slot_3, final Object slot_4, final Object slot_5, final Object slot_6, final Object slot_7, final Object slot_8, final Object slot_9, ItemStack resultItem){
+
+ if (gtPlusPlus.GTplusplus.CURRENT_LOAD_PHASE != GTplusplus.INIT_PHASE.POST_INIT) {
+ Logger.INFO(ReflectionUtils.getMethodName(1));
+ Logger.INFO(ReflectionUtils.getMethodName(2));
+ Logger.INFO(ReflectionUtils.getMethodName(3));
+ Logger.INFO(ReflectionUtils.getMethodName(4));
+ Logger.INFO(ReflectionUtils.getMethodName(5));
+ Logger.INFO(ReflectionUtils.getMethodName(6));
+ Logger.INFO(ReflectionUtils.getMethodName(7));
+ Logger.INFO(ReflectionUtils.getMethodName(8));
+ Logger.INFO(ReflectionUtils.getMethodName(9));
+ System.exit(1);
+ }
+
if (resultItem == null){
Logger.RECIPE("[Fix] Found a recipe with an invalid output, yet had a valid inputs. Using Dummy output so recipe can be found..");
resultItem = ItemUtils.getItemStackOfAmountFromOreDict("givemeabrokenitem", 1);
@@ -325,6 +341,21 @@ public static int mInvalidID = 1;
InputItem4, InputItem5, InputItem6,
InputItem7, InputItem8, InputItem9
};
+
+
+ if (gtPlusPlus.GTplusplus.CURRENT_LOAD_PHASE != GTplusplus.INIT_PHASE.POST_INIT) {
+ Logger.INFO(ReflectionUtils.getMethodName(1));
+ Logger.INFO(ReflectionUtils.getMethodName(2));
+ Logger.INFO(ReflectionUtils.getMethodName(3));
+ Logger.INFO(ReflectionUtils.getMethodName(4));
+ Logger.INFO(ReflectionUtils.getMethodName(5));
+ Logger.INFO(ReflectionUtils.getMethodName(6));
+ Logger.INFO(ReflectionUtils.getMethodName(7));
+ Logger.INFO(ReflectionUtils.getMethodName(8));
+ Logger.INFO(ReflectionUtils.getMethodName(9));
+ System.exit(1);
+ }
+
int size = COMPAT_HANDLER.mGtRecipesToGenerate.size();
COMPAT_HANDLER.mGtRecipesToGenerate.put(new InternalRecipeObject(o, OutputItem, true));