diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-12-24 03:59:59 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-12-24 03:59:59 +0000 |
commit | 12dab5d109ac81034fd0a8fe18317024a996af61 (patch) | |
tree | c08e9a305f081fef24df556126be744d19f4c0f8 /src/Java | |
parent | c1606dd2997151dbf09797092a04294230d42059 (diff) | |
download | GT5-Unofficial-12dab5d109ac81034fd0a8fe18317024a996af61.tar.gz GT5-Unofficial-12dab5d109ac81034fd0a8fe18317024a996af61.tar.bz2 GT5-Unofficial-12dab5d109ac81034fd0a8fe18317024a996af61.zip |
+ Added a config option to adjust the Turbine Rotor removal cut-off point.
+ Added some new Bags/Packs for various things. An Automatic Lunchbox, a Tool Box and a Magicians Satchel.
+ Added full compound of Eglin Steel to ABS. Closes #392.
- Removed all Multi-Tools.
$ Rewrote and Fixed the recipe system. All recipes are queued regardless of when called, then created during the end of the POST_INIT load phase. Fixes too many bugs to list. (Few more to do before tomorrow)
$ Fixed COFH Hard requirement. Closes #398.
% Adjusted the internal map type of the AutoMap. Should improve performance, if only in single digit cpu cycles.
> To-Do) Fix Recipes pertaining to compound materials made from using fluids. State may be detected wrong after recipe system changes.
Diffstat (limited to 'src/Java')
58 files changed, 2257 insertions, 1257 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 92c7a9a049..077efe102a 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -77,9 +77,14 @@ public class GTplusplus implements ActionListener { mPrev.setPhaseActive(false); } mIsPhaseActive = aIsPhaseActive; + if (CURRENT_LOAD_PHASE != this) { + CURRENT_LOAD_PHASE = this; + } } } + public static INIT_PHASE CURRENT_LOAD_PHASE = INIT_PHASE.SUPER; + //Mod Instance @Mod.Instance(CORE.MODID) public static GTplusplus instance; diff --git a/src/Java/gtPlusPlus/api/objects/GregtechException.java b/src/Java/gtPlusPlus/api/objects/GregtechException.java new file mode 100644 index 0000000000..916dbc4aaf --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/GregtechException.java @@ -0,0 +1,28 @@ +package gtPlusPlus.api.objects; + +public class GregtechException extends Throwable { + + private static final long serialVersionUID = 3601884582161841486L; + + public GregtechException(String aError) { + this(aError, true); + } + + public GregtechException(String aError, boolean aIsVerbose) { + Logger.ERROR("Throwing GT++ Exception!"); + Logger.ERROR("[EXCEPTION] "+aError); + if (aIsVerbose) { + Logger.INFO("Throwing GT++ Exception!"); + Logger.INFO("[EXCEPTION] "+aError); + printStackTrace(); + } + } + + @Override + public void printStackTrace() { + super.printStackTrace(); + } + + + +} diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index 45cce2eee5..ca231dbd63 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -19,12 +19,12 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable { public AutoMap() { - this(new HashMap<Integer, V>()); + this(new LinkedHashMap<Integer, V>()); } public AutoMap(Map<Integer, V> defaultMapType) { mInternalMap = defaultMapType; - mInternalNameMap = new HashMap<String, Integer>(); + mInternalNameMap = new LinkedHashMap<String, Integer>(); } @Override @@ -86,6 +86,7 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable { public synchronized boolean clear(){ this.mInternalID = 0; this.mInternalMap.clear(); + this.mInternalNameMap.clear(); return true; } 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)); diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_OB_Sprinkler.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_OB_Sprinkler.java deleted file mode 100644 index 7bb3779b6a..0000000000 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_OB_Sprinkler.java +++ /dev/null @@ -1,594 +0,0 @@ -package gtPlusPlus.preloader.asm.transformers; - -import static org.objectweb.asm.Opcodes.*; - -import java.io.IOException; -import org.apache.logging.log4j.Level; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; - -import cpw.mods.fml.relauncher.FMLRelaunchLog; - - -public class ClassTransformer_OB_Sprinkler { - - //The qualified name of the class we plan to transform. - private static final String className = "openblocks.common.tileentity.TileEntitySprinkler"; - //openblocks/common/tileentity/TileEntitySprinkler - - private final boolean isValid; - private final boolean isObfuscated; - private final ClassReader reader; - private final ClassWriter writer; - private final String mItemStackName; - private final String mWorldName; - private final String mItemName; - private final String mItemsName; - private final String mIInventoryName; - private final String mTileEntityName; - - public ClassTransformer_OB_Sprinkler(boolean obfuscated, byte[] basicClass) { - isObfuscated = obfuscated; - ClassReader aTempReader = null; - ClassWriter aTempWriter = null; - - mItemStackName = isObfuscated ? "add" : "net/minecraft/item/ItemStack"; - mWorldName = isObfuscated ? "ahc" : "net/minecraft/world/World"; - mItemName = isObfuscated ? "adb" : "net/minecraft/item/Item"; - mItemsName = isObfuscated ? "ade" : "net/minecraft/init/Items"; - mIInventoryName = isObfuscated ? "rb" : "net/minecraft/inventory/IInventory"; - mTileEntityName = isObfuscated ? "aor" : "net/minecraft/tileentity/TileEntity"; - - try { - aTempReader = new ClassReader(className); - aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); - new ClassReader(basicClass).accept(new localClassVisitor(aTempWriter), 0); - } catch (IOException e) {} - if (aTempReader != null && aTempWriter != null) { - isValid = true; - } - else { - isValid = false; - } - reader = aTempReader; - writer = aTempWriter; - - if (reader != null && writer != null) { - injectField("inventory"); - injectMethod("getFertArray"); - injectMethod("getInventory"); - injectMethod("getRealInventory"); - injectMethod("generateInventory"); - injectMethod("updateEntity"); - //injectMethod("createInventoryCallback"); - //injectMethod("registerInventoryCallback"); - } - - } - - public boolean isValidTransformer() { - return isValid; - } - - public ClassReader getReader() { - return reader; - } - - public ClassWriter getWriter() { - return writer; - } - - public void injectField(String aFieldName) { - FieldVisitor fv; - if (aFieldName.equals("inventory")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Injecting "+aFieldName+" into "+className+"."); - if (true) { - fv = getWriter().visitField(ACC_PRIVATE + ACC_FINAL, "inventory", "Lopenmods/inventory/GenericInventory;", null, null); - fv.visitEnd(); - } - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Field injection complete."); - } - } - - public void injectMethod(String aMethodName) { - MethodVisitor mv; - AnnotationVisitor av0; - if (aMethodName.equals("getFertArray")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Injecting "+aMethodName+" into "+className+"."); - mv = getWriter().visitMethod(ACC_PUBLIC + ACC_STATIC, "getFertArray", "()[L"+mItemStackName+";", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(256, l0); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/ob/SprinklerHandler", "getValidFerts", "()Ljava/util/HashMap;", false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/HashMap", "isEmpty", "()Z", false); - Label l1 = new Label(); - mv.visitJumpInsn(IFEQ, l1); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLineNumber(257, l2); - mv.visitTypeInsn(NEW, ""+mItemStackName+""); - mv.visitInsn(DUP); - mv.visitFieldInsn(GETSTATIC, ""+mItemsName+"", "dye", "L"+mItemName+";"); - mv.visitInsn(ICONST_1); - mv.visitIntInsn(BIPUSH, 15); - mv.visitMethodInsn(INVOKESPECIAL, ""+mItemStackName+"", "<init>", "(L"+mItemName+";II)V", false); - mv.visitVarInsn(ASTORE, 0); - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitLineNumber(258, l3); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/ob/SprinklerHandler", "registerSprinklerFertilizer", "(L"+mItemStackName+";)V", false); - mv.visitLabel(l1); - mv.visitLineNumber(260, l1); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/ob/SprinklerHandler", "getValidFerts", "()Ljava/util/HashMap;", false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/HashMap", "size", "()I", false); - mv.visitTypeInsn(ANEWARRAY, ""+mItemStackName+""); - mv.visitVarInsn(ASTORE, 0); - Label l4 = new Label(); - mv.visitLabel(l4); - mv.visitLineNumber(261, l4); - mv.visitInsn(ICONST_0); - mv.visitVarInsn(ISTORE, 1); - Label l5 = new Label(); - mv.visitLabel(l5); - mv.visitLineNumber(262, l5); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/xmod/ob/SprinklerHandler", "getValidFerts", "()Ljava/util/HashMap;", false); - mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/HashMap", "values", "()Ljava/util/Collection;", false); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Collection", "iterator", "()Ljava/util/Iterator;", true); - mv.visitVarInsn(ASTORE, 3); - Label l6 = new Label(); - mv.visitJumpInsn(GOTO, l6); - Label l7 = new Label(); - mv.visitLabel(l7); - mv.visitFrame(F_FULL, 4, new Object[] {"[L"+mItemStackName+";", INTEGER, TOP, "java/util/Iterator"}, 0, new Object[] {}); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true); - mv.visitTypeInsn(CHECKCAST, ""+mItemStackName+""); - mv.visitVarInsn(ASTORE, 2); - Label l8 = new Label(); - mv.visitLabel(l8); - mv.visitLineNumber(263, l8); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ILOAD, 1); - mv.visitIincInsn(1, 1); - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn(INVOKEVIRTUAL, ""+mItemStackName+"", "copy", "()L"+mItemStackName+";", false); - mv.visitInsn(AASTORE); - mv.visitLabel(l6); - mv.visitLineNumber(262, l6); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true); - mv.visitJumpInsn(IFNE, l7); - Label l9 = new Label(); - mv.visitLabel(l9); - mv.visitLineNumber(265, l9); - mv.visitVarInsn(ALOAD, 0); - mv.visitInsn(ARRAYLENGTH); - mv.visitInsn(ICONST_1); - Label l10 = new Label(); - mv.visitJumpInsn(IF_ICMPGE, l10); - Label l11 = new Label(); - mv.visitLabel(l11); - mv.visitLineNumber(266, l11); - mv.visitInsn(ICONST_0); - mv.visitTypeInsn(ANEWARRAY, ""+mItemStackName+""); - mv.visitVarInsn(ASTORE, 0); - mv.visitLabel(l10); - mv.visitLineNumber(268, l10); - mv.visitFrame(F_FULL, 2, new Object[] {"[L"+mItemStackName+";", INTEGER}, 0, new Object[] {}); - mv.visitVarInsn(ALOAD, 0); - mv.visitInsn(ARETURN); - Label l12 = new Label(); - mv.visitLabel(l12); - mv.visitLocalVariable("aBoneMeal", "L"+mItemStackName+";", null, l3, l1, 0); - mv.visitLocalVariable("aFerts", "[L"+mItemStackName+";", null, l4, l12, 0); - mv.visitLocalVariable("aSlot", "I", null, l5, l12, 1); - mv.visitLocalVariable("i", "L"+mItemStackName+";", null, l8, l6, 2); - mv.visitMaxs(5, 4); - mv.visitEnd(); - - } - else if (aMethodName.equals("updateEntity")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Injecting "+aMethodName+" into "+className+"."); - mv = getWriter().visitMethod(ACC_PUBLIC, "updateEntity", "()V", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(156, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESPECIAL, "net/minecraft/tileentity/TileEntity", "updateEntity", "()V", false); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLineNumber(157, l1); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "worldObj", "L"+mWorldName+";"); - mv.visitFieldInsn(GETFIELD, ""+mWorldName+"", "isRemote", "Z"); - Label l2 = new Label(); - mv.visitJumpInsn(IFNE, l2); - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitLineNumber(158, l3); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "tank", "Lopenmods/sync/SyncableTank;"); - mv.visitMethodInsn(INVOKEVIRTUAL, "openmods/sync/SyncableTank", "getFluidAmount", "()I", false); - Label l4 = new Label(); - mv.visitJumpInsn(IFGT, l4); - Label l5 = new Label(); - mv.visitLabel(l5); - mv.visitLineNumber(159, l5); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "needsTankUpdate", "Z"); - Label l6 = new Label(); - mv.visitJumpInsn(IFEQ, l6); - Label l7 = new Label(); - mv.visitLabel(l7); - mv.visitLineNumber(160, l7); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "tank", "Lopenmods/sync/SyncableTank;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "worldObj", "L"+mWorldName+";"); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKEVIRTUAL, "openblocks/common/tileentity/TileEntitySprinkler", "getPosition", "()Lopenmods/utils/Coord;", false); - mv.visitMethodInsn(INVOKEVIRTUAL, "openmods/sync/SyncableTank", "updateNeighbours", "(L"+mWorldName+";Lopenmods/utils/Coord;)V", false); - Label l8 = new Label(); - mv.visitLabel(l8); - mv.visitLineNumber(161, l8); - mv.visitVarInsn(ALOAD, 0); - mv.visitInsn(ICONST_0); - mv.visitFieldInsn(PUTFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "needsTankUpdate", "Z"); - mv.visitLabel(l6); - mv.visitLineNumber(163, l6); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "tank", "Lopenmods/sync/SyncableTank;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "worldObj", "L"+mWorldName+";"); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKEVIRTUAL, "openblocks/common/tileentity/TileEntitySprinkler", "getPosition", "()Lopenmods/utils/Coord;", false); - mv.visitFieldInsn(GETSTATIC, "net/minecraftforge/common/util/ForgeDirection", "DOWN", "Lnet/minecraftforge/common/util/ForgeDirection;"); - mv.visitMethodInsn(INVOKEVIRTUAL, "openmods/sync/SyncableTank", "fillFromSide", "(L"+mWorldName+";Lopenmods/utils/Coord;Lnet/minecraftforge/common/util/ForgeDirection;)I", false); - mv.visitInsn(POP); - mv.visitLabel(l4); - mv.visitLineNumber(166, l4); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "ticks", "I"); - mv.visitFieldInsn(GETSTATIC, "openblocks/Config", "sprinklerBonemealConsumeRate", "I"); - mv.visitInsn(IREM); - Label l9 = new Label(); - mv.visitJumpInsn(IFNE, l9); - Label l10 = new Label(); - mv.visitLabel(l10); - mv.visitLineNumber(167, l10); - mv.visitMethodInsn(INVOKESTATIC, "openblocks/common/tileentity/TileEntitySprinkler", "getFertArray", "()[L"+mItemStackName+";", false); - mv.visitInsn(DUP); - mv.visitVarInsn(ASTORE, 4); - mv.visitInsn(ARRAYLENGTH); - mv.visitVarInsn(ISTORE, 3); - mv.visitInsn(ICONST_0); - mv.visitVarInsn(ISTORE, 2); - Label l11 = new Label(); - mv.visitJumpInsn(GOTO, l11); - Label l12 = new Label(); - mv.visitLabel(l12); - mv.visitFrame(F_FULL, 5, new Object[] {"openblocks/common/tileentity/TileEntitySprinkler", TOP, INTEGER, INTEGER, "[L"+mItemStackName+";"}, 0, new Object[] {}); - mv.visitVarInsn(ALOAD, 4); - mv.visitVarInsn(ILOAD, 2); - mv.visitInsn(AALOAD); - mv.visitVarInsn(ASTORE, 1); - Label l13 = new Label(); - mv.visitLabel(l13); - mv.visitLineNumber(168, l13); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESPECIAL, "openblocks/common/tileentity/TileEntitySprinkler", "getRealInventory", "()Lopenmods/inventory/GenericInventory;", false); - mv.visitMethodInsn(INVOKEVIRTUAL, "openmods/inventory/GenericInventory", "contents", "()Ljava/util/List;", false); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/List", "iterator", "()Ljava/util/Iterator;", true); - mv.visitVarInsn(ASTORE, 6); - Label l14 = new Label(); - mv.visitJumpInsn(GOTO, l14); - Label l15 = new Label(); - mv.visitLabel(l15); - mv.visitFrame(F_FULL, 7, new Object[] {"openblocks/common/tileentity/TileEntitySprinkler", ""+mItemStackName+"", INTEGER, INTEGER, "[L"+mItemStackName+";", TOP, "java/util/Iterator"}, 0, new Object[] {}); - mv.visitVarInsn(ALOAD, 6); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;", true); - mv.visitTypeInsn(CHECKCAST, ""+mItemStackName+""); - mv.visitVarInsn(ASTORE, 5); - Label l16 = new Label(); - mv.visitLabel(l16); - mv.visitLineNumber(169, l16); - mv.visitVarInsn(ALOAD, 5); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn(INVOKESTATIC, ""+mItemStackName+"", "areItemStacksEqual", "(L"+mItemStackName+";L"+mItemStackName+";)Z", false); - mv.visitJumpInsn(IFEQ, l14); - Label l17 = new Label(); - mv.visitLabel(l17); - mv.visitLineNumber(170, l17); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESPECIAL, "openblocks/common/tileentity/TileEntitySprinkler", "getRealInventory", "()Lopenmods/inventory/GenericInventory;", false); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn(INVOKESTATIC, "openmods/inventory/legacy/ItemDistribution", "consumeFirstInventoryItem", "(L"+mIInventoryName+";L"+mItemStackName+";)Z", false); - mv.visitFieldInsn(PUTFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "hasBonemeal", "Z"); - Label l18 = new Label(); - mv.visitLabel(l18); - mv.visitLineNumber(171, l18); - mv.visitJumpInsn(GOTO, l9); - mv.visitLabel(l14); - mv.visitLineNumber(168, l14); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 6); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z", true); - mv.visitJumpInsn(IFNE, l15); - Label l19 = new Label(); - mv.visitLabel(l19); - mv.visitLineNumber(167, l19); - mv.visitIincInsn(2, 1); - mv.visitLabel(l11); - mv.visitFrame(F_FULL, 5, new Object[] {"openblocks/common/tileentity/TileEntitySprinkler", TOP, INTEGER, INTEGER, "[L"+mItemStackName+";"}, 0, new Object[] {}); - mv.visitVarInsn(ILOAD, 2); - mv.visitVarInsn(ILOAD, 3); - mv.visitJumpInsn(IF_ICMPLT, l12); - mv.visitLabel(l9); - mv.visitLineNumber(178, l9); - mv.visitFrame(F_FULL, 1, new Object[] {"openblocks/common/tileentity/TileEntitySprinkler"}, 0, new Object[] {}); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "ticks", "I"); - mv.visitFieldInsn(GETSTATIC, "openblocks/Config", "sprinklerWaterConsumeRate", "I"); - mv.visitInsn(IREM); - mv.visitJumpInsn(IFNE, l2); - Label l20 = new Label(); - mv.visitLabel(l20); - mv.visitLineNumber(179, l20); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "tank", "Lopenmods/sync/SyncableTank;"); - mv.visitInsn(ICONST_1); - mv.visitInsn(ICONST_1); - mv.visitMethodInsn(INVOKEVIRTUAL, "openmods/sync/SyncableTank", "drain", "(IZ)Lnet/minecraftforge/fluids/FluidStack;", false); - Label l21 = new Label(); - mv.visitJumpInsn(IFNULL, l21); - mv.visitInsn(ICONST_1); - Label l22 = new Label(); - mv.visitJumpInsn(GOTO, l22); - mv.visitLabel(l21); - mv.visitFrame(F_SAME1, 0, null, 1, new Object[] {"openblocks/common/tileentity/TileEntitySprinkler"}); - mv.visitInsn(ICONST_0); - mv.visitLabel(l22); - mv.visitFrame(F_FULL, 1, new Object[] {"openblocks/common/tileentity/TileEntitySprinkler"}, 2, new Object[] {"openblocks/common/tileentity/TileEntitySprinkler", INTEGER}); - mv.visitMethodInsn(INVOKESPECIAL, "openblocks/common/tileentity/TileEntitySprinkler", "setEnabled", "(Z)V", false); - Label l23 = new Label(); - mv.visitLabel(l23); - mv.visitLineNumber(180, l23); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKEVIRTUAL, "openblocks/common/tileentity/TileEntitySprinkler", "sync", "()V", false); - mv.visitLabel(l2); - mv.visitLineNumber(183, l2); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitInsn(DUP); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "ticks", "I"); - mv.visitInsn(ICONST_1); - mv.visitInsn(IADD); - mv.visitFieldInsn(PUTFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "ticks", "I"); - Label l24 = new Label(); - mv.visitLabel(l24); - mv.visitLineNumber(186, l24); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESPECIAL, "openblocks/common/tileentity/TileEntitySprinkler", "isEnabled", "()Z", false); - Label l25 = new Label(); - mv.visitJumpInsn(IFEQ, l25); - Label l26 = new Label(); - mv.visitLabel(l26); - mv.visitLineNumber(187, l26); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "worldObj", "L"+mWorldName+";"); - mv.visitFieldInsn(GETFIELD, ""+mWorldName+"", "isRemote", "Z"); - Label l27 = new Label(); - mv.visitJumpInsn(IFEQ, l27); - Label l28 = new Label(); - mv.visitLabel(l28); - mv.visitLineNumber(188, l28); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESPECIAL, "openblocks/common/tileentity/TileEntitySprinkler", "sprayParticles", "()V", false); - mv.visitJumpInsn(GOTO, l25); - mv.visitLabel(l27); - mv.visitLineNumber(190, l27); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESPECIAL, "openblocks/common/tileentity/TileEntitySprinkler", "attemptFertilize", "()V", false); - mv.visitLabel(l25); - mv.visitLineNumber(192, l25); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitInsn(RETURN); - Label l29 = new Label(); - mv.visitLabel(l29); - mv.visitLocalVariable("this", "Lopenblocks/common/tileentity/TileEntitySprinkler;", null, l0, l29, 0); - mv.visitLocalVariable("f", "L"+mItemStackName+";", null, l13, l19, 1); - mv.visitLocalVariable("g", "L"+mItemStackName+";", null, l16, l14, 5); - mv.visitMaxs(4, 7); - mv.visitEnd(); - - } - else if (aMethodName.equals("generateInventory")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Injecting "+aMethodName+" into "+className+"."); - mv = getWriter().visitMethod(ACC_PRIVATE, "generateInventory", "()Lopenmods/inventory/GenericInventory;", null, null); - - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(281, l0); - mv.visitTypeInsn(NEW, "gtPlusPlus/xmod/ob/CustomSprinklerInventory"); - mv.visitInsn(DUP); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn("sprinkler"); - mv.visitInsn(ICONST_1); - mv.visitIntInsn(BIPUSH, 9); - mv.visitMethodInsn(INVOKESPECIAL, "gtPlusPlus/xmod/ob/CustomSprinklerInventory", "<init>", "(L"+mTileEntityName+";Ljava/lang/String;ZI)V", false); - mv.visitVarInsn(ASTORE, 1); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLineNumber(282, l1); - mv.visitVarInsn(ALOAD, 1); - Label l2 = new Label(); - mv.visitJumpInsn(IFNULL, l2); - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitLineNumber(283, l3); - mv.visitLdcInsn("Created Custom Inventory for OB Sprinkler."); - mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/api/objects/Logger", "INFO", "(Ljava/lang/String;)V", false); - mv.visitLabel(l2); - mv.visitLineNumber(285, l2); - mv.visitFrame(F_APPEND,1, new Object[] {"openmods/inventory/GenericInventory"}, 0, null); - mv.visitVarInsn(ALOAD, 1); - Label l4 = new Label(); - mv.visitJumpInsn(IFNULL, l4); - mv.visitVarInsn(ALOAD, 1); - Label l5 = new Label(); - mv.visitJumpInsn(GOTO, l5); - mv.visitLabel(l4); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitInsn(ACONST_NULL); - mv.visitLabel(l5); - mv.visitFrame(F_SAME1, 0, null, 1, new Object[] {"openmods/inventory/GenericInventory"}); - mv.visitInsn(ARETURN); - Label l6 = new Label(); - mv.visitLabel(l6); - mv.visitLocalVariable("this", "Lopenblocks/common/tileentity/TileEntitySprinkler;", null, l0, l6, 0); - mv.visitLocalVariable("x", "Lopenmods/inventory/GenericInventory;", null, l1, l6, 1); - mv.visitMaxs(6, 2); - mv.visitEnd(); - } - else if (aMethodName.equals("getRealInventory")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Injecting "+aMethodName+" into "+className+"."); - mv = getWriter().visitMethod(ACC_PRIVATE, "getRealInventory", "()Lopenmods/inventory/GenericInventory;", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(274, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKEVIRTUAL, "openblocks/common/tileentity/TileEntitySprinkler", "getInventory", "()L"+mIInventoryName+";", false); - mv.visitTypeInsn(CHECKCAST, "openmods/inventory/GenericInventory"); - mv.visitInsn(ARETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("this", "Lopenblocks/common/tileentity/TileEntitySprinkler;", null, l0, l1, 0); - mv.visitMaxs(1, 1); - mv.visitEnd(); - } - else if (aMethodName.equals("getInventory")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Injecting "+aMethodName+" into "+className+"."); - mv = getWriter().visitMethod(ACC_PUBLIC, "getInventory", "()L"+mIInventoryName+";", null, null); - { - av0 = mv.visitAnnotation("Lopenmods/include/IncludeInterface;", false); - av0.visitEnd(); - } - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(225, l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "inventory", "Lopenmods/inventory/GenericInventory;"); - Label l1 = new Label(); - mv.visitJumpInsn(IFNONNULL, l1); - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitLineNumber(226, l2); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESPECIAL, "openblocks/common/tileentity/TileEntitySprinkler", "generateInventory", "()Lopenmods/inventory/GenericInventory;", false); - mv.visitFieldInsn(PUTFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "inventory", "Lopenmods/inventory/GenericInventory;"); - mv.visitLabel(l1); - mv.visitLineNumber(228, l1); - mv.visitFrame(F_SAME, 0, null, 0, null); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, "openblocks/common/tileentity/TileEntitySprinkler", "inventory", "Lopenmods/inventory/GenericInventory;"); - mv.visitInsn(ARETURN); - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitLocalVariable("this", "Lopenblocks/common/tileentity/TileEntitySprinkler;", null, l0, l3, 0); - mv.visitMaxs(2, 1); - mv.visitEnd(); - } - else if (aMethodName.equals("createInventoryCallback")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Injecting "+aMethodName+" into "+className+"."); - mv = getWriter().visitMethod(ACC_PROTECTED, "createInventoryCallback", "()Lopenmods/api/IInventoryCallback;", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(289, l0); - mv.visitTypeInsn(NEW, "gtPlusPlus/xmod/ob/CallbackObject"); - mv.visitInsn(DUP); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESPECIAL, "gtPlusPlus/xmod/ob/CallbackObject", "<init>", "(L"+mTileEntityName+";)V", false); - mv.visitInsn(ARETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("this", "Lopenblocks/common/tileentity/TileEntitySprinkler;", null, l0, l1, 0); - mv.visitMaxs(3, 1); - mv.visitEnd(); - } - else if (aMethodName.equals("registerInventoryCallback")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Injecting "+aMethodName+" into "+className+"."); - mv = getWriter().visitMethod(ACC_PROTECTED, "registerInventoryCallback", "(Lopenmods/inventory/GenericInventory;)Lopenmods/inventory/GenericInventory;", null, null); - mv.visitCode(); - Label l0 = new Label(); - mv.visitLabel(l0); - mv.visitLineNumber(293, l0); - mv.visitVarInsn(ALOAD, 1); - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKEVIRTUAL, "openblocks/common/tileentity/TileEntitySprinkler", "createInventoryCallback", "()Lopenmods/api/IInventoryCallback;", false); - mv.visitMethodInsn(INVOKEVIRTUAL, "openmods/inventory/GenericInventory", "addCallback", "(Lopenmods/api/IInventoryCallback;)Lopenmods/inventory/GenericInventory;", false); - mv.visitInsn(ARETURN); - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitLocalVariable("this", "Lopenblocks/common/tileentity/TileEntitySprinkler;", null, l0, l1, 0); - mv.visitLocalVariable("inventory", "Lopenmods/inventory/GenericInventory;", null, l0, l1, 1); - mv.visitMaxs(2, 2); - mv.visitEnd(); - } - - - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Method injection complete."); - } - - public static final class localClassVisitor extends ClassVisitor { - - public localClassVisitor(ClassVisitor cv) { - super(ASM5, cv); - } - - @Override - public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { - FieldVisitor fieldVisitor; - if (access == (ACC_PRIVATE + ACC_FINAL) && name.equals("inventory") && desc.equals("Lopenmods/inventory/GenericInventory;")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Removing field "+name); - return null; - } - fieldVisitor = super.visitField(access, name, desc, signature, value); - return fieldVisitor; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - if (name.equals("updateEntity")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Removing method "+name); - return null; - } - if (name.equals("getInventory")) { - FMLRelaunchLog.log("[GT++ ASM] OpenBlocks Sprinkler Patch", Level.INFO, "Removing method "+name); - return null; - } - MethodVisitor methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); - return methodVisitor; - } - } - -} diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java index 3dbe10af59..d842c37fcd 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java @@ -852,7 +852,7 @@ public enum GTPP_Bee_Definition implements IBeeDefinition { private static ItemStack issStackValid(ItemStack result){ if (result == null){ - return ItemUtils.getSimpleStack(ModItems.AAA_Broken); + return ItemUtils.getErrorStack(1); } return result; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index abf8fd9714..6903305f9d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -70,7 +70,6 @@ public class HANDLER_GT { //Only loads if the config option is true (default: true) if (CORE.ConfigSwitches.enableSkookumChoochers){ new MetaGeneratedGregtechTools(); - new ProcessingToolHeadChoocher().run(); } if (ConfigSwitches.enableOldGTcircuits && !CORE.GTNH){ @@ -84,6 +83,12 @@ public class HANDLER_GT { } public static void postInit(){ + + //Only loads if the config option is true (default: true) + if (CORE.ConfigSwitches.enableSkookumChoochers){ + new ProcessingToolHeadChoocher().run(); + } + if (CORE.ConfigSwitches.enableNitroFix){ GregtechNitroDieselFix.run(); } @@ -103,6 +108,7 @@ public class HANDLER_GT { private static int removeCrudeTurbineRotors() { int aRemoved = 0; + int CUT = CORE.turbineCutoffBase; Item aU; Collection<GT_Recipe> aAssRecipes = GT_Recipe.GT_Recipe_Map.sAssemblerRecipes.mRecipeList; //170, 172, 174, 176 @@ -122,7 +128,7 @@ public class HANDLER_GT { //Logger.INFO("Found assembler recipe outputting a GT Tool with a meta value of "+aMeta); if (aMeta >= 170 && aMeta <= 176) { //Found a Turbine - int aCutoff = aMeta == 170 ? 75000 : (aMeta == 172 ? 150000 : (aMeta == 174 ? 225000 : 300000)); + int aCutoff = aMeta == 170 ? CUT : (aMeta == 172 ? CUT*2 : (aMeta == 174 ? CUT*3 : CUT*4)); String aType = aMeta == 170 ? "Small " : (aMeta == 172 ? "" : (aMeta == 174 ? "Large " : "Huge ")); Materials aMainMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(aI); Materials aSecondaryMaterial = GT_MetaGenerated_Tool.getSecondaryMaterial(aI); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index fa4cb8a347..31317d5377 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -417,7 +417,10 @@ public enum GregtechItemList implements GregtechItemContainer { Machine_HV_Component_Maker, Machine_EV_Component_Maker, Machine_IV_Component_Maker, - + Machine_LuV_Component_Maker, + Machine_ZPM_Component_Maker, + Machine_UV_Component_Maker, + //Solar Generators GT_Solar_ULV, GT_Solar_LV, GT_Solar_MV, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java index 6ed5eecd38..e2a30851aa 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_AlloySmelter.java @@ -9,6 +9,7 @@ import gregtech.api.enums.ItemList; import gtPlusPlus.api.interfaces.RunnableWithInfo; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.util.minecraft.ItemUtils; public class RecipeGen_AlloySmelter extends RecipeGen_Base { @@ -30,8 +31,10 @@ public class RecipeGen_AlloySmelter extends RecipeGen_Base { private void generateRecipes(final Material material){ final int tVoltageMultiplier = material.getMeltingPointK() >= 2800 ? 60 : 15; + + //Nuggets - if (material.getIngot(1) != null && material.getNugget(1) != null) + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getNugget(1))) GT_Values.RA.addAlloySmelterRecipe( material.getIngot(1), ItemList.Shape_Mold_Nugget.get(0), @@ -40,7 +43,7 @@ public class RecipeGen_AlloySmelter extends RecipeGen_Base { 2 * tVoltageMultiplier); //Gears - if (material.getIngot(1) != null && material.getGear(1) != null) + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getGear(1))) GT_Values.RA.addAlloySmelterRecipe( material.getIngot(8), ItemList.Shape_Mold_Gear.get(0), @@ -49,7 +52,7 @@ public class RecipeGen_AlloySmelter extends RecipeGen_Base { 2 * tVoltageMultiplier); //Ingot - if (material.getIngot(1) != null && material.getNugget(1) != null) + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getNugget(1))) GT_Values.RA.addAlloySmelterRecipe( material.getNugget(9), ItemList.Shape_Mold_Ingot.get(0), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java index 0182ca13e8..66941849f8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Assembler.java @@ -33,6 +33,7 @@ public class RecipeGen_Assembler extends RecipeGen_Base { private void generateRecipes(final Material material){ //Frame Box + if (ItemUtils.checkForInvalidItems(new ItemStack[] {material.getRod(1), material.getFrameBox(1)})) GT_Values.RA.addAssemblerRecipe( material.getRod(4), ItemUtils.getGregtechCircuit(4), @@ -41,6 +42,7 @@ public class RecipeGen_Assembler extends RecipeGen_Base { 8); //Rotor + if (ItemUtils.checkForInvalidItems(new ItemStack[] {material.getPlate(1), material.getRing(1), material.getRotor(1)})) addAssemblerRecipe( material.getPlate(4), material.getRing(1), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java index b588613224..d4051ff8bf 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_DustGeneration.java @@ -7,9 +7,7 @@ import net.minecraft.item.ItemStack; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; -import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gtPlusPlus.api.interfaces.RunnableWithInfo; import gtPlusPlus.api.objects.Logger; @@ -35,7 +33,7 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { public RecipeGen_DustGeneration(final Material M){ this(M, false); } - + public RecipeGen_DustGeneration(final Material M, final boolean O){ this.toGenerate = M; this.disableOptional = O; @@ -59,74 +57,76 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { final ItemStack[] inputStacks = material.getMaterialComposites(); final ItemStack outputStacks = material.getDust(material.smallestStackSizeWhenProcessing); - if (RecipeUtils.recipeBuilder( - tinyDust, tinyDust, tinyDust, - tinyDust, tinyDust, tinyDust, - tinyDust, tinyDust, tinyDust, - normalDust)){ - Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); - } - - if (RecipeUtils.recipeBuilder( - normalDust, null, null, - null, null, null, - null, null, null, - material.getTinyDust(9))){ - Logger.WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Failed"); - } + if (ItemUtils.checkForInvalidItems(tinyDust) && ItemUtils.checkForInvalidItems(normalDust)) { + if (RecipeUtils.recipeBuilder( + tinyDust, tinyDust, tinyDust, + tinyDust, tinyDust, tinyDust, + tinyDust, tinyDust, tinyDust, + normalDust)){ + Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("9 Tiny dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } - if (RecipeUtils.recipeBuilder( - smallDust, smallDust, null, - smallDust, smallDust, null, - null, null, null, - normalDust)){ - Logger.WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + if (RecipeUtils.recipeBuilder( + normalDust, null, null, + null, null, null, + null, null, null, + material.getTinyDust(9))){ + Logger.WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("9 Tiny dust from 1 Recipe: "+material.getLocalizedName()+" - Failed"); + } } - - if (RecipeUtils.recipeBuilder( - null, normalDust, null, - null, null, null, - null, null, null, - material.getSmallDust(4))){ - Logger.WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + if (ItemUtils.checkForInvalidItems(smallDust) && ItemUtils.checkForInvalidItems(normalDust)) { + if (RecipeUtils.recipeBuilder( + smallDust, smallDust, null, + smallDust, smallDust, null, + null, null, null, + normalDust)){ + Logger.WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("4 Small dust to 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } + if (RecipeUtils.recipeBuilder( + null, normalDust, null, + null, null, null, + null, null, null, + material.getSmallDust(4))){ + Logger.WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("4 Small dust from 1 Dust Recipe: "+material.getLocalizedName()+" - Failed"); + } } //Macerate blocks back to dusts. final ItemStack materialBlock = material.getBlock(1); final ItemStack materialFrameBox = material.getFrameBox(1); - if (materialBlock != null) { + if (ItemUtils.checkForInvalidItems(materialBlock)) { GT_ModHandler.addPulverisationRecipe(materialBlock, material.getDust(9)); } - if (materialFrameBox != null) { + if (ItemUtils.checkForInvalidItems(materialFrameBox)) { GT_ModHandler.addPulverisationRecipe(materialFrameBox, material.getDust(2)); } - - if (smallDust != null && tinyDust != null) { + + if (ItemUtils.checkForInvalidItems(smallDust) && ItemUtils.checkForInvalidItems(tinyDust)) { generatePackagerRecipes(material); } - + ItemStack ingot = material.getIngot(1); - if (normalDust != null && ingot != null) { + if (ItemUtils.checkForInvalidItems(normalDust) && ItemUtils.checkForInvalidItems(ingot)) { addFurnaceRecipe(material); addMacerationRecipe(material); } - + //Is this a composite? if ((inputStacks != null) && !disableOptional){ //Is this a composite? @@ -149,13 +149,13 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { //Get us four ItemStacks to input into the mixer ItemStack[] input = new ItemStack[4]; - + input[0] = (inputStacks.length >= 1) ? ((inputStacks[0] == null) ? null : inputStacks[0]) : null; input[1] = (inputStacks.length >= 2) ? ((inputStacks[1] == null) ? null : inputStacks[1]) : null; input[2] = (inputStacks.length >= 3) ? ((inputStacks[2] == null) ? null : inputStacks[2]) : null; input[3] = (inputStacks.length >= 4) ? ((inputStacks[3] == null) ? null : inputStacks[3]) : null; - - + + if (inputStacks.length == 1) { input[1] = input[0]; input[0] = CI.getNumberedCircuit(inputStacks.length+10); @@ -172,8 +172,8 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { input[1] = input[0]; input[0] = CI.getNumberedCircuit(inputStacks.length+10); } - - + + /*for (int g = 0; g<4; g++) { if(inputStacks.length > g) { input[g] = inputStacks[g] != null ? inputStacks[g] : null; @@ -285,7 +285,7 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { input2 = input1; input1 = CI.getNumberedCircuit(20); } - + //Add mixer Recipe FluidStack oxygen = GT_Values.NF; if (material.getComposites() != null){ @@ -344,14 +344,14 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { } return false; } - + public static boolean generatePackagerRecipes(Material aMatInfo) { AutoMap<Boolean> aResults = new AutoMap<Boolean>(); //Small Dust aResults.put(GT_Values.RA.addBoxingRecipe(GT_Utility.copyAmount(4L, new Object[]{aMatInfo.getSmallDust(4)}), ItemList.Schematic_Dust.get(0L, new Object[0]), aMatInfo.getDust(1), 100, 4)); - //Tiny Dust + //Tiny Dust aResults.put(GT_Values.RA.addBoxingRecipe(GT_Utility.copyAmount(9L, new Object[]{aMatInfo.getTinyDust(9)}), ItemList.Schematic_Dust.get(0L, new Object[0]), aMatInfo.getDust(1), 100, 4)); - + for (boolean b : aResults) { if (!b) { return false; @@ -359,7 +359,7 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { } return true; } - + private void addMacerationRecipe(Material aMatInfo){ try { Logger.MATERIALS("Adding Maceration recipe for "+aMatInfo.getLocalizedName()+" Ingot -> Dusts"); @@ -378,7 +378,7 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { try { if (aMatInfo.requiresBlastFurnace()) { aOutput = aMatInfo.getHotIngot(1); - if (aOutput != null) { + if (ItemUtils.checkForInvalidItems(aOutput)) { if (addBlastFurnaceRecipe(aMatInfo, aDust, null, aOutput, null, aMatInfo.getMeltingPointK())){ Logger.MATERIALS("Successfully added a blast furnace recipe for "+aMatInfo.getLocalizedName()); } @@ -392,7 +392,7 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { } else { aOutput = aMatInfo.getIngot(1); - if (aOutput != null) { + if (ItemUtils.checkForInvalidItems(aOutput)) { if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(aDust, aOutput)){ Logger.MATERIALS("Successfully added a furnace recipe for "+aMatInfo.getLocalizedName()); } @@ -437,6 +437,6 @@ public class RecipeGen_DustGeneration extends RecipeGen_Base { return false; } } - + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java index 2fd7f93c2d..9315826495 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Extruder.java @@ -13,6 +13,7 @@ import gtPlusPlus.api.interfaces.RunnableWithInfo; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.util.minecraft.ItemUtils; public class RecipeGen_Extruder extends RecipeGen_Base { @@ -48,36 +49,38 @@ public class RecipeGen_Extruder extends RecipeGen_Base { Logger.WARNING("Generating Extruder recipes for "+material.getLocalizedName()); - //Ingot Recipe - if (material.getIngot(1) != null && material.getBlock(1) != null) - if (addExtruderRecipe( - material.getBlock(1), - shape_Ingot, - material.getIngot(9), - (int) Math.max(material.getMass() * 2L * 1, 1), - 4 * material.vVoltageMultiplier)){ - Logger.WARNING("Extruder Ingot Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("Extruder Ingot Recipe: "+material.getLocalizedName()+" - Failed"); - } + + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getBlock(1))) { + //Ingot Recipe + if (addExtruderRecipe( + material.getBlock(1), + shape_Ingot, + material.getIngot(9), + (int) Math.max(material.getMass() * 2L * 1, 1), + 4 * material.vVoltageMultiplier)){ + Logger.WARNING("Extruder Ingot Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Extruder Ingot Recipe: "+material.getLocalizedName()+" - Failed"); + } - //Block Recipe - if (material.getIngot(1) != null && material.getBlock(1) != null) - if (addExtruderRecipe( - material.getIngot(9), - shape_Block, - material.getBlock(1), - (int) Math.max(material.getMass() * 2L * 1, 1), - 8 * material.vVoltageMultiplier)){ - Logger.WARNING("Extruder Block Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("Extruder Block Recipe: "+material.getLocalizedName()+" - Failed"); + //Block Recipe + if (addExtruderRecipe( + material.getIngot(9), + shape_Block, + material.getBlock(1), + (int) Math.max(material.getMass() * 2L * 1, 1), + 8 * material.vVoltageMultiplier)){ + Logger.WARNING("Extruder Block Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Extruder Block Recipe: "+material.getLocalizedName()+" - Failed"); + } } + //Plate Recipe - if (material.getIngot(1) != null && material.getPlate(1) != null) + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getPlate(1))) if (addExtruderRecipe( itemIngot, shape_Plate, @@ -90,7 +93,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { } //Ring Recipe - if (material.getIngot(1) != null && material.getRing(1) != null) + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getRing(1))) if (!material.isRadioactive){ if (addExtruderRecipe( itemIngot, @@ -107,7 +110,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { //Gear Recipe - if (material.getIngot(1) != null && material.getGear(1) != null) + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getGear(1))) if (!material.isRadioactive){ if (addExtruderRecipe( material.getIngot(4), @@ -124,7 +127,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { //Rod Recipe - if (material.getIngot(1) != null && material.getRod(1) != null) + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getRod(1))) if (addExtruderRecipe( itemIngot, shape_Rod, @@ -139,7 +142,7 @@ public class RecipeGen_Extruder extends RecipeGen_Base { //Bolt Recipe - if (material.getIngot(1) != null && material.getBolt(1) != null) + if (ItemUtils.checkForInvalidItems(material.getIngot(1)) && ItemUtils.checkForInvalidItems(material.getBolt(1))) if (!material.isRadioactive){ if (addExtruderRecipe( itemIngot, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java index 5e2675689b..433c07e948 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Fluids.java @@ -10,6 +10,7 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.util.minecraft.ItemUtils; public class RecipeGen_Fluids extends RecipeGen_Base { @@ -46,7 +47,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { if (!material.requiresBlastFurnace()) { // Ingot - if (material.getIngot(1) != null) + if (ItemUtils.checkForInvalidItems(material.getIngot(1))) if (GT_Values.RA.addFluidExtractionRecipe(material.getIngot(1), // Input null, // Input 2 material.getFluid(144), // Fluid Output @@ -62,7 +63,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Plate - if (material.getPlate(1) != null) + if (ItemUtils.checkForInvalidItems(material.getPlate(1))) if (GT_Values.RA.addFluidExtractionRecipe(material.getPlate(1), // Input null, // Input 2 material.getFluid(144), // Fluid Output @@ -78,7 +79,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Double Plate - if (material.getPlateDouble(1) != null) + if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1))) if (GT_Values.RA.addFluidExtractionRecipe(material.getPlateDouble(1), // Input null, // Input 2 material.getFluid(288), // Fluid Output @@ -94,7 +95,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Nugget - if (material.getNugget(1) != null) + if (ItemUtils.checkForInvalidItems(material.getNugget(1))) if (GT_Values.RA.addFluidExtractionRecipe(material.getNugget(1), // Input null, // Input 2 material.getFluid(16), // Fluid Output @@ -110,7 +111,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Block - if (material.getBlock(1) != null) + if (ItemUtils.checkForInvalidItems(material.getBlock(1))) if (GT_Values.RA.addFluidExtractionRecipe(material.getBlock(1), // Input null, // Input 2 material.getFluid(144 * 9), // Fluid Output @@ -130,7 +131,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { // Making Shapes from fluid // Ingot - if (material.getIngot(1) != null) + if (ItemUtils.checkForInvalidItems(material.getIngot(1))) if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Ingot.get(0), // Item Shape material.getFluid(144), // Fluid Input material.getIngot(1), // output @@ -145,7 +146,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Plate - if (material.getPlate(1) != null) + if (ItemUtils.checkForInvalidItems(material.getPlate(1))) if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Plate.get(0), // Item Shape material.getFluid(144), // Fluid Input material.getPlate(1), // output @@ -160,7 +161,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Nugget - if (material.getNugget(1) != null) + if (ItemUtils.checkForInvalidItems(material.getNugget(1))) if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Nugget.get(0), // Item Shape material.getFluid(16), // Fluid Input material.getNugget(1), // output @@ -175,7 +176,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Gears - if (material.getGear(1) != null) + if (ItemUtils.checkForInvalidItems(material.getGear(1))) if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Gear.get(0), // Item Shape material.getFluid(576), // Fluid Input material.getGear(1), // output @@ -189,7 +190,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Blocks - if (material.getBlock(1) != null) + if (ItemUtils.checkForInvalidItems(material.getBlock(1))) if (GT_Values.RA.addFluidSolidifierRecipe(ItemList.Shape_Mold_Block.get(0), // Item Shape material.getFluid(144 * 9), // Fluid Input material.getBlock(1), // output @@ -220,7 +221,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { ItemList mold_Ring = ItemList.valueOf("Shape_Mold_Ring"); // Rod - if (material.getRod(1) != null) + if (ItemUtils.checkForInvalidItems(material.getRod(1))) if (mold_Rod != null && GT_Values.RA.addFluidSolidifierRecipe(mold_Rod.get(0), // Item Shape material.getFluid(72), // Fluid Input material.getRod(1), // output @@ -235,7 +236,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Rod Long - if (material.getLongRod(1) != null) + if (ItemUtils.checkForInvalidItems(material.getLongRod(1))) if (mold_Rod_Long != null && GT_Values.RA.addFluidSolidifierRecipe(mold_Rod_Long.get(0), // Item // Shape material.getFluid(144), // Fluid Input @@ -251,7 +252,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Bolt - if (material.getBolt(1) != null) + if (ItemUtils.checkForInvalidItems(material.getBolt(1))) if (mold_Bolt != null && GT_Values.RA.addFluidSolidifierRecipe(mold_Bolt.get(0), // Item Shape material.getFluid(18), // Fluid Input material.getBolt(1), // output @@ -266,7 +267,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Screw - if (material.getScrew(1) != null) + if (ItemUtils.checkForInvalidItems(material.getScrew(1))) if (mold_Screw != null && GT_Values.RA.addFluidSolidifierRecipe(mold_Screw.get(0), // Item Shape material.getFluid(18), // Fluid Input material.getScrew(1), // output @@ -281,7 +282,7 @@ public class RecipeGen_Fluids extends RecipeGen_Base { } // Ring - if (material.getRing(1) != null) + if (ItemUtils.checkForInvalidItems(material.getRing(1))) if (mold_Ring != null && GT_Values.RA.addFluidSolidifierRecipe(mold_Ring.get(0), // Item Shape material.getFluid(36), // Fluid Input material.getRing(1), // output diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java index 9529b9019a..ddba6b5bf0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Ore.java @@ -3,18 +3,21 @@ package gtPlusPlus.xmod.gregtech.loaders; import net.minecraft.item.ItemStack; import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; - +import gtPlusPlus.api.interfaces.RunnableWithInfo; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.material.MaterialStack; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.recipe.common.CI; @@ -23,12 +26,17 @@ import gtPlusPlus.core.util.minecraft.MaterialUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import net.minecraftforge.fluids.FluidStack; -public class RecipeGen_Ore implements Runnable{ +public class RecipeGen_Ore extends RecipeGen_Base { - final Material toGenerate; + public final static Set<RunnableWithInfo<Material>> mRecipeGenMap = new HashSet<RunnableWithInfo<Material>>(); + + static { + MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); + } public RecipeGen_Ore(final Material M){ this.toGenerate = M; + mRecipeGenMap.add(this); } @Override @@ -368,7 +376,7 @@ public class RecipeGen_Ore implements Runnable{ int mCounter = 0; for (Pair<Integer, Material> f : componentMap){ - if (f.getValue().getState() != MaterialState.SOLID){ + if (f.getValue().getState() != MaterialState.SOLID && f.getValue().getState() != MaterialState.ORE){ Logger.MATERIALS("[Dehydrator] Found Fluid Component, adding "+f.getKey()+" cells of "+f.getValue().getLocalizedName()+"."); mInternalOutputs[mCounter++] = f.getValue().getCell(f.getKey()); mCellCount += f.getKey(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java index 001c494356..15e64534f9 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Plates.java @@ -14,6 +14,7 @@ import gtPlusPlus.api.interfaces.RunnableWithInfo; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.util.minecraft.ItemUtils; public class RecipeGen_Plates extends RecipeGen_Base { @@ -45,6 +46,7 @@ public class RecipeGen_Plates extends RecipeGen_Base { Logger.WARNING("Generating Plate recipes for "+material.getLocalizedName()); //Forge Hammer + if (ItemUtils.checkForInvalidItems(ingotStackTwo) && ItemUtils.checkForInvalidItems(plate_Single)) if (addForgeHammerRecipe( ingotStackTwo, plate_Single, @@ -56,6 +58,7 @@ public class RecipeGen_Plates extends RecipeGen_Base { Logger.WARNING("Forge Hammer Recipe: "+material.getLocalizedName()+" - Failed"); } //Bender + if (ItemUtils.checkForInvalidItems(ingotStackOne) && ItemUtils.checkForInvalidItems(plate_Single)) if (addBenderRecipe( ingotStackOne, plate_Single, @@ -67,6 +70,7 @@ public class RecipeGen_Plates extends RecipeGen_Base { Logger.WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); } //Alloy Smelter + if (ItemUtils.checkForInvalidItems(ingotStackTwo) && ItemUtils.checkForInvalidItems(plate_Single)) if (GT_Values.RA.addAlloySmelterRecipe( ingotStackTwo, shape_Mold, @@ -81,6 +85,7 @@ public class RecipeGen_Plates extends RecipeGen_Base { //Making Double Plates + if (ItemUtils.checkForInvalidItems(ingotStackTwo) && ItemUtils.checkForInvalidItems(plate_Double)) if (addBenderRecipe( ingotStackTwo, plate_Double, @@ -91,6 +96,8 @@ public class RecipeGen_Plates extends RecipeGen_Base { else { Logger.WARNING("Bender Recipe: "+material.getLocalizedName()+" - Failed"); } + + if (ItemUtils.checkForInvalidItems(plate_SingleTwo) && ItemUtils.checkForInvalidItems(plate_Double)) if (addBenderRecipe( plate_SingleTwo, plate_Double, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java index 8e3ef4e21d..e15c5da29e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java @@ -108,6 +108,10 @@ public class RecipeGen_Recycling implements Runnable { for (final Pair<OrePrefixes, ItemStack> validPrefix : mValidPairs) { try { + if (material == null || validPrefix == null) { + continue; + } + if (material.getState() != MaterialState.SOLID || validPrefix.getKey() == OrePrefixes.ingotHot){ continue; } @@ -118,7 +122,7 @@ public class RecipeGen_Recycling implements Runnable { int mFluidAmount = (int) GT_Utility.translateMaterialToFluidAmount(validPrefix.getKey().mMaterialAmount, true); //Maceration - if (tempStack != null) { + if (ItemUtils.checkForInvalidItems(tempStack)) { // mValidItems[mSlotIndex++] = tempStack; if ((mDust != null) && GT_ModHandler.addPulverisationRecipe(tempStack, mDust)) { Logger.WARNING("Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle " @@ -133,12 +137,12 @@ public class RecipeGen_Recycling implements Runnable { } //Arc Furnace - if (tempStack != null) { + if (ItemUtils.checkForInvalidItems(tempStack)) { } //Fluid Extractor - if (tempStack != null) { + if (ItemUtils.checkForInvalidItems(tempStack)) { // mValidItems[mSlotIndex++] = tempStack; if ((mDust != null) && GT_Values.RA.addFluidExtractionRecipe(tempStack, null, material.getFluid(mFluidAmount), 0, 30, 8)) { Logger.WARNING("Fluid Recycle Recipe: " + material.getLocalizedName() + " - Success - Recycle " diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java index 1646ab1535..79615d8457 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_ShapedCrafting.java @@ -13,6 +13,7 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; public class RecipeGen_ShapedCrafting extends RecipeGen_Base { @@ -21,7 +22,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { static { MaterialGenerator.mRecipeMapsToGenerate.put(mRecipeGenMap); } - + public RecipeGen_ShapedCrafting(final Material M){ this.toGenerate = M; mRecipeGenMap.add(this); @@ -37,62 +38,63 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { if (!CORE.GTNH) { //Nuggets - if (material.getNugget(1) != null) - GT_ModHandler.addShapelessCraftingRecipe( - material.getIngot(1), - new Object[]{ - material.getNugget(1), - material.getNugget(1), - material.getNugget(1), - material.getNugget(1), - material.getNugget(1), - material.getNugget(1), - material.getNugget(1), - material.getNugget(1), - material.getNugget(1) - }); + if (ItemUtils.checkForInvalidItems(material.getNugget(1)) && ItemUtils.checkForInvalidItems(material.getIngot(1))) + GT_ModHandler.addShapelessCraftingRecipe( + material.getIngot(1), + new Object[]{ + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1), + material.getNugget(1) + }); } - + //Plates - + //Single Plate Shaped/Shapeless - if (material.getPlate(1) != null && material.getIngot(1) != null) - GT_ModHandler.addCraftingRecipe( - material.getPlate(1), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[]{"h", "B", "I", - Character.valueOf('I'), - material.getIngot(1), - Character.valueOf('B'), - material.getIngot(1)}); + if (ItemUtils.checkForInvalidItems(material.getPlate(1)) && ItemUtils.checkForInvalidItems(material.getIngot(1))) + if (material.getPlate(1) != null && material.getIngot(1) != null) + GT_ModHandler.addCraftingRecipe( + material.getPlate(1), + gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"h", "B", "I", + Character.valueOf('I'), + material.getIngot(1), + Character.valueOf('B'), + material.getIngot(1)}); - if (material.getPlate(1) != null && material.getIngot(1) != null) - GT_ModHandler.addShapelessCraftingRecipe( - material.getPlate(1), - new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, - material.getIngot(1), - material.getIngot(1)}); + if (ItemUtils.checkForInvalidItems(material.getPlate(1)) && ItemUtils.checkForInvalidItems(material.getIngot(1))) + GT_ModHandler.addShapelessCraftingRecipe( + material.getPlate(1), + new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, + material.getIngot(1), + material.getIngot(1)}); //Double Plate Shaped/Shapeless - if (material.getPlateDouble(1) != null && material.getPlate(1) != null) - GT_ModHandler.addCraftingRecipe( - material.getPlateDouble(1), - gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, - new Object[]{"I", "B", "h", - Character.valueOf('I'), - material.getPlate(1), - Character.valueOf('B'), - material.getPlate(1)}); + if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1)) && ItemUtils.checkForInvalidItems(material.getPlate(1))) + GT_ModHandler.addCraftingRecipe( + material.getPlateDouble(1), + gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"I", "B", "h", + Character.valueOf('I'), + material.getPlate(1), + Character.valueOf('B'), + material.getPlate(1)}); - if (material.getPlateDouble(1) != null && material.getPlate(1) != null) - GT_ModHandler.addShapelessCraftingRecipe( - material.getPlateDouble(1), - new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, - material.getPlate(1), - material.getPlate(1)}); + if (ItemUtils.checkForInvalidItems(material.getPlateDouble(1)) && ItemUtils.checkForInvalidItems(material.getPlate(1))) + GT_ModHandler.addShapelessCraftingRecipe( + material.getPlateDouble(1), + new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, + material.getPlate(1), + material.getPlate(1)}); //Ring Recipe - if (!material.isRadioactive && material.getRing(1) != null && material.getRod(1) != null){ + if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getRing(1)) && ItemUtils.checkForInvalidItems(material.getRod(1))) { if (CORE.GTNH){ if (RecipeUtils.recipeBuilder( "craftingToolHardHammer", null, null, @@ -121,7 +123,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { //Framebox Recipe - if (!material.isRadioactive && material.getFrameBox(1) != null && material.getRod(1) != null){ + if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getFrameBox(1)) && ItemUtils.checkForInvalidItems(material.getRod(1))) { final ItemStack stackStick = material.getRod(1); if (RecipeUtils.recipeBuilder( stackStick, stackStick, stackStick, @@ -166,7 +168,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { //Shaped Recipe - Bolts - if (!material.isRadioactive && material.getBolt(1) != null && material.getRod(1) != null){ + if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getBolt(1)) && ItemUtils.checkForInvalidItems(material.getRod(1))) { if (RecipeUtils.recipeBuilder( "craftingToolSaw", null, null, null, material.getRod(1), null, @@ -181,47 +183,47 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { //Shaped Recipe - Ingot to Rod - if (material.getRod(1) != null && material.getIngot(1) != null) - if (RecipeUtils.recipeBuilder( - "craftingToolFile", null, null, - null, material.getIngot(1), null, - null, null, null, - material.getRod(1))){ - Logger.WARNING("Rod Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("Rod Recipe: "+material.getLocalizedName()+" - Failed"); - } + if (ItemUtils.checkForInvalidItems(material.getRod(1)) && ItemUtils.checkForInvalidItems(material.getIngot(1))) + if (RecipeUtils.recipeBuilder( + "craftingToolFile", null, null, + null, material.getIngot(1), null, + null, null, null, + material.getRod(1))){ + Logger.WARNING("Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } //Shaped Recipe - Long Rod to two smalls - if (material.getRod(1) != null && material.getLongRod(1) != null) - if (RecipeUtils.recipeBuilder( - "craftingToolSaw", null, null, - material.getLongRod(1), null, null, - null, null, null, - material.getRod(2))){ - Logger.WARNING("Rod Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("Rod Recipe: "+material.getLocalizedName()+" - Failed"); - } + if (ItemUtils.checkForInvalidItems(material.getRod(1)) && ItemUtils.checkForInvalidItems(material.getLongRod(1))) + if (RecipeUtils.recipeBuilder( + "craftingToolSaw", null, null, + material.getLongRod(1), null, null, + null, null, null, + material.getRod(2))){ + Logger.WARNING("Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } //Two small to long rod - if (material.getLongRod(1) != null && material.getRod(1) != null) - if (RecipeUtils.recipeBuilder( - material.getRod(1), "craftingToolHardHammer", material.getRod(1), - null, null, null, - null, null, null, - material.getLongRod(1))){ - Logger.WARNING("Long Rod Recipe: "+material.getLocalizedName()+" - Success"); - } - else { - Logger.WARNING("Long Rod Recipe: "+material.getLocalizedName()+" - Failed"); - } + if (ItemUtils.checkForInvalidItems(material.getLongRod(1)) && ItemUtils.checkForInvalidItems(material.getRod(1))) + if (RecipeUtils.recipeBuilder( + material.getRod(1), "craftingToolHardHammer", material.getRod(1), + null, null, null, + null, null, null, + material.getLongRod(1))){ + Logger.WARNING("Long Rod Recipe: "+material.getLocalizedName()+" - Success"); + } + else { + Logger.WARNING("Long Rod Recipe: "+material.getLocalizedName()+" - Failed"); + } //Rotor Recipe - if (!material.isRadioactive && material.getRotor(1) != null && material.getRing(1) != null && material.getPlate(1) != null && material.getScrew(1) != null){ + if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getRotor(1)) && ItemUtils.checkForInvalidItems(material.getRing(1)) && !material.isRadioactive && ItemUtils.checkForInvalidItems(material.getPlate(1)) && ItemUtils.checkForInvalidItems(material.getScrew(1))) { if (RecipeUtils.recipeBuilder( material.getPlate(1), "craftingToolHardHammer", material.getPlate(1), material.getScrew(1), material.getRing(1), "craftingToolFile", @@ -235,7 +237,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { } //Gear Recipe - if (!material.isRadioactive && material.getGear(1) != null && material.getPlate(1) != null && material.getRod(1) != null){ + if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getGear(1)) && ItemUtils.checkForInvalidItems(material.getPlate(1)) && ItemUtils.checkForInvalidItems(material.getRod(1))) { if (RecipeUtils.recipeBuilder( material.getRod(1), material.getPlate(1), material.getRod(1), material.getPlate(1), "craftingToolWrench", material.getPlate(1), @@ -249,7 +251,7 @@ public class RecipeGen_ShapedCrafting extends RecipeGen_Base { } //Screws - if (!material.isRadioactive && material.getScrew(1) != null && material.getBolt(1) != null){ + if (!material.isRadioactive && ItemUtils.checkForInvalidItems(material.getScrew(1)) && ItemUtils.checkForInvalidItems(material.getBolt(1))) { if (RecipeUtils.recipeBuilder( "craftingToolFile", material.getBolt(1), null, material.getBolt(1), null, null, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java index c611dda53e..94104ab0d5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java @@ -129,7 +129,7 @@ public class GregtechConduits { wireFactory("RedstoneAlloy", 32, BaseWireID+45, 0, 2, 1, new short[]{178,34,34, 0}); } - if(!GTNH) { + if(!GTNH) { customWireFactory(ALLOY.LEAGRISIUM, 512, BaseWireID + 56, 1, 2, 2); customWireFactory(ELEMENT.getInstance().ZIRCONIUM, 128, BaseWireID + 67, 1, 2, 2); customWireFactory(ALLOY.HG1223, 32768, BaseWireID + 78, 2, 8, 4); @@ -235,8 +235,6 @@ public class GregtechConduits { } } - generateWireRecipes(aMaterial); - } private static void superConductorFactory(final GT_Materials Material, final int Voltage, final int ID, final long insulatedLoss, final long uninsulatedLoss, final long Amps){ @@ -292,7 +290,7 @@ public class GregtechConduits { GT_OreDictUnificator.registerOre(OrePrefixes.pipeMedium.get(material), new GT_MetaPipeEntity_Fluid(startID+2, "GT_Pipe_"+material.mDefaultLocalName+"", ""+material.mDefaultLocalName+" Fluid Pipe", 0.5F, material, transferRatePerTick*6, heatResistance, isGasProof).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.pipeLarge.get(material), new GT_MetaPipeEntity_Fluid(startID+3, "GT_Pipe_"+material.mDefaultLocalName+"_Large", "Large "+material.mDefaultLocalName+" Fluid Pipe", 0.75F, material, transferRatePerTick*8, heatResistance, isGasProof).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.pipeHuge.get(material), new GT_MetaPipeEntity_Fluid(startID+4, "GT_Pipe_"+material.mDefaultLocalName+"_Huge", "Huge "+material.mDefaultLocalName+" Fluid Pipe", GTNH?0.875F:1.0F, material, transferRatePerTick*10, heatResistance, isGasProof).getStackForm(1L)); - generatePipeRecipes(material.mDefaultLocalName, mass, voltage); + //generatePipeRecipes(material.mDefaultLocalName, mass, voltage); } private static void generateNonGTFluidPipes(final GT_Materials material, final Material myMaterial, final int startID, final int transferRatePerSec, final int heatResistance, final boolean isGasProof){ @@ -312,14 +310,14 @@ public class GregtechConduits { GT_OreDictUnificator.registerOre(OrePrefixes.pipeMedium.get(material), new GregtechMetaPipeEntityFluid(startID+2, "GT_Pipe_"+material.mDefaultLocalName+"", ""+material.mDefaultLocalName+" Fluid Pipe", 0.5F, material, transferRatePerTick*6, heatResistance, isGasProof).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.pipeLarge.get(material), new GregtechMetaPipeEntityFluid(startID+3, "GT_Pipe_"+material.mDefaultLocalName+"_Large", "Large "+material.mDefaultLocalName+" Fluid Pipe", 0.75F, material, transferRatePerTick*8, heatResistance, isGasProof).getStackForm(1L)); GT_OreDictUnificator.registerOre(OrePrefixes.pipeHuge.get(material), new GregtechMetaPipeEntityFluid(startID+4, "GT_Pipe_"+material.mDefaultLocalName+"_Huge", "Huge "+material.mDefaultLocalName+" Fluid Pipe", GTNH?0.875F:1.0F, material, transferRatePerTick*10, heatResistance, isGasProof).getStackForm(1L)); - generatePipeRecipes(material.mDefaultLocalName, mass, tVoltageMultiplier); + //generatePipeRecipes(material.mDefaultLocalName, mass, tVoltageMultiplier); } - private static void generatePipeRecipes(final String materialName, final long Mass, final long vMulti){ + public static void generatePipeRecipes(final String materialName, final long Mass, final long vMulti){ String output = materialName.substring(0, 1).toUpperCase() + materialName.substring(1); - output = output.replace("-", "").replace("_", "").replace(" ", ""); + output = Utils.sanitizeString(output); if (output.equals("VoidMetal")){ output = "Void"; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java index adaabed10f..d0b9d9287f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechCustomHatches.java @@ -1,15 +1,8 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; -import static gtPlusPlus.core.recipe.common.CI.bitsd; - -import gregtech.api.enums.ItemList; -import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ALLOY; -import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler_Adv; @@ -60,21 +53,6 @@ public class GregtechCustomHatches { "Naquadah Reactor Input hatch" // Local name ).getStackForm(1L)); - 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.HG1223.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])); - } private static void run2() { @@ -106,35 +84,6 @@ public class GregtechCustomHatches { .set((new GT_MetaTileEntity_Hatch_Muffler_Adv(30009, "hatch.muffler.adv.tier.09", "Advanced Muffler Hatch (MAX)", 9)) .getStackForm(1L)); - 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) }); - - //GT++ multiblock Control Core Bus GregtechItemList.Hatch_Control_Core .set((new GT_MetaTileEntity_Hatch_ControlCore(30020, "hatch.control.adv", "Control Core Module", 1)) diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java index 3741955e7b..bbe2d10273 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechPollutionDevices.java @@ -2,8 +2,6 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.recipe.common.CI; -import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_AirIntake; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic.GregtechMetaAtmosphericReconditioner; @@ -53,11 +51,7 @@ public class GregtechPollutionDevices { } GregtechItemList.Hatch_Air_Intake.set(new GT_MetaTileEntity_Hatch_AirIntake(861, "hatch.air.intake.tier.00", "Air Intake Hatch", 5).getStackForm(1L)); - 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])); + } |