diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core')
113 files changed, 6953 insertions, 2394 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index b7a2526e30..af7e5d833e 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -2,6 +2,7 @@ package gtPlusPlus.core.block; import gtPlusPlus.core.block.general.LightGlass; import gtPlusPlus.core.block.machine.Machine_Workbench; +import gtPlusPlus.core.block.machine.Machine_WorkbenchAdvanced; import gtPlusPlus.core.fluids.FluidRegistryHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -13,6 +14,7 @@ import cpw.mods.fml.common.registry.GameRegistry; public final class ModBlocks { public static Block blockWorkbench; + public static Block blockWorkbenchAdvanced; //Blocks //public static Block blockBloodSteel; //public static Block blockStaballoy; @@ -48,6 +50,7 @@ public final class ModBlocks { //Workbench blockWorkbench = new Machine_Workbench().setHardness(1.5F); + blockWorkbenchAdvanced = new Machine_WorkbenchAdvanced().setHardness(2.5F); } diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java index 308413d81f..ed986b756e 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java @@ -4,24 +4,31 @@ import gtPlusPlus.GTplusplus; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.player.PlayerUtils; +import ic2.core.item.tool.ItemToolWrench; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import buildcraft.api.tools.IToolWrench; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import crazypants.enderio.api.tool.ITool; public class Machine_Workbench extends BlockContainer { @SideOnly(Side.CLIENT) private IIcon textureTop; @SideOnly(Side.CLIENT) + private IIcon textureBottom; + @SideOnly(Side.CLIENT) private IIcon textureFront; @SuppressWarnings("deprecation") @@ -31,7 +38,7 @@ public class Machine_Workbench extends BlockContainer this.setBlockName("blockWorkbenchGT"); this.setCreativeTab(AddToCreativeTab.tabMachines); GameRegistry.registerBlock(this, "blockWorkbenchGT"); - LanguageRegistry.addName(this, "Gregtech Workbench"); + LanguageRegistry.addName(this, "Bronze Workbench"); } @@ -42,16 +49,17 @@ public class Machine_Workbench extends BlockContainer @SideOnly(Side.CLIENT) public IIcon getIcon(int p_149691_1_, int p_149691_2_) { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? Blocks.planks.getBlockTextureFromSide(p_149691_1_) : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront)); + return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront)); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "workbench"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "workbench" + "_top"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "workbench"); + this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); + this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_top_crafting"); + this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side"); + this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); } /** @@ -59,17 +67,49 @@ public class Machine_Workbench extends BlockContainer */ @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) - { - if (world.isRemote) return true; - - TileEntity te = world.getTileEntity(x, y, z); - if (te != null && te instanceof TileEntityWorkbench) - { - player.openGui(GTplusplus.instance, 3, world, x, y, z); - return true; - } - return false; - } + { + + ItemStack heldItem = null; + if (world.isRemote){ + heldItem = PlayerUtils.getItemStackInPlayersHand(); + } + + boolean holdingWrench = false; + + if (heldItem != null){ + if (heldItem.getItem() instanceof ItemToolWrench){ + holdingWrench = true; + } + else if (heldItem.getItem() instanceof IToolWrench){ + holdingWrench = true; + } + else if (heldItem.getItem() instanceof ITool){ + holdingWrench = true; + } + /*else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){ + GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) heldItem.getItem(); + if (testTool.canWrench(player, x, y, z)){ + holdingWrench = true; + } + }*/ + else { + holdingWrench = false; + } + } + + if (world.isRemote) return true; + + TileEntity te = world.getTileEntity(x, y, z); + if (te != null && te instanceof TileEntityWorkbench) + { + if (!holdingWrench){ + player.openGui(GTplusplus.instance, 3, world, x, y, z); + return true; + } + Utils.LOG_INFO("Holding a Wrench, doing wrench things instead."); + } + return false; + } @Override public TileEntity createNewTileEntity(World world, int p_149915_2_) { diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java new file mode 100644 index 0000000000..2f061ea298 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java @@ -0,0 +1,114 @@ +package gtPlusPlus.core.block.machine; + +import gtPlusPlus.GTplusplus; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.player.PlayerUtils; +import ic2.core.item.tool.ItemToolWrench; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import buildcraft.api.tools.IToolWrench; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import crazypants.enderio.api.tool.ITool; + +public class Machine_WorkbenchAdvanced extends BlockContainer +{ + @SideOnly(Side.CLIENT) + private IIcon textureTop; + @SideOnly(Side.CLIENT) + private IIcon textureBottom; + @SideOnly(Side.CLIENT) + private IIcon textureFront; + + @SuppressWarnings("deprecation") + public Machine_WorkbenchAdvanced() + { + super(Material.iron); + this.setBlockName("blockWorkbenchGTAdvanced"); + this.setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerBlock(this, "blockWorkbenchGTAdvanced"); + LanguageRegistry.addName(this, "Advanced Workbench"); + + } + + /** + * Gets the block's texture. Args: side, meta + */ + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int p_149691_1_, int p_149691_2_) + { + return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : (p_149691_1_ != 2 && p_149691_1_ != 4 ? this.blockIcon : this.textureFront)); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister p_149651_1_) + { + this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); + this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting"); + this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); + this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); + } + + /** + * Called upon block activation (right click on the block.) + */ + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) + { + + ItemStack heldItem = PlayerUtils.getItemStackInPlayersHand(player); + if (world.isRemote) return true; + boolean holdingWrench = false; + + if (heldItem != null){ + if (heldItem.getItem() instanceof ItemToolWrench){ + holdingWrench = true; + } + else if (heldItem.getItem() instanceof IToolWrench){ + holdingWrench = true; + } + else if (heldItem.getItem() instanceof ITool){ + holdingWrench = true; + } + /*else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){ + GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) heldItem.getItem(); + if (testTool.canWrench(player, x, y, z)){ + holdingWrench = true; + } + }*/ + else { + holdingWrench = false; + } + } + + + TileEntity te = world.getTileEntity(x, y, z); + if (te != null && te instanceof TileEntityWorkbenchAdvanced) + { + if (!holdingWrench){ + player.openGui(GTplusplus.instance, 4, world, x, y, z); + return true; + } + Utils.LOG_INFO("Holding a Wrench, doing wrench things instead."); + } + return false; + } + + @Override + public TileEntity createNewTileEntity(World world, int p_149915_2_) { + return new TileEntityWorkbenchAdvanced(128000, 2); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java b/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java index 06c13f997a..5ffd70efc4 100644 --- a/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java +++ b/src/Java/gtPlusPlus/core/block/machine/heliumgen/tileentity/TileEntityHeliumGenerator.java @@ -4,7 +4,7 @@ import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.block.machine.heliumgen.slots.InvSlotRadiation; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import ic2.api.Direction; import ic2.api.reactor.IReactor; import ic2.api.reactor.IReactorComponent; @@ -51,7 +51,7 @@ public class TileEntityHeliumGenerator extends TileEntityInventory implements II if(++progress >= 40){ //if(++progress >= 300){ if(heliumStack == null) - heliumStack = UtilsItems.getSimpleStack(ModItems.itemHeliumBlob); + heliumStack = ItemUtils.getSimpleStack(ModItems.itemHeliumBlob); else if(heliumStack.getItem() == ModItems.itemHeliumBlob && heliumStack.stackSize < 64) heliumStack.stackSize++; progress = 0; diff --git a/src/Java/gtPlusPlus/core/commands/CommandMath.java b/src/Java/gtPlusPlus/core/commands/CommandMath.java index 2a726dd8b1..01091d84e3 100644 --- a/src/Java/gtPlusPlus/core/commands/CommandMath.java +++ b/src/Java/gtPlusPlus/core/commands/CommandMath.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.commands; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.player.PlayerUtils; import java.util.ArrayList; import java.util.List; @@ -101,7 +102,7 @@ public class CommandMath implements ICommand } } catch(NullPointerException e) { - Utils.messagePlayer(P, "You do not have a spawn, so..."); + PlayerUtils.messagePlayer(P, "You do not have a spawn, so..."); } if (Y == null || Y.equals(null)) { Y = W.getSpawnPoint(); diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java new file mode 100644 index 0000000000..634fbe47d2 --- /dev/null +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java @@ -0,0 +1,31 @@ +package gtPlusPlus.core.common.compat; + +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.item.general.ItemCloakingDevice; +import gtPlusPlus.core.item.general.ItemHealingDevice; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.Utils; + +public class COMPAT_Baubles { + + public static void run(){ + if (LoadedMods.Baubles){ + baublesLoaded(); + } + else { + baublesNotLoaded(); + } + } + + public static void baublesLoaded(){ + Utils.LOG_INFO("Baubles Found - Loading Wearables."); + ModItems.itemPersonalCloakingDevice = new ItemCloakingDevice(0); + //itemPersonalCloakingDeviceCharged = new ItemCloakingDevice(0).set; + ModItems.itemPersonalHealingDevice = new ItemHealingDevice(); + } + + public static void baublesNotLoaded(){ + Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); + } + +} diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java index efa86f0009..c64e332c50 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_CompactWindmills.java @@ -3,7 +3,7 @@ package gtPlusPlus.core.common.compat; import static gtPlusPlus.core.handler.COMPAT_HANDLER.AddRecipeQueue; import static gtPlusPlus.core.handler.COMPAT_HANDLER.RemoveRecipeQueue; import gtPlusPlus.core.recipe.ShapedRecipeObject; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; @@ -11,49 +11,49 @@ import net.minecraft.item.ItemStack; public class COMPAT_CompactWindmills { //Change IC2 Upgrades - public static ItemStack kineticWind = UtilsItems.simpleMetaStack("IC2:blockKineticGenerator", 0, 1); - public static ItemStack shaftIron = UtilsItems.simpleMetaStack("IC2:itemRecipePart", 11, 1); - public static ItemStack cableCopper = UtilsItems.simpleMetaStack("gregtech:gt.blockmachines", 1367, 1); + public static ItemStack kineticWind = ItemUtils.simpleMetaStack("IC2:blockKineticGenerator", 0, 1); + public static ItemStack shaftIron = ItemUtils.simpleMetaStack("IC2:itemRecipePart", 11, 1); + public static ItemStack cableCopper = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 1367, 1); public static String plateRubber = "ore:plateRubber"; //Machine Casings - public static ItemStack elvCasing = UtilsItems.simpleMetaStack("gregtech:gt.blockcasings", 0, 1); - public static ItemStack lvCasing = UtilsItems.simpleMetaStack("gregtech:gt.blockcasings", 1, 1); - public static ItemStack mvCasing = UtilsItems.simpleMetaStack("gregtech:gt.blockcasings", 2, 1); - public static ItemStack hvCasing = UtilsItems.simpleMetaStack("gregtech:gt.blockcasings", 3, 1); - public static ItemStack evCasing = UtilsItems.simpleMetaStack("gregtech:gt.blockcasings", 4, 1); - public static ItemStack ivCasing = UtilsItems.simpleMetaStack("gregtech:gt.blockcasings", 5, 1); + public static ItemStack elvCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 0, 1); + public static ItemStack lvCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 1, 1); + public static ItemStack mvCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 2, 1); + public static ItemStack hvCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 3, 1); + public static ItemStack evCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 4, 1); + public static ItemStack ivCasing = ItemUtils.simpleMetaStack("gregtech:gt.blockcasings", 5, 1); //GT Transformers - public static ItemStack elvTransformer = UtilsItems.simpleMetaStack("gregtech:gt.blockmachines", 20, 1); - public static ItemStack lvTransformer = UtilsItems.simpleMetaStack("gregtech:gt.blockmachines", 21, 1); - public static ItemStack mvTransformer = UtilsItems.simpleMetaStack("gregtech:gt.blockmachines", 22, 1); - public static ItemStack hvTransformer = UtilsItems.simpleMetaStack("gregtech:gt.blockmachines", 23, 1); - public static ItemStack evTransformer = UtilsItems.simpleMetaStack("gregtech:gt.blockmachines", 24, 1); + public static ItemStack elvTransformer = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 20, 1); + public static ItemStack lvTransformer = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 21, 1); + public static ItemStack mvTransformer = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 22, 1); + public static ItemStack hvTransformer = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 23, 1); + public static ItemStack evTransformer = ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 24, 1); //Compact Windmills - public static ItemStack elvWindmill = UtilsItems.simpleMetaStack("CompactWindmills:blockCompactWindmill", 0, 1); - public static ItemStack lvWindmill = UtilsItems.simpleMetaStack("CompactWindmills:blockCompactWindmill", 1, 1); - public static ItemStack mvWindmill = UtilsItems.simpleMetaStack("CompactWindmills:blockCompactWindmill", 2, 1); - public static ItemStack hvWindmill = UtilsItems.simpleMetaStack("CompactWindmills:blockCompactWindmill", 3, 1); - public static ItemStack evWindmill = UtilsItems.simpleMetaStack("CompactWindmills:blockCompactWindmill", 4, 1); + public static ItemStack elvWindmill = ItemUtils.simpleMetaStack("CompactWindmills:blockCompactWindmill", 0, 1); + public static ItemStack lvWindmill = ItemUtils.simpleMetaStack("CompactWindmills:blockCompactWindmill", 1, 1); + public static ItemStack mvWindmill = ItemUtils.simpleMetaStack("CompactWindmills:blockCompactWindmill", 2, 1); + public static ItemStack hvWindmill = ItemUtils.simpleMetaStack("CompactWindmills:blockCompactWindmill", 3, 1); + public static ItemStack evWindmill = ItemUtils.simpleMetaStack("CompactWindmills:blockCompactWindmill", 4, 1); //Compact Rotors - public static ItemStack rotor2 = UtilsItems.getItemStack("CompactWindmills:WOOL", 1); - public static ItemStack rotor1 = UtilsItems.getItemStack("CompactWindmills:WOOD", 1); - public static ItemStack rotor3 = UtilsItems.getItemStack("CompactWindmills:ALLOY", 1); - public static ItemStack rotor4 = UtilsItems.getItemStack("CompactWindmills:CARBON", 1); - public static ItemStack rotor5 = UtilsItems.getItemStack("CompactWindmills:IRIDIUM", 1); + public static ItemStack rotor2 = ItemUtils.getItemStack("CompactWindmills:WOOL", 1); + public static ItemStack rotor1 = ItemUtils.getItemStack("CompactWindmills:WOOD", 1); + public static ItemStack rotor3 = ItemUtils.getItemStack("CompactWindmills:ALLOY", 1); + public static ItemStack rotor4 = ItemUtils.getItemStack("CompactWindmills:CARBON", 1); + public static ItemStack rotor5 = ItemUtils.getItemStack("CompactWindmills:IRIDIUM", 1); //IC2 Rotors - public static ItemStack rotorIC1 = UtilsItems.getItemStack("IC2:itemwoodrotor", 1); - public static ItemStack rotorIC2 = UtilsItems.getItemStack("IC2:itemironrotor", 1); - public static ItemStack rotorIC3 = UtilsItems.getItemStack("IC2:itemsteelrotor", 1); - public static ItemStack rotorIC4 = UtilsItems.getItemStack("IC2:itemwcarbonrotor", 1); - public static ItemStack rotorBlade1 = UtilsItems.simpleMetaStack("IC2:itemRecipePart", 7, 1); - public static ItemStack rotorBlade2 = UtilsItems.simpleMetaStack("IC2:itemRecipePart", 8, 1); - public static ItemStack rotorBlade3 = UtilsItems.simpleMetaStack("IC2:itemRecipePart", 10, 1); - public static ItemStack rotorBlade4 = UtilsItems.simpleMetaStack("IC2:itemRecipePart", 9, 1); + public static ItemStack rotorIC1 = ItemUtils.getItemStack("IC2:itemwoodrotor", 1); + public static ItemStack rotorIC2 = ItemUtils.getItemStack("IC2:itemironrotor", 1); + public static ItemStack rotorIC3 = ItemUtils.getItemStack("IC2:itemsteelrotor", 1); + public static ItemStack rotorIC4 = ItemUtils.getItemStack("IC2:itemwcarbonrotor", 1); + public static ItemStack rotorBlade1 = ItemUtils.simpleMetaStack("IC2:itemRecipePart", 7, 1); + public static ItemStack rotorBlade2 = ItemUtils.simpleMetaStack("IC2:itemRecipePart", 8, 1); + public static ItemStack rotorBlade3 = ItemUtils.simpleMetaStack("IC2:itemRecipePart", 10, 1); + public static ItemStack rotorBlade4 = ItemUtils.simpleMetaStack("IC2:itemRecipePart", 9, 1); //Plates public static String plateTier1 = "ore:plateMagnalium"; diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java index d538b2df3d..7a5389e37c 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_EnderIO.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.common.compat; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.item.ModItems; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; public class COMPAT_EnderIO { @@ -12,7 +12,7 @@ public class COMPAT_EnderIO { } private static final void run(){ - UtilsItems.getItemForOreDict("EnderIO:itemAlloy", "ingotVibrantAlloy", "Vibrant Alloy Ingot", 2); + ItemUtils.getItemForOreDict("EnderIO:itemAlloy", "ingotVibrantAlloy", "Vibrant Alloy Ingot", 2); GT_OreDictUnificator.registerOre("plateConductiveIron", new ItemStack(ModItems.itemPlateConductiveIron)); GT_OreDictUnificator.registerOre("plateDarkSteel", new ItemStack(ModItems.itemPlateDarkSteel)); GT_OreDictUnificator.registerOre("plateElectricalSteel", new ItemStack(ModItems.itemPlateElectricalSteel)); diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java index 5e21c432b5..d8ff219db7 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_ExtraUtils.java @@ -2,25 +2,25 @@ package gtPlusPlus.core.common.compat; import gtPlusPlus.core.lib.CORE.configSwitches; import gtPlusPlus.core.recipe.RECIPES_Tools; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.ItemStack; public class COMPAT_ExtraUtils { public static void OreDict(){ - RECIPES_Tools.RECIPE_DivisionSigil = new ItemStack(UtilsItems.getItem("ExtraUtilities:divisionSigil")); + RECIPES_Tools.RECIPE_DivisionSigil = new ItemStack(ItemUtils.getItem("ExtraUtilities:divisionSigil")); run(); } private static final void run(){ - UtilsItems.getItemForOreDict("ExtraUtilities:bedrockiumIngot", "ingotBedrockium", "Bedrockium Ingot", 0); + ItemUtils.getItemForOreDict("ExtraUtilities:bedrockiumIngot", "ingotBedrockium", "Bedrockium Ingot", 0); //GT_OreDictUnificator.registerOre("plateBedrockium", new ItemStack(ModItems.itemPlateBedrockium)); if (configSwitches.enableAlternativeDivisionSigilRecipe){ //Division Sigil - UtilsRecipe.recipeBuilder( + RecipeUtils.recipeBuilder( "plateNetherStar", "gemIridium", "plateNetherStar", "plateIridium", RECIPES_Tools.craftingToolHardHammer, "plateIridium", "plateNetherStar", "gemIridium", "plateNetherStar", diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java index 14ec5dfd4d..c1546bba63 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_IC2.java @@ -5,14 +5,14 @@ import static gtPlusPlus.core.handler.COMPAT_HANDLER.RemoveRecipeQueue; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.lib.CORE.configSwitches; import gtPlusPlus.core.recipe.ShapedRecipeObject; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; public class COMPAT_IC2 { - private static ItemStack itemCropnalyzer = UtilsItems.simpleMetaStack("IC2:itemCropnalyzer", 0, 1); - private static ItemStack itemSolarHelmet = UtilsItems.simpleMetaStack("IC2:itemSolarHelmet", 0, 1); + private static ItemStack itemCropnalyzer = ItemUtils.simpleMetaStack("IC2:itemCropnalyzer", 0, 1); + private static ItemStack itemSolarHelmet = ItemUtils.simpleMetaStack("IC2:itemSolarHelmet", 0, 1); public static ShapedRecipeObject Cropnalyzer = new ShapedRecipeObject( "ore:cableGt02Copper", "ore:cableGt02Copper", null, diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java index 3a996ed849..9e29458bce 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_MorePlanets.java @@ -1,6 +1,6 @@ package gtPlusPlus.core.common.compat; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; public class COMPAT_MorePlanets { @@ -11,27 +11,27 @@ public class COMPAT_MorePlanets { private final static void run(){ //Metals - UtilsItems.getItemForOreDict("MorePlanet:kapteyn-b_item", "ingotFrozenIron", "Frozen Iron Ingot", 0); - UtilsItems.getItemForOreDict("MorePlanet:kapteyn-b_item", "ingotAnyIron", "Frozen Iron Ingot", 0); - UtilsItems.getItemForOreDict("MorePlanet:polongnius_item", "ingotPalladium", "Palladium Ingot", 5); - UtilsItems.getItemForOreDict("MorePlanet:fronos_item", "ingotIridium", "Iridium Ingot", 3); - UtilsItems.getItemForOreDict("MorePlanet:nibiru_item", "ingotNorium", "Norium Ingot", 1); - UtilsItems.getItemForOreDict("MorePlanet:venus_item", "ingotLead", "Lead Ingot", 0); - UtilsItems.getItemForOreDict("MorePlanet:diona_item", "ingotQuontonium", "Quontonium Ingot", 0); - UtilsItems.getItemForOreDict("MorePlanet:diona_item", "ingotFronisium", "Fronisium Ingot", 1); - UtilsItems.getItemForOreDict("MorePlanet:sirius-b_item", "ingotSulfur", "Sulfur Ingot", 3); - UtilsItems.getItemForOreDict("MorePlanet:koentus_item", "ingotKoentusMeteoricIron", "Koentus Meteoric Iron Ingot", 4); - UtilsItems.getItemForOreDict("MorePlanet:mercury_item", "ingotMetallic", "Metallic Ingot", 2); - UtilsItems.getItemForOreDict("MorePlanet:polongnius_item", "ingotPolongiusMeteoricIron", "Polongius Meteoric Iron Ingot", 4); - UtilsItems.getItemForOreDict("MorePlanet:mercury_item", "ingotMeteoricSteel", "Meteoric Steel Ingot", 3); - UtilsItems.getItemForOreDict("MorePlanet:sirius-b_item", "dustSulfur", "Sulfur Dust", 2); + ItemUtils.getItemForOreDict("MorePlanet:kapteyn-b_item", "ingotFrozenIron", "Frozen Iron Ingot", 0); + ItemUtils.getItemForOreDict("MorePlanet:kapteyn-b_item", "ingotAnyIron", "Frozen Iron Ingot", 0); + ItemUtils.getItemForOreDict("MorePlanet:polongnius_item", "ingotPalladium", "Palladium Ingot", 5); + ItemUtils.getItemForOreDict("MorePlanet:fronos_item", "ingotIridium", "Iridium Ingot", 3); + ItemUtils.getItemForOreDict("MorePlanet:nibiru_item", "ingotNorium", "Norium Ingot", 1); + ItemUtils.getItemForOreDict("MorePlanet:venus_item", "ingotLead", "Lead Ingot", 0); + ItemUtils.getItemForOreDict("MorePlanet:diona_item", "ingotQuontonium", "Quontonium Ingot", 0); + ItemUtils.getItemForOreDict("MorePlanet:diona_item", "ingotFronisium", "Fronisium Ingot", 1); + ItemUtils.getItemForOreDict("MorePlanet:sirius-b_item", "ingotSulfur", "Sulfur Ingot", 3); + ItemUtils.getItemForOreDict("MorePlanet:koentus_item", "ingotKoentusMeteoricIron", "Koentus Meteoric Iron Ingot", 4); + ItemUtils.getItemForOreDict("MorePlanet:mercury_item", "ingotMetallic", "Metallic Ingot", 2); + ItemUtils.getItemForOreDict("MorePlanet:polongnius_item", "ingotPolongiusMeteoricIron", "Polongius Meteoric Iron Ingot", 4); + ItemUtils.getItemForOreDict("MorePlanet:mercury_item", "ingotMeteoricSteel", "Meteoric Steel Ingot", 3); + ItemUtils.getItemForOreDict("MorePlanet:sirius-b_item", "dustSulfur", "Sulfur Dust", 2); //Gems - UtilsItems.getItemForOreDict("MorePlanet:fronos_item", "gemBlackDiamond", "Black Diamond Gem", 2); - UtilsItems.getItemForOreDict("MorePlanet:koentus_item", "gemWhiteCrystal", "White Crystal", 0); - UtilsItems.getItemForOreDict("MorePlanet:nibiru_item", "gemRedCrystal", "Red Crystal", 0); - UtilsItems.getItemForOreDict("MorePlanet:pluto_item", "gemXeonius", "Xeonius Gem", 0); - UtilsItems.getItemForOreDict("MorePlanet:kapteyn-b_item", "gemUranium", "Uranium Gem", 1); + ItemUtils.getItemForOreDict("MorePlanet:fronos_item", "gemBlackDiamond", "Black Diamond Gem", 2); + ItemUtils.getItemForOreDict("MorePlanet:koentus_item", "gemWhiteCrystal", "White Crystal", 0); + ItemUtils.getItemForOreDict("MorePlanet:nibiru_item", "gemRedCrystal", "Red Crystal", 0); + ItemUtils.getItemForOreDict("MorePlanet:pluto_item", "gemXeonius", "Xeonius Gem", 0); + ItemUtils.getItemForOreDict("MorePlanet:kapteyn-b_item", "gemUranium", "Uranium Gem", 1); } } diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java index d99e81f48d..b1b7464dd2 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Thaumcraft.java @@ -3,7 +3,7 @@ package gtPlusPlus.core.common.compat; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.lib.CORE.configSwitches; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; public class COMPAT_Thaumcraft { @@ -18,26 +18,26 @@ public class COMPAT_Thaumcraft { for(int i=0; i<=6; i++){ //Utils.LOG_INFO(""+i); - UtilsItems.getItemForOreDict("Thaumcraft:ItemShard", "shardAny", "TC Shard "+i, i); - GT_OreDictUnificator.registerOre("shardAny", UtilsItems.getItemStack("Thaumcraft:ItemShard:"+i, 1)); - UtilsItems.getItemForOreDict("Thaumcraft:ItemShard", "gemInfusedAnything", "TC Shard "+i, i); - GT_OreDictUnificator.registerOre("gemInfusedAnything", UtilsItems.getItemStack("Thaumcraft:ItemShard:"+i, 1)); + ItemUtils.getItemForOreDict("Thaumcraft:ItemShard", "shardAny", "TC Shard "+i, i); + GT_OreDictUnificator.registerOre("shardAny", ItemUtils.getItemStack("Thaumcraft:ItemShard:"+i, 1)); + ItemUtils.getItemForOreDict("Thaumcraft:ItemShard", "gemInfusedAnything", "TC Shard "+i, i); + GT_OreDictUnificator.registerOre("gemInfusedAnything", ItemUtils.getItemStack("Thaumcraft:ItemShard:"+i, 1)); //System.out.println("TC Shard registration count is: "+i); } if (LoadedMods.ForbiddenMagic){ for(int i=0; i<=6; i++){ //Utils.LOG_INFO(""+i); - UtilsItems.getItemForOreDict("ForbiddenMagic:NetherShard", "shardAny", "FM Shard "+i, i); - GT_OreDictUnificator.registerOre("shardAny", UtilsItems.getItemStack("ForbiddenMagic:NetherShard:"+i, 1)); - UtilsItems.getItemForOreDict("ForbiddenMagic:NetherShard", "gemInfusedAnything", "FM Shard "+i, i); - GT_OreDictUnificator.registerOre("gemInfusedAnything", UtilsItems.getItemStack("ForbiddenMagic:NetherShard:"+i, 1)); + ItemUtils.getItemForOreDict("ForbiddenMagic:NetherShard", "shardAny", "FM Shard "+i, i); + GT_OreDictUnificator.registerOre("shardAny", ItemUtils.getItemStack("ForbiddenMagic:NetherShard:"+i, 1)); + ItemUtils.getItemForOreDict("ForbiddenMagic:NetherShard", "gemInfusedAnything", "FM Shard "+i, i); + GT_OreDictUnificator.registerOre("gemInfusedAnything", ItemUtils.getItemStack("ForbiddenMagic:NetherShard:"+i, 1)); //System.out.println("TC Shard registration count is: "+i); } - UtilsItems.getItemForOreDict("ForbiddenMagic:GluttonyShard", "shardAny", "FM Gluttony Shard", 0); - GT_OreDictUnificator.registerOre("shardAny", UtilsItems.getItemStack("ForbiddenMagic:GluttonyShard", 1)); - UtilsItems.getItemForOreDict("ForbiddenMagic:GluttonyShard", "gemInfusedAnything", "FM Gluttony Shard", 0); - GT_OreDictUnificator.registerOre("gemInfusedAnything", UtilsItems.getItemStack("ForbiddenMagic:GluttonyShard", 1)); + ItemUtils.getItemForOreDict("ForbiddenMagic:GluttonyShard", "shardAny", "FM Gluttony Shard", 0); + GT_OreDictUnificator.registerOre("shardAny", ItemUtils.getItemStack("ForbiddenMagic:GluttonyShard", 1)); + ItemUtils.getItemForOreDict("ForbiddenMagic:GluttonyShard", "gemInfusedAnything", "FM Gluttony Shard", 0); + GT_OreDictUnificator.registerOre("gemInfusedAnything", ItemUtils.getItemStack("ForbiddenMagic:GluttonyShard", 1)); } } diff --git a/src/Java/gtPlusPlus/core/container/Container_Workbench.java b/src/Java/gtPlusPlus/core/container/Container_Workbench.java index 3c12e860bc..c814f8815e 100644 --- a/src/Java/gtPlusPlus/core/container/Container_Workbench.java +++ b/src/Java/gtPlusPlus/core/container/Container_Workbench.java @@ -1,18 +1,26 @@ package gtPlusPlus.core.container; +import gregtech.api.gui.GT_Slot_Holo; import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.interfaces.IItemBlueprint; import gtPlusPlus.core.inventories.InventoryWorkbenchChest; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloCrafting; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots; import gtPlusPlus.core.inventories.InventoryWorkbenchTools; +import gtPlusPlus.core.item.general.ItemBlueprint; +import gtPlusPlus.core.slots.SlotBlueprint; import gtPlusPlus.core.slots.SlotGtTool; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.slots.SlotOutput; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; 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.InventoryCraftResult; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; -import net.minecraft.inventory.SlotCrafting; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.world.World; @@ -23,23 +31,29 @@ public class Container_Workbench extends Container { public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); public final InventoryWorkbenchChest inventoryChest; public final InventoryWorkbenchTools inventoryTool; - public IInventory craftResult = new InventoryCraftResult(); + public final InventoryWorkbenchHoloSlots inventoryHolo; + public final InventoryWorkbenchHoloCrafting inventoryCrafting; + private World worldObj; private int posX; private int posY; private int posZ; - - public boolean movingChest; - public boolean movingCrafting; - public static int StorageSlotNumber = 12; //Number of slots in storage area - public static int ToolSlotNumber = 5; // Number of slots in the tool area up top + public static int HoloSlotNumber = 6; public static int InputSlotNumber = 9; //Number of Slots in the Crafting Grid - public static int InOutputSlotNumber = InputSlotNumber + 1; //Same plus Output Slot + public static int StorageSlotNumber = 16; //Number of slots in storage area + public static int ToolSlotNumber = 5; // Number of slots in the tool area up top + public static int InOutputSlotNumber = InputSlotNumber + StorageSlotNumber + ToolSlotNumber + HoloSlotNumber; //Same plus Output Slot public static int InventorySlotNumber = 36; //Inventory Slots (Inventory and Hotbar) public static int InventoryOutSlotNumber = InventorySlotNumber + 1; //Inventory Slot Number + Output public static int FullSlotNumber = InventorySlotNumber + InOutputSlotNumber; //All slots - + + private int slotOutput = 0; + private int[] slotHolo = new int[5]; + private int[] slotCrafting = new int[9]; + private int[] slotStorage = new int[16]; + private int[] slotTools = new int[5]; + public void moveCraftingToChest(){ //Check Chest Space for (int i=0;i<9;i++){ @@ -78,8 +92,8 @@ public class Container_Workbench extends Container { this.tile_entity = tile; this.inventoryChest = tile.inventoryChest; this.inventoryTool = tile.inventoryTool; - - int o=0; + this.inventoryHolo = tile.inventoryHolo; + this.inventoryCrafting = tile.inventoryCrafting; int var6; int var7; @@ -88,8 +102,26 @@ public class Container_Workbench extends Container { posY = tile.yCoord; posZ = tile.zCoord; + int o=0; + //Output slot - addSlotToContainer(new SlotCrafting(inventory.player, this.craftMatrix, craftResult, 0, 136, 64)); + addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64)); + //Util Slots + addSlotToContainer(new SlotBlueprint(inventoryHolo, 1, 136, 28)); //Blueprint + addSlotToContainer(new SlotNoInput(inventoryHolo, 2, 154, 28)); //Hopper + addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 3, 154, 64, false, false, 64)); //Parking + //Holo Slots + addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 4, 154, 46, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 5, 136, 46, false, false, 1)); + + for (int i=1; i<6; i++){ + slotHolo[o] = o+1; + o++; + } + + o=0; + + updateCraftingMatrix(); //Crafting Grid for (var6 = 0; var6 < 3; ++var6) @@ -97,67 +129,202 @@ public class Container_Workbench extends Container { for (var7 = 0; var7 < 3; ++var7) { this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 82 + var7 * 18, 28 + var6 * 18)); - } - } - //Player Inventory - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 9; ++var7) - { - this.addSlotToContainer(new Slot(inventory, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18)); + /*if (this.inventoryCrafting.getStackInSlot(o) != null){ + this.craftMatrix.setInventorySlotContents(o, inventoryCrafting.getStackInSlot(o)); + this.inventoryCrafting.setInventorySlotContents(o, null); + } */ + slotCrafting[o] = o+6; + o++; } } - //Player Hotbar - for (var6 = 0; var6 < 9; ++var6) - { - this.addSlotToContainer(new Slot(inventory, var6, 8 + var6 * 18, 142)); - } - - + o=0; //Storage Side for (var6 = 0; var6 < 4; ++var6) { for (var7 = 0; var7 < 4; ++var7) { - //Utils.LOG_INFO("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); + //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); this.addSlotToContainer(new Slot(inventoryChest, var7 + var6 * 4, 8 + var7 * 18, 7 + var6 * 18)); + slotStorage[o] = o+15; + o++; } } + o=0; + //Tool Slots for (var6 = 0; var6 < 1; ++var6) { for (var7 = 0; var7 < 5; ++var7) { this.addSlotToContainer(new SlotGtTool(inventoryTool, var7 + var6 * 3, 82 + var7 * 18, 8 + var6 * 18)); + slotTools[o] = o+31; + o++; } } + //Player Inventory + for (var6 = 0; var6 < 3; ++var6) + { + for (var7 = 0; var7 < 9; ++var7) + { + this.addSlotToContainer(new Slot(inventory, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18)); + } + } + + //Player Hotbar + for (var6 = 0; var6 < 9; ++var6) + { + this.addSlotToContainer(new Slot(inventory, var6, 8 + var6 * 18, 142)); + } + this.onCraftMatrixChanged(this.craftMatrix); } + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer){ + + if (!aPlayer.worldObj.isRemote){ + if (aSlotIndex == 999 || aSlotIndex == -999){ + //Utils.LOG_WARNING("??? - "+aSlotIndex); + } + + if (aSlotIndex == slotOutput){ + Utils.LOG_WARNING("Player Clicked on the output slot"); + //TODO + } + + for (int x : slotHolo){ + if (aSlotIndex == x){ + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); + if (x == 1){ + Utils.LOG_WARNING("Player Clicked Blueprint slot in the Holo Grid"); + } + else if (x == 2){ + Utils.LOG_WARNING("Player Clicked Right Arrow slot in the Holo Grid"); + if (inventoryHolo.getStackInSlot(1) != null){ + Utils.LOG_WARNING("Found an ItemStack."); + if (inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ + Utils.LOG_WARNING("Found a blueprint."); + ItemStack tempBlueprint = inventoryHolo.getStackInSlot(1); + ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); + if (inventoryHolo.getStackInSlot(0) != null && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ + Utils.LOG_WARNING("Output slot was not empty."); + Utils.LOG_WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); + tempItemBlueprint.setBlueprint(inventoryHolo.getStackInSlot(1), craftMatrix, inventoryHolo.getStackInSlot(0)); + ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); + inventoryHolo.setInventorySlotContents(1, newTempBlueprint); + Utils.LOG_WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); + } + else { + if (tempItemBlueprint.hasBlueprint(tempBlueprint)){ + Utils.LOG_WARNING("Blueprint already holds a recipe."); + } + else { + Utils.LOG_WARNING("Output slot was empty."); + } + } + } + else { + Utils.LOG_WARNING("ItemStack found was not a blueprint."); + } + } + else { + Utils.LOG_WARNING("No ItemStack found in Blueprint slot."); + } + } + else if (x == 3){ + Utils.LOG_WARNING("Player Clicked Big [P] slot in the Holo Grid"); + } + else if (x == 4){ + Utils.LOG_WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); + } + else if (x == 5){ + Utils.LOG_WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); + } + } + } + + for (int x : slotCrafting){ + if (aSlotIndex == x){ + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); + } + } + for (int x : slotStorage){ + if (aSlotIndex == x){ + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); + } + } + for (int x : slotTools){ + if (aSlotIndex == x){ + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); + } + } + } + //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + private void updateCraftingMatrix() { + for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { + craftMatrix.setInventorySlotContents(i, tile_entity.inventoryCrafting.getStackInSlot(i)); + } + } + + @Override + public void onCraftMatrixChanged(IInventory iiventory) { + tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); + } @Override + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + saveCraftingMatrix(); + } + + private void saveCraftingMatrix() { + for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { + tile_entity.inventoryCrafting.setInventorySlotContents(i, craftMatrix.getStackInSlot(i)); + } + } + + + + + /*@Override public void onCraftMatrixChanged(IInventory par1IInventory){ //Custom Recipe Handler //craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj)); - - //Vanilla CraftingManager - craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); - } + //Vanilla CraftingManager + Utils.LOG_WARNING("checking crafting grid for a valid output."); + ItemStack temp = CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj); + if (temp != null){ + Utils.LOG_WARNING("Output found. "+temp.getDisplayName()+" x"+temp.stackSize); + craftResult.setInventorySlotContents(slotOutput, temp); + } + else { + Utils.LOG_WARNING("No Valid output found."); + craftResult.setInventorySlotContents(slotOutput, null); + } + }*/ - @Override + /*@Override public void onContainerClosed(EntityPlayer par1EntityPlayer) - { + { + for (int o=0; o<craftMatrix.getSizeInventory(); o++){ + this.inventoryCrafting.setInventorySlotContents(o, craftMatrix.getStackInSlot(o)); + this.craftMatrix.setInventorySlotContents(o, null); + }*/ - super.onContainerClosed(par1EntityPlayer); + //super.onContainerClosed(par1EntityPlayer); - if (worldObj.isRemote) + /*if (worldObj.isRemote) { return; } @@ -170,10 +337,7 @@ public class Container_Workbench extends Container { { par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false); } - } - - } - + }*/ @Override public boolean canInteractWith(EntityPlayer par1EntityPlayer){ @@ -243,4 +407,12 @@ public class Container_Workbench extends Container { return var3; } + + //Can merge Slot + @Override + public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_) { + return p_94530_2_.inventory != tile_entity.inventoryCraftResult && super.func_94530_a(p_94530_1_, p_94530_2_); + } + + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java new file mode 100644 index 0000000000..f7dc7bb08c --- /dev/null +++ b/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java @@ -0,0 +1,384 @@ +package gtPlusPlus.core.container; + +import gregtech.api.gui.GT_Slot_Holo; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.interfaces.IItemBlueprint; +import gtPlusPlus.core.inventories.InventoryWorkbenchChest; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloCrafting; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots; +import gtPlusPlus.core.inventories.InventoryWorkbenchToolsElectric; +import gtPlusPlus.core.item.general.ItemBlueprint; +import gtPlusPlus.core.slots.SlotBlueprint; +import gtPlusPlus.core.slots.SlotGtToolElectric; +import gtPlusPlus.core.slots.SlotNoInput; +import gtPlusPlus.core.slots.SlotOutput; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; +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.InventoryCrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.world.World; + +public class Container_WorkbenchAdvanced extends Container { + + protected TileEntityWorkbenchAdvanced tile_entity; + public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); + public final InventoryWorkbenchChest inventoryChest; + public final InventoryWorkbenchToolsElectric inventoryTool; + public final InventoryWorkbenchHoloSlots inventoryHolo; + public final InventoryWorkbenchHoloCrafting inventoryCrafting; + + private World worldObj; + private int posX; + private int posY; + private int posZ; + + public static int HoloSlotNumber = 6; + public static int InputSlotNumber = 9; //Number of Slots in the Crafting Grid + public static int StorageSlotNumber = 16; //Number of slots in storage area + public static int ToolSlotNumber = 5; // Number of slots in the tool area up top + public static int InOutputSlotNumber = InputSlotNumber + StorageSlotNumber + ToolSlotNumber + HoloSlotNumber; //Same plus Output Slot + public static int InventorySlotNumber = 36; //Inventory Slots (Inventory and Hotbar) + public static int InventoryOutSlotNumber = InventorySlotNumber + 1; //Inventory Slot Number + Output + public static int FullSlotNumber = InventorySlotNumber + InOutputSlotNumber; //All slots + + private int slotOutput = 0; + private int[] slotHolo = new int[5]; + private int[] slotCrafting = new int[9]; + private int[] slotStorage = new int[16]; + private int[] slotTools = new int[5]; + + public Container_WorkbenchAdvanced(InventoryPlayer inventory, TileEntityWorkbenchAdvanced tile){ + this.tile_entity = tile; + this.inventoryChest = tile.inventoryChest; + this.inventoryTool = tile.inventoryTool; + this.inventoryHolo = tile.inventoryHolo; + this.inventoryCrafting = tile.inventoryCrafting; + + int var6; + int var7; + worldObj = tile.getWorldObj(); + posX = tile.xCoord; + posY = tile.yCoord; + posZ = tile.zCoord; + + int o=0; + + //Output slot + addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64)); + //Util Slots + addSlotToContainer(new SlotBlueprint(inventoryHolo, 1, 136, 28)); //Blueprint + addSlotToContainer(new SlotNoInput(inventoryHolo, 2, 154, 28)); //Hopper + addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 3, 154, 64, false, false, 64)); //Parking + //Holo Slots + addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 4, 154, 46, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 5, 136, 46, false, false, 1)); + + for (int i=1; i<6; i++){ + slotHolo[o] = o+1; + o++; + } + + o=0; + + updateCraftingMatrix(); + + //Crafting Grid + for (var6 = 0; var6 < 3; ++var6) + { + for (var7 = 0; var7 < 3; ++var7) + { + this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 82 + var7 * 18, 28 + var6 * 18)); + + /*if (this.inventoryCrafting.getStackInSlot(o) != null){ + this.craftMatrix.setInventorySlotContents(o, inventoryCrafting.getStackInSlot(o)); + this.inventoryCrafting.setInventorySlotContents(o, null); + } */ + slotCrafting[o] = o+6; + o++; + } + } + + o=0; + + //Storage Side + for (var6 = 0; var6 < 4; ++var6) + { + for (var7 = 0; var7 < 4; ++var7) + { + //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); + this.addSlotToContainer(new Slot(inventoryChest, var7 + var6 * 4, 8 + var7 * 18, 7 + var6 * 18)); + slotStorage[o] = o+15; + o++; + } + } + + o=0; + + //Tool Slots + for (var6 = 0; var6 < 1; ++var6) + { + for (var7 = 0; var7 < 5; ++var7) + { + this.addSlotToContainer(new SlotGtToolElectric(inventoryTool, var7 + var6 * 3, 82 + var7 * 18, 8 + var6 * 18, 3, false)); + slotTools[o] = o+31; + o++; + } + } + + //Player Inventory + for (var6 = 0; var6 < 3; ++var6) + { + for (var7 = 0; var7 < 9; ++var7) + { + this.addSlotToContainer(new Slot(inventory, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18)); + } + } + + //Player Hotbar + for (var6 = 0; var6 < 9; ++var6) + { + this.addSlotToContainer(new Slot(inventory, var6, 8 + var6 * 18, 142)); + } + + this.onCraftMatrixChanged(this.craftMatrix); + + } + + @Override + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer){ + + if (!aPlayer.worldObj.isRemote){ + if (aSlotIndex == 999 || aSlotIndex == -999){ + //Utils.LOG_WARNING("??? - "+aSlotIndex); + } + + if (aSlotIndex == slotOutput){ + Utils.LOG_WARNING("Player Clicked on the output slot"); + //TODO + } + + for (int x : slotHolo){ + if (aSlotIndex == x){ + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); + if (x == 1){ + Utils.LOG_WARNING("Player Clicked Blueprint slot in the Holo Grid"); + } + else if (x == 2){ + Utils.LOG_WARNING("Player Clicked Right Arrow slot in the Holo Grid"); + if (inventoryHolo.getStackInSlot(1) != null){ + Utils.LOG_WARNING("Found an ItemStack."); + if (inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ + Utils.LOG_WARNING("Found a blueprint."); + ItemStack tempBlueprint = inventoryHolo.getStackInSlot(1); + ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); + if (inventoryHolo.getStackInSlot(0) != null && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ + Utils.LOG_WARNING("Output slot was not empty."); + Utils.LOG_WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); + tempItemBlueprint.setBlueprint(inventoryHolo.getStackInSlot(1), craftMatrix, inventoryHolo.getStackInSlot(0)); + ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); + inventoryHolo.setInventorySlotContents(1, newTempBlueprint); + Utils.LOG_WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); + } + else { + if (tempItemBlueprint.hasBlueprint(tempBlueprint)){ + Utils.LOG_WARNING("Blueprint already holds a recipe."); + } + else { + Utils.LOG_WARNING("Output slot was empty."); + } + } + } + else { + Utils.LOG_WARNING("ItemStack found was not a blueprint."); + } + } + else { + Utils.LOG_WARNING("No ItemStack found in Blueprint slot."); + } + } + else if (x == 3){ + Utils.LOG_WARNING("Player Clicked Big [P] slot in the Holo Grid"); + } + else if (x == 4){ + Utils.LOG_WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); + } + else if (x == 5){ + Utils.LOG_WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); + } + } + } + + for (int x : slotCrafting){ + if (aSlotIndex == x){ + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); + } + } + for (int x : slotStorage){ + if (aSlotIndex == x){ + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); + } + } + for (int x : slotTools){ + if (aSlotIndex == x){ + Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); + } + } + } + //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + private void updateCraftingMatrix() { + for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { + craftMatrix.setInventorySlotContents(i, tile_entity.inventoryCrafting.getStackInSlot(i)); + } + } + + @Override + public void onCraftMatrixChanged(IInventory iiventory) { + tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); + } + + @Override + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + super.onContainerClosed(par1EntityPlayer); + saveCraftingMatrix(); + } + + private void saveCraftingMatrix() { + for (int i = 0; i < craftMatrix.getSizeInventory(); i++) { + tile_entity.inventoryCrafting.setInventorySlotContents(i, craftMatrix.getStackInSlot(i)); + } + } + + + + + /*@Override + public void onCraftMatrixChanged(IInventory par1IInventory){ + //Custom Recipe Handler + //craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj)); + + //Vanilla CraftingManager + Utils.LOG_WARNING("checking crafting grid for a valid output."); + ItemStack temp = CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj); + if (temp != null){ + Utils.LOG_WARNING("Output found. "+temp.getDisplayName()+" x"+temp.stackSize); + craftResult.setInventorySlotContents(slotOutput, temp); + } + else { + Utils.LOG_WARNING("No Valid output found."); + craftResult.setInventorySlotContents(slotOutput, null); + } + }*/ + + /*@Override + public void onContainerClosed(EntityPlayer par1EntityPlayer) + { + for (int o=0; o<craftMatrix.getSizeInventory(); o++){ + this.inventoryCrafting.setInventorySlotContents(o, craftMatrix.getStackInSlot(o)); + this.craftMatrix.setInventorySlotContents(o, null); + }*/ + + //super.onContainerClosed(par1EntityPlayer); + + /*if (worldObj.isRemote) + { + return; + } + + for (int i = 0; i < InputSlotNumber; i++) + { + ItemStack itemstack = craftMatrix.getStackInSlotOnClosing(i); + + if (itemstack != null) + { + par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false); + } + }*/ + + @Override + public boolean canInteractWith(EntityPlayer par1EntityPlayer){ + if (worldObj.getBlock(posX, posY, posZ) != ModBlocks.blockWorkbench){ + return false; + } + + return par1EntityPlayer.getDistanceSq((double)posX + 0.5D, (double)posY + 0.5D, (double)posZ + 0.5D) <= 64D; + } + + + @Override + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) + { + ItemStack var3 = null; + Slot var4 = (Slot)this.inventorySlots.get(par2); + + if (var4 != null && var4.getHasStack()) + { + ItemStack var5 = var4.getStack(); + var3 = var5.copy(); + + if (par2 == 0) + { + if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) + { + return null; + } + + var4.onSlotChange(var5, var3); + } + else if (par2 >= InOutputSlotNumber && par2 < InventoryOutSlotNumber) + { + if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) + { + return null; + } + } + else if (par2 >= InventoryOutSlotNumber && par2 < FullSlotNumber) + { + if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) + { + return null; + } + } + else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) + { + return null; + } + + if (var5.stackSize == 0) + { + var4.putStack((ItemStack)null); + } + else + { + var4.onSlotChanged(); + } + + if (var5.stackSize == var3.stackSize) + { + return null; + } + + var4.onPickupFromSlot(par1EntityPlayer, var5); + } + + return var3; + } + + //Can merge Slot + @Override + public boolean func_94530_a(ItemStack p_94530_1_, Slot p_94530_2_) { + return p_94530_2_.inventory != tile_entity.inventoryCraftResult && super.func_94530_a(p_94530_1_, p_94530_2_); + } + + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java b/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java index ebd84f9654..52bfa7d2d9 100644 --- a/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java +++ b/src/Java/gtPlusPlus/core/fluids/BlockFluidBase.java @@ -28,19 +28,19 @@ public class BlockFluidBase extends BlockFluidClassic { @SuppressWarnings("deprecation") public BlockFluidBase(Fluid fluid, Material material) { - super(fluid, net.minecraft.block.material.Material.water); + super(fluid, net.minecraft.block.material.Material.lava); short[] tempColour = material.getRGBA(); this.colour = Utils.rgbtoHexValue(tempColour[0], tempColour[1], tempColour[2]); this.fluidMaterial = material; setCreativeTab(AddToCreativeTab.tabOther); this.displayName = material.getLocalizedName(); - LanguageRegistry.addName(this, "Molten "+displayName+" ["+MathUtils.celsiusToKelvin(fluidMaterial.getBoilingPoint_C())+"K]"); + LanguageRegistry.addName(this, "Molten "+displayName+" ["+MathUtils.celsiusToKelvin(fluidMaterial.getBoilingPointC())+"K]"); this.setBlockName(GetProperName()); } @SuppressWarnings("deprecation") public BlockFluidBase(String fluidName, Fluid fluid, short[] colour) { - super(fluid, net.minecraft.block.material.Material.water); + super(fluid, net.minecraft.block.material.Material.lava); short[] tempColour = colour; this.colour = Utils.rgbtoHexValue(tempColour[0], tempColour[1], tempColour[2]); setCreativeTab(AddToCreativeTab.tabOther); diff --git a/src/Java/gtPlusPlus/core/fluids/GenericFluid.java b/src/Java/gtPlusPlus/core/fluids/GenericFluid.java index 1780cb8577..38af8774eb 100644 --- a/src/Java/gtPlusPlus/core/fluids/GenericFluid.java +++ b/src/Java/gtPlusPlus/core/fluids/GenericFluid.java @@ -28,6 +28,7 @@ public class GenericFluid extends Fluid{ FluidRegistry.registerFluid(fluidFactory); blockFactory = new BlockFluidBase(displayName, fluidFactory, rgba).setBlockName("fluidblock"+fluidName); GameRegistry.registerBlock(blockFactory, ItemBlockFluid.class, blockFactory.getUnlocalizedName().substring(5)); + fluidFactory.setBlock(blockFactory); //fluidFactory.setUnlocalizedName(blockFactory.getUnlocalizedName()); @@ -50,6 +51,7 @@ public class GenericFluid extends Fluid{ FluidRegistry.registerFluid(fluidFactory); blockFactory = new BlockFluidBase(fluidFactory, fluidMaterial).setBlockName("fluidblock"+fluidName); GameRegistry.registerBlock(blockFactory, ItemBlockFluid.class, blockFactory.getUnlocalizedName().substring(5)); + fluidFactory.setBlock(blockFactory); //IC2_ItemFluidCell emptyCell = new IC2_ItemFluidCell(fluidName); /*if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java index 2da4c7bc7c..86388a2632 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java @@ -16,7 +16,7 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GUI_Workbench extends GuiContainer { - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/Workbench.png"); + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/BronzeCraftingTable.png"); public boolean moveItemsToChest = false; public boolean moveItemsToCrafting = false; @@ -52,8 +52,8 @@ public class GUI_Workbench extends GuiContainer { super.initGui(); //The parameters of GuiButton are(id, x, y, width, height, text); - this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X")); - this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y")); + //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X")); + //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y")); //NOTE: the id always has to be different or else it might get called twice or never! //Add any other buttons here too! @@ -65,12 +65,12 @@ public class GUI_Workbench extends GuiContainer { //If the button id is different, or you have mrs buttons, create another if block for that too! if(B.id == 1){ System.out.println("Trying to empty crafting grid to the storage compartment."); - moveItemsToChest = true; + //moveItemsToChest = true; ((Container_Workbench) this.inventorySlots).moveCraftingToChest(); } else if(B.id == 2){ System.out.println("Trying to move items into the crafting grid."); - moveItemsToCrafting = true; + //moveItemsToCrafting = true; ((Container_Workbench) this.inventorySlots).moveChestToCrafting(); } diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java new file mode 100644 index 0000000000..5c04acf13b --- /dev/null +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java @@ -0,0 +1,41 @@ +package gtPlusPlus.core.gui.machine; + +import gtPlusPlus.core.container.Container_WorkbenchAdvanced; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +@SideOnly(Side.CLIENT) +public class GUI_WorkbenchAdvanced extends GuiContainer { + + private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/AdvancedCraftingTable.png"); + + public GUI_WorkbenchAdvanced(InventoryPlayer player_inventory, TileEntityWorkbenchAdvanced tile){ + super(new Container_WorkbenchAdvanced(player_inventory, tile)); + } + + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j){ + //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); + //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); + } + + + @Override + protected void drawGuiContainerBackgroundLayer(float f, int i, int j){ + GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + this.mc.renderEngine.bindTexture(craftingTableGuiTextures); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 927423d060..7f7ab96ee7 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -21,10 +21,13 @@ import gtPlusPlus.core.recipe.RECIPES_GREGTECH; import gtPlusPlus.core.recipe.RECIPES_LaserEngraver; import gtPlusPlus.core.recipe.ShapedRecipeObject; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.recipe.RecipeUtils; +import gtPlusPlus.xmod.gregtech.registration.gregtech.Gregtech4Content; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechDehydrator; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechEnergyBuffer; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechGeothermalThermalGenerator; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialBlastSmelter; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialCentrifuge; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialCokeOven; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialElectrolyzer; @@ -63,7 +66,7 @@ public class COMPAT_HANDLER { GT_OreDictUnificator.registerOre("craftingToolSandHammer", new ItemStack(ModItems.itemSandstoneHammer)); for(int i=1; i<=10; i++){ - GT_OreDictUnificator.registerOre("bufferCore_"+CORE.VOLTAGES[i-1], new ItemStack(UtilsItems.getItem("miscutils:item.itemBufferCore"+i))); + GT_OreDictUnificator.registerOre("bufferCore_"+CORE.VOLTAGES[i-1], new ItemStack(ItemUtils.getItem("miscutils:item.itemBufferCore"+i))); } } @@ -83,12 +86,14 @@ public class COMPAT_HANDLER { GregtechIndustrialMacerator.run(); GregtechIndustrialWiremill.run(); GregtechIndustrialMassFabricator.run(); - //GregtechIndustrialSinter.run(); + GregtechIndustrialBlastSmelter.run(); GregtechSolarGenerators.run(); GregtechPowerSubStation.run(); GregtechDehydrator.run(); GregtechTieredFluidTanks.run(); GregtechIndustrialMultiTank.run(); + GregtechGeothermalThermalGenerator.run(); + Gregtech4Content.run(); } } @@ -131,7 +136,7 @@ public class COMPAT_HANDLER { public static void RemoveRecipesFromOtherMods(){ //Removal of Recipes for(Object item : RemoveRecipeQueue){ - UtilsRecipe.removeCraftingRecipe(item); + RecipeUtils.removeCraftingRecipe(item); } } diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java index 97b7369134..ccf2b83837 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -1,5 +1,6 @@ package gtPlusPlus.core.handler; +import gtPlusPlus.xmod.Computronics.HANDLER_Computronics; import gtPlusPlus.xmod.forestry.HANDLER_FR; import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.growthcraft.HANDLER_GC; @@ -16,6 +17,7 @@ public class COMPAT_IntermodStaging { HANDLER_FR.preInit(); HANDLER_Psych.preInit(); HANDLER_IC2.preInit(); + HANDLER_Computronics.preInit(); } @@ -26,6 +28,7 @@ public class COMPAT_IntermodStaging { HANDLER_FR.Init(); HANDLER_Psych.init(); HANDLER_IC2.init(); + HANDLER_Computronics.init(); } public static void postInit(){ @@ -35,6 +38,7 @@ public class COMPAT_IntermodStaging { HANDLER_FR.postInit(); HANDLER_Psych.postInit(); HANDLER_IC2.postInit(); + HANDLER_Computronics.postInit(); } diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java index dc1903e83d..c2b120d428 100644 --- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java +++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java @@ -3,14 +3,17 @@ package gtPlusPlus.core.handler; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.container.Container_BackpackBase; import gtPlusPlus.core.container.Container_Workbench; +import gtPlusPlus.core.container.Container_WorkbenchAdvanced; 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.machine.GUI_Workbench; +import gtPlusPlus.core.gui.machine.GUI_WorkbenchAdvanced; import gtPlusPlus.core.interfaces.IGuiManager; import gtPlusPlus.core.inventories.BaseInventoryBackpack; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.forestry.bees.alveary.TileAlvearyFrameHousing; import gtPlusPlus.xmod.forestry.bees.alveary.gui.CONTAINER_FrameHousing; @@ -28,7 +31,7 @@ public class GuiHandler implements IGuiHandler { public static final int GUI2 = 1; //RTG public static final int GUI3 = 2; //BackpackHandler public static final int GUI4 = 3; //Workbench - public static final int GUI5 = 4; // + public static final int GUI5 = 4; //Workbench Adv public static final int GUI6 = 5; // public static final int GUI7 = 6; // public static final int GUI8 = 7; // @@ -73,6 +76,11 @@ public class GuiHandler implements IGuiHandler { return new Container_Workbench(player.inventory, (TileEntityWorkbench)te); } + if (ID == GUI5){ + Utils.LOG_INFO("sad"); + return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te); + + } } @@ -112,6 +120,10 @@ public class GuiHandler implements IGuiHandler { if (ID == GUI4){ return new GUI_Workbench(player.inventory, (TileEntityWorkbench)te); } + if (ID == GUI5){ + Utils.LOG_INFO("sad"); + return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te); + } } return null; diff --git a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java index affb56566d..275a67f571 100644 --- a/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java +++ b/src/Java/gtPlusPlus/core/handler/Recipes/RegistrationHandler.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.handler.Recipes; import gtPlusPlus.core.handler.COMPAT_HANDLER; +import gtPlusPlus.core.recipe.RECIPES_General; import gtPlusPlus.core.recipe.RECIPES_MachineComponents; import gtPlusPlus.core.recipe.RECIPES_Machines; import gtPlusPlus.core.recipe.RECIPES_Shapeless; @@ -23,6 +24,7 @@ public class RegistrationHandler { RECIPES_Shapeless.RECIPES_LOAD(); RECIPES_MachineComponents.RECIPES_LOAD(); RECIPE_Batteries.RECIPES_LOAD(); + RECIPES_General.RECIPES_LOAD(); //RECIPES_MTWRAPPER.run(); Utils.LOG_INFO("Loaded: "+recipesSuccess+" Failed: "+recipesFailed); COMPAT_HANDLER.areInitItemsLoaded = true; diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java index 1db26846c7..e529d47699 100644 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java @@ -3,6 +3,7 @@ package gtPlusPlus.core.handler.events; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.player.PlayerCache; +import gtPlusPlus.core.util.player.PlayerUtils; import java.util.UUID; @@ -37,7 +38,7 @@ public class LoginEventHandler { Utils.LOG_INFO("You're not using the latest recommended version of GT++, consider updating."); Utils.LOG_INFO("Latest version is: "+CORE.MASTER_VERSION); Utils.LOG_INFO("You currently have: "+CORE.VERSION); - Utils.messagePlayer(localPlayerRef, "You're not using the latest recommended version of GT++, consider updating."); + PlayerUtils.messagePlayer(localPlayerRef, "You're not using the latest recommended version of GT++, consider updating."); } else { Utils.LOG_INFO("You're using the latest recommended version of GT++."); diff --git a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java index a7c689a79a..49b844f057 100644 --- a/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/PickaxeBlockBreakEventHandler.java @@ -5,6 +5,7 @@ import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.BaseTileEntity; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.player.PlayerUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaSafeBlockBase; import java.util.UUID; @@ -42,12 +43,12 @@ public class PickaxeBlockBreakEventHandler { Utils.LOG_INFO("UUID info. Accessor: "+accessorUUID + " | Owner: "+ownerUUID); if (accessorUUID == ownerUUID){ - Utils.messagePlayer(playerInternal, "Since you own this block, it has been destroyed."); + PlayerUtils.messagePlayer(playerInternal, "Since you own this block, it has been destroyed."); event.setCanceled(false); } else { event.setCanceled(true); - Utils.messagePlayer(playerInternal, "Since you do not own this block, it has not been destroyed."); + PlayerUtils.messagePlayer(playerInternal, "Since you do not own this block, it has not been destroyed."); } // } diff --git a/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java b/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java new file mode 100644 index 0000000000..90126b1e82 --- /dev/null +++ b/src/Java/gtPlusPlus/core/interfaces/IItemBlueprint.java @@ -0,0 +1,48 @@ +package gtPlusPlus.core.interfaces; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +public interface IItemBlueprint { + + /** + * The inventory size for the blueprint~ + */ + public int INV_SIZE = 9; + + /** + * Meta Compatible function to allow meta items to be blueprints + * @param stack yourMetaItem + * @return true if it is a Blueprint + */ + public boolean isBlueprint(ItemStack stack); + + /** + * Sets the blueprint for this itemstack. + * @param stack yourMetaItem + * @return true if blueprint is set successfully + */ + public boolean setBlueprint(ItemStack stack, IInventory craftingTable, ItemStack output); + + /** + * Sets the name of the recipe/blueprint + * @param String Blueprint Name + * @return N/A + */ + public void setBlueprintName(ItemStack stack, String name); + + /** + * Does this itemstack hold a blueprint? + * @param stack yourMetaItem + * @return true if is holding a Blueprint + */ + public boolean hasBlueprint(ItemStack stack); + + /** + * Gets the recipe held by the item + * @param stack yourMetaItem + * @return the blueprints contents + */ + public ItemStack[] getBlueprint(ItemStack stack); + +} diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java new file mode 100644 index 0000000000..f4fe78d458 --- /dev/null +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java @@ -0,0 +1,164 @@ +package gtPlusPlus.core.inventories; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +public class InventoryWorkbenchHoloCrafting implements IInventory{ + + private String name = "Inventory Crafting"; + + /** Defining your inventory size this way is handy */ + public static final int INV_SIZE = 9; + + /** Inventory's size must be same as number of slots you add to the Container class */ + private ItemStack[] inventory = new ItemStack[INV_SIZE]; + + /** + * @param itemstack - the ItemStack to which this inventory belongs + */ + public InventoryWorkbenchHoloCrafting() + { + + } + + /*public void readFromNBT(NBTTagCompound nbt) + { + NBTTagList list = nbt.getTagList("Items", 10); + inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++) + { + NBTTagCompound data = list.getCompoundTagAt(i); + int slot = data.getInteger("Slot"); + if(slot >= 0 && slot < INV_SIZE) + { + inventory[slot] = ItemStack.loadItemStackFromNBT(data); + } + } + } + + public void writeToNBT(NBTTagCompound nbt) + { + NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++) + { + ItemStack stack = inventory[i]; + if(stack != null) + { + NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + }*/ + + @Override + public int getSizeInventory() + { + return inventory.length; + } + + public ItemStack[] getInventory(){ + return inventory; + } + + @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); + markDirty(); + } + else + { + 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(); + } + markDirty(); + } + + @Override + public String getInventoryName() + { + return name; + } + + @Override + public boolean hasCustomInventoryName() + { + return name.length() > 0; + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + @Override + public void markDirty() + { + for (int i = 0; i < getSizeInventory(); ++i) + { + ItemStack temp = getStackInSlot(i); + if (temp != null){ + //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize); + } + + if (temp != null && temp.stackSize == 0) { + inventory[i] = null; + } + } + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + return true; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + + @Override + public boolean isItemValidForSlot(int slot, ItemStack itemstack) + { + return true; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java new file mode 100644 index 0000000000..c5da273a11 --- /dev/null +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java @@ -0,0 +1,268 @@ +package gtPlusPlus.core.inventories; + +import gtPlusPlus.core.util.Utils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryCraftResult; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class InventoryWorkbenchHoloSlots implements IInventory{ + + private String name = "Inventory Holo"; + + //Output Slot + public IInventory craftResult = new InventoryCraftResult(); + + /** Defining your inventory size this way is handy */ + public static final int INV_SIZE = 6; + + /** Inventory's size must be same as number of slots you add to the Container class */ + private ItemStack[] inventory = new ItemStack[INV_SIZE]; + + /** + * @param itemstack - the ItemStack to which this inventory belongs + */ + public InventoryWorkbenchHoloSlots() + { + + } + + public void readFromNBT(NBTTagCompound nbt) + { + NBTTagList list = nbt.getTagList("Items", 10); + inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++) + { + NBTTagCompound data = list.getCompoundTagAt(i); + int slot = data.getInteger("Slot"); + if(slot >= 1 && slot < INV_SIZE) + { + inventory[slot] = ItemStack.loadItemStackFromNBT(data); + } + } + } + + public void writeToNBT(NBTTagCompound nbt) + { + NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++) + { + ItemStack stack = inventory[i]; + if(stack != null && i != 0) + { + NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + } + + @Override + public int getSizeInventory() + { + return inventory.length; + } + + public ItemStack[] getInventory(){ + return inventory; + } + + @Override + public ItemStack getStackInSlot(int slot) + { + return inventory[slot]; + } + + @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 1; + } + + /** + * 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; + } + } + } + + @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 boolean isItemValidForSlot(int slot, ItemStack itemstack) + { + return false; + } + + /** A list of one item containing the result of the crafting formula */ + private ItemStack[] stackResult = new ItemStack[1]; + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + /*@Override + public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) + { + ItemStack stack = getStackInSlot(0); + if (this.stackResult[0] != null) + { + ItemStack itemstack = this.stackResult[0]; + this.stackResult[0] = null; + return itemstack; + } + if(stack != null) + { + if(stack.stackSize > p_70298_2_) + { + stack = stack.splitStack(p_70298_2_); + // Don't forget this line or your inventory will not be saved! + markDirty(); + } + else + { + // this method also calls markDirty, so we don't need to call it again + setInventorySlotContents(p_70298_1_, null); + } + } + return stack; + }*/ + @Override + public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) + { + if (getStackInSlot(0) != null){ + Utils.LOG_INFO("getStackInSlot(0) contains "+getStackInSlot(0).getDisplayName()); + if (this.stackResult[0] == null){ + Utils.LOG_INFO("this.stackResult[0] == null"); + this.stackResult[0] = getStackInSlot(0); + } + else if (this.stackResult[0] != null){ + Utils.LOG_INFO("this.stackResult[0] != null"); + if (this.stackResult[0].getDisplayName().toLowerCase().equals(getStackInSlot(0).getDisplayName().toLowerCase())){ + Utils.LOG_INFO("Items are the same?"); + } + else { + Utils.LOG_INFO("Items are not the same."); + } + } + } + + if (this.stackResult[0] != null) + { + Utils.LOG_INFO("this.stackResult[0] != null - Really never should be though. - Returning "+this.stackResult[0].getDisplayName()); + ItemStack itemstack = this.stackResult[0]; + this.stackResult[0] = null; + return itemstack; + } + return null; + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + @Override + public ItemStack getStackInSlotOnClosing(int p_70304_1_) + { + if (this.stackResult[0] != null) + { + ItemStack itemstack = this.stackResult[0]; + this.stackResult[0] = null; + return itemstack; + } + return null; + } + +} + + + +//Default Behaviour +/*@Override +public ItemStack decrStackSize(int slot, int amount) +{ + 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 markDirty, so we don't need to call it again + setInventorySlotContents(slot, null); + } + } + return stack; +}*/ + +//Default Behaviour +/*@Override +public ItemStack getStackInSlotOnClosing(int slot) +{ + ItemStack stack = getStackInSlot(slot); + setInventorySlotContents(slot, null); + return stack; +}*/ + diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java new file mode 100644 index 0000000000..77f3351e59 --- /dev/null +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java @@ -0,0 +1,191 @@ +package gtPlusPlus.core.inventories; + +import gregtech.api.items.GT_MetaGenerated_Tool; +import gtPlusPlus.core.slots.SlotGtToolElectric; +import ic2.api.item.IElectricItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class InventoryWorkbenchToolsElectric implements IInventory{ + + private String name = "Inventory Tools"; + + /** Defining your inventory size this way is handy */ + public static final int INV_SIZE = 5; + + /** Inventory's size must be same as number of slots you add to the Container class */ + private ItemStack[] inventory = new ItemStack[INV_SIZE]; + private Slot[] toolSlots = new SlotGtToolElectric[INV_SIZE]; //TODO + + /** + * @param itemstack - the ItemStack to which this inventory belongs + */ + public InventoryWorkbenchToolsElectric() + { + + } + + public void readFromNBT(NBTTagCompound nbt) + { + NBTTagList list = nbt.getTagList("Items", 10); + inventory = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++) + { + NBTTagCompound data = list.getCompoundTagAt(i); + int slot = data.getInteger("Slot"); + if(slot >= 0 && slot < INV_SIZE) + { + inventory[slot] = ItemStack.loadItemStackFromNBT(data); + } + } + } + + public void writeToNBT(NBTTagCompound nbt) + { + NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++) + { + ItemStack stack = inventory[i]; + if(stack != null) + { + NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + } + + @Override + public int getSizeInventory() + { + return inventory.length; + } + + public ItemStack[] getInventory(){ + return inventory; + } + + @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 markDirty, 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 1; + } + + /** + * 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; + } + } + } + + @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 boolean isItemValidForSlot(int slot, ItemStack itemstack) + { + // Don't want to be able to store the inventory item within itself + // Bad things will happen, like losing your inventory + // Actually, this needs a custom Slot to work + if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem){ + return true; + } + return false; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index fd7d005e55..2fa0d2c698 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -2,25 +2,28 @@ package gtPlusPlus.core.item; import static gtPlusPlus.core.creative.AddToCreativeTab.tabMachines; import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; import static gtPlusPlus.core.lib.CORE.LOAD_ALL_CONTENT; -import static gtPlusPlus.core.util.item.UtilsItems.generateItemsFromMaterial; import gregtech.api.enums.Materials; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.common.compat.COMPAT_Baubles; import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.BaseEuItem; import gtPlusPlus.core.item.base.BaseItemBackpack; import gtPlusPlus.core.item.base.CoreItem; +import gtPlusPlus.core.item.base.dusts.decimal.BaseItemCentidust; +import gtPlusPlus.core.item.base.dusts.decimal.BaseItemDecidust; import gtPlusPlus.core.item.base.foods.BaseItemFood; import gtPlusPlus.core.item.base.foods.BaseItemHotFood; import gtPlusPlus.core.item.base.ingots.BaseItemIngot; import gtPlusPlus.core.item.base.plates.BaseItemPlate; import gtPlusPlus.core.item.effects.RarityUncommon; import gtPlusPlus.core.item.general.BufferCore; -import gtPlusPlus.core.item.general.ItemCloakingDevice; -import gtPlusPlus.core.item.general.ItemHealingDevice; +import gtPlusPlus.core.item.general.ItemBlueprint; import gtPlusPlus.core.item.general.RF2EU_Battery; import gtPlusPlus.core.item.general.fuelrods.FuelRod_Base; import gtPlusPlus.core.item.init.ItemsFoods; import gtPlusPlus.core.item.tool.misc.SandstoneHammer; import gtPlusPlus.core.item.tool.staballoy.MultiPickaxeBase; +import gtPlusPlus.core.item.tool.staballoy.MultiSpadeBase; import gtPlusPlus.core.item.tool.staballoy.StaballoyAxe; import gtPlusPlus.core.item.tool.staballoy.StaballoyPickaxe; import gtPlusPlus.core.lib.CORE; @@ -28,13 +31,16 @@ import gtPlusPlus.core.lib.CORE.configSwitches; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.material.MaterialGenerator; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.debug.DEBUG_INIT; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; +import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.EnumHelper; import cpw.mods.fml.common.registry.GameRegistry; public final class ModItems { @@ -46,11 +52,6 @@ public final class ModItems { public static Item itemDebugShapeSpawner; public static Item itemBaseSpawnEgg; - - - //Tantaloy60(789, TextureSet.SET_DULL, 8.0F, 5120, 3, 1 | 2 | 16 | 32 | 64 | 128, 213, 231, 237, 0, "Tantaloy 60", 0, 0, 3035, 2200, true, false, 1, 2, 1, Dyes.dyeLightGray, 2, Arrays.asList(new MaterialStack(Tungsten, 1), new MaterialStack(Tantalum, 9)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 8), new TC_AspectStack(TC_Aspects.STRONTIO, 3))), - //Tantaloy61(790, TextureSet.SET_DULL, 7.0F, 5120, 2, 1 | 2 | 16 | 32 | 64 | 128, 193, 211, 217, 0, "Tantaloy 61", 0, 0, 3015, 2150, true, false, 1, 2, 1, Dyes.dyeLightGray, 2, Arrays.asList(new MaterialStack(Tungsten, 1), new MaterialStack(Tantalum, 9), new MaterialStack(Titanium, 1)), Arrays.asList(new TC_AspectStack(TC_Aspects.METALLUM, 8), new TC_AspectStack(TC_Aspects.STRONTIO, 3))), - //EnderIO public static Item itemPlateSoularium; @@ -102,16 +103,20 @@ public final class ModItems { public static BaseItemHotFood itemHotFoodRaisinToast; public static BaseItemFood itemFoodCurriedSausages; public static BaseItemHotFood itemHotFoodCurriedSausages; - + public static Item RfEuBattery; public static Item itemPersonalCloakingDevice; public static Item itemPersonalCloakingDeviceCharged; public static Item itemPersonalHealingDevice; public static MultiPickaxeBase MP_GTMATERIAL; + public static MultiSpadeBase MS_GTMATERIAL; + public static BaseItemDecidust itemBaseDecidust; + public static BaseItemCentidust itemBaseCentidust; + public static ItemStack FluidCell; - + public static BaseItemBackpack backpack_Red; public static BaseItemBackpack backpack_Green; public static BaseItemBackpack backpack_Blue; @@ -128,11 +133,30 @@ public final class ModItems { public static BaseItemBackpack backpack_Gray; public static BaseItemBackpack backpack_Black; public static BaseItemBackpack backpack_White; - + + public static ItemBlueprint itemBlueprintBase; + public static Item dustLithiumCarbonate; + public static Item dustLithiumHydroxide; + public static Item dustLithiumPeroxide; + public static Item dustLithiumFluoride; + + public static Item dustUraniumTetraFluoride; + public static Item dustUraniumHexaFluoride; + + public static Item dustBerylliumFluoride; + + public static Item dustQuicklime; + public static Item dustCalciumHydroxide; + public static Item dustCalciumCarbonate; + public static Item dust2LiOH_CaCO3; + public static Item dustLi2BeF4; + + public static BaseEuItem metaItem2; //@SuppressWarnings("unused") + @SuppressWarnings("unused") public static final void init(){ AAA_Broken = new BaseItemIngot("AAA_Broken", "Errors - Tell Alkalus", Utils.rgbtoHexValue(128, 128, 128), 0); @@ -142,6 +166,16 @@ public final class ModItems { DEBUG_INIT.registerItems(); } + + //Some Simple forms of materials + itemStickyRubber = new Item().setUnlocalizedName("itemStickyRubber").setCreativeTab(tabMachines).setTextureName(CORE.MODID + ":itemStickyRubber"); + GameRegistry.registerItem(itemStickyRubber, "itemStickyRubber"); + GT_OreDictUnificator.registerOre("ingotRubber", ItemUtils.getItemStack(CORE.MODID+":itemStickyRubber", 1)); + + itemHeliumBlob = new CoreItem("itemHeliumBlob", tabMisc).setTextureName(CORE.MODID + ":itemHeliumBlob"); + GT_OreDictUnificator.registerOre("dustHydrogen", new ItemStack(ModItems.itemHeliumBlob)); + //GameRegistry.registerItem(itemHeliumBlob, "itemHeliumBlob"); + //Make some backpacks //Primary colours backpack_Red = new BaseItemBackpack("backpackRed", Utils.rgbtoHexValue(200, 0, 0)); @@ -163,59 +197,77 @@ 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)); - + + itemBlueprintBase = new ItemBlueprint("itemBlueprint"); + //Start meta Item Generation ItemsFoods.load(); try{ - generateItemsFromMaterial(ALLOY.ENERGYCRYSTAL); - generateItemsFromMaterial(ALLOY.BLOODSTEEL); - generateItemsFromMaterial(ALLOY.STABALLOY); - generateItemsFromMaterial(ALLOY.TANTALLOY_60); - generateItemsFromMaterial(ALLOY.TANTALLOY_61); - generateItemsFromMaterial(ALLOY.BEDROCKIUM); - generateItemsFromMaterial(ALLOY.QUANTUM); - + //Elements generate first so they can be used in compounds. + + //Uranium-233 is a fissile isotope of uranium that is bred from thorium-232 as part of the thorium fuel cycle. + MaterialGenerator.generate(ELEMENT.getInstance().URANIUM233); + MaterialGenerator.generate(ELEMENT.getInstance().ZIRCONIUM); + + //Carbides - Tungsten Carbide exists in .09 so don't generate it. - Should still come before alloys though + if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ + MaterialGenerator.generate(ALLOY.TUNGSTEN_CARBIDE); + } + MaterialGenerator.generate(ALLOY.SILICON_CARBIDE); + MaterialGenerator.generate(ALLOY.ZIRCONIUM_CARBIDE); + MaterialGenerator.generate(ALLOY.TANTALUM_CARBIDE); + MaterialGenerator.generate(ALLOY.NIOBIUM_CARBIDE); + + //Generate some Alloys + + //Misc Alloys + MaterialGenerator.generate(ALLOY.ENERGYCRYSTAL); + MaterialGenerator.generate(ALLOY.BLOODSTEEL); + MaterialGenerator.generate(ALLOY.BEDROCKIUM); + MaterialGenerator.generate(ALLOY.ZERON_100); + //Tumbaga was the name given by Spaniards to a non-specific alloy of gold and copper + MaterialGenerator.generate(ALLOY.TUMBAGA); + //Potin is traditionally an alloy of bronze, tin and lead, with varying quantities of each possible + MaterialGenerator.generate(ALLOY.POTIN); + + //Staballoy & Tantalloy + MaterialGenerator.generate(ALLOY.STABALLOY); + MaterialGenerator.generate(ALLOY.TANTALLOY_60); + MaterialGenerator.generate(ALLOY.TANTALLOY_61); - generateItemsFromMaterial(ALLOY.INCONEL_625); - generateItemsFromMaterial(ALLOY.INCONEL_690); - generateItemsFromMaterial(ALLOY.INCONEL_792); + //Inconel + MaterialGenerator.generate(ALLOY.INCONEL_625); + MaterialGenerator.generate(ALLOY.INCONEL_690); + MaterialGenerator.generate(ALLOY.INCONEL_792); - if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - generateItemsFromMaterial(ALLOY.TUNGSTEN_CARBIDE); - } - generateItemsFromMaterial(ALLOY.SILICON_CARBIDE); - generateItemsFromMaterial(ALLOY.ZERON_100); - generateItemsFromMaterial(ALLOY.MARAGING250); - generateItemsFromMaterial(ALLOY.MARAGING300); - generateItemsFromMaterial(ALLOY.MARAGING350); - generateItemsFromMaterial(ALLOY.STELLITE); - generateItemsFromMaterial(ALLOY.TALONITE); - - //Tumbaga was the name given by Spaniards to a non-specific alloy of gold and copper - generateItemsFromMaterial(ALLOY.TUMBAGA); - //Potin is traditionally an alloy of bronze, tin and lead, with varying quantities of each possible - generateItemsFromMaterial(ALLOY.POTIN); - + + //Maraging Steel + MaterialGenerator.generate(ALLOY.MARAGING250); + MaterialGenerator.generate(ALLOY.MARAGING300); + MaterialGenerator.generate(ALLOY.MARAGING350); + + //Composite Alloys + MaterialGenerator.generate(ALLOY.STELLITE); + MaterialGenerator.generate(ALLOY.TALONITE); + + //Hastelloy + MaterialGenerator.generate(ALLOY.HASTELLOY_W); + MaterialGenerator.generate(ALLOY.HASTELLOY_X); + MaterialGenerator.generate(ALLOY.HASTELLOY_C276); + MaterialGenerator.generate(ALLOY.HASTELLOY_N); + + //Incoloy + MaterialGenerator.generate(ALLOY.INCOLOY_020); + MaterialGenerator.generate(ALLOY.INCOLOY_DS); + MaterialGenerator.generate(ALLOY.INCOLOY_MA956); + + //Leagrisium + MaterialGenerator.generate(ALLOY.LEAGRISIUM); + //Must be the final Alloy to Generate + MaterialGenerator.generate(ALLOY.QUANTUM); + - generateItemsFromMaterial(ALLOY.HASTELLOY_W); - generateItemsFromMaterial(ALLOY.HASTELLOY_X); - generateItemsFromMaterial(ALLOY.HASTELLOY_C276); - generateItemsFromMaterial(ALLOY.HASTELLOY_N); - - generateItemsFromMaterial(ALLOY.INCOLOY_020); - generateItemsFromMaterial(ALLOY.INCOLOY_DS); - generateItemsFromMaterial(ALLOY.INCOLOY_MA956); - - - generateItemsFromMaterial(ELEMENT.ZIRCONIUM); - generateItemsFromMaterial(ALLOY.ZIRCONIUM_CARBIDE); - generateItemsFromMaterial(ALLOY.TANTALUM_CARBIDE); - generateItemsFromMaterial(ALLOY.NIOBIUM_CARBIDE); - - //Uranium-233 is a fissile isotope of uranium that is bred from thorium-232 as part of the thorium fuel cycle. - UtilsItems.generateItemsFromMaterial(ELEMENT.URANIUM233); - } catch (Throwable r){ Utils.LOG_INFO("Failed to Generated a Material. "+r.getMessage()); //Utils.LOG_INFO("Failed to Generated a Material. "+r.getCause().getMessage()); @@ -224,73 +276,64 @@ public final class ModItems { r.printStackTrace(); System.exit(1); } - - - dustLithiumCarbonate = UtilsItems.generateSpecialUseDusts("LithiumCarbonate", "Lithium Carbonate", Utils.rgbtoHexValue(137, 139, 142))[0]; + + + //Nuclear Fuel Dusts + dustUraniumTetraFluoride = ItemUtils.generateSpecialUseDusts("UraniumTetrafluoride", "Uranium Tetrafluoride", Utils.rgbtoHexValue(17, 179, 42))[0]; + dustUraniumHexaFluoride = ItemUtils.generateSpecialUseDusts("UraniumHexafluoride", "Uranium Hexafluoride", Utils.rgbtoHexValue(9, 199, 32))[0]; + + dustBerylliumFluoride = ItemUtils.generateSpecialUseDusts("BerylliumFluoride", "Beryllium Fluoride", Utils.rgbtoHexValue(175, 175, 175))[0]; //https://en.wikipedia.org/wiki/Beryllium_fluoride + + dustLithiumCarbonate = ItemUtils.generateSpecialUseDusts("LithiumCarbonate", "Lithium Carbonate", Utils.rgbtoHexValue(240, 240, 240))[0]; //https://en.wikipedia.org/wiki/Lithium_carbonate + dustLithiumFluoride = ItemUtils.generateSpecialUseDusts("LithiumFluoride", "Lithium Fluoride", Utils.rgbtoHexValue(245, 245, 245))[0]; //https://en.wikipedia.org/wiki/Lithium_fluoride + dustLithiumPeroxide = ItemUtils.generateSpecialUseDusts("LithiumPeroxide", "Lithium Peroxide", Utils.rgbtoHexValue(250, 250, 250))[0]; //https://en.wikipedia.org/wiki/Lithium_peroxide + dustLithiumHydroxide = ItemUtils.generateSpecialUseDusts("LithiumHydroxide", "Lithium Hydroxide", Utils.rgbtoHexValue(250, 250, 250))[0]; //https://en.wikipedia.org/wiki/Lithium_hydroxide + + if (ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1).getItem() == ModItems.AAA_Broken || !LoadedMods.IHL){ + dustQuicklime = ItemUtils.generateSpecialUseDusts("Quicklime", "Quicklime", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_oxide + } + dustCalciumHydroxide = ItemUtils.generateSpecialUseDusts("CalciumHydroxide", "Hydrated Lime", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_hydroxide + dustCalciumCarbonate = ItemUtils.generateSpecialUseDusts("CalciumCarbonate", "Calcium Carbonate", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_carbonate + dust2LiOH_CaCO3 = ItemUtils.generateSpecialUseDusts("2LiOHCaCO3", "2LiOH & CaCO3 Compound", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_carbonate + //FLiBe Fuel Compounds + dustLi2BeF4 = ItemUtils.generateSpecialUseDusts("Li2BeF4", "Li2BeF4 Fuel Compound", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/FLiBe + + metaItem2 = new BaseEuItem(); + metaItem2.registerItem(0, EnumChatFormatting.BLACK+"Test Item 0", 0, 0, "I am 0."); + metaItem2.registerItem(1, EnumChatFormatting.GREEN+"Test Item 1", 1006346000, 1, "I Hold EU 1.", 500); + metaItem2.registerItem(2, EnumChatFormatting.GOLD+"Test Item 2", 1004630000, 2, "I Hold EU 2.", 8000); + metaItem2.registerItem(3, "Test Item 3", 1000765000, 4, "I Hold EU 3.", 32000); + metaItem2.registerItem(4, "Whirlygig", 1043644000, (short) 5, "Spin me right round.", EnumRarity.rare, EnumChatFormatting.DARK_GREEN, true); + metaItem2.registerItem(5, "Whirlygig 2", 2124867000, (short) 7, "Spin me right round.", EnumRarity.uncommon, EnumChatFormatting.RED, true); + + // ItemList.Battery_RE_HV_Cadmium.set(BaseEuItem. + + //GameRegistry.registerItem(this, unlocalName); boolean gtStyleTools = LoadedMods.Gregtech; - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Wood); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Cobblestone); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Iron); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.WroughtIron); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.DarkIron); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Gold); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Silver); - - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Diamond); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Emerald); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Ruby); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Sapphire); - - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Cupronickel); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Brass); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Bronze); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Steel); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Lead); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Titanium); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Tungsten); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Platinum); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Chrome); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.TungstenSteel); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Aluminium); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Thaumium); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Cobalt); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Iridium); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Ultimet); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Osmiridium); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.NetherStar); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Naquadah); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.NaquadahAlloy); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.NaquadahEnriched); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Neutronium); - - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Thorium); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.DamascusSteel); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Magnalium); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.BlackSteel); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Invar); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.MeteoricSteel); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.StainlessSteel); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.BlueSteel); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Neodymium); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Desh); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.ElectrumFlux); - + Materials[] rm = Materials.values(); + for (Materials m : rm){ + MP_GTMATERIAL = ItemUtils.generateMultiPick(gtStyleTools, m); + MS_GTMATERIAL = ItemUtils.generateMultiShovel(gtStyleTools, m); + /*itemBaseDecidust = UtilsItems.generateDecidust(m); + itemBaseCentidust = UtilsItems.generateCentidust(m);*/ + } + //EnderIO Resources if (LoadedMods.EnderIO || LOAD_ALL_CONTENT){ Utils.LOG_INFO("EnderIO Found - Loading Resources."); //Item Init - itemPlateSoularium = new BaseItemPlate("itemPlate"+"Soularium", "Soularium", Utils.rgbtoHexValue(95, 90, 54), 2, 0); - itemPlateRedstoneAlloy = new BaseItemPlate("itemPlate"+"RedstoneAlloy", "Redstone Alloy", Utils.rgbtoHexValue(178,34,34), 2, 0); - itemPlateElectricalSteel =new BaseItemPlate("itemPlate"+"ElectricalSteel", "Electrical Steel", Utils.rgbtoHexValue(194, 194, 194), 2, 0); - itemPlatePulsatingIron = new BaseItemPlate("itemPlate"+"PhasedIron", "Pulsating Iron", Utils.rgbtoHexValue(50, 91, 21), 2, 0); - itemPlateEnergeticAlloy = new BaseItemPlate("itemPlate"+"EnergeticAlloy", "Energetic Alloy", Utils.rgbtoHexValue(252, 152, 45), 2, 0); - itemPlateVibrantAlloy = new BaseItemPlate("itemPlate"+"VibrantAlloy", "Vibrant Alloy", Utils.rgbtoHexValue(204, 242, 142), 2, 0); - itemPlateConductiveIron = new BaseItemPlate("itemPlate"+"ConductiveIron", "Conductive Iron", Utils.rgbtoHexValue(164, 109, 100), 2, 0); - + itemPlateSoularium = new BaseItemPlate("itemPlate"+"Soularium", "Soularium", new short[]{95, 90, 54}, 2, 0); + itemPlateRedstoneAlloy = new BaseItemPlate("itemPlate"+"RedstoneAlloy", "Redstone Alloy", new short[]{178,34,34}, 2, 0); + itemPlateElectricalSteel =new BaseItemPlate("itemPlate"+"ElectricalSteel", "Electrical Steel", new short[]{194, 194, 194}, 2, 0); + itemPlatePulsatingIron = new BaseItemPlate("itemPlate"+"PhasedIron", "Phased Iron", new short[]{50, 91, 21}, 2, 0); + itemPlateEnergeticAlloy = new BaseItemPlate("itemPlate"+"EnergeticAlloy", "Energetic Alloy", new short[]{252, 152, 45}, 2, 0); + itemPlateVibrantAlloy = new BaseItemPlate("itemPlate"+"VibrantAlloy", "Vibrant Alloy", new short[]{204, 242, 142}, 2, 0); + itemPlateConductiveIron = new BaseItemPlate("itemPlate"+"ConductiveIron", "Conductive Iron", new short[]{164, 109, 100}, 2, 0); + } else { Utils.LOG_WARNING("EnderIO not Found - Skipping Resources."); @@ -299,10 +342,10 @@ public final class ModItems { if (LoadedMods.Big_Reactors|| LOAD_ALL_CONTENT){ Utils.LOG_INFO("BigReactors Found - Loading Resources."); //Item Init - itemPlateBlutonium = new BaseItemPlate("itemPlate"+"Blutonium", "Blutonium", Utils.rgbtoHexValue(0, 0, 255), 2, 0); - itemPlateCyanite = new BaseItemPlate("itemPlate"+"Cyanite", "Cyanite", Utils.rgbtoHexValue(0, 191, 255), 2, 0); - itemPlateLudicrite = new BaseItemPlate("itemPlate"+"Ludicrite", "Ludicrite", Utils.rgbtoHexValue(167, 5, 179), 2, 0); - + itemPlateBlutonium = new BaseItemPlate("itemPlate"+"Blutonium", "Blutonium", new short[]{0, 0, 255}, 2, 0); + itemPlateCyanite = new BaseItemPlate("itemPlate"+"Cyanite", "Cyanite", new short[]{0, 191, 255}, 2, 0); + itemPlateLudicrite = new BaseItemPlate("itemPlate"+"Ludicrite", "Ludicrite", new short[]{167, 5, 179}, 2, 0); + } else { Utils.LOG_WARNING("BigReactors not Found - Skipping Resources."); @@ -312,15 +355,14 @@ public final class ModItems { Utils.LOG_INFO("Thaumcraft Found - Loading Resources."); //Item Init try { - - UtilsItems.getItemForOreDict("Thaumcraft:ItemResource", "ingotVoidMetal", "Void Metal Ingot", 16); + + ItemUtils.getItemForOreDict("Thaumcraft:ItemResource", "ingotVoidMetal", "Void Metal Ingot", 16); + itemPlateVoidMetal = new BaseItemPlate("itemPlate"+"Void", "Void", new short[]{82, 17, 82}, 2, 0); GT_OreDictUnificator.registerOre("plateVoidMetal", new ItemStack(ModItems.itemPlateVoidMetal)); - - itemPlateVoidMetal = new BaseItemPlate("itemPlate"+"Void", "Void Metal", Utils.rgbtoHexValue(82, 17, 82), 2, 0); } catch (NullPointerException e){ e.getClass(); } - + } else { Utils.LOG_WARNING("Thaumcraft not Found - Skipping Resources."); @@ -344,7 +386,7 @@ public final class ModItems { if (LoadedMods.PneumaticCraft|| LOAD_ALL_CONTENT){ Utils.LOG_INFO("PneumaticCraft Found - Loading Resources."); //Item Init - itemPlateCompressedIron = new BaseItemPlate("itemPlate"+"CompressedIron", "Compressed Iron", Utils.rgbtoHexValue(128, 128, 128), 2, 0); + itemPlateCompressedIron = new BaseItemPlate("itemPlate"+"CompressedIron", "Compressed Iron", new short[]{128, 128, 128}, 2, 0); } else { Utils.LOG_WARNING("PneumaticCraft not Found - Skipping Resources."); @@ -364,7 +406,7 @@ public final class ModItems { if (LoadedMods.RFTools|| LOAD_ALL_CONTENT){ Utils.LOG_INFO("rfTools Found - Loading Resources."); //Item Init - itemPlateDimensionShard = new BaseItemPlate("itemPlate"+"DimensionShard", "Dimensional Shard", Utils.rgbtoHexValue(170, 230, 230), 2, 0); + itemPlateDimensionShard = new BaseItemPlate("itemPlate"+"DimensionShard", "Dimensional Shard", new short[]{170, 230, 230}, 2, 0); } else { Utils.LOG_WARNING("rfTools not Found - Skipping Resources."); @@ -378,25 +420,26 @@ public final class ModItems { FuelRod_Uranium = new FuelRod_Base("itemFuelRod_Uranium", "Uranium", 2500, 2500); FuelRod_Plutonium = new FuelRod_Base("itemFuelRod_Plutonium", "Plutonium", 5000, 5000); RfEuBattery = new RF2EU_Battery(); - - if (LoadedMods.Baubles){ - Utils.LOG_INFO("Baubles Found - Loading Wearables."); - itemPersonalCloakingDevice = new ItemCloakingDevice(0); - //itemPersonalCloakingDeviceCharged = new ItemCloakingDevice(0).set; - itemPersonalHealingDevice = new ItemHealingDevice(); + + try {Class baublesTest = Class.forName("baubles.api.IBauble"); + if (baublesTest != null){ + COMPAT_Baubles.run(); } else { - Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); + Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); + } + } catch(Throwable T){ + Utils.LOG_INFO("Baubles Not Found - Skipping Resources."); } //Registry //GameRegistry.registerItem(FuelRod_Empty, "itemFuelRod_Empty"); //GameRegistry.registerItem(FuelRod_Thorium, "itemFuelRod_Thorium"); //GameRegistry.registerItem(FuelRod_Uranium, "itemFuelRod_Uranium"); //GameRegistry.registerItem(FuelRod_Plutonium, "itemFuelRod_Plutonium"); - + //FluidCell = new ItemStack(new IC2_ItemFluidCell("itemGT++FluidCell")); - - + + } else { Utils.LOG_WARNING("IndustrialCraft2 not Found - Skipping Resources."); @@ -405,8 +448,8 @@ public final class ModItems { //Special Item Handling Case if (configSwitches.enableAlternativeBatteryAlloy) { - ModItems.itemIngotBatteryAlloy = new BaseItemIngot("itemIngotBatteryAlloy", "Battery Alloy", Utils.rgbtoHexValue(35, 228, 141), 0); - ModItems.itemPlateBatteryAlloy = new BaseItemPlate("itemPlateBatteryAlloy", "Battery Alloy", Utils.rgbtoHexValue(35, 228, 141), 2, 0); + //ModItems.itemIngotBatteryAlloy = new BaseItemIngot("itemIngotBatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 0); TODO + ModItems.itemPlateBatteryAlloy = new BaseItemPlate("itemPlateBatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 2, 0); } @@ -437,17 +480,10 @@ public final class ModItems { //System.out.println("Buffer Core registration count is: "+i); } - itemStickyRubber = new Item().setUnlocalizedName("itemStickyRubber").setCreativeTab(tabMachines).setTextureName(CORE.MODID + ":itemStickyRubber"); - GameRegistry.registerItem(itemStickyRubber, "itemStickyRubber"); - GT_OreDictUnificator.registerOre("ingotRubber", UtilsItems.getItemStack(CORE.MODID+":itemStickyRubber", 1)); - - itemHeliumBlob = new CoreItem("itemHeliumBlob", tabMisc).setTextureName(CORE.MODID + ":itemHeliumBlob"); - //GameRegistry.registerItem(itemHeliumBlob, "itemHeliumBlob"); - itemPLACEHOLDER_Circuit = new Item().setUnlocalizedName("itemPLACEHOLDER_Circuit").setTextureName(CORE.MODID + ":itemPLACEHOLDER_Circuit"); GameRegistry.registerItem(itemPLACEHOLDER_Circuit, "itemPLACEHOLDER_Circuit"); //ItemBlockGtFrameBox = new ItemBlockGtFrameBox(ModBlocks.blockGtFrameSet1); //GameRegistry.registerItem(ItemBlockGtFrameBox, "itemGtFrameBoxSet1"); } -}
\ No newline at end of file +} diff --git a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java new file mode 100644 index 0000000000..80412fdd3c --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java @@ -0,0 +1,517 @@ +package gtPlusPlus.core.item.base; + +import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.GT_Values.V; +import gregtech.api.GregTech_API; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.SubTag; +import gregtech.api.enums.TC_Aspects.TC_AspectStack; +import gregtech.api.interfaces.IItemBehaviour; +import gregtech.api.interfaces.IItemContainer; +import gregtech.api.objects.ItemData; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.array.Pair; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import ic2.api.item.IElectricItemManager; +import ic2.api.item.ISpecialElectricItem; + +import java.util.ArrayList; +import java.util.BitSet; +import java.util.HashMap; +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IIcon; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricItemManager { + + /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ + private final HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>> mItemBehaviors = new HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>>(); + public final short mOffset, mItemAmount; + public final BitSet mEnabledItems; + public final BitSet mVisibleItems; + public final IIcon[][] mIconList; + /** The unlocalized name of this item. */ + private String unlocalizedName; + + private ArrayList<Pair<Integer, EnumRarity>> rarity = new ArrayList<Pair<Integer, EnumRarity>>(); + private ArrayList<Pair<Integer, EnumChatFormatting>> descColour = new ArrayList<Pair<Integer, EnumChatFormatting>>(); + private ArrayList<Pair<Integer, String>> itemName = new ArrayList<Pair<Integer, String>>(); + private ArrayList<Pair<Integer, String>> itemDescription = new ArrayList<Pair<Integer, String>>(); + private ArrayList<Pair<Integer, Boolean>> hasEffect = new ArrayList<Pair<Integer, Boolean>>(); + + public final HashMap<Short, Long[]> mElectricStats = new HashMap<Short, Long[]>(); + public final HashMap<Short, Short> mBurnValues = new HashMap<Short, Short>(); + + public BaseEuItem() { + this("MU-metaitem.02", AddToCreativeTab.tabOther, (short) 1000, (short) 31766); + } + + public BaseEuItem(String unlocalizedName, CreativeTabs creativeTab, short aOffset, short aItemAmount) { + mEnabledItems = new BitSet(aItemAmount); + mVisibleItems = new BitSet(aItemAmount); + mOffset = (short) Math.min(32766, aOffset); + mItemAmount = (short) Math.min(aItemAmount, 32766 - mOffset); + mIconList = new IIcon[aItemAmount][1]; + setHasSubtypes(true); + setMaxDamage(0); + setUnlocalizedName(unlocalizedName); + setCreativeTab(creativeTab); + setMaxStackSize(1); + GameRegistry.registerItem(this, unlocalizedName); + } + + + public void registerItem(int id, String localizedName, long euStorage, int tier, String description) { + registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false); + } + + public void registerItem(int id, String localizedName, long euStorage, int tier, String description, int burnTime) { + registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false); + setBurnValue(id, burnTime); + } + + + public void registerItem(int id, String localizedName, long euStorage, short tier, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect) { + addItem(id, localizedName, EnumChatFormatting.YELLOW+"Electric", new Object[]{}); + setElectricStats(mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true); + this.rarity.add(new Pair<Integer, EnumRarity>(id, regRarity)); + this.itemName.add(new Pair<Integer, String>(id, localizedName)); + this.itemDescription.add(new Pair<Integer, String>(id, description)); + this.descColour.add(new Pair<Integer, EnumChatFormatting>(id, colour)); + this.hasEffect.add(new Pair<Integer, Boolean>(id, Effect)); + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(ItemStack par1ItemStack){ + if (rarity.get(par1ItemStack.getItemDamage()-mOffset) != null) + return rarity.get(par1ItemStack.getItemDamage()-mOffset).getValue(); + return EnumRarity.common; + } + + @Override + public boolean hasEffect(ItemStack par1ItemStack){ + if (hasEffect.get(par1ItemStack.getItemDamage()-mOffset) != null) + return hasEffect.get(par1ItemStack.getItemDamage()-mOffset).getValue(); + return false; + } + + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public final void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + //aList.add("Meta: "+(aStack.getItemDamage()-mOffset)); + if (descColour.get(aStack.getItemDamage()-mOffset) != null && itemDescription.get(aStack.getItemDamage()-mOffset) != null) + aList.add(descColour.get(aStack.getItemDamage()-mOffset).getValue()+itemDescription.get(aStack.getItemDamage()-mOffset).getValue()); + String tKey = getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); + if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) aList.add(tString); + Long[] tStats = getElectricStats(aStack); + if (tStats != null) { + if (tStats[3] > 0) { + aList.add(EnumChatFormatting.AQUA + "Contains " + GT_Utility.formatNumbers(tStats[3]) + " EU Tier: " + (tStats[2] >= 0 ? tStats[2] : 0) + EnumChatFormatting.GRAY); + } else { + long tCharge = getRealCharge(aStack); + if (tStats[3] == -2 && tCharge <= 0) { + aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY); + } else { + aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY); + } + } + } + ArrayList<IItemBehaviour<BaseEuItem>> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (IItemBehaviour<BaseEuItem> tBehavior : tList) + aList = tBehavior.getAdditionalToolTips(this, aList, aStack); + } + + + @Override + public final Item getChargedItem(ItemStack itemStack) { + return this; + } + + @Override + public final Item getEmptyItem(ItemStack itemStack) { + return this; + } + + @Override + public final double getMaxCharge(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null) return 0; + return Math.abs(tStats[0]); + } + + @Override + public final double getTransferLimit(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null) return 0; + return Math.max(tStats[1], tStats[3]); + } + + @Override + public final int getTier(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); + } + + @Override + public final double charge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aSimulate) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null || tStats[2] > aTier || !(tStats[3] == -1 || tStats[3] == -3 || (tStats[3] < 0 && aCharge == Integer.MAX_VALUE)) || aStack.stackSize != 1) + return 0; + long tChargeBefore = getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) setCharge(aStack, tNewCharge); + return tNewCharge - tChargeBefore; + } + + @Override + public final double discharge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aBatteryAlike, boolean aSimulate) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null || tStats[2] > aTier) return 0; + if (aBatteryAlike && !canProvideEnergy(aStack)) return 0; + if (tStats[3] > 0) { + if (aCharge < tStats[3] || aStack.stackSize < 1) return 0; + if (!aSimulate) aStack.stackSize--; + return tStats[3]; + } + long tChargeBefore = getRealCharge(aStack), tNewCharge = Math.max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) setCharge(aStack, tNewCharge); + return tChargeBefore - tNewCharge; + } + + @Override + public final double getCharge(ItemStack aStack) { + return getRealCharge(aStack); + } + + @Override + public final boolean canUse(ItemStack aStack, double aAmount) { + return getRealCharge(aStack) >= aAmount; + } + + @Override + public final boolean use(ItemStack aStack, double aAmount, EntityLivingBase aPlayer) { + chargeFromArmor(aStack, aPlayer); + if (aPlayer instanceof EntityPlayer && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) return true; + double tTransfer = discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); + if (tTransfer == aAmount) { + discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + chargeFromArmor(aStack, aPlayer); + return true; + } + discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + chargeFromArmor(aStack, aPlayer); + return false; + } + + @Override + public final boolean canProvideEnergy(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null) return false; + return tStats[3] > 0 || (aStack.stackSize == 1 && (tStats[3] == -2 || tStats[3] == -3)); + } + + @Override + public final void chargeFromArmor(ItemStack aStack, EntityLivingBase aPlayer) { + if (aPlayer == null || aPlayer.worldObj.isRemote) return; + for (int i = 1; i < 5; i++) { + ItemStack tArmor = aPlayer.getEquipmentInSlot(i); + if (GT_ModHandler.isElectricItem(tArmor)) { + IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); + if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= getTier(aStack)) { + double tCharge = ElectricItem.manager.discharge(tArmor, charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, true, false); + if (tCharge > 0) { + charge(aStack, tCharge, Integer.MAX_VALUE, true, false); + if (aPlayer instanceof EntityPlayer) { + Container tContainer = ((EntityPlayer) aPlayer).openContainer; + if (tContainer != null) tContainer.detectAndSendChanges(); + } + } + } + } + } + } + + public final long getRealCharge(ItemStack aStack) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null) return 0; + if (tStats[3] > 0) return (int) (long) tStats[3]; + NBTTagCompound tNBT = aStack.getTagCompound(); + return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); + } + + public final boolean setCharge(ItemStack aStack, long aCharge) { + Long[] tStats = getElectricStats(aStack); + if (tStats == null || tStats[3] > 0) return false; + NBTTagCompound tNBT = aStack.getTagCompound(); + if (tNBT == null) tNBT = new NBTTagCompound(); + tNBT.removeTag("GT.ItemCharge"); + aCharge = Math.min(tStats[0] < 0 ? Math.abs(tStats[0] / 2) : aCharge, Math.abs(tStats[0])); + if (aCharge > 0) { + aStack.setItemDamage(getChargedMetaData(aStack)); + tNBT.setLong("GT.ItemCharge", aCharge); + } else { + aStack.setItemDamage(getEmptyMetaData(aStack)); + } + if (tNBT.hasNoTags()) aStack.setTagCompound(null); + else aStack.setTagCompound(tNBT); + isItemStackUsable(aStack); + return true; + } + + @SuppressWarnings("static-method") + public short getChargedMetaData(ItemStack aStack) { + return (short) aStack.getItemDamage(); + } + + @SuppressWarnings("static-method") + public short getEmptyMetaData(ItemStack aStack) { + return (short) aStack.getItemDamage(); + } + + + public boolean isItemStackUsable(ItemStack aStack) { + ArrayList<IItemBehaviour<BaseEuItem>> tList = mItemBehaviors.get((short) getDamage(aStack)); + if (tList != null) for (IItemBehaviour<BaseEuItem> tBehavior : tList) + if (!tBehavior.isItemStackUsable(this, aStack)) return false; + return true; + } + + @Override + public final String getToolTip(ItemStack aStack) { + return null; + } // This has its own ToolTip Handler, no need to let the IC2 Handler screw us up at this Point + + @Override + public final IElectricItemManager getManager(ItemStack aStack) { + return this; + } // We are our own Manager + + /** + * Sets the Furnace Burn Value for the Item. + * + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU) + * @return the Item itself for convenience in constructing. + */ + public final BaseEuItem setBurnValue(int aMetaValue, int aValue) { + if (aMetaValue < 0 || aValue < 0) return this; + if (aValue == 0) mBurnValues.remove((short) aMetaValue); + else mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); + return this; + } + + /** + * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior) + * @param aTransferLimit Transfer Limit. + * @param aTier The electric Tier. + * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0). + * Use -1 if you want to make this Battery chargeable (the use and canUse Functions will still discharge if you just use this) + * Use -2 if you want to make this Battery dischargeable. + * Use -3 if you want to make this Battery charge/discharge-able. + * @return the Item itself for convenience in constructing. + */ + public final BaseEuItem setElectricStats(int aMetaValue, long aMaxCharge, long aTransferLimit, long aTier, long aSpecialData, boolean aUseAnimations) { + if (aMetaValue < 0) return this; + if (aMaxCharge == 0) mElectricStats.remove((short) aMetaValue); + else { + mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData}); + } + return this; + } + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) { + for (int i = 0, j = mEnabledItems.length(); i < j; i++) + if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) { + Long[] tStats = mElectricStats.get((short) (mOffset + i)); + if (tStats != null && tStats[3] < 0) { + ItemStack tStack = new ItemStack(this, 1, mOffset + i); + setCharge(tStack, Math.abs(tStats[0])); + isItemStackUsable(tStack); + aList.add(tStack); + } + if (tStats == null || tStats[3] != -2) { + ItemStack tStack = new ItemStack(this, 1, mOffset + i); + isItemStackUsable(tStack); + aList.add(tStack); + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public final void registerIcons(IIconRegister aIconRegister) { + for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++) + if (mEnabledItems.get(i)) { + for (byte k = 1; k < mIconList[i].length; k++) { + mIconList[i][k] = aIconRegister.registerIcon(CORE.MODID+":" + (getUnlocalizedName() + "/" + i + "/" + k)); + } + mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":" + (getUnlocalizedName() + "/" + i)); + } + } + + + @Override + public final IIcon getIconFromDamage(int aMetaData) { + if (aMetaData < 0) return null; + return aMetaData - mOffset < mIconList.length ? mIconList[aMetaData - mOffset][0] : null; + } + + /** + * Sets the unlocalized name of this item to the string passed as the parameter" + */ + @Override + public Item setUnlocalizedName(String p_77655_1_){ + this.unlocalizedName = p_77655_1_; + super.setUnlocalizedName(p_77655_1_); + return this; + } + + /** + * Returns the unlocalized name of this item. + */ + @Override + public String getUnlocalizedName() + { + return this.unlocalizedName; + } + + public final Long[] getElectricStats(ItemStack aStack) { + return mElectricStats.get((short) aStack.getItemDamage()); + } + + @Override + public int getItemEnchantability() { + return 0; + } + + @Override + public boolean isBookEnchantable(ItemStack aStack, ItemStack aBook) { + return false; + } + + @Override + public boolean getIsRepairable(ItemStack aStack, ItemStack aMaterial) { + return false; + } + + + /** + * Adds a special Item Behaviour to the Item. + * <p/> + * Note: the boolean Behaviours sometimes won't be executed if another boolean Behaviour returned true before. + * + * @param aMetaValue the Meta Value of the Item you want to add it to. [0 - 32765] + * @param aBehavior the Click Behavior you want to add. + * @return the Item itself for convenience in constructing. + */ + public final BaseEuItem addItemBehavior(int aMetaValue, IItemBehaviour<BaseEuItem> aBehavior) { + if (aMetaValue < 0 || aMetaValue >= 32766 || aBehavior == null) return this; + ArrayList<IItemBehaviour<BaseEuItem>> tList = mItemBehaviors.get((short) aMetaValue); + if (tList == null) { + tList = new ArrayList<IItemBehaviour<BaseEuItem>>(1); + mItemBehaviors.put((short) aMetaValue, tList); + } + tList.add(aBehavior); + return this; + } + + /** + * This adds a Custom Item to the ending Range. + * + * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset) + * @param aEnglish The Default Localized Name of the created Item + * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip + * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing. + * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things. + * @return An ItemStack containing the newly created Item. + */ + @SuppressWarnings("unchecked") + public final ItemStack addItem(int aID, String aEnglish, String aToolTip, Object... aRandomData) { + if (aToolTip == null) aToolTip = ""; + if (aID >= 0 && aID < mItemAmount) { + ItemStack rStack = new ItemStack(this, 1, mOffset + aID); + mEnabledItems.set(aID); + mVisibleItems.set(aID); + GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".name", aEnglish); + GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".tooltip", aToolTip); + List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>(); + // Important Stuff to do first + for (Object tRandomData : aRandomData) + if (tRandomData instanceof SubTag) { + if (tRandomData == SubTag.INVISIBLE) { + mVisibleItems.set(aID, false); + continue; + } + if (tRandomData == SubTag.NO_UNIFICATION) { + GT_OreDictUnificator.addToBlacklist(rStack); + continue; + } + } + // now check for the rest + for (Object tRandomData : aRandomData) + if (tRandomData != null) { + boolean tUseOreDict = true; + if (tRandomData instanceof IItemBehaviour) { + addItemBehavior(mOffset + aID, (IItemBehaviour<BaseEuItem>) tRandomData); + tUseOreDict = false; + } + if (tRandomData instanceof IItemContainer) { + ((IItemContainer) tRandomData).set(rStack); + tUseOreDict = false; + } + if (tRandomData instanceof SubTag) { + continue; + } + if (tRandomData instanceof TC_AspectStack) { + ((TC_AspectStack) tRandomData).addToAspectList(tAspects); + continue; + } + if (tRandomData instanceof ItemData) { + if (GT_Utility.isStringValid(tRandomData)) + GT_OreDictUnificator.registerOre(tRandomData, rStack); + else GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); + continue; + } + if (tUseOreDict) { + GT_OreDictUnificator.registerOre(tRandomData, rStack); + continue; + } + } + if (GregTech_API.sThaumcraftCompat != null) + GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); + return rStack; + } + return null; + } + + @Override + public String getItemStackDisplayName(ItemStack par1ItemStack) { + return itemName.get(par1ItemStack.getItemDamage()-mOffset).getValue(); + } + +} diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java index 316f922639..391f7bb986 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java @@ -5,7 +5,7 @@ import gtPlusPlus.GTplusplus; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.handler.GuiHandler; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -28,7 +28,7 @@ public class BaseItemBackpack extends Item{ this.setTextureName(CORE.MODID + ":" + "itemBackpack"); this.colourValue = colour; GameRegistry.registerItem(this, unlocalizedName); - GT_OreDictUnificator.registerOre("storageBackpack", UtilsItems.getSimpleStack(this)); + GT_OreDictUnificator.registerOre("storageBackpack", ItemUtils.getSimpleStack(this)); setMaxStackSize(1); setCreativeTab(AddToCreativeTab.tabOther); } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java new file mode 100644 index 0000000000..86cd1c8046 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java @@ -0,0 +1,108 @@ +package gtPlusPlus.core.item.base; + +import java.util.List; + +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/* + * + * + Key Point: You can access the NBT compound data from the Item class (in those methods that pass an ItemStack), but the NBT compound can only be set on an ItemStack. + + The steps to add NBT data to an ItemStack: + Create or otherwise get an ItemStack of the desired item + Create an NBTTagCompound and fill it with the appropriate data + Call ItemStack#setTagCompound() method to set it. + + * + */ + +public class BaseItemBrain extends Item{ + // This is an array of all the types I am going to be adding. + String[] brainTypes = { "dead", "preserved", "fresh", "tasty" }; + + // This method allows us to have different language translation keys for + // each item we add. + @Override + public String getUnlocalizedName(ItemStack stack) + { + // This makes sure that the stack has a tag compound. This is how data + // is stored on items. + if (stack.hasTagCompound()) + { + // This is the object holding all of the item data. + NBTTagCompound itemData = stack.getTagCompound(); + // This checks to see if the item has data stored under the + // brainType key. + if (itemData.hasKey("brainType")) + { + // This retrieves data from the brainType key and uses it in + // the return value + return "item." + itemData.getString("brainType"); + } + } + // This will be used if the item is obtained without nbt data on it. + return "item.nullBrain"; + } + + + // This is a fun method which allows us to run some code when our item is + // shown in a creative tab. I am going to use it to add all the brain + // types. + @SuppressWarnings("unchecked") + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tab, List itemList) + { + // This creates a loop with a counter. It will go through once for + // every listing in brainTypes, and gives us a number associated + // with each listing. + for (int pos = 0; pos < brainTypes.length; pos++) + { + // This creates a new ItemStack instance. The item parameter + // supplied is this item. + ItemStack brainStack = new ItemStack(item); + // By default, a new ItemStack does not have any nbt compound data. + // We need to give it some. + brainStack.setTagCompound(new NBTTagCompound()); + // Now we set the type of the item, brainType is the key, and + // brainTypes[pos] is grabbing a + // entry from the brainTypes array. + brainStack.getTagCompound().setString("brainType", + brainTypes[pos]); + // And this adds it to the itemList, which is a list of all items + // in the creative tab. + itemList.add(brainStack); + } + } + + // This code will allow us to tell the items apart in game. You can change + @SuppressWarnings("unchecked") + // texture based on nbt data, but I won't be covering that. + @Override + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean isAdvanced){ + if ( stack.hasTagCompound() + && stack.getTagCompound().hasKey("brainType")) + { + // StatCollector is a class which allows us to handle string + // language translation. This requires that you fill out the + // translation in you language class. + tooltip.add(StatCollector.translateToLocal("tooltip.yourmod." + + stack.getTagCompound().getString("brainType") + ".desc")); + } + else // If the brain does not have valid tag data, a default message + { + tooltip.add(StatCollector.translateToLocal( + "tooltip.yourmod.nullbrain.desc")); + } + } +} + diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java new file mode 100644 index 0000000000..ee9d451948 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -0,0 +1,160 @@ +package gtPlusPlus.core.item.base; + +import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.entity.EntityUtils; +import gtPlusPlus.core.util.item.ItemUtils; + +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; + +public class BaseItemComponent extends Item{ + + public final Material componentMaterial; + public final String materialName; + public final String unlocalName; + public final ComponentTypes componentType; + + public BaseItemComponent(Material material, ComponentTypes componentType) { + this.componentMaterial = material; + this.unlocalName = "item"+componentType.COMPONENT_NAME+material.getUnlocalizedName(); + this.materialName = material.getLocalizedName(); + this.componentType = componentType; + this.setCreativeTab(AddToCreativeTab.tabMisc); + this.setUnlocalizedName(unlocalName); + this.setMaxStackSize(64); + this.setTextureName(CORE.MODID + ":" + "item"+componentType.COMPONENT_NAME); + GameRegistry.registerItem(this, unlocalName); + GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this)); + } + + @Override + public String getItemStackDisplayName(ItemStack p_77653_1_) { + + return (componentMaterial.getLocalizedName()+componentType.DISPLAY_NAME); + } + + public final String getMaterialName() { + return materialName; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + + if (materialName != null && materialName != "" && !materialName.equals("")){ + + + if (componentType == ComponentTypes.DUST){ + list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust."); + } + if (componentType == ComponentTypes.INGOT){ + list.add(EnumChatFormatting.GRAY+"A solid ingot of " + materialName + "."); + if (materialName != null && materialName != "" && !materialName.equals("") && unlocalName.toLowerCase().contains("ingothot")){ + list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot! "+EnumChatFormatting.GRAY+" Avoid direct handling.."); + } + } + if (componentType == ComponentTypes.PLATE){ + list.add(EnumChatFormatting.GRAY+"A flat plate of " + materialName + "."); + } + if (componentType == ComponentTypes.PLATEDOUBLE){ + list.add(EnumChatFormatting.GRAY+"A double plate of " + materialName + "."); + } + if (componentType == ComponentTypes.ROD){ + list.add(EnumChatFormatting.GRAY+"A 40cm Rod of " + materialName + "."); + } + if (componentType == ComponentTypes.RODLONG){ + list.add(EnumChatFormatting.GRAY+"A 80cm Rod of " + materialName + "."); + } + if (componentType == ComponentTypes.ROTOR){ + list.add(EnumChatFormatting.GRAY+"A Rotor made out of " + materialName + ". "); + } + if (componentType == ComponentTypes.BOLT){ + list.add(EnumChatFormatting.GRAY+"A small Bolt, constructed from " + materialName + "."); + } + if (componentType == ComponentTypes.SCREW){ + list.add(EnumChatFormatting.GRAY+"A 8mm Screw, fabricated out of some " + materialName + "."); + } + if (componentType == ComponentTypes.GEAR){ + list.add(EnumChatFormatting.GRAY+"A large Gear, constructed from " + materialName + "."); + } + if (componentType == ComponentTypes.RING){ + list.add(EnumChatFormatting.GRAY+"A " + materialName + " Ring."); + } + if (componentMaterial.isRadioactive){ + list.add(CORE.GT_Tooltip_Radioactive); + } + + } + + super.addInformation(stack, aPlayer, list, bool); + } + + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + return componentMaterial.getRgbAsHex(); + } + + @Override + public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(componentMaterial.vRadioationLevel, world, entityHolding); + } + + + + + + + + + public static enum ComponentTypes { + DUST("Dust", " Dust", "dust"), + INGOT("Ingot", " Ingot", "ingot"), + PLATE("Plate", " Plate", "plate"), + PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble"), + ROD("Rod", " Rod", "stick"), + RODLONG("RodLong", " Long Rod", "stickLong"), + GEAR("Gear", " Gear", "gear"), + SCREW("Screw", " Screw", "screw"), + BOLT("Bolt", " Bolt", "bolt"), + ROTOR("Rotor", " Rotor", "rotor"), + RING("Ring", " Ring", "ring"), + CELL("Cell", " Cell", "cell"), + NUGGET("Nugget", " Nugget", "nugget"); + + private String COMPONENT_NAME; + private String DISPLAY_NAME; + private String OREDICT_NAME; + private ComponentTypes (final String LocalName, String DisplayName, String OreDictName){ + this.COMPONENT_NAME = LocalName; + this.DISPLAY_NAME = DisplayName; + this.OREDICT_NAME = OreDictName; + } + + public String getComponent(){ + return COMPONENT_NAME; + } + + public String getName(){ + return DISPLAY_NAME; + } + + public String getOreDictName(){ + return OREDICT_NAME; + } + + } + +} + + diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java b/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java index a6cc29497e..431f93b3e6 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java @@ -8,7 +8,6 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; public class BaseItemGeneric extends Item { @@ -24,7 +23,6 @@ public class BaseItemGeneric extends Item @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(EnumChatFormatting.GOLD+""); super.addInformation(stack, aPlayer, list, bool); } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java b/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java new file mode 100644 index 0000000000..ed87677970 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java @@ -0,0 +1,108 @@ +package gtPlusPlus.core.item.base; + +import gregtech.api.enums.Materials; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Quality; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; + +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class BaseItemLoot extends Item{ + + private final String materialName; + private final String unlocalName; + private final LootTypes lootTypes; + private Quality lootQuality; + private final Materials lootMaterial; + + public BaseItemLoot(LootTypes lootType, Materials material) { + this.lootTypes = lootType; + this.lootMaterial = material; + this.materialName = material.mDefaultLocalName; + this.unlocalName = "item"+lootType.LOOT_TYPE+this.materialName; + this.setUnlocalizedName(unlocalName); + this.setMaxStackSize(1); + this.setTextureName(CORE.MODID + ":" + "item"+lootType.LOOT_TYPE); + } + + public ItemStack generateLootStack(){ + lootQuality = Quality.getRandomQuality(); + return ItemUtils.getSimpleStack(this, 1); + } + + @Override + public String getItemStackDisplayName(ItemStack p_77653_1_) { + return (materialName+lootTypes.DISPLAY_SUFFIX); + } + + public final String getMaterialName() { + return materialName; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + list.add(lootQuality.getQuality()); + + /*if (componentMaterial.isRadioactive){ + list.add(CORE.GT_Tooltip_Radioactive); + }*/ + + super.addInformation(stack, aPlayer, list, bool); + } + + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + short[] temp = lootMaterial.mRGBa; + return Utils.rgbtoHexValue(temp[0], temp[1], temp[2]); + } + + @Override + public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { + //EntityUtils.applyRadiationDamageToEntity(lootQuality.vRadioationLevel, world, entityHolding); + } + + + + + + + + + public static enum LootTypes { + Sword("Sword", " Longsword", "sword"), + Shortsword("Sword", " Short Blade", "blade"), + Helmet("Helmet", " Medium Helm", "helmet"), + Chestplate("Platebody", " Chestplate", "platebody"), + Leggings("Platelegs", " Platelegs", "platelegs"), + Boots("Boots", " Boots", "boots"); + private String LOOT_TYPE; + private String DISPLAY_SUFFIX; + private String OREDICT_NAME; + private LootTypes (final String LocalName, final String DisplayName, final String OreDictName){ + this.LOOT_TYPE = LocalName; + this.DISPLAY_SUFFIX = DisplayName; + this.OREDICT_NAME = OreDictName; + } + public String getLootType(){ + return LOOT_TYPE; + } + public String getName(){ + return DISPLAY_SUFFIX; + } + public String getOreDictName(){ + return OREDICT_NAME; + } + } + +} + + diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java index b77b2d336e..0653cddbb8 100644 --- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java +++ b/src/Java/gtPlusPlus/core/item/base/CoreItem.java @@ -102,7 +102,7 @@ public class CoreItem extends Item @Override public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { list.add(descColour+itemDescription); - super.addInformation(stack, aPlayer, list, bool); + //super.addInformation(stack, aPlayer, list, bool); } @Override diff --git a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java index 3d56307f39..6292c5cde6 100644 --- a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java +++ b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java @@ -1,81 +1,11 @@ package gtPlusPlus.core.item.base.bolts; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.math.MathUtils; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.common.registry.GameRegistry; - -public class BaseItemBolt extends Item{ - - final Material boltMaterial; - final String materialName; - final String unlocalName; +public class BaseItemBolt extends BaseItemComponent{ public BaseItemBolt(Material material) { - this.boltMaterial = material; - this.unlocalName = "itemBolt"+material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); - this.setMaxStackSize(64); - this.setTextureName(CORE.MODID + ":" + "itemBolt"); - GameRegistry.registerItem(this, unlocalName); - GT_OreDictUnificator.registerOre(unlocalName.replace("itemB", "b"), UtilsItems.getSimpleStack(this)); - addExtruderRecipe(); + super(material, BaseItemComponent.ComponentTypes.BOLT); } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - - return (materialName+ " Bolt"); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"A small Bolt, constructed from " + materialName + "."); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return materialName; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (boltMaterial.getRgbAsHex() == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return boltMaterial.getRgbAsHex(); - - } - - private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Bolts"); - String tempIngot = unlocalName.replace("itemBolt", "ingot"); - ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); - if (null != tempOutputStack){ - GT_Values.RA.addExtruderRecipe(tempOutputStack, - ItemList.Shape_Extruder_Bolt.get(1), - UtilsItems.getSimpleStack(this, 8), - (int) Math.max(boltMaterial.getMass() * 2L * 1, 1), - 8 * boltMaterial.vVoltageMultiplier); - } - - } - } diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java new file mode 100644 index 0000000000..f2c2187558 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java @@ -0,0 +1,42 @@ +package gtPlusPlus.core.item.base.cell; + +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.util.IIcon; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class BaseItemCell extends BaseItemComponent{ + + private IIcon base; + private IIcon overlay; + ComponentTypes Cell = ComponentTypes.CELL; + + public BaseItemCell(Material material) { + super(material, BaseItemComponent.ComponentTypes.CELL); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses(){ + return true; + } + + @Override + public void registerIcons(IIconRegister i) { + this.base = i.registerIcon(CORE.MODID + ":" + "item"+Cell.getComponent()); + this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+Cell.getComponent()+"_Overlay"); + } + + + @Override + public IIcon getIconFromDamageForRenderPass(int damage, int pass) { + if(pass == 0) { + return this.base; + } + return this.overlay; + } + +} diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 236edca24d..69d5363240 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -7,9 +7,9 @@ import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.entity.EntityUtils; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.recipe.UtilsRecipe; import java.util.List; @@ -70,9 +70,8 @@ public class BaseItemDust extends Item{ } if (temp != null && temp != ""){ oredictName = temp; - GT_OreDictUnificator.registerOre(temp, UtilsItems.getSimpleStack(this)); + GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); } - addMixerRecipe(); addFurnaceRecipe(); addMacerationRecipe(); } @@ -95,7 +94,7 @@ public class BaseItemDust extends Item{ protected final int sRadiation; @Override public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); } @Override @@ -113,6 +112,9 @@ public class BaseItemDust extends Item{ if (sRadiation > 0){ list.add(CORE.GT_Tooltip_Radioactive); } + if (dustInfo != null){ + list.add(dustInfo.vChemicalFormula); + } //} super.addInformation(stack, aPlayer, list, bool); } @@ -130,79 +132,6 @@ public class BaseItemDust extends Item{ } - - - private void addMixerRecipe(){ - - ItemStack thisItem; - ItemStack normalDust = dustInfo.getDust(1); - ItemStack smallDust = dustInfo.getSmallDust(1); - ItemStack tinyDust = dustInfo.getTinyDust(1); - - ItemStack[] inputStacks = dustInfo.getMaterialComposites(); - ItemStack outputStacks = dustInfo.getDust(10); - - if (oredictName.contains("dustTiny")){ - thisItem = tinyDust; - ItemStack normalStack = dustInfo.getDust(1); - ItemStack tinyStack = dustInfo.getTinyDust(9); - Utils.LOG_INFO("Generating a 9 Tiny dust to 1 Dust recipe for "+materialName); - UtilsRecipe.recipeBuilder( - thisItem, thisItem, thisItem, - thisItem, thisItem, thisItem, - thisItem, thisItem, thisItem, - normalStack); - - Utils.LOG_INFO("Generating a 9 Tiny dust from 1 Dust recipe for "+materialName); - UtilsRecipe.recipeBuilder( - normalStack, null, null, - null, null, null, - null, null, null, - tinyStack); - - } - else if (oredictName.contains("dustSmall")){ - thisItem = smallDust; - ItemStack normalStack = dustInfo.getDust(1); - ItemStack smallStack = dustInfo.getSmallDust(4); - - Utils.LOG_INFO("Generating a 4 Small dust to 1 Dust recipe for "+materialName); - UtilsRecipe.recipeBuilder( - thisItem, thisItem, null, - thisItem, thisItem, null, - null, null, null, - normalStack); - - Utils.LOG_INFO("Generating a 4 Small dust from 1 Dust recipe for "+materialName); - UtilsRecipe.recipeBuilder( - null, normalStack, null, - null, null, null, - null, null, null, - smallStack); - - } - else { - thisItem = normalDust; - } - - if (thisItem == normalDust){ - Utils.LOG_WARNING("Generating a Dust recipe for "+materialName+" in the mixer."); - - if (inputStacks.length != 0){ - GT_Values.RA.addMixerRecipe( - inputStacks[0], inputStacks[1], - inputStacks[2], inputStacks[3], - null, null, - outputStacks, - 8*mTier*20, 8*mTier*2); - } - else { - return; - } - } - } - - private void addMacerationRecipe(){ Utils.LOG_WARNING("Adding recipe for "+materialName+" Dusts"); @@ -228,8 +157,8 @@ public class BaseItemDust extends Item{ Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot); ItemStack[] outputStacks = {dustInfo.getDust(1)}; if (tempIngot != null && tempIngot != ""){ - tempInputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); - tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempDust, 1); + tempInputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); + tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempDust, 1); ItemStack tempStackOutput2 = null; int chance = mTier*10/MathUtils.randInt(10, 20); if (outputStacks.length != 0){ @@ -273,25 +202,30 @@ public class BaseItemDust extends Item{ if (dustInfo.requiresBlastFurnace()){ Utils.LOG_WARNING("Adding recipe for Hot "+materialName+" Ingots in a Blast furnace."); String tempIngot = temp.replace("ingot", "ingotHot"); - ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); + ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName() + " Debug: "+tempIngot); if (null != tempOutputStack){ - addBlastFurnaceRecipe(UtilsItems.getSimpleStack(this), null, tempOutputStack, null, 350*mTier); + addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*mTier); } return; } Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a furnace."); - ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(temp, 1); + ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); Utils.LOG_WARNING("This will produce an ingot of "+tempOutputStack.getDisplayName() + " Debug: "+temp); if (null != tempOutputStack){ if (mTier < 5 || !dustInfo.requiresBlastFurnace()){ - CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(UtilsItems.getSimpleStack(this), tempOutputStack); + if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(ItemUtils.getSimpleStack(this), tempOutputStack)){ + Utils.LOG_WARNING("Successfully added a furnace recipe for "+materialName); + } + else { + Utils.LOG_WARNING("Failed to add a furnace recipe for "+materialName); + } } else if (mTier >= 5 || dustInfo.requiresBlastFurnace()){ Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a Blast furnace."); Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName()); if (null != tempOutputStack){ - addBlastFurnaceRecipe(UtilsItems.getSimpleStack(this), null, tempOutputStack, null, 350*mTier); + addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*mTier); } return; } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java index 78067e48c7..d5dd78a49b 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java @@ -4,7 +4,8 @@ import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.entity.EntityUtils; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import java.util.List; @@ -35,7 +36,7 @@ public class BaseItemDustUnique extends Item{ this.setCreativeTab(tabMisc); this.colour = colour; this.materialName = materialName; - this.sRadiation = UtilsItems.getRadioactivityLevel(materialName); + this.sRadiation = ItemUtils.getRadioactivityLevel(materialName); GameRegistry.registerItem(this, unlocalizedName); String temp = ""; @@ -60,7 +61,7 @@ public class BaseItemDustUnique extends Item{ Utils.LOG_WARNING("Generating OreDict Name: "+temp); } if (temp != null && temp != ""){ - GT_OreDictUnificator.registerOre(temp, UtilsItems.getSimpleStack(this)); + GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); } } @@ -82,7 +83,7 @@ public class BaseItemDustUnique extends Item{ protected final int sRadiation; @Override public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); } @Override diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java new file mode 100644 index 0000000000..0faa781fd9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java @@ -0,0 +1,56 @@ +package gtPlusPlus.core.item.base.dusts.decimal; + +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; + +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import cpw.mods.fml.common.registry.GameRegistry; + +public class BaseItemCentidust extends Item{ + + final Material dustMaterial; + final String materialName; + final String unlocalName; + + public BaseItemCentidust(Material material) { + this.dustMaterial = material; + this.unlocalName = "itemCentidust"+material.getUnlocalizedName(); + this.materialName = material.getLocalizedName(); + this.setCreativeTab(AddToCreativeTab.tabMisc); + this.setUnlocalizedName(unlocalName); + this.setMaxStackSize(10); + this.setTextureName(CORE.MODID + ":" + "itemCentidust"); //TODO + GameRegistry.registerItem(this, unlocalName); + //GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO + } + + @Override + public String getItemStackDisplayName(ItemStack p_77653_1_) { + + return (materialName+ " Centidust"); + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + if (materialName != null && materialName != "" && !materialName.equals("")){ + list.add(EnumChatFormatting.GRAY+"1% of a " + materialName + " dust pile."); + } + super.addInformation(stack, aPlayer, list, bool); + } + + public final String getMaterialName() { + return materialName; + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + return dustMaterial.getRgbAsHex(); + } + +} diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java new file mode 100644 index 0000000000..afb9eef473 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java @@ -0,0 +1,56 @@ +package gtPlusPlus.core.item.base.dusts.decimal; + +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; + +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import cpw.mods.fml.common.registry.GameRegistry; + +public class BaseItemDecidust extends Item{ + + final Material dustMaterial; + final String materialName; + final String unlocalName; + + public BaseItemDecidust(Material material) { + this.dustMaterial = material; + this.unlocalName = "itemDecidust"+material.getUnlocalizedName(); + this.materialName = material.getLocalizedName(); + this.setCreativeTab(AddToCreativeTab.tabMisc); + this.setUnlocalizedName(unlocalName); + this.setMaxStackSize(10); + this.setTextureName(CORE.MODID + ":" + "itemDecidust"); //TODO + GameRegistry.registerItem(this, unlocalName); + //GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO + } + + @Override + public String getItemStackDisplayName(ItemStack p_77653_1_) { + + return (materialName+ " Decidust"); + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + if (materialName != null && materialName != "" && !materialName.equals("")){ + list.add(EnumChatFormatting.GRAY+"10% of a " + materialName + " dust pile."); + } + super.addInformation(stack, aPlayer, list, bool); + } + + public final String getMaterialName() { + return materialName; + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + return dustMaterial.getRgbAsHex(); + } + +} diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java index aaad22be9c..92b8c8c224 100644 --- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java +++ b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.item.base.foods; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import java.util.List; @@ -42,7 +42,7 @@ public class BaseItemHotFood extends BaseItemFood{ if(iStack.getItemDamage() == cooldownTime) { if (entityHolding instanceof EntityPlayer){ Utils.LOG_INFO("Foods Done."); - ((EntityPlayer) entityHolding).inventory.addItemStackToInventory(UtilsItems.getSimpleStack(output)); + ((EntityPlayer) entityHolding).inventory.addItemStackToInventory(ItemUtils.getSimpleStack(output)); ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); } }else if(iStack.getItemDamage() < cooldownTime){ diff --git a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java index 47ce5b7815..7c4fe89568 100644 --- a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java +++ b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java @@ -1,81 +1,11 @@ package gtPlusPlus.core.item.base.gears; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.math.MathUtils; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.common.registry.GameRegistry; - -public class BaseItemGear extends Item{ - - final Material gearMaterial; - final String materialName; - final String unlocalName; +public class BaseItemGear extends BaseItemComponent{ public BaseItemGear(Material material) { - this.gearMaterial = material; - this.unlocalName = "itemGear"+material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); - this.setMaxStackSize(64); - this.setTextureName(CORE.MODID + ":" + "itemGear"); - GameRegistry.registerItem(this, unlocalName); - GT_OreDictUnificator.registerOre(unlocalName.replace("itemG", "g"), UtilsItems.getSimpleStack(this)); - addExtruderRecipe(); - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - - return (gearMaterial.getLocalizedName()+ " Gear"); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"A large Gear, constructed from " + materialName + "."); - } - super.addInformation(stack, aPlayer, list, bool); + super(material, BaseItemComponent.ComponentTypes.GEAR); } - - public final String getMaterialName() { - return materialName; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (gearMaterial.getRgbAsHex() == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return gearMaterial.getRgbAsHex(); - - } - - private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Gears"); - ItemStack tempOutputStack = gearMaterial.getIngot(8); - if (null != tempOutputStack){ - - GT_Values.RA.addExtruderRecipe( - tempOutputStack, - ItemList.Shape_Extruder_Gear.get(1), - UtilsItems.getSimpleStack(this), - (int) Math.max(gearMaterial.getMass() * 5L, 1), - 8 * gearMaterial.vVoltageMultiplier); - } - } - } diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java index e193636043..9a0ef0d097 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java @@ -5,7 +5,8 @@ import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.entity.EntityUtils; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import java.util.List; @@ -44,7 +45,7 @@ public class BaseItemIngot extends Item{ temp = unlocalName.replace("itemHotIngot", "ingotHot"); } if (temp != null && temp != ""){ - GT_OreDictUnificator.registerOre(temp, UtilsItems.getSimpleStack(this)); + GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); } generateCompressorRecipe(); } @@ -84,7 +85,7 @@ public class BaseItemIngot extends Item{ private void generateCompressorRecipe(){ if (unlocalName.contains("itemIngot")){ - ItemStack tempStack = UtilsItems.getSimpleStack(this, 9); + ItemStack tempStack = ItemUtils.getSimpleStack(this, 9); ItemStack tempOutput = null; String temp = getUnlocalizedName().replace("item.itemIngot", "block"); Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); @@ -95,7 +96,7 @@ public class BaseItemIngot extends Item{ temp = temp.replace("itemIngot", "block"); Utils.LOG_WARNING("Generating OreDict Name: "+temp); if (temp != null && temp != ""){ - tempOutput = UtilsItems.getItemStackOfAmountFromOreDict(temp, 1); + tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); if (tempOutput != null){ GT_ModHandler.addCompressionRecipe(tempStack, tempOutput); } @@ -113,6 +114,6 @@ public class BaseItemIngot extends Item{ protected final int sRadiation; @Override public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); } } diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java index 6fa358f36f..6b60e7f8d3 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java @@ -3,7 +3,7 @@ package gtPlusPlus.core.item.base.ingots; import gregtech.api.enums.GT_Values; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import java.util.List; @@ -50,7 +50,7 @@ public class BaseItemIngotHot extends BaseItemIngot{ private void generateRecipe(){ Utils.LOG_WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+materialName+"."); - GT_Values.RA.addVacuumFreezerRecipe(UtilsItems.getSimpleStack(this), outputIngot.copy(), 60*mTier); + GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), outputIngot.copy(), 60*mTier); } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java index 77af69f809..2e39a47f81 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java @@ -3,7 +3,7 @@ package gtPlusPlus.core.item.base.itemblock; import gtPlusPlus.core.fluids.BlockFluidBase; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import java.util.List; @@ -26,7 +26,7 @@ public class ItemBlockFluid extends ItemBlock{ this.baseBlock = (BlockFluidBase) block; this.blockColour = baseBlock.getRenderColor(1); this.thisFluid = baseBlock.getFluidMaterial(); - this.sRadiation=UtilsItems.getRadioactivityLevel(baseBlock.getUnlocalizedName()); + this.sRadiation=ItemUtils.getRadioactivityLevel(baseBlock.getUnlocalizedName()); this.name = baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); //GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), UtilsItems.getSimpleStack(this)); } @@ -60,7 +60,7 @@ public class ItemBlockFluid extends ItemBlock{ @Override public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add("Temperature: "+MathUtils.celsiusToKelvin(thisFluid.getMeltingPoint_C())+"K"); + list.add("Temperature: "+MathUtils.celsiusToKelvin(thisFluid.getMeltingPointC())+"K"); if (sRadiation > 0){ list.add(CORE.GT_Tooltip_Radioactive); } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java index ed21b3642a..8bf5346084 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java @@ -3,8 +3,8 @@ package gtPlusPlus.core.item.base.itemblock; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.block.base.BlockBaseModular; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.entity.EntityUtils; +import gtPlusPlus.core.util.item.ItemUtils; import java.util.List; @@ -30,7 +30,7 @@ public class ItemBlockGtBlock extends ItemBlock{ else { sRadiation = 0; } - GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), UtilsItems.getSimpleStack(this)); + GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this)); } public int getRenderColor(int aMeta) { @@ -47,7 +47,7 @@ public class ItemBlockGtBlock extends ItemBlock{ @Override public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); } } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java index b4628f12ab..9d442e3102 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.item.base.itemblock; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.block.base.BlockBaseModular; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; @@ -14,7 +14,7 @@ public class ItemBlockGtFrameBox extends ItemBlock{ super(block); BlockBaseModular baseBlock = (BlockBaseModular) block; this.blockColour = baseBlock.getRenderColor(1); - GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), UtilsItems.getSimpleStack(this)); + GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), ItemUtils.getSimpleStack(this)); } public int getRenderColor(int aMeta) { diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java new file mode 100644 index 0000000000..73fcbc2ab6 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java @@ -0,0 +1,43 @@ +package gtPlusPlus.core.item.base.itemblock; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class ItemBlockTileEntity extends ItemBlock{ + + String[] description; + + public ItemBlockTileEntity(Block block) { + super(block); + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + for (int i =0; i< this.description.length; i++){ + if (!this.description[i].equals("")){ + list.add(this.description[i]); + } + } + + + super.addInformation(stack, aPlayer, list, bool); + } + + @Override + public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { + + } + + public void setDecription(String[] description){ + for (int i =0; i< description.length; i++){ + this.description[i] = description[i]; + } + } + +} diff --git a/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java b/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java new file mode 100644 index 0000000000..d4f7ac02a6 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java @@ -0,0 +1,11 @@ +package gtPlusPlus.core.item.base.nugget; + +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.material.Material; + +public class BaseItemNugget extends BaseItemComponent{ + + public BaseItemNugget(Material material) { + super(material, BaseItemComponent.ComponentTypes.NUGGET); + } +} diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java index 103198a395..3d1153eb6a 100644 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java +++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java @@ -1,92 +1,19 @@ package gtPlusPlus.core.item.base.plates; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.materials.MaterialUtils; -import java.util.List; +public class BaseItemPlate extends BaseItemComponent{ -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; - -public class BaseItemPlate extends Item{ - - protected int colour; - protected String materialName; - protected String unlocalName; - private int mTier; - - public BaseItemPlate(String unlocalizedName, String materialName, int colour, int tier, int sRadioactivity) { - setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalizedName); - this.unlocalName = unlocalizedName; - this.setMaxStackSize(64); - this.setTextureName(CORE.MODID + ":" + "itemPlate"); - this.colour = colour; - this.mTier = tier; - this.materialName = materialName; - this.sRadiation = sRadioactivity; - GameRegistry.registerItem(this, unlocalizedName); - GT_OreDictUnificator.registerOre(unlocalName.replace("itemP", "p"), UtilsItems.getSimpleStack(this)); - //addBendingRecipe(); - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - - return (materialName+ " Plate"); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"A flat plate of " + materialName + "."); - } - if (sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - super.addInformation(stack, aPlayer, list, bool); + public BaseItemPlate(Material material) { + super(material, BaseItemComponent.ComponentTypes.PLATE); } - - public final String getMaterialName() { - return materialName; + + public BaseItemPlate(String unlocalizedName, String materialName, short[] colour, int tier, int sRadioactivity) { + this(MaterialUtils.generateQuickMaterial(materialName, new short[]{colour[0], colour[1], colour[2], 0}, sRadioactivity)); } - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return colour; - - } - protected final int sRadiation; - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); - } - - private void addBendingRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Plates"); - String tempIngot = unlocalName.replace("itemPlate", "ingot"); - ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); - if (null != tempOutputStack){ - GT_Values.RA.addBenderRecipe(tempOutputStack, - UtilsItems.getSimpleStack(this), - 14*mTier*20, - 64*mTier); - } - } } diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java index e6bfc1253a..ce8bbe8191 100644 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java +++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java @@ -1,126 +1,18 @@ package gtPlusPlus.core.item.base.plates; -import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_OreDictUnificator; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.math.MathUtils; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.material.Material; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; - -public class BaseItemPlateDouble extends Item{ - protected int colour; - protected String materialName; - protected String unlocalName; - private int mTier; +public class BaseItemPlateDouble extends BaseItemComponent{ - public BaseItemPlateDouble(String unlocalizedName, String materialName, int colour, int tier, int sRadioactivity) { - setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalizedName); - this.unlocalName = unlocalizedName; + public BaseItemPlateDouble(Material material) { + super(material, BaseItemComponent.ComponentTypes.PLATEDOUBLE); this.setMaxStackSize(32); - this.setTextureName(CORE.MODID + ":" + "itemPlateDouble"); - this.colour = colour; - this.mTier = tier; - this.materialName = materialName; - this.sRadiation = sRadioactivity; - GameRegistry.registerItem(this, unlocalizedName); - GT_OreDictUnificator.registerOre(unlocalName.replace("itemP", "p"), UtilsItems.getSimpleStack(this)); - //addBendingRecipe(); - //addCraftingRecipe(); } @Override public String getItemStackDisplayName(ItemStack p_77653_1_) { - return ("Double "+materialName+ " Plate"); } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"A double plate of " + materialName + "."); - } - if (sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return materialName; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return colour; - - } - - protected final int sRadiation; - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); - } - - private void addBendingRecipe(){ - Utils.LOG_WARNING("Adding bender recipe for "+materialName+" Double Plates"); - String tempIngot = unlocalName.replace("itemPlateDouble", "ingot"); - String tempPlate = unlocalName.replace("itemPlateDouble", "plate"); - ItemStack inputIngot = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 2); - ItemStack inputPlate = UtilsItems.getItemStackOfAmountFromOreDict(tempPlate, 2); - if (null != inputIngot){ - GT_Values.RA.addBenderRecipe(inputIngot, - UtilsItems.getSimpleStack(this), - 4*20, - 96); - } - if (null != inputPlate){ - GT_Values.RA.addBenderRecipe(inputPlate, - UtilsItems.getSimpleStack(this), - 4*20, - 96); - } - } - - private void addCraftingRecipe(){ - Utils.LOG_WARNING("Adding crafting recipes for "+materialName+" Double Plates"); - String tempPlate = unlocalName.replace("itemPlateDouble", "plate"); - ItemStack inputPlate = UtilsItems.getItemStackOfAmountFromOreDict(tempPlate, 1); - if (null != inputPlate){ - - GT_ModHandler.addCraftingRecipe( - GT_Utility.copyAmount(1L, new Object[]{UtilsItems.getSimpleStack(this)}), - 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'), - inputPlate, - Character.valueOf('B'), - inputPlate}); - - GT_ModHandler.addShapelessCraftingRecipe( - GT_Utility.copyAmount(1L, new Object[]{UtilsItems.getSimpleStack(this)}), - new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer, - inputPlate, - inputPlate}); - } - } - } diff --git a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java index d03b2b4e2f..6ad3509876 100644 --- a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java +++ b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java @@ -1,94 +1,11 @@ package gtPlusPlus.core.item.base.rings; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.recipe.UtilsRecipe; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.common.registry.GameRegistry; - -public class BaseItemRing extends Item{ - - final Material ringMaterial; - final String materialName; - final String unlocalName; +public class BaseItemRing extends BaseItemComponent{ public BaseItemRing(Material material) { - this.ringMaterial = material; - this.unlocalName = "itemRing"+material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); - this.setMaxStackSize(64); - this.setTextureName(CORE.MODID + ":" + "itemRing"); - GameRegistry.registerItem(this, unlocalName); - GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); - addExtruderRecipe(); - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - - return (materialName+ " Ring"); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"A " + materialName + " Ring."); - } - super.addInformation(stack, aPlayer, list, bool); + super(material, BaseItemComponent.ComponentTypes.RING); } - - public final String getMaterialName() { - return materialName; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (ringMaterial.getRgbAsHex() == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return ringMaterial.getRgbAsHex(); - - } - - private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Rings"); - - //Extruder Recipe - String tempIngot = unlocalName.replace("itemRing", "ingot"); - ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); - if (null != tempOutputStack){ - GT_Values.RA.addExtruderRecipe(tempOutputStack, - ItemList.Shape_Extruder_Ring.get(1), - UtilsItems.getSimpleStack(this, 4), - (int) Math.max(ringMaterial.getMass() * 2L * 1, 1), - 6 * ringMaterial.vVoltageMultiplier); - } - - //Shaped Recipe - tempIngot = unlocalName.replace("itemRing", "stick"); - tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); - if (null != tempOutputStack){ - UtilsRecipe.addShapedGregtechRecipe( - "craftingToolWrench", null, null, - null, tempOutputStack, null, - null, null, null, - UtilsItems.getSimpleStack(this, 1)); - } - } - } diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java index 0e4802ad0c..2e4acd6ccb 100644 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java +++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java @@ -1,141 +1,31 @@ package gtPlusPlus.core.item.base.rods; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.recipe.UtilsRecipe; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; - -public class BaseItemRod extends Item{ - - final Material rodMaterial; - final String materialName; - final String unlocalName; - - public BaseItemRod(Material material, int sRadioactivity) { - this.rodMaterial = material; - this.unlocalName = "itemRod"+material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); - this.setTextureName(CORE.MODID + ":" + "itemRod"); - this.setMaxStackSize(64); - this.sRadiation = sRadioactivity; - GameRegistry.registerItem(this, unlocalName); - GT_OreDictUnificator.registerOre(unlocalName.replace("itemRod", "stick"), UtilsItems.getSimpleStack(this)); - - if (!material.equals(ELEMENT.URANIUM233)){ - addExtruderRecipe(); - } - - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - - return (materialName+ " Rod"); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"A 40cm Rod of " + materialName + "."); - } - if (sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return materialName; - } - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (rodMaterial.getRgbAsHex() == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return rodMaterial.getRgbAsHex(); +public class BaseItemRod extends BaseItemComponent{ + public BaseItemRod(Material material) { + super(material, BaseItemComponent.ComponentTypes.ROD); + addExtruderRecipe(); } - protected final int sRadiation; - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); - } private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Rods"); - - String tempStick = unlocalName.replace("itemRod", "stick"); - String tempStickLong = unlocalName.replace("itemRod", "stickLong"); - String tempBolt = unlocalName.replace("itemRod", "bolt"); - ItemStack stackStick = UtilsItems.getItemStackOfAmountFromOreDict(tempStick, 1); - ItemStack stackStick2 = UtilsItems.getItemStackOfAmountFromOreDict(tempStick, 2); - ItemStack stackBolt = UtilsItems.getItemStackOfAmountFromOreDict(tempBolt, 4); - ItemStack stackStickLong = UtilsItems.getItemStackOfAmountFromOreDict(tempStickLong, 1); - ItemStack stackIngot = rodMaterial.getIngot(1); + Utils.LOG_WARNING("Adding cutter recipe for "+materialName+" Rods"); - - GT_Values.RA.addExtruderRecipe( - stackIngot, - ItemList.Shape_Extruder_Rod.get(1), - stackStick2, - (int) Math.max(rodMaterial.getMass() * 2L * 1, 1), - 6 * rodMaterial.vVoltageMultiplier); + ItemStack stackStick = componentMaterial.getRod(1); + ItemStack stackBolt = componentMaterial.getBolt(4); GT_Values.RA.addCutterRecipe( stackStick, stackBolt, null, - (int) Math.max(rodMaterial.getMass() * 2L, 1L), + (int) Math.max(componentMaterial.getMass() * 2L, 1L), 4); - - if (sRadiation == 0){ - UtilsRecipe.recipeBuilder( - stackStick, stackStick, stackStick, - stackStick, "craftingToolWrench", stackStick, - stackStick, stackStick, stackStick, - UtilsItems.getItemStackOfAmountFromOreDict(unlocalName.replace("itemRod", "frameGt"), 2)); - } - - //Shaped Recipe - Bolts - stackBolt = UtilsItems.getItemStackOfAmountFromOreDict(tempBolt, 2); - if (null != stackBolt){ - UtilsRecipe.recipeBuilder( - "craftingToolSaw", null, null, - null, stackStick, null, - null, null, null, - stackBolt); - } - - //Shaped Recipe - Ingot to Rod - if (null != stackIngot){ - UtilsRecipe.recipeBuilder( - "craftingToolFile", null, null, - null, stackIngot, null, - null, null, null, - stackStick); - } - } } diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java index 6d87fd5872..882dc8b2bf 100644 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java +++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java @@ -1,94 +1,31 @@ package gtPlusPlus.core.item.base.rods; import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.recipe.UtilsRecipe; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import cpw.mods.fml.common.registry.GameRegistry; - -public class BaseItemRodLong extends Item{ - final Material rodLongMaterial; - final String materialName; - final String unlocalName; +public class BaseItemRodLong extends BaseItemComponent{ - public BaseItemRodLong(Material material, int sRadioactivity) { - this.rodLongMaterial = material; - this.unlocalName = "itemRodLong"+material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(material.getUnlocalizedName()); - this.setTextureName(CORE.MODID + ":" + "itemRodLong"); - this.setMaxStackSize(64); - this.sRadiation = sRadioactivity; - GameRegistry.registerItem(this, unlocalName); - GT_OreDictUnificator.registerOre(unlocalName.replace("itemRod", "stick"), UtilsItems.getSimpleStack(this)); + public BaseItemRodLong(Material material) { + super(material, BaseItemComponent.ComponentTypes.RODLONG); addExtruderRecipe(); } - + @Override public String getItemStackDisplayName(ItemStack p_77653_1_) { - return ("Long "+materialName+ " Rod"); } - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"A 80cm Rod of " + materialName + "."); - } - if (sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return materialName; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (rodLongMaterial.getRgbAsHex() == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return rodLongMaterial.getRgbAsHex(); - - } - - protected final int sRadiation; - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); - } - private void addExtruderRecipe(){ Utils.LOG_WARNING("Adding recipe for Long "+materialName+" Rods"); String tempStick = unlocalName.replace("itemRodLong", "stick"); String tempStickLong = unlocalName.replace("itemRodLong", "stickLong"); - ItemStack stackStick = UtilsItems.getItemStackOfAmountFromOreDict(tempStick, 1); - ItemStack stackLong = UtilsItems.getItemStackOfAmountFromOreDict(tempStickLong, 1); - - UtilsRecipe.addShapedGregtechRecipe( - stackStick, "craftingToolHardHammer", stackStick, - null, null, null, - null, null, null, - stackLong); + ItemStack stackStick = ItemUtils.getItemStackOfAmountFromOreDict(tempStick, 1); + ItemStack stackLong = ItemUtils.getItemStackOfAmountFromOreDict(tempStickLong, 1); ItemStack temp = stackStick; temp.stackSize = 2; @@ -96,25 +33,15 @@ public class BaseItemRodLong extends Item{ GT_Values.RA.addForgeHammerRecipe( temp, stackLong, - (int) Math.max(rodLongMaterial.getMass(), 1L), + (int) Math.max(componentMaterial.getMass(), 1L), 16); GT_Values.RA.addCutterRecipe( stackLong, temp, null, - (int) Math.max(rodLongMaterial.getMass(), 1L), - 4); - - //Shaped Recipe - Long Rod to two smalls - if (null != stackLong){ - stackStick.stackSize = 2; - UtilsRecipe.recipeBuilder( - "craftingToolSaw", null, null, - stackLong, null, null, - null, null, null, - stackStick); - } + (int) Math.max(componentMaterial.getMass(), 1L), + 4); } } diff --git a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java index d8ecea32bd..f993cc64b2 100644 --- a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java +++ b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java @@ -1,93 +1,11 @@ package gtPlusPlus.core.item.base.rotors; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.item.base.BaseItemComponent; +import gtPlusPlus.core.material.Material; -import java.util.List; +public class BaseItemRotor extends BaseItemComponent{ -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.common.registry.GameRegistry; - -public class BaseItemRotor extends Item{ - - protected int colour; - protected String materialName; - protected String unlocalName; - - public BaseItemRotor(String unlocalizedName, String materialName, int colour) { - setUnlocalizedName(unlocalizedName); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalizedName); - this.unlocalName = unlocalizedName; - this.setMaxStackSize(64); - this.setTextureName(CORE.MODID + ":" + "itemRotor"); - this.colour = colour; - this.materialName = materialName; - GameRegistry.registerItem(this, unlocalizedName); - GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); - generateRecipe(); - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - - return (materialName+ " Rotor"); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"A spindley Rotor made out of " + materialName + ". "); - } - super.addInformation(stack, aPlayer, list, bool); + public BaseItemRotor(Material material) { + super(material, BaseItemComponent.ComponentTypes.ROTOR); } - - public final String getMaterialName() { - return materialName; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return colour; - - } - - public static boolean getValidItemStack(ItemStack validStack){ - if (validStack != null){ - return true; - } - return false; - } - - public void generateRecipe(){ - - Utils.LOG_WARNING("Adding recipe for "+materialName+" Rotors"); - String tempIngot = unlocalName.replace("itemRotor", "plate"); - ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1); - Utils.LOG_WARNING("Found for recipe:"+tempIngot+ "isValidStack()="+getValidItemStack(tempOutputStack)); - String screw = unlocalName.replace("itemRotor", "screw"); - ItemStack screwStack = UtilsItems.getItemStackOfAmountFromOreDict(screw, 1); - Utils.LOG_WARNING("Found for recipe:"+screw+ "isValidStack()="+getValidItemStack(screwStack)); - String ring = unlocalName.replace("itemRotor", "ring"); - ItemStack ringStack = UtilsItems.getItemStackOfAmountFromOreDict(ring, 1); - Utils.LOG_WARNING("Found for recipe:"+ring+ "isValidStack()="+getValidItemStack(ringStack)); - - UtilsRecipe.addShapedGregtechRecipe( - tempOutputStack, "craftingToolHardHammer", tempOutputStack, - screwStack, ringStack, "craftingToolFile", - tempOutputStack, "craftingToolScrewdriver", tempOutputStack, - UtilsItems.getSimpleStack(this)); - } - } diff --git a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java index 8d727770ce..93aa5b7526 100644 --- a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java +++ b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java @@ -1,86 +1,29 @@ package gtPlusPlus.core.item.base.screws; import gregtech.api.enums.GT_Values; -import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.util.recipe.UtilsRecipe; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.common.registry.GameRegistry; -public class BaseItemScrew extends Item{ - - final Material screwMaterial; - final String materialName; - final String unlocalName; +public class BaseItemScrew extends BaseItemComponent{ public BaseItemScrew(Material material) { - this.screwMaterial = material; - this.unlocalName = "itemScrew"+material.getUnlocalizedName(); - this.materialName = material.getLocalizedName(); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); - this.setMaxStackSize(64); - this.setTextureName(CORE.MODID + ":" + "itemScrew"); - GameRegistry.registerItem(this, unlocalName); - GT_OreDictUnificator.registerOre(unlocalName.replace("itemS", "s"), UtilsItems.getSimpleStack(this)); + super(material, BaseItemComponent.ComponentTypes.SCREW); addLatheRecipe(); } - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - - return (materialName+ " Screw"); - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"A 8mm Screw, fabricated out of some " + materialName + "."); - } - super.addInformation(stack, aPlayer, list, bool); - } - - public final String getMaterialName() { - return materialName; - } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (screwMaterial.getRgbAsHex() == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return screwMaterial.getRgbAsHex(); - - } - private void addLatheRecipe(){ Utils.LOG_WARNING("Adding recipe for "+materialName+" Screws"); - ItemStack boltStack = UtilsItems.getItemStackOfAmountFromOreDict(unlocalName.replace("itemScrew", "bolt"), 1); + ItemStack boltStack = ItemUtils.getItemStackOfAmountFromOreDict(unlocalName.replace("itemScrew", "bolt"), 1); if (null != boltStack){ GT_Values.RA.addLatheRecipe( boltStack, - UtilsItems.getSimpleStack(this), + ItemUtils.getSimpleStack(this), null, - (int) Math.max(screwMaterial.getMass() / 8L, 1L), - 4); - - - UtilsRecipe.recipeBuilder( - "craftingToolFile", boltStack, null, - boltStack, null, null, - null, null, null, - UtilsItems.getSimpleStack(this)); + (int) Math.max(componentMaterial.getMass() / 8L, 1L), + 4); } } diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java new file mode 100644 index 0000000000..3c8e09e9e5 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java @@ -0,0 +1,292 @@ +package gtPlusPlus.core.item.general; + +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.interfaces.IItemBlueprint; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.player.PlayerUtils; + +import java.util.List; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; + +public class ItemBlueprint extends Item implements IItemBlueprint{ + + public ItemBlueprint(String unlocalizedName) { + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setMaxStackSize(1); + this.setCreativeTab(AddToCreativeTab.tabMachines); + //this.bpID = MathUtils.randInt(0, 1000); + GameRegistry.registerItem(this, unlocalizedName); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(ItemStack itemStack, EntityPlayer aPlayer, List list, boolean bool) { + //Create some NBT if it's not there, otherwise this does nothing. + if (!itemStack.hasTagCompound()){ + createNBT(itemStack); + } + //Set up some default variables. + int id = -1; + String name = ""; + boolean blueprint = false; + //Get proper display vars from NBT if it's there + if (itemStack.hasTagCompound()){ + //Utils.LOG_WARNING("Found TagCompound"); + id = (int) getNBT(itemStack, "mID"); + name = (String) getNBT(itemStack, "mName"); + blueprint = (boolean) getNBT(itemStack, "mBlueprint"); + } + //Write to tooltip list for each viable setting. + if (itemStack.hasTagCompound()) { + if (id != -1){ + list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id); + } + if(blueprint){ + list.add(EnumChatFormatting.BLUE+"Currently holding a blueprint for "+name); + } + else { + list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything."); + } + } + else { + list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything."); + } + super.addInformation(itemStack, aPlayer, list, bool); + } + + @Override + public String getItemStackDisplayName(ItemStack p_77653_1_) { + return "Blueprint [I am useless]"; + } + + @Override + public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { + createNBT(itemStack); + } + + @Override + public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { + + } + + @Override + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + //Let the player know what blueprint is held + if (itemStack.hasTagCompound()) { + PlayerUtils.messagePlayer(par3Entity, "This Blueprint holds NBT data. "+"|"+getNBT(itemStack, "mID")+"|"+getNBT(itemStack, "mBlueprint")+"|"+getNBT(itemStack, "mName")+"|"+ItemUtils.getArrayStackNames(readItemsFromNBT(itemStack))); + } + else { + createNBT(itemStack); + PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. "+getNBT(itemStack, "mID")); + } + + + return super.onItemRightClick(itemStack, world, par3Entity); + } + + public ItemStack[] readItemsFromNBT(ItemStack itemStack){ + ItemStack[] blueprint = new ItemStack[9]; + if (itemStack.hasTagCompound()){ + NBTTagCompound nbt = itemStack.getTagCompound(); + NBTTagList list = nbt.getTagList("Items", 10); + blueprint = new ItemStack[INV_SIZE]; + for(int i = 0;i<list.tagCount();i++) + { + NBTTagCompound data = list.getCompoundTagAt(i); + int slot = data.getInteger("Slot"); + if(slot >= 0 && slot < INV_SIZE) + { + blueprint[slot] = ItemStack.loadItemStackFromNBT(data); + } + } + return blueprint; + } + return null; + } + + public ItemStack writeItemsToNBT(ItemStack itemStack, ItemStack[] craftingGrid){ + ItemStack[] blueprint = craftingGrid; + if (itemStack.hasTagCompound()){ + NBTTagCompound nbt = itemStack.getTagCompound(); + NBTTagList list = new NBTTagList(); + for(int i = 0;i<INV_SIZE;i++) + { + ItemStack stack = blueprint[i]; + if(stack != null) + { + NBTTagCompound data = new NBTTagCompound(); + stack.writeToNBT(data); + data.setInteger("Slot", i); + list.appendTag(data); + } + } + nbt.setTag("Items", list); + itemStack.setTagCompound(nbt); + return itemStack; + } + return null; + } + + @Override + public boolean isBlueprint(ItemStack stack) { + return true; + } + + @Override + public boolean setBlueprint(ItemStack stack, IInventory craftingTable, ItemStack output) { + boolean hasBP = false; + ItemStack[] blueprint = new ItemStack[9]; + + if (stack.hasTagCompound()){ + hasBP = (boolean) getNBT(stack, "mBlueprint"); + blueprint = readItemsFromNBT(stack); + } + + if (!hasBP){ + try { + for (int o=0; o<craftingTable.getSizeInventory(); o++){ + blueprint[o] = craftingTable.getStackInSlot(o); + if (blueprint[0] != null){ + blueprint[0].stackSize = 0; + } + } + writeItemsToNBT(stack, blueprint); + if (stack.hasTagCompound()){ + if(stack.getTagCompound().getCompoundTag("Items") != null){ + stack.stackTagCompound.setBoolean("mBlueprint", true); + } + else { + //Invalid BP saved? + } + hasBP = (boolean) getNBT(stack, "mBlueprint"); + } + + if (output != null){ + setBlueprintName(stack, output.getDisplayName()); + return (hasBP = true); + } + return false; + } catch (Throwable t){ + return false; + } + } + return false; + } + + @Override + public void setBlueprintName(ItemStack stack, String name) { + stack.stackTagCompound.setString("mName", name); + } + + @Override + public boolean hasBlueprint(ItemStack stack) { + if (stack.hasTagCompound()){ + return (boolean) getNBT(stack, "mBlueprint"); + } + return false; + } + + @Override + public ItemStack[] getBlueprint(ItemStack stack) { + ItemStack[] blueprint = new ItemStack[9]; + if (stack.hasTagCompound()){ + blueprint = readItemsFromNBT(stack); + } + try { + ItemStack[] returnStack = new ItemStack[9]; + for (int o=0; o<blueprint.length; o++){ + returnStack[o] = blueprint[o]; + if (returnStack[0] != null){ + returnStack[0].stackSize = 1; + } + } + return returnStack; + } catch (Throwable t){ + return null; + } + } + + public boolean createNBT(ItemStack itemStack){ + if (itemStack.hasTagCompound()){ + if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){ + //No Blueprint and no name Set + Utils.LOG_WARNING("No Blueprint and no name Set"); + return false; + } + else if (itemStack.stackTagCompound.getBoolean("mBlueprint") && !itemStack.stackTagCompound.getString("mName").equals("")){ + //Has Blueprint but invalid name set + Utils.LOG_WARNING("Has Blueprint but invalid name set"); + //itemStack.stackTagCompound = null; + //createNBT(itemStack); + return false; + } + else if (!itemStack.stackTagCompound.getBoolean("mBlueprint") && itemStack.stackTagCompound.getString("mName").equals("")){ + //Has no Blueprint, but strangely has a name + Utils.LOG_WARNING("Has no Blueprint, but strangely has a name"); + //itemStack.stackTagCompound = null; + //createNBT(itemStack); + return false; + } + return false; + } + else if(!itemStack.hasTagCompound()){ + int bpID = MathUtils.randInt(0, 1000); + boolean hasRecipe = false; + String recipeName = ""; + Utils.LOG_WARNING("Creating Blueprint, setting up it's NBT data. "+bpID); + itemStack.stackTagCompound = new NBTTagCompound(); + itemStack.stackTagCompound.setInteger("mID", bpID); + itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe); + itemStack.stackTagCompound.setString("mName", recipeName); + return true; + } + else { + int bpID = MathUtils.randInt(0, 1000); + boolean hasRecipe = false; + String recipeName = ""; + Utils.LOG_WARNING("Creating a Blueprint, setting up it's NBT data. "+bpID); + itemStack.stackTagCompound = new NBTTagCompound(); + itemStack.stackTagCompound.setInteger("mID", bpID); + itemStack.stackTagCompound.setBoolean("mBlueprint", hasRecipe); + itemStack.stackTagCompound.setString("mName", recipeName); + return true; + } + } + + public Object getNBT(ItemStack itemStack, String tagNBT){ + if (!itemStack.hasTagCompound()){ + return null; + } + Object o = null; + if (tagNBT.equals("mID")){ + o = itemStack.stackTagCompound.getInteger(tagNBT); + } + else if (tagNBT.equals("mBlueprint")){ + o = itemStack.stackTagCompound.getBoolean(tagNBT); + } + else if (tagNBT.equals("mName")){ + o = itemStack.stackTagCompound.getString(tagNBT); + } + else if (tagNBT.equals("")){ + //For More Tag Support + //o = itemStack.stackTagCompound.getInteger(tagNBT); + } + if (o != null) + return o; + return null; } + +} diff --git a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java index 22b6ed27f1..c5f383955c 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.item.general; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; @@ -21,8 +21,10 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import baubles.api.BaubleType; import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; +@Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemCloakingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{ private final String unlocalizedName = "personalCloakingDevice"; @@ -36,7 +38,7 @@ public class ItemCloakingDevice extends Item implements IElectricItem, IElectric this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(1); this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice"); - this.thisStack = UtilsItems.getSimpleStack(this); + this.thisStack = ItemUtils.getSimpleStack(this); this.charge(thisStack, charge, 3, true, false); if (charge == 10000*20*500){ this.setDamage(thisStack, 13); diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java index 728d498e2b..4f1d7f4ecf 100644 --- a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java +++ b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java @@ -3,8 +3,9 @@ package gtPlusPlus.core.item.general; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.player.PlayerUtils; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; import ic2.api.item.IElectricItemManager; @@ -20,8 +21,10 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import baubles.api.BaubleType; import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; +@Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")}) public class ItemHealingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{ private final String unlocalizedName = "personalHealingDevice"; @@ -34,7 +37,7 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(1); this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice"); - this.thisStack = UtilsItems.getSimpleStack(this); + this.thisStack = ItemUtils.getSimpleStack(this); GameRegistry.registerItem(this, unlocalizedName); } @@ -218,8 +221,8 @@ public class ItemHealingDevice extends Item implements IElectricItem, IElectricI Utils.LOG_INFO("rx:"+rx); arg1.heal(rx*2); discharge(arg0, (1638400/4)*rx, 6, true, true, false); - Utils.messagePlayer((EntityPlayer) arg1, "Your NanoBooster Whirs! Leaving you feeling stronger. It Healed "+rx+" hp."); - Utils.messagePlayer((EntityPlayer) arg1, "You check it's remaining uses, it has "+secondsLeft(arg0)+"."); + PlayerUtils.messagePlayer((EntityPlayer) arg1, "Your NanoBooster Whirs! Leaving you feeling stronger. It Healed "+rx+" hp."); + PlayerUtils.messagePlayer((EntityPlayer) arg1, "You check it's remaining uses, it has "+secondsLeft(arg0)+"."); } } } diff --git a/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java b/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java index f1141e1ef4..7844d96f3f 100644 --- a/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java +++ b/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.item.general; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; @@ -44,7 +44,7 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, this.setUnlocalizedName(unlocalizedName); this.setMaxStackSize(1); this.setTextureName(CORE.MODID + ":" + "itemIngot"); - this.thisStack = UtilsItems.getSimpleStack(this); + this.thisStack = ItemUtils.getSimpleStack(this); GameRegistry.registerItem(this, unlocalizedName); } @@ -206,7 +206,7 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, public double discharge(ItemStack stack, double amount, int tier, boolean ignoreTransferLimit, boolean externally, boolean simulate) { if ((stack.stackTagCompound == null) || (!stack.stackTagCompound.hasKey("Energy"))) { - double euCharge = getCharge(UtilsItems.getSimpleStack(this)); + double euCharge = getCharge(ItemUtils.getSimpleStack(this)); if (euCharge != 0 && euCharge >= 1){ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); } @@ -254,7 +254,7 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { - double euCharge = getCharge(UtilsItems.getSimpleStack(this)); + double euCharge = getCharge(ItemUtils.getSimpleStack(this)); if (euCharge != 0 && euCharge >= 1){ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); } @@ -277,7 +277,7 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) { if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { - double euCharge = getCharge(UtilsItems.getSimpleStack(this)); + double euCharge = getCharge(ItemUtils.getSimpleStack(this)); if (euCharge != 0 && euCharge >= 1){ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); } @@ -299,7 +299,7 @@ public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, public int getEnergyStored(ItemStack container) { if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) { - double euCharge = getCharge(UtilsItems.getSimpleStack(this)); + double euCharge = getCharge(ItemUtils.getSimpleStack(this)); if (euCharge != 0 && euCharge >= 1){ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU)); } diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java index 8f1a2083ac..7fbfca0ac8 100644 --- a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java +++ b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java @@ -5,7 +5,7 @@ import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.base.foods.BaseItemFood; import gtPlusPlus.core.item.base.foods.BaseItemHotFood; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; @@ -19,24 +19,24 @@ public class ItemsFoods { //Raisin Bread ModItems.itemIngotRaisinBread = new BaseItemFood("itemIngotRaisinBread", "Raisin Bread", 3, 1.5f, false, new PotionEffect(Potion.weakness.id, 40, 1)).setAlwaysEdible(); - GT_OreDictUnificator.registerOre("foodRaisinBread", UtilsItems.getItemStack(CORE.MODID+":itemIngotRaisinBread", 1)); + GT_OreDictUnificator.registerOre("foodRaisinBread", ItemUtils.getItemStack(CORE.MODID+":itemIngotRaisinBread", 1)); //Hot Raisin Bread ModItems.itemHotIngotRaisinBread = new BaseItemHotFood("itemHotIngotRaisinBread", 1, 0.5f, "Raisin Bread", 120, ModItems.itemIngotRaisinBread); - GT_OreDictUnificator.registerOre("foodHotRaisinBread", UtilsItems.getItemStack(CORE.MODID+":itemHotIngotRaisinBread", 1)); + GT_OreDictUnificator.registerOre("foodHotRaisinBread", ItemUtils.getItemStack(CORE.MODID+":itemHotIngotRaisinBread", 1)); //Raisin Bread ModItems.itemFoodRaisinToast = new BaseItemFood("itemFoodRaisinToast", "Raisin Toast", 1, 0.5f, false).setAlwaysEdible(); - GT_OreDictUnificator.registerOre("foodRaisinToast", UtilsItems.getItemStack(CORE.MODID+":itemFoodRaisinToast", 1)); + GT_OreDictUnificator.registerOre("foodRaisinToast", ItemUtils.getItemStack(CORE.MODID+":itemFoodRaisinToast", 1)); //Hot Raisin Bread ModItems.itemHotFoodRaisinToast = new BaseItemHotFood("itemHotFoodRaisinToast", 1, 0.5f, "Raisin Toast", 20, ModItems.itemFoodRaisinToast); - GT_OreDictUnificator.registerOre("foodHotRaisinToast", UtilsItems.getItemStack(CORE.MODID+":itemHotFoodRaisinToast", 1)); + GT_OreDictUnificator.registerOre("foodHotRaisinToast", ItemUtils.getItemStack(CORE.MODID+":itemHotFoodRaisinToast", 1)); //Raisin Bread ModItems.itemFoodCurriedSausages = new BaseItemFood("itemFoodCurriedSausages", "Curried Sausages", 5, 2f, false); - GT_OreDictUnificator.registerOre("foodCurriedSausages", UtilsItems.getItemStack(CORE.MODID+":itemFoodCurriedSausages", 1)); + GT_OreDictUnificator.registerOre("foodCurriedSausages", ItemUtils.getItemStack(CORE.MODID+":itemFoodCurriedSausages", 1)); //Hot Raisin Bread ModItems.itemHotFoodCurriedSausages = new BaseItemHotFood("itemHotFoodCurriedSausages", 1, 0.5f, "Curried Sausages", 240, ModItems.itemFoodCurriedSausages); - GT_OreDictUnificator.registerOre("foodHotCurriedSausages", UtilsItems.getItemStack(CORE.MODID+":itemHotFoodCurriedSausages", 1)); + GT_OreDictUnificator.registerOre("foodHotCurriedSausages", ItemUtils.getItemStack(CORE.MODID+":itemHotFoodCurriedSausages", 1)); } diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java index 60353f2d1b..99ee699dcf 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java @@ -3,10 +3,10 @@ package gtPlusPlus.core.item.tool.staballoy; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.player.UtilsMining; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -37,6 +37,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ protected ItemStack thisPickaxe = null; protected final int colour; protected final String materialName; + public boolean isValid = true; public MultiPickaxeBase(String unlocalizedName, ToolMaterial material, int materialDurability, int colour) { super(Utils.sanitizeString(unlocalizedName), material); @@ -46,12 +47,15 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ this.setMaxStackSize(1); this.setMaxDamage(materialDurability); this.colour = colour; - this.materialName = material.name(); - GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); + this.materialName = material.name(); this.setCreativeTab(AddToCreativeTab.tabTools); - try {addRecipe();} catch (Throwable e){} + try {isValid = addRecipe();} catch (Throwable e){} + if (colour != 0 && isValid){ + GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); + } + } - + /* * * @@ -61,25 +65,35 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ * * */ - - private void addRecipe(){ + + private boolean addRecipe(){ String plateDense = "plateDense"+materialName; String rodLong = "stickLong"+materialName; String toolHammer = "craftingToolHardHammer"; String toolWrench = "craftingToolWrench"; String toolFile = "craftingToolFile"; String toolScrewDriver = "craftingToolScrewdriver"; - UtilsRecipe.recipeBuilder( + + if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ + return false; + } + if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){ + return false; + } + + RecipeUtils.recipeBuilder( plateDense, plateDense, plateDense, toolFile, rodLong, toolHammer, toolWrench, rodLong, toolScrewDriver, - UtilsItems.getSimpleStack(this)); + ItemUtils.getSimpleStack(this)); + + return true; } - + public final String getMaterialName() { return materialName; } - + @Override public String getItemStackDisplayName(ItemStack iStack) { @@ -113,7 +127,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ return colour; } - + @SuppressWarnings("static-method") private float calculateDurabilityLoss(World world, int X, int Y, int Z){ float bDurabilityLoss = 0; @@ -127,7 +141,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ bHardness = removalist.getBlockHardness(world, X, Y, Z)*100; Utils.LOG_WARNING("Hardness: "+bHardness); - bDurabilityLoss = bHardness; + bDurabilityLoss = 100; //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss); correctTool = canPickaxeBlock(removalist, world); @@ -154,21 +168,21 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ Utils.LOG_WARNING(block.toString()); String removalTool = ""; removalTool = block.getHarvestTool(1); - + if (removalTool.equals("pickaxe") || UtilsMining.getBlockType(block)){ if (canPickaxeBlock(block, world)){ if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ - + if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-dur)){ - - block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); - world.setBlockToAir(X, Y, Z); - + + block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); + world.setBlockToAir(X, Y, Z); + } else { return; } - + } } else { @@ -179,13 +193,15 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ } } - - - @Override + public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){ - item.damageItem(damage*100, localPlayer); + item.damageItem(damage, localPlayer); } - + + public void setItemDamage(ItemStack item, int damage){ + item.setItemDamage(damage-1); + } + @Override @SideOnly(Side.CLIENT) diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java new file mode 100644 index 0000000000..0560893490 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java @@ -0,0 +1,115 @@ +package gtPlusPlus.core.item.tool.staballoy; + +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.recipe.RecipeUtils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class MultiSpadeBase extends StaballoySpade{ + + /* (non-Javadoc) + * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) + */ + @Override + public double getDurabilityForDisplay(ItemStack stack) { + if (super.getDurabilityForDisplay(stack) > 0){ + return super.getDurabilityForDisplay(stack);} + return 0; + } + + protected Boolean FACING_HORIZONTAL = true; + protected String FACING = "north"; + protected EntityPlayer localPlayer; + protected String lookingDirection; + protected World localWorld; + protected ItemStack thisPickaxe = null; + protected final int colour; + protected final String materialName; + public boolean isValid = true; + + public MultiSpadeBase(String unlocalizedName, ToolMaterial material, int materialDurability, int colour) { + super(Utils.sanitizeString(unlocalizedName), material); + this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName)); + this.setTextureName(CORE.MODID + ":" + "itemShovel"); + this.FACING_HORIZONTAL=true; + this.setMaxStackSize(1); + this.setMaxDamage(materialDurability); + this.colour = colour; + this.materialName = material.name(); + this.setCreativeTab(AddToCreativeTab.tabTools); + try {isValid = addRecipe();} catch (Throwable e){} + if (colour != 0 && isValid){ + GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); + } + } + + private boolean addRecipe(){ + String plateDense = "plateDense"+materialName; + String rodLong = "stickLong"+materialName; + String toolHammer = "craftingToolHardHammer"; + String toolWrench = "craftingToolWrench"; + String toolFile = "craftingToolFile"; + String toolScrewDriver = "craftingToolScrewdriver"; + + if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ + return false; + } + if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){ + return false; + } + + RecipeUtils.recipeBuilder( + toolFile, plateDense, toolHammer, + null, rodLong, null, + toolWrench, rodLong, toolScrewDriver, + ItemUtils.getSimpleStack(this)); + + return true; + } + + public final String getMaterialName() { + return materialName; + } + + @Override + public String getItemStackDisplayName(ItemStack iStack) { + + String name; + if (getUnlocalizedName().toLowerCase().contains("wood")){ + name = "Wooden"; + } + else { + name = materialName; + } + return "Big "+name+" Spade"; + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (colour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + return colour; + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(ItemStack par1ItemStack){ + return EnumRarity.uncommon; + } + + @Override + public boolean hasEffect(ItemStack par1ItemStack){ + return false; + } + +} diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java index d20ad259e7..079e3cfc39 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java @@ -99,7 +99,7 @@ public class StaballoyPickaxe extends ItemPickaxe{ } } - return bDurabilityLoss; + return 100; } public Boolean canPickaxeBlock(Block currentBlock, World currentWorld){ @@ -158,16 +158,48 @@ public class StaballoyPickaxe extends ItemPickaxe{ } //int heldItemDurability = heldItem.getDamage(1); - Utils.LOG_WARNING("Total Loss: "+(int)DURABILITY_LOSS); + Utils.LOG_INFO("Total Loss: "+(int)DURABILITY_LOSS); //heldItem.setDamage(heldStack, DURABILITY_LOSS); //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack)); - if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-DURABILITY_LOSS)){ - damageItem(heldItem, (int) DURABILITY_LOSS, localPlayer); + Utils.LOG_INFO("1x: "+(heldItem.getItemDamage())); + int itemdmg = heldItem.getItemDamage(); + int maxdmg = heldItem.getMaxDamage(); + int dodmg = (int)DURABILITY_LOSS; + int durNow = (int) maxdmg-itemdmg; + int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); + + Utils.LOG_INFO( + "Current Damage: " + itemdmg + + " Max Damage: " + maxdmg + + " Durability to be lost: " + dodmg + + " Current Durability: " + durNow + + " Remaining Durability: " + durLeft + ); + + + //Break Tool + if ((durNow-dodmg) <= (99) && itemdmg != 0){ + //TODO break tool + Utils.LOG_INFO("Breaking Tool"); + heldItem.stackSize = 0; } + //Do Damage else { - damageItem(heldItem, heldItem.getMaxDamage()-heldItem.getItemDamage(), localPlayer); + //setItemDamage(heldItem, durLeft); + Utils.LOG_INFO(""+(durNow-durLeft)); + damageItem(heldItem, (durNow-durLeft)-1, localPlayer); + } + + + /*if (heldItem.getItemDamage() <= ((heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)){ + Utils.LOG_INFO("2: "+DURABILITY_LOSS+" 3: "+((heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)); + setItemDamage(heldItem, (int) (heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)); } + else { + Utils.LOG_INFO("3: "+( heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage()))); + setItemDamage(heldItem, heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage())); + }*/ //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); DURABILITY_LOSS = 0; @@ -177,6 +209,10 @@ public class StaballoyPickaxe extends ItemPickaxe{ public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){ item.damageItem(damage, localPlayer); } + + public void setItemDamage(ItemStack item, int damage){ + item.setItemDamage(damage-1); + } //Should clear up blocks quicker if I chain it. public void removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){ @@ -279,8 +315,9 @@ public class StaballoyPickaxe extends ItemPickaxe{ @Override public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { thisPickaxe = stack; - list.add(EnumChatFormatting.GOLD+"Mines a 3x3 area in the direction you are facing."); - super.addInformation(stack, aPlayer, list, bool); + list.add(EnumChatFormatting.GRAY+"Mines a 3x3 at 100 durability per block mined."); + list.add(EnumChatFormatting.GRAY+"Durability: "+(stack.getMaxDamage()-stack.getItemDamage())+"/"+stack.getMaxDamage()); + //super.addInformation(stack, aPlayer, list, bool); } @Override diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java new file mode 100644 index 0000000000..79eac5816b --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java @@ -0,0 +1,316 @@ +package gtPlusPlus.core.item.tool.staballoy; + +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.player.UtilsMining; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemSpade; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class StaballoySpade extends ItemSpade{ + + /* (non-Javadoc) + * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) + */ + @Override + public double getDurabilityForDisplay(ItemStack stack) { + if (super.getDurabilityForDisplay(stack) > 0){ + return super.getDurabilityForDisplay(stack);} + return 0; + } + + protected Boolean FACING_HORIZONTAL = true; + protected String FACING = "north"; + protected EntityPlayer localPlayer; + protected String lookingDirection; + protected World localWorld; + public ItemStack thisPickaxe = null; + + /* + * + * + * + * Methods + * + * + * + */ + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer aPlayer) { + localPlayer = aPlayer; + localWorld = world; + thisPickaxe = stack; + return super.onItemRightClick(stack, world, aPlayer); + } + + + + @Override + public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int X, int Y, int Z, EntityLivingBase entity) { + //super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); + localWorld = world; + thisPickaxe = stack; + //checkFacing(world); + if (!world.isRemote){ + GetDestroyOrientation(lookingDirection, world, X, Y, Z, stack); + } + + return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); + } + + public Boolean canPickaxeBlock(Block currentBlock, World currentWorld){ + String correctTool = ""; + if (!currentWorld.isRemote){ + try { + correctTool = currentBlock.getHarvestTool(0); + //Utils.LOG_WARNING(correctTool); + + Utils.LOG_INFO("Tool for Block: "+correctTool+" | Current block: "+currentBlock.getLocalizedName()); + if (UtilsMining.getBlockType(currentBlock) || correctTool.equals("shovel")){ + return true;} + } catch (NullPointerException e){ + return false;} + } + return false; + } + + private void GetDestroyOrientation(String FACING, World world, int X, int Y, int Z, ItemStack heldItem){ + localWorld = world; + float DURABILITY_LOSS = 0; + if (!world.isRemote){ + + if (FACING.equals("below") || FACING.equals("above")){ + DURABILITY_LOSS = 0; + for(int i = -1; i < 2; i++) { + for(int j = -1; j < 2; j++) { + DURABILITY_LOSS = (DURABILITY_LOSS + removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem)); + } + } + } + + else if (FACING.equals("facingEast") || FACING.equals("facingWest")){ + DURABILITY_LOSS = 0; + for(int i = -1; i < 2; i++) { + for(int j = -1; j < 2; j++) { + DURABILITY_LOSS = (DURABILITY_LOSS + removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem)); + } + } + } + + else if (FACING.equals("facingNorth") || FACING.equals("facingSouth")){ + DURABILITY_LOSS = 0; + for(int i = -1; i < 2; i++) { + for(int j = -1; j < 2; j++) { + DURABILITY_LOSS = (DURABILITY_LOSS + removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem)); + } + } + } + + //int heldItemDurability = heldItem.getDamage(1); + Utils.LOG_INFO("Total Loss: "+(int)DURABILITY_LOSS); + //heldItem.setDamage(heldStack, DURABILITY_LOSS); + //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); + //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack)); + Utils.LOG_INFO("1x: "+(heldItem.getItemDamage())); + int itemdmg = heldItem.getItemDamage(); + int maxdmg = heldItem.getMaxDamage(); + int dodmg = (int)DURABILITY_LOSS; + int durNow = (int) maxdmg-itemdmg; + int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); + + Utils.LOG_INFO( + "Current Damage: " + itemdmg + + " Max Damage: " + maxdmg + + " Durability to be lost: " + dodmg + + " Current Durability: " + durNow + + " Remaining Durability: " + durLeft + ); + + + //Break Tool + if ((durNow-dodmg) <= (900) && itemdmg != 0){ + //TODO break tool + Utils.LOG_INFO("Breaking Tool"); + heldItem.stackSize = 0; + } + //Do Damage + else { + //setItemDamage(heldItem, durLeft); + Utils.LOG_INFO(""+(durNow-durLeft)); + damageItem(heldItem, (durNow-durLeft)-1, localPlayer); + } + DURABILITY_LOSS = 0; + + } + } + + public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){ + item.damageItem(damage, localPlayer); + } + + public void setItemDamage(ItemStack item, int damage){ + item.setItemDamage(damage-1); + } + + //Should clear up blocks quicker if I chain it. + public int removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){ + localWorld = world; + Utils.LOG_INFO("Trying to drop/remove a block."); + try { + Block block = world.getBlock(X, Y, Z); + Utils.LOG_WARNING(block.toString()); + String removalTool = ""; + removalTool = block.getHarvestTool(0); + if (removalTool != null){ + if (removalTool.equals("shovel")){ + if (canPickaxeBlock(block, world)){ + if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ + + int itemdmg = heldItem.getItemDamage(); + int maxdmg = heldItem.getMaxDamage(); + int dodmg = (int)100; + int durNow = (int) maxdmg-itemdmg; + int durLeft = (int) ((maxdmg-itemdmg)-100); + + if ((durNow-dodmg) <= (900) && itemdmg != 0){ + //Do Nothing, Tool is useless. + return 0; + } + block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); + world.setBlockToAir(X, Y, Z); + Utils.LOG_INFO("Adding 100 damage to item."); + return 100; + } + Utils.LOG_INFO("Incorrect Tool for mining this block. Wrong Block Water/lava/bedrock/blacklist"); + return 0; + } + Utils.LOG_INFO("Incorrect Tool for mining this block. Cannot Shovel this block type."); + return 0; + } + Utils.LOG_INFO("Incorrect Tool for mining this block. Blocks mining tool is now Shovel."); + return 0; + } + Utils.LOG_INFO("Either the block was air or it declares an invalid mining tool."); + return 0; + } catch (NullPointerException e){ + Utils.LOG_INFO("Something Broke"); + e.printStackTrace(); + return 0; + } + } + + public boolean checkFacing(World world){ + localWorld = world; + if (localPlayer != null){ + int direction = MathHelper.floor_double((double)((localPlayer.rotationYaw * 4F) / 360F) + 0.5D) & 3; + //Utils.LOG_WARNING("Player - F: "+direction); + //Utils.LOG_WARNING("Player - getLookVec(): "+localPlayer.getLookVec().yCoord); + + /*if (localPlayer.getLookVec().yCoord > 0){ + localPlayer.getLookVec().yCoord; + }*/ + + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, (EntityPlayer) localPlayer, false); + if (movingobjectposition != null){ + int sideHit = movingobjectposition.sideHit; + String playerStandingPosition = ""; + if (movingobjectposition != null) { + //System.out.println("Side Hit: "+movingobjectposition.sideHit); + } + + if (sideHit == 0){ + playerStandingPosition = "above"; + FACING_HORIZONTAL = false; + } + else if (sideHit == 1){ + playerStandingPosition = "below"; + FACING_HORIZONTAL = false; + } + else if (sideHit == 2){ + playerStandingPosition = "facingSouth"; + FACING_HORIZONTAL = true; + } + else if (sideHit == 3){ + playerStandingPosition = "facingNorth"; + FACING_HORIZONTAL = true; + } + else if (sideHit == 4){ + playerStandingPosition = "facingEast"; + FACING_HORIZONTAL = true; + } + else if (sideHit == 5){ + playerStandingPosition = "facingWest"; + FACING_HORIZONTAL = true; + } + lookingDirection = playerStandingPosition; + + if (direction == 0){ + FACING = "south"; + } + else if (direction == 1){ + FACING = "west"; + } + else if (direction == 2){ + FACING = "north"; + } + else if (direction == 3){ + FACING = "east"; + } + } + + + return true; + } + return false; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + thisPickaxe = stack; + list.add(EnumChatFormatting.GOLD+"Spades a 3x3 area in the direction you are facing."); + super.addInformation(stack, aPlayer, list, bool); + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(ItemStack par1ItemStack){ + return EnumRarity.rare; + } + + @Override + public boolean hasEffect(ItemStack par1ItemStack){ + return true; + } + + + @Override + public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer aPlayer) { + thisPickaxe = itemstack; + localPlayer = aPlayer; + checkFacing(localPlayer.worldObj); + return super.onBlockStartBreak(itemstack, X, Y, Z, aPlayer); + } + public StaballoySpade(String unlocalizedName, ToolMaterial material) { + super(material); + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.FACING_HORIZONTAL=true; + this.setMaxStackSize(1); + this.setMaxDamage(3200); + } +} diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index d8798f707b..68bf2ec445 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -6,22 +6,19 @@ import gtPlusPlus.core.util.networking.NetworkUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator; -import java.util.ArrayList; -import java.util.List; +import java.util.HashMap; import java.util.Map; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.config.Configuration; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class CORE { public static final String name = "GT++"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.4.8.2-prerelease"; + public static final String VERSION = "1.4.9-release"; public static final String MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); public static boolean isModUpToDate = Utils.isModUpToDate(); public static boolean DEBUG = false; @@ -34,10 +31,7 @@ public class CORE { @Deprecated public static IGregtech_RecipeAdder sRecipeAdder; public static GregtechRecipe GT_Recipe = new GregtechRecipe(); - - @SideOnly(Side.CLIENT) - public static IIconRegister GT_BlockIcons, GT_ItemIcons; - public static List<Runnable> GT_BlockIconload = new ArrayList<Runnable>(); + public static Configuration Config; public static final String GT_Tooltip = "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus "+EnumChatFormatting.GRAY+"- "+EnumChatFormatting.RED+"[GT++]"; public static final String GT_Tooltip_Radioactive = EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.GREEN+"Radioactive! "+EnumChatFormatting.GOLD+" Avoid direct handling without hazmat protection."; @@ -47,6 +41,9 @@ public class CORE { * A List containing all the Materials, which are somehow in use by GT and therefor receive a specific Set of Items. */ public static final GT_Materials[] sMU_GeneratedMaterials = new GT_Materials[1000]; + + //Tesseract map + public static final Map<Integer, GT_MetaTileEntity_TesseractGenerator> sTesseractGenerators = new HashMap<Integer, GT_MetaTileEntity_TesseractGenerator>(); //GUIS public enum GUI_ENUM @@ -80,11 +77,8 @@ public class CORE { //Debug public static boolean disableEnderIOIntegration = false; - public static boolean disableStaballoyBlastFurnaceRecipe = false; - public static boolean disableCentrifugeFormation = false; //Machine Related - public static boolean enableSolarGenerators = false; public static boolean enableAlternativeBatteryAlloy = false; public static boolean enableThaumcraftShardUnification = false; public static boolean disableIC2Recipes = false; @@ -93,6 +87,29 @@ public class CORE { //Feature Related public static boolean enableCustomAlvearyBlocks = false; + //Single Block Machines + public static boolean enableMachine_SolarGenerators = false; + public static boolean enableMachine_Dehydrators = true; + public static boolean enableMachine_SteamConverter = true; + public static boolean enableMachine_FluidTanks = true; + public static boolean enableMachine_RocketEngines = true; + public static boolean enableMachine_GeothermalEngines = true; + public static boolean enableCustom_Pipes = true; + public static boolean enableCustom_Cables = true; + + //Multiblocks + public static boolean enabledMultiblock_AlloyBlastSmelter = true; + public static boolean enabledMultiblock_IndustrialCentrifuge = true; + public static boolean enabledMultiblock_IndustrialCokeOven = true; + public static boolean enabledMultiblock_IndustrialElectrolyzer = true; + public static boolean enabledMultiblock_IndustrialMacerationStack = true; + public static boolean enabledMultiblock_IndustrialPlatePress = true; + public static boolean enabledMultiblock_IndustrialWireMill = true; + public static boolean enabledMultiblock_IronBlastFurnace = true; + public static boolean enabledMultiblock_MatterFabricator = true; + public static boolean enabledMultiblock_MultiTank = true; + public static boolean enabledMultiblock_PowerSubstation = true; + } } diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index ad7ab7b2c9..440f72d2c8 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -34,6 +34,8 @@ public class LoadedMods { public static boolean MiscUtils = true; //Dummy For MetaData Lookups in MT Wrapper public static boolean ThermalFoundation = false; public static boolean IHL = false; + public static boolean OpenComputers = false; //OpenComputers + public static boolean Computronics = false; //computronics @@ -119,9 +121,17 @@ public class LoadedMods { totalMods++; } if (Loader.isModLoaded("Growthcraft") == true){ - Growthcraft = true; - Utils.LOG_INFO("Components enabled for: Growthcraft"); - totalMods++; + Utils.LOG_INFO("Growthcraft Version: "+getModVersion("Growthcraft")); + if (getModVersion("Growthcraft").equals("1.7.10-2.3.1")){ + //Load Growthcraft Compat + Growthcraft = true; + Utils.LOG_INFO("Components enabled for: Growthcraft"); + totalMods++; + } + else { + Growthcraft = false; + Utils.LOG_INFO("Growthcraft found, but the version was too new. I will update GC support eventually."); + } } if (Loader.isModLoaded("CoFHCore") == true){ CoFHCore = true; @@ -173,6 +183,16 @@ public class LoadedMods { Utils.LOG_INFO("Components enabled for: Baubles"); totalMods++; } + if (Loader.isModLoaded("OpenComputers") == true){ + OpenComputers = true; + Utils.LOG_INFO("Components enabled for: OpenComputers"); + totalMods++; + } + if (Loader.isModLoaded("computronics") == true){ + Computronics = true; + Utils.LOG_INFO("Components enabled for: Computronics"); + totalMods++; + } Utils.LOG_INFO("Content found for "+totalMods+" mods"); diff --git a/src/Java/gtPlusPlus/core/lib/MaterialInfo.java b/src/Java/gtPlusPlus/core/lib/MaterialInfo.java deleted file mode 100644 index 455becc2d1..0000000000 --- a/src/Java/gtPlusPlus/core/lib/MaterialInfo.java +++ /dev/null @@ -1,181 +0,0 @@ -package gtPlusPlus.core.lib; - -import static gtPlusPlus.core.lib.CORE.noItem; -import static gtPlusPlus.core.util.item.UtilsItems.getItemStackOfAmountFromOreDict; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TextureSet; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.util.materials.MaterialUtils; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -public enum MaterialInfo { - - ENERGYCRYSTAL(GTplusplus.randomDust_A, 8, GTplusplus.randomDust_B, 8, GTplusplus.randomDust_C, 8, GTplusplus.randomDust_D, 8, "dustEnergyCrystal", 1, noItem, 0), - - BLOODSTEEL(noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0), - - STABALLOY("dustTitanium", 1, "dustUranium", 8, noItem, 0, noItem, 0, "dustStaballoy", 1, noItem, 0), - - TANTALLOY60("dustTungsten", 1, "dustTantalum", 8, "dustTinyTitanium", 5, noItem, 0, "dustTantalloy60", 1, noItem, 0), - - TANTALLOY61("dustTungsten", 1, "dustSmallTitanium", 3, "dustSmallYttrium", 2, "dustTantalum", 9, "dustTantalloy61", 1, noItem, 0), - - QUANTUM(noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0), - - TUMBAGA("dustGold", 6, "dustCopper", 3, noItem, 0, noItem, 0, "dustTumbaga", 2, noItem, 0), - - POTIN("dustBronze", 3, "dustTin", 2, "dustLead", 4, noItem, 0, "dustPotin", 3, noItem, 0), - - BEDROCKIUM(noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0), - - INCONEL625("dustNickel", 5, "dustChrome", 2, "dustWroughtIron", 1, "dustMolybdenum", 1, "dustInconel625", 4, "dustTinyDarkAsh", 1), - - INCONEL690("dustNickel", 5, "dustChrome", 2, "dustNiobium", 1, "dustMolybdenum", 1, "dustInconel690", 2, "dustTinyDarkAsh", 1), - - INCONEL792("dustNickel", 5, "dustChrome", 1, "dustAluminium", 2, "dustNiobium", 1, "dustInconel792", 2, "dustTinyDarkAsh", 1), - - TUNGSTENCARBIDE("dustTungsten", 16, "dustCarbon", 16, noItem, 0, noItem, 0, "dustTungstenCarbide", 4, noItem, 0), - - SILICONCARBIDE("dustSilicon", 16, "dustCarbon", 16, noItem, 0, noItem, 0, "dustSiliconCarbide", 4, noItem, 0), - - ZERON100("dustChrome", 5, "dustSmallNickel", 6, "dustSmallMolybdenum", 3, "dustSteel", 14, "dustZeron100", 5, noItem, 0), - - MARAGING250("dustSteel", 4, "dustNickel", 2, "dustCobalt", 1, "dustTinyTitanium", 1, "dustMaragingSteel250", 6, noItem, 0), - - MARAGING300("dustSteel", 5, "dustNickel", 2, "dustCobalt", 2, "dustSmallTitanium", 1, "dustMaragingSteel300", 5, noItem, 0), - - MARAGING350("dustSteel", 6, "dustNickel", 3, "dustCobalt", 3, "dustTitanium", 1, "dustMaragingSteel350", 4, noItem, 0), - - STELLITE("dustCobalt", 4, "dustChrome", 4, "dustManganese", 2, "dustTitanium", 1, "dustStellite", 2, noItem, 0), - - TALONITE("dustCobalt", 4, "dustChrome", 4, "dustPhosphorus", 1, "dustMolybdenum", 1, "dustTalonite", 2, noItem, 0), - - HASTELLOY_W("dustSmallCobalt", 1, "dustSmallChrome", 4, "dustMolybdenum", 2, "dustNickel", 6, "dustHastelloyW", 2, noItem, 0), - - HASTELLOY_X("dustTinyCobalt", 6, "dustChrome", 2, "dustMolybdenum", 1, "dustNickel", 5, "dustHastelloyX", 2, noItem, 0), - - HASTELLOY_C276("dustSmallCobalt", 1, "dustSmallChrome", 14, "dustSmallMolybdenum", 14, "dustNickel", 5, "dustHastelloyC276", 2, noItem, 0), - - INCOLOY020("dustIron", 4, "dustChrome", 2, "dustTinyCarbon", 2, "dustSmallCopper", 4, "dustIncoloy020", 1, noItem, 0), - - INCOLOYDS("dustIron", 4, "dustChrome", 2, "dustTinyTitanium", 2, "dustSmallManganese", 1, "dustIncoloyDS", 1, noItem, 0), - - INCOLOYMA956("dustIron", 6, "dustChrome", 2, "dustSmallAluminium", 5, "dustTinyYttrium", 1, "dustIncoloyMA956", 1, noItem, 0), - - TANTALUMCARBIDE("dustTantalum", 4, "dustCarbon", 2, noItem, 0, noItem, 0, "dustTantalumCarbide", 1, noItem, 0), - - ZIRCONIUM(noItem, 0, noItem, 0, noItem, 0, noItem, 0, "dustZirconium", 1, noItem, 0), - - ZIRCONIUMCARBIDE("dustZirconium", 2, "dustCarbon", 2, noItem, 0, noItem, 0, "dustZirconiumCarbide", 1, noItem, 0), - - NIOMBIUMCARBIDE("dustNiobium", 2, "dustCarbon", 2, noItem, 0, noItem, 0, "dustNiobiumCarbide", 1, noItem, 0), - - HASTELLOY_N("dustIron", 1, "dustSmallChrome", 7, "dustSmallMolybdenum", 12, "dustNickel", 4, "dustHastelloyN", 1, noItem, 0), - - URANIUM233(noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0, noItem, 0); - - - - private String input1; - private String input2; - private String input3; - private String input4; - private int inputAmount1; - private int inputAmount2; - private int inputAmount3; - private int inputAmount4; - private String out1; - private String out2; - private int outAmount1; - private int outAmount2; - public static List<String> nonLoadedInputs; - public final Materials materialGT; - - private MaterialInfo ( - String inputMaterial_1, int amountIn1, - String inputMaterial_2, int amountIn2, - String inputMaterial_3, int amountIn3, - String inputMaterial_4, int amountIn4, - String output_A,int amount1, String output_B, int amount2) - { - this.input1 = inputMaterial_1; - this.input2 = inputMaterial_2; - this.input3 = inputMaterial_3; - this.input4 = inputMaterial_4; - this.inputAmount1 = amountIn1; - this.inputAmount2 = amountIn2; - this.inputAmount3 = amountIn3; - this.inputAmount4 = amountIn4; - this.out1 = output_A; - this.out2 = output_B; - this.outAmount1 = amount1; - this.outAmount2 = amount2; - - - - this.materialGT = MaterialUtils.addGtMaterial( - getMaterialName().toLowerCase(), TextureSet.SET_DULL, 2f, 512, 2, - 1 | 2 | 16 | 32 | 64 | 128, - 193, 211, 217, 0, getMaterialName(), 0, 0, 3015, 2150, true, - false, 1, 2, 1, Dyes.dyeWhite, 2, null, null); - } - - public ItemStack[] getInputs() { - return new ItemStack[]{ - getStack(input1, inputAmount1), - getStack(input2, inputAmount2), - getStack(input3, inputAmount3), - getStack(input4, inputAmount4) - }; - } - - public ItemStack[] getOutputs() { - return new ItemStack[]{ - getStack(out1, outAmount1), - getStack(out2, outAmount2) - }; - } - - public String[] getInputItemsAsList(){ - String[] inputArray = { - input1, - input2, - input3, - input4 - }; - return inputArray; - } - - public int[] getInputStackSizesAsList(){ - int[] inputArray = { - inputAmount1, - inputAmount2, - inputAmount3, - inputAmount4 - }; - return inputArray; - } - - @SuppressWarnings("static-method") - public ItemStack getStack(String i, int r){ - if (i == ""){ - return null; - } - ItemStack temp = getItemStackOfAmountFromOreDict(i,r); - if (temp.getDisplayName().toLowerCase().contains("tell alkalus")){ - //temp = null; - } - return temp; - } - - public String getMaterialName(){ - String x = this.name(); - return x; - } - - -} diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index 89ea7ec2ff..56cc6d1343 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -29,99 +29,88 @@ public final class ALLOY { "Staballoy", //Material Name new short[]{68, 75, 66, 0}, //Material Colour 3450, //Melting Point in C - ((ELEMENT.URANIUM.getBoilingPoint_C()*9)+(ELEMENT.TITANIUM.getBoilingPoint_C()*1))/10, //Boiling Point in C - ((ELEMENT.URANIUM.getProtons()*9)+ELEMENT.TITANIUM.getProtons())/10, //Protons - ((ELEMENT.URANIUM.getNeutrons()*9)+ELEMENT.TITANIUM.getNeutrons())/10, //Neutrons + ((ELEMENT.getInstance().URANIUM.getBoilingPointC()*9)+(ELEMENT.getInstance().TITANIUM.getBoilingPointC()*1))/10, //Boiling Point in C + ((ELEMENT.getInstance().URANIUM.getProtons()*9)+ELEMENT.getInstance().TITANIUM.getProtons())/10, //Protons + ((ELEMENT.getInstance().URANIUM.getNeutrons()*9)+ELEMENT.getInstance().TITANIUM.getNeutrons())/10, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.URANIUM, 90), - new MaterialStack(ELEMENT.TITANIUM, 10) + new MaterialStack(ELEMENT.getInstance().URANIUM, 9), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 1) }); public static final Material TANTALLOY_60 = new Material( "Tantalloy-60", //Material Name new short[]{213, 231, 237, 0}, //Material Colour 3025, //Melting Point in C - ((ELEMENT.TUNGSTEN.getBoilingPoint_C()*1)+(ELEMENT.TANTALUM.getBoilingPoint_C()*8)+(ELEMENT.TITANIUM.getBoilingPoint_C()*1))/10, //Boiling Point in C - ((ELEMENT.TUNGSTEN.getProtons()*1)+(ELEMENT.TANTALUM.getProtons()*8)+(ELEMENT.TITANIUM.getProtons()*1))/10, //Protons - ((ELEMENT.TUNGSTEN.getNeutrons()*1)+(ELEMENT.TANTALUM.getNeutrons()*8)+(ELEMENT.TITANIUM.getNeutrons()*1))/10, //Neutrons + ((ELEMENT.getInstance().TUNGSTEN.getBoilingPointC()*1)+(ELEMENT.getInstance().TANTALUM.getBoilingPointC()*8)+(ELEMENT.getInstance().TITANIUM.getBoilingPointC()*1))/10, //Boiling Point in C + ((ELEMENT.getInstance().TUNGSTEN.getProtons()*1)+(ELEMENT.getInstance().TANTALUM.getProtons()*8)+(ELEMENT.getInstance().TITANIUM.getProtons()*1))/10, //Protons + ((ELEMENT.getInstance().TUNGSTEN.getNeutrons()*1)+(ELEMENT.getInstance().TANTALUM.getNeutrons()*8)+(ELEMENT.getInstance().TITANIUM.getNeutrons()*1))/10, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.TUNGSTEN, 7), - new MaterialStack(ELEMENT.TANTALUM, 90), - new MaterialStack(ELEMENT.TANTALUM, 2) + new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 4), + new MaterialStack(ELEMENT.getInstance().TANTALUM, 46) }); public static final Material TANTALLOY_61 = new Material( "Tantalloy-61", //Material Name new short[]{193, 211, 217, 0}, //Material Colour 3030, //Melting Point in C - ((ELEMENT.TUNGSTEN.getBoilingPoint_C()*1)+(ELEMENT.TANTALUM.getBoilingPoint_C()*7)+(ELEMENT.TITANIUM.getBoilingPoint_C()*1)+(ELEMENT.YTTRIUM.getBoilingPoint_C()*1))/10, //Boiling Point in C - ((ELEMENT.TUNGSTEN.getProtons()*1)+(ELEMENT.TANTALUM.getProtons()*7)+(ELEMENT.TITANIUM.getProtons()*1)+(ELEMENT.YTTRIUM.getProtons()*1))/10, //Protons - ((ELEMENT.TUNGSTEN.getNeutrons()*1)+(ELEMENT.TANTALUM.getNeutrons()*7)+(ELEMENT.TITANIUM.getNeutrons()*1)+(ELEMENT.YTTRIUM.getNeutrons()*1))/10, //Neutrons + ((ELEMENT.getInstance().TUNGSTEN.getBoilingPointC()*1)+(ELEMENT.getInstance().TANTALUM.getBoilingPointC()*7)+(ELEMENT.getInstance().TITANIUM.getBoilingPointC()*1)+(ELEMENT.getInstance().YTTRIUM.getBoilingPointC()*1))/10, //Boiling Point in C + ((ELEMENT.getInstance().TUNGSTEN.getProtons()*1)+(ELEMENT.getInstance().TANTALUM.getProtons()*7)+(ELEMENT.getInstance().TITANIUM.getProtons()*1)+(ELEMENT.getInstance().YTTRIUM.getProtons()*1))/10, //Protons + ((ELEMENT.getInstance().TUNGSTEN.getNeutrons()*1)+(ELEMENT.getInstance().TANTALUM.getNeutrons()*7)+(ELEMENT.getInstance().TITANIUM.getNeutrons()*1)+(ELEMENT.getInstance().YTTRIUM.getNeutrons()*1))/10, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.TUNGSTEN, 10), - new MaterialStack(ELEMENT.TANTALUM, 70), - new MaterialStack(ELEMENT.TITANIUM, 10), - new MaterialStack(ELEMENT.YTTRIUM, 10) + new MaterialStack(ALLOY.TANTALLOY_60, 2), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 12), + new MaterialStack(ELEMENT.getInstance().YTTRIUM, 8) }); - public static final Material QUANTUM = new Material( - "Quantum", //Material Name - new short[]{128, 128, 128, 0}, //Material Colour - 9999, //Melting Point in C - 0, //Boiling Point in C - 100, //Protons - 100, //Neutrons - true, //Uses Blast furnace? - //Material Stacks with Percentage of required elements. - null); - public static final Material BRONZE = new Material( "Bronze", //Material Name new short[]{128, 128, 128, 0}, //Material Colour - ((ELEMENT.TIN.getMeltingPoint_C()*1)+(ELEMENT.COPPER.getMeltingPoint_C()*3))/4, //Melting point in C - ((ELEMENT.TIN.getBoilingPoint_C()*1)+(ELEMENT.COPPER.getBoilingPoint_C()*3))/4, //Boiling Point in C - ((ELEMENT.TIN.getProtons()*1)+(ELEMENT.COPPER.getProtons()*3))/4, //Protons - ((ELEMENT.TIN.getNeutrons()*1)+(ELEMENT.COPPER.getNeutrons()*3))/4, //Neutrons + ((ELEMENT.getInstance().TIN.getMeltingPointC()*1)+(ELEMENT.getInstance().COPPER.getMeltingPointC()*3))/4, //Melting point in C + ((ELEMENT.getInstance().TIN.getBoilingPointC()*1)+(ELEMENT.getInstance().COPPER.getBoilingPointC()*3))/4, //Boiling Point in C + ((ELEMENT.getInstance().TIN.getProtons()*1)+(ELEMENT.getInstance().COPPER.getProtons()*3))/4, //Protons + ((ELEMENT.getInstance().TIN.getNeutrons()*1)+(ELEMENT.getInstance().COPPER.getNeutrons()*3))/4, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.COPPER, 75), - new MaterialStack(ELEMENT.TIN, 25) + new MaterialStack(ELEMENT.getInstance().COPPER, 35), + new MaterialStack(ELEMENT.getInstance().COPPER, 40), + new MaterialStack(ELEMENT.getInstance().TIN, 25) }); public static final Material TUMBAGA = new Material( "Tumbaga", //Material Name new short[]{255,178,15, 0}, //Material Colour - ((ELEMENT.GOLD.getMeltingPoint_C()*7)+(ELEMENT.COPPER.getMeltingPoint_C()*3))/10, //Melting point in C - ((ELEMENT.GOLD.getBoilingPoint_C()*7)+(ELEMENT.COPPER.getBoilingPoint_C()*3))/10, //Boiling Point in C - ((ELEMENT.GOLD.getProtons()*7)+(ELEMENT.COPPER.getProtons()*3))/10, //Protons - ((ELEMENT.GOLD.getNeutrons()*7)+(ELEMENT.COPPER.getNeutrons()*3))/10, //Neutrons + ((ELEMENT.getInstance().GOLD.getMeltingPointC()*7)+(ELEMENT.getInstance().COPPER.getMeltingPointC()*3))/10, //Melting point in C + ((ELEMENT.getInstance().GOLD.getBoilingPointC()*7)+(ELEMENT.getInstance().COPPER.getBoilingPointC()*3))/10, //Boiling Point in C + ((ELEMENT.getInstance().GOLD.getProtons()*7)+(ELEMENT.getInstance().COPPER.getProtons()*3))/10, //Protons + ((ELEMENT.getInstance().GOLD.getNeutrons()*7)+(ELEMENT.getInstance().COPPER.getNeutrons()*3))/10, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.GOLD, 70), - new MaterialStack(ELEMENT.COPPER, 30) + new MaterialStack(ELEMENT.getInstance().GOLD, 30), + new MaterialStack(ELEMENT.getInstance().GOLD, 40), + new MaterialStack(ELEMENT.getInstance().COPPER, 30) }); public static final Material POTIN = new Material( "Potin", //Material Name new short[]{201,151,129, 0}, //Material Colour - ((ELEMENT.LEAD.getMeltingPoint_C()*4)+(ALLOY.BRONZE.getMeltingPoint_C()*4)+(ELEMENT.TIN.getMeltingPoint_C()*2))/10, //Melting point in C - ((ELEMENT.LEAD.getBoilingPoint_C()*4)+(ALLOY.BRONZE.getBoilingPoint_C()*4)+(ELEMENT.TIN.getBoilingPoint_C()*2))/10, //Boiling Point in C - ((ELEMENT.LEAD.getProtons()*4)+(ALLOY.BRONZE.getProtons()*4)+(ELEMENT.TIN.getProtons()*2))/10, //Protons - ((ELEMENT.LEAD.getNeutrons()*4)+(ALLOY.BRONZE.getNeutrons()*4)+(ELEMENT.TIN.getNeutrons()*2))/10, //Neutrons + ((ELEMENT.getInstance().LEAD.getMeltingPointC()*4)+(ALLOY.BRONZE.getMeltingPointC()*4)+(ELEMENT.getInstance().TIN.getMeltingPointC()*2))/10, //Melting point in C + ((ELEMENT.getInstance().LEAD.getBoilingPointC()*4)+(ALLOY.BRONZE.getBoilingPointC()*4)+(ELEMENT.getInstance().TIN.getBoilingPointC()*2))/10, //Boiling Point in C + ((ELEMENT.getInstance().LEAD.getProtons()*4)+(ALLOY.BRONZE.getProtons()*4)+(ELEMENT.getInstance().TIN.getProtons()*2))/10, //Protons + ((ELEMENT.getInstance().LEAD.getNeutrons()*4)+(ALLOY.BRONZE.getNeutrons()*4)+(ELEMENT.getInstance().TIN.getNeutrons()*2))/10, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.LEAD, 40), + new MaterialStack(ELEMENT.getInstance().LEAD, 40), new MaterialStack(ALLOY.BRONZE, 40), - new MaterialStack(ELEMENT.TIN, 20) + new MaterialStack(ELEMENT.getInstance().TIN, 20) }); public static final Material BEDROCKIUM = new Material( @@ -139,341 +128,440 @@ public final class ALLOY { "Inconel-625", //Material Name new short[]{128, 200, 128, 0}, //Material Colour 1425, //Melting Point in C - ((ELEMENT.NICKEL.getBoilingPoint_C()*6)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*2)+(ELEMENT.IRON.getBoilingPoint_C()*1)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*1))/10, //Boiling Point in C - ((ELEMENT.NICKEL.getProtons()*6)+(ELEMENT.CHROMIUM.getProtons()*2)+(ELEMENT.IRON.getProtons()*1)+(ELEMENT.MOLYBDENUM.getProtons()*1))/10, //Protons - ((ELEMENT.NICKEL.getNeutrons()*6)+(ELEMENT.CHROMIUM.getNeutrons()*2)+(ELEMENT.IRON.getNeutrons()*1)+(ELEMENT.MOLYBDENUM.getNeutrons()*1))/10, //Neutrons + ((ELEMENT.getInstance().NICKEL.getBoilingPointC()*6)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*2)+(ELEMENT.getInstance().IRON.getBoilingPointC()*1)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*1))/10, //Boiling Point in C + ((ELEMENT.getInstance().NICKEL.getProtons()*6)+(ELEMENT.getInstance().CHROMIUM.getProtons()*2)+(ELEMENT.getInstance().IRON.getProtons()*1)+(ELEMENT.getInstance().MOLYBDENUM.getProtons()*1))/10, //Protons + ((ELEMENT.getInstance().NICKEL.getNeutrons()*6)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*2)+(ELEMENT.getInstance().IRON.getNeutrons()*1)+(ELEMENT.getInstance().MOLYBDENUM.getNeutrons()*1))/10, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.NICKEL, 60), - new MaterialStack(ELEMENT.CHROMIUM, 20), - new MaterialStack(ELEMENT.IRON, 10), - new MaterialStack(ELEMENT.MOLYBDENUM, 10) + new MaterialStack(ELEMENT.getInstance().NICKEL, 60), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 20), + new MaterialStack(ELEMENT.getInstance().IRON, 10), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 10) }); public static final Material INCONEL_690 = new Material( "Inconel-690", //Material Name new short[]{118, 220, 138, 0}, //Material Colour 1425, //Melting Point in C - ((ELEMENT.NICKEL.getBoilingPoint_C()*6)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*2)+(ELEMENT.NIOBIUM.getBoilingPoint_C()*1)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*1))/10, //Boiling Point in C - ((ELEMENT.NICKEL.getProtons()*6)+(ELEMENT.CHROMIUM.getProtons()*2)+(ELEMENT.NIOBIUM.getProtons()*1)+(ELEMENT.MOLYBDENUM.getProtons()*1))/10, //Protons - ((ELEMENT.NICKEL.getNeutrons()*6)+(ELEMENT.CHROMIUM.getNeutrons()*2)+(ELEMENT.NIOBIUM.getNeutrons()*1)+(ELEMENT.MOLYBDENUM.getNeutrons()*1))/10, //Neutrons + ((ELEMENT.getInstance().NICKEL.getBoilingPointC()*6)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*2)+(ELEMENT.getInstance().NIOBIUM.getBoilingPointC()*1)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*1))/10, //Boiling Point in C + ((ELEMENT.getInstance().NICKEL.getProtons()*6)+(ELEMENT.getInstance().CHROMIUM.getProtons()*2)+(ELEMENT.getInstance().NIOBIUM.getProtons()*1)+(ELEMENT.getInstance().MOLYBDENUM.getProtons()*1))/10, //Protons + ((ELEMENT.getInstance().NICKEL.getNeutrons()*6)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*2)+(ELEMENT.getInstance().NIOBIUM.getNeutrons()*1)+(ELEMENT.getInstance().MOLYBDENUM.getNeutrons()*1))/10, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.NICKEL, 60), - new MaterialStack(ELEMENT.CHROMIUM, 20), - new MaterialStack(ELEMENT.NIOBIUM, 10), - new MaterialStack(ELEMENT.MOLYBDENUM, 10) + new MaterialStack(ELEMENT.getInstance().NICKEL, 60), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 20), + new MaterialStack(ELEMENT.getInstance().NIOBIUM, 10), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 10) }); public static final Material INCONEL_792 = new Material( "Inconel-792", //Material Name new short[]{108, 240, 118, 0}, //Material Colour 1425, //Melting Point in C - ((ELEMENT.NICKEL.getBoilingPoint_C()*6)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*1)+(ELEMENT.IRON.getBoilingPoint_C()*1)+(ELEMENT.ALUMINIUM.getBoilingPoint_C()*2))/10, //Boiling Point in C - ((ELEMENT.NICKEL.getProtons()*6)+(ELEMENT.CHROMIUM.getProtons()*1)+(ELEMENT.IRON.getProtons()*1)+(ELEMENT.ALUMINIUM.getProtons()*2))/10, //Protons - ((ELEMENT.NICKEL.getNeutrons()*6)+(ELEMENT.CHROMIUM.getNeutrons()*1)+(ELEMENT.IRON.getNeutrons()*1)+(ELEMENT.ALUMINIUM.getNeutrons()*2))/10, //Neutrons + ((ELEMENT.getInstance().NICKEL.getBoilingPointC()*6)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*1)+(ELEMENT.getInstance().IRON.getBoilingPointC()*1)+(ELEMENT.getInstance().ALUMINIUM.getBoilingPointC()*2))/10, //Boiling Point in C + ((ELEMENT.getInstance().NICKEL.getProtons()*6)+(ELEMENT.getInstance().CHROMIUM.getProtons()*1)+(ELEMENT.getInstance().IRON.getProtons()*1)+(ELEMENT.getInstance().ALUMINIUM.getProtons()*2))/10, //Protons + ((ELEMENT.getInstance().NICKEL.getNeutrons()*6)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*1)+(ELEMENT.getInstance().IRON.getNeutrons()*1)+(ELEMENT.getInstance().ALUMINIUM.getNeutrons()*2))/10, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.NICKEL, 60), - new MaterialStack(ELEMENT.CHROMIUM, 10), - new MaterialStack(ELEMENT.NIOBIUM, 10), - new MaterialStack(ELEMENT.ALUMINIUM, 20) + new MaterialStack(ELEMENT.getInstance().NICKEL, 60), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 10), + new MaterialStack(ELEMENT.getInstance().NIOBIUM, 10), + new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 20) }); public static final Material STEEL = new Material( "Steel", //Material Name new short[]{180, 180, 20, 0}, //Material Colour - ((ELEMENT.CARBON.getMeltingPoint_C()*5)+(ELEMENT.IRON.getMeltingPoint_C()*95))/100, //Melting point in C - ((ELEMENT.CARBON.getBoilingPoint_C()*5)+(ELEMENT.IRON.getBoilingPoint_C()*95))/100, //Boiling Point in C - ((ELEMENT.CARBON.getProtons()*5)+(ELEMENT.IRON.getProtons()*95))/100, //Protons - ((ELEMENT.CARBON.getNeutrons()*5)+(ELEMENT.IRON.getNeutrons()*95))/100, //Neutrons + ((ELEMENT.getInstance().CARBON.getMeltingPointC()*5)+(ELEMENT.getInstance().IRON.getMeltingPointC()*95))/100, //Melting point in C + ((ELEMENT.getInstance().CARBON.getBoilingPointC()*5)+(ELEMENT.getInstance().IRON.getBoilingPointC()*95))/100, //Boiling Point in C + ((ELEMENT.getInstance().CARBON.getProtons()*5)+(ELEMENT.getInstance().IRON.getProtons()*95))/100, //Protons + ((ELEMENT.getInstance().CARBON.getNeutrons()*5)+(ELEMENT.getInstance().IRON.getNeutrons()*95))/100, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.CARBON, 05), - new MaterialStack(ELEMENT.IRON, 95) + new MaterialStack(ELEMENT.getInstance().CARBON, 10), + new MaterialStack(ELEMENT.getInstance().IRON, 30), + new MaterialStack(ELEMENT.getInstance().IRON, 30), + new MaterialStack(ELEMENT.getInstance().IRON, 30) }); public static final Material ZERON_100 = new Material( "Zeron-100", //Material Name new short[]{180, 180, 20, 0}, //Material Colour - ((ELEMENT.CHROMIUM.getMeltingPoint_C()*25)+(ELEMENT.NICKEL.getMeltingPoint_C()*6)+(ELEMENT.COBALT.getMeltingPoint_C()*9)+(ALLOY.STEEL.getMeltingPoint_C()*60))/100, //Melting Point in C - ((ELEMENT.CHROMIUM.getBoilingPoint_C()*25)+(ELEMENT.NICKEL.getBoilingPoint_C()*6)+(ELEMENT.COBALT.getBoilingPoint_C()*9)+(ALLOY.STEEL.getBoilingPoint_C()*60))/100, //Boiling Point in C - ((ELEMENT.CHROMIUM.getProtons()*25)+(ELEMENT.NICKEL.getProtons()*6)+(ELEMENT.COBALT.getProtons()*9)+(ALLOY.STEEL.getProtons()*60))/100, //Protons - ((ELEMENT.CHROMIUM.getNeutrons()*25)+(ELEMENT.NICKEL.getNeutrons()*6)+(ELEMENT.COBALT.getNeutrons()*9)+(ALLOY.STEEL.getNeutrons()*60))/100, //Neutrons + ((ELEMENT.getInstance().CHROMIUM.getMeltingPointC()*25)+(ELEMENT.getInstance().NICKEL.getMeltingPointC()*6)+(ELEMENT.getInstance().COBALT.getMeltingPointC()*9)+(ALLOY.STEEL.getMeltingPointC()*60))/100, //Melting Point in C + ((ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*25)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*6)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*9)+(ALLOY.STEEL.getBoilingPointC()*60))/100, //Boiling Point in C + ((ELEMENT.getInstance().CHROMIUM.getProtons()*25)+(ELEMENT.getInstance().NICKEL.getProtons()*6)+(ELEMENT.getInstance().COBALT.getProtons()*9)+(ALLOY.STEEL.getProtons()*60))/100, //Protons + ((ELEMENT.getInstance().CHROMIUM.getNeutrons()*25)+(ELEMENT.getInstance().NICKEL.getNeutrons()*6)+(ELEMENT.getInstance().COBALT.getNeutrons()*9)+(ALLOY.STEEL.getNeutrons()*60))/100, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.CHROMIUM, 25), - new MaterialStack(ELEMENT.NICKEL, 6), - new MaterialStack(ELEMENT.COBALT, 9), - new MaterialStack(ALLOY.STEEL, 60) + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 26), + new MaterialStack(ELEMENT.getInstance().NICKEL, 6), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 4), + new MaterialStack(ELEMENT.getInstance().COPPER, 20), + new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 4), + new MaterialStack(ALLOY.STEEL, 40) }); public static final Material MARAGING250 = new Material( "Maraging Steel 250", //Material Name new short[]{140, 140, 140, 0}, //Material Colour 1413, //Melting Point in C - ((ELEMENT.TITANIUM.getBoilingPoint_C()*5)+(ELEMENT.NICKEL.getBoilingPoint_C()*16)+(ELEMENT.COBALT.getBoilingPoint_C()*9)+(ALLOY.STEEL.getBoilingPoint_C()*70))/100, //Boiling Point in C - ((ELEMENT.TITANIUM.getProtons()*5)+(ELEMENT.NICKEL.getProtons()*16)+(ELEMENT.COBALT.getProtons()*9)+(ALLOY.STEEL.getProtons()*70))/100, //Protons - ((ELEMENT.TITANIUM.getNeutrons()*5)+(ELEMENT.NICKEL.getNeutrons()*16)+(ELEMENT.COBALT.getNeutrons()*9)+(ALLOY.STEEL.getNeutrons()*70))/100, //Neutrons + ((ELEMENT.getInstance().TITANIUM.getBoilingPointC()*5)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*16)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*9)+(ALLOY.STEEL.getBoilingPointC()*70))/100, //Boiling Point in C + ((ELEMENT.getInstance().TITANIUM.getProtons()*5)+(ELEMENT.getInstance().NICKEL.getProtons()*16)+(ELEMENT.getInstance().COBALT.getProtons()*9)+(ALLOY.STEEL.getProtons()*70))/100, //Protons + ((ELEMENT.getInstance().TITANIUM.getNeutrons()*5)+(ELEMENT.getInstance().NICKEL.getNeutrons()*16)+(ELEMENT.getInstance().COBALT.getNeutrons()*9)+(ALLOY.STEEL.getNeutrons()*70))/100, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.TITANIUM, 5), - new MaterialStack(ELEMENT.NICKEL, 16), - new MaterialStack(ELEMENT.COBALT, 9), - new MaterialStack(ALLOY.STEEL, 70) + new MaterialStack(ALLOY.STEEL, 64), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 4), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 4), + new MaterialStack(ELEMENT.getInstance().NICKEL, 16), + new MaterialStack(ELEMENT.getInstance().COBALT, 8), }); public static final Material MARAGING300 = new Material( "Maraging Steel 300", //Material Name new short[]{150, 150, 150, 0}, //Material Colour 1413, //Melting Point in C - ((ELEMENT.TITANIUM.getBoilingPoint_C()*10)+(ELEMENT.NICKEL.getBoilingPoint_C()*21)+(ELEMENT.COBALT.getBoilingPoint_C()*14)+(ALLOY.STEEL.getBoilingPoint_C()*55))/100, //Boiling Point in C - ((ELEMENT.TITANIUM.getProtons()*10)+(ELEMENT.NICKEL.getProtons()*21)+(ELEMENT.COBALT.getProtons()*14)+(ALLOY.STEEL.getProtons()*55))/100, //Protons - ((ELEMENT.TITANIUM.getNeutrons()*10)+(ELEMENT.NICKEL.getNeutrons()*21)+(ELEMENT.COBALT.getNeutrons()*14)+(ALLOY.STEEL.getNeutrons()*55))/100, //Neutrons + ((ELEMENT.getInstance().TITANIUM.getBoilingPointC()*10)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*21)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*14)+(ALLOY.STEEL.getBoilingPointC()*55))/100, //Boiling Point in C + ((ELEMENT.getInstance().TITANIUM.getProtons()*10)+(ELEMENT.getInstance().NICKEL.getProtons()*21)+(ELEMENT.getInstance().COBALT.getProtons()*14)+(ALLOY.STEEL.getProtons()*55))/100, //Protons + ((ELEMENT.getInstance().TITANIUM.getNeutrons()*10)+(ELEMENT.getInstance().NICKEL.getNeutrons()*21)+(ELEMENT.getInstance().COBALT.getNeutrons()*14)+(ALLOY.STEEL.getNeutrons()*55))/100, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.TITANIUM, 10), - new MaterialStack(ELEMENT.NICKEL, 21), - new MaterialStack(ELEMENT.COBALT, 14), - new MaterialStack(ALLOY.STEEL, 55) + new MaterialStack(ALLOY.STEEL, 64), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 4), + new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 4), + new MaterialStack(ELEMENT.getInstance().NICKEL, 16), + new MaterialStack(ELEMENT.getInstance().COBALT, 8), }); public static final Material MARAGING350 = new Material( "Maraging Steel 350", //Material Name new short[]{160, 160, 160, 0}, //Material Colour 1413, //Melting Point in C - ((ELEMENT.TITANIUM.getBoilingPoint_C()*15)+(ELEMENT.NICKEL.getBoilingPoint_C()*21)+(ELEMENT.COBALT.getBoilingPoint_C()*9)+(ALLOY.STEEL.getBoilingPoint_C()*55))/100, //Boiling Point in C - ((ELEMENT.TITANIUM.getProtons()*15)+(ELEMENT.NICKEL.getProtons()*21)+(ELEMENT.COBALT.getProtons()*9)+(ALLOY.STEEL.getProtons()*55))/100, //Protons - ((ELEMENT.TITANIUM.getNeutrons()*15)+(ELEMENT.NICKEL.getNeutrons()*21)+(ELEMENT.COBALT.getNeutrons()*9)+(ALLOY.STEEL.getNeutrons()*55))/100, //Neutrons + ((ELEMENT.getInstance().TITANIUM.getBoilingPointC()*15)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*21)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*9)+(ALLOY.STEEL.getBoilingPointC()*55))/100, //Boiling Point in C + ((ELEMENT.getInstance().TITANIUM.getProtons()*15)+(ELEMENT.getInstance().NICKEL.getProtons()*21)+(ELEMENT.getInstance().COBALT.getProtons()*9)+(ALLOY.STEEL.getProtons()*55))/100, //Protons + ((ELEMENT.getInstance().TITANIUM.getNeutrons()*15)+(ELEMENT.getInstance().NICKEL.getNeutrons()*21)+(ELEMENT.getInstance().COBALT.getNeutrons()*9)+(ALLOY.STEEL.getNeutrons()*55))/100, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.TITANIUM, 15), - new MaterialStack(ELEMENT.NICKEL, 21), - new MaterialStack(ELEMENT.COBALT, 9), - new MaterialStack(ALLOY.STEEL, 55) + new MaterialStack(ALLOY.STEEL, 64), + new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 4), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 4), + new MaterialStack(ELEMENT.getInstance().NICKEL, 16), + new MaterialStack(ELEMENT.getInstance().COBALT, 8), }); public static final Material STELLITE = new Material( "Stellite", //Material Name new short[]{129, 75, 120, 0}, //Material Colour 1310, //Melting Point in C - ((ELEMENT.TITANIUM.getBoilingPoint_C()*10)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*35)+(ELEMENT.COBALT.getBoilingPoint_C()*35)+(ELEMENT.MANGANESE.getBoilingPoint_C()*20))/100, //Boiling Point in C - ((ELEMENT.TITANIUM.getProtons()*10)+(ELEMENT.CHROMIUM.getProtons()*35)+(ELEMENT.COBALT.getProtons()*35)+(ELEMENT.MANGANESE.getProtons()*20))/100, //Protons - ((ELEMENT.TITANIUM.getNeutrons()*10)+(ELEMENT.CHROMIUM.getNeutrons()*35)+(ELEMENT.COBALT.getNeutrons()*35)+(ELEMENT.MANGANESE.getNeutrons()*20))/100, //Neutrons + ((ELEMENT.getInstance().TITANIUM.getBoilingPointC()*10)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*35)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*35)+(ELEMENT.getInstance().MANGANESE.getBoilingPointC()*20))/100, //Boiling Point in C + ((ELEMENT.getInstance().TITANIUM.getProtons()*10)+(ELEMENT.getInstance().CHROMIUM.getProtons()*35)+(ELEMENT.getInstance().COBALT.getProtons()*35)+(ELEMENT.getInstance().MANGANESE.getProtons()*20))/100, //Protons + ((ELEMENT.getInstance().TITANIUM.getNeutrons()*10)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*35)+(ELEMENT.getInstance().COBALT.getNeutrons()*35)+(ELEMENT.getInstance().MANGANESE.getNeutrons()*20))/100, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.COBALT, 35), - new MaterialStack(ELEMENT.CHROMIUM, 35), - new MaterialStack(ELEMENT.MANGANESE, 20), - new MaterialStack(ELEMENT.TITANIUM, 10) + new MaterialStack(ELEMENT.getInstance().COBALT, 35), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 35), + new MaterialStack(ELEMENT.getInstance().MANGANESE, 20), + new MaterialStack(ELEMENT.getInstance().TITANIUM, 10) }); public static final Material TALONITE = new Material( "Talonite", //Material Name new short[]{228, 75, 120, 0}, //Material Colour 1454, //Melting Point in C - ((ELEMENT.MOLYBDENUM.getBoilingPoint_C()*10)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*30)+(ELEMENT.COBALT.getBoilingPoint_C()*40)+(ELEMENT.PHOSPHORUS.getBoilingPoint_C()*20))/100, //Boiling Point in C - ((ELEMENT.MOLYBDENUM.getProtons()*10)+(ELEMENT.CHROMIUM.getProtons()*30)+(ELEMENT.COBALT.getProtons()*40)+(ELEMENT.PHOSPHORUS.getProtons()*20))/100, //Protons - ((ELEMENT.MOLYBDENUM.getNeutrons()*10)+(ELEMENT.CHROMIUM.getNeutrons()*30)+(ELEMENT.COBALT.getNeutrons()*40)+(ELEMENT.PHOSPHORUS.getNeutrons()*20))/100, //Neutrons + ((ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*10)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*30)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*40)+(ELEMENT.getInstance().PHOSPHORUS.getBoilingPointC()*20))/100, //Boiling Point in C + ((ELEMENT.getInstance().MOLYBDENUM.getProtons()*10)+(ELEMENT.getInstance().CHROMIUM.getProtons()*30)+(ELEMENT.getInstance().COBALT.getProtons()*40)+(ELEMENT.getInstance().PHOSPHORUS.getProtons()*20))/100, //Protons + ((ELEMENT.getInstance().MOLYBDENUM.getNeutrons()*10)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*30)+(ELEMENT.getInstance().COBALT.getNeutrons()*40)+(ELEMENT.getInstance().PHOSPHORUS.getNeutrons()*20))/100, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.COBALT, 40), - new MaterialStack(ELEMENT.CHROMIUM, 30), - new MaterialStack(ELEMENT.PHOSPHORUS, 20), - new MaterialStack(ELEMENT.MOLYBDENUM, 10) + new MaterialStack(ELEMENT.getInstance().COBALT, 40), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 30), + new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 20), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 10) }); public static final Material HASTELLOY_W = new Material( "Hastelloy-W", //Material Name new short[]{218, 165, 32, 0}, //Material Colour 1350, //Melting Point in C - ((ELEMENT.IRON.getBoilingPoint_C()*6)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*24)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*5)+(ELEMENT.NICKEL.getBoilingPoint_C()*65))/100, //Boiling Point in C - ((ELEMENT.IRON.getProtons()*6)+(ELEMENT.MOLYBDENUM.getProtons()*24)+(ELEMENT.CHROMIUM.getProtons()*5)+(ELEMENT.NICKEL.getProtons()*65))/100, //Protons - ((ELEMENT.IRON.getNeutrons()*6)+(ELEMENT.MOLYBDENUM.getNeutrons()*24)+(ELEMENT.CHROMIUM.getNeutrons()*5)+(ELEMENT.NICKEL.getNeutrons()*65))/100, //Neutrons + ((ELEMENT.getInstance().IRON.getBoilingPointC()*6)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*24)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*5)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*65))/100, //Boiling Point in C + ((ELEMENT.getInstance().IRON.getProtons()*6)+(ELEMENT.getInstance().MOLYBDENUM.getProtons()*24)+(ELEMENT.getInstance().CHROMIUM.getProtons()*5)+(ELEMENT.getInstance().NICKEL.getProtons()*65))/100, //Protons + ((ELEMENT.getInstance().IRON.getNeutrons()*6)+(ELEMENT.getInstance().MOLYBDENUM.getNeutrons()*24)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*5)+(ELEMENT.getInstance().NICKEL.getNeutrons()*65))/100, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.IRON, 06), - new MaterialStack(ELEMENT.MOLYBDENUM, 24), - new MaterialStack(ELEMENT.CHROMIUM, 5), - new MaterialStack(ELEMENT.NICKEL, 65) + new MaterialStack(ELEMENT.getInstance().IRON, 06), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 24), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 8), + new MaterialStack(ELEMENT.getInstance().NICKEL, 62) }); + /*public static final Material HASTELLOY_X = new Material( + "Hastelloy-X", //Material Name + new short[]{255, 193, 37, 0}, //Material Colour + 1350, //Melting Point in C + ((ELEMENT.getInstance().IRON.getBoilingPoint_C()*18)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPoint_C()*9)+(ELEMENT.getInstance().CHROMIUM.getBoilingPoint_C()*22)+(ELEMENT.getInstance().NICKEL.getBoilingPoint_C()*51))/100, //Boiling Point in C + ((ELEMENT.getInstance().IRON.getProtons()*18)+(ELEMENT.getInstance().MOLYBDENUM.getProtons()*9)+(ELEMENT.getInstance().CHROMIUM.getProtons()*22)+(ELEMENT.getInstance().NICKEL.getProtons()*51))/100, //Protons + ((ELEMENT.getInstance().IRON.getNeutrons()*18)+(ELEMENT.getInstance().MOLYBDENUM.getNeutrons()*9)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*22)+(ELEMENT.getInstance().NICKEL.getNeutrons()*51))/100, //Neutrons + false, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().IRON, 18), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 9), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 22), + new MaterialStack(ELEMENT.getInstance().NICKEL, 51) + });*/ + public static final Material HASTELLOY_X = new Material( "Hastelloy-X", //Material Name new short[]{255, 193, 37, 0}, //Material Colour 1350, //Melting Point in C - ((ELEMENT.IRON.getBoilingPoint_C()*18)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*9)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*22)+(ELEMENT.NICKEL.getBoilingPoint_C()*51))/100, //Boiling Point in C - ((ELEMENT.IRON.getProtons()*18)+(ELEMENT.MOLYBDENUM.getProtons()*9)+(ELEMENT.CHROMIUM.getProtons()*22)+(ELEMENT.NICKEL.getProtons()*51))/100, //Protons - ((ELEMENT.IRON.getNeutrons()*18)+(ELEMENT.MOLYBDENUM.getNeutrons()*9)+(ELEMENT.CHROMIUM.getNeutrons()*22)+(ELEMENT.NICKEL.getNeutrons()*51))/100, //Neutrons + ((ELEMENT.getInstance().IRON.getBoilingPointC()*18)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*9)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*22)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*51))/100, //Boiling Point in C + ((ELEMENT.getInstance().IRON.getProtons()*18)+(ELEMENT.getInstance().MOLYBDENUM.getProtons()*9)+(ELEMENT.getInstance().CHROMIUM.getProtons()*22)+(ELEMENT.getInstance().NICKEL.getProtons()*51))/100, //Protons + ((ELEMENT.getInstance().IRON.getNeutrons()*18)+(ELEMENT.getInstance().MOLYBDENUM.getNeutrons()*9)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*22)+(ELEMENT.getInstance().NICKEL.getNeutrons()*51))/100, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.IRON, 18), - new MaterialStack(ELEMENT.MOLYBDENUM, 9), - new MaterialStack(ELEMENT.CHROMIUM, 22), - new MaterialStack(ELEMENT.NICKEL, 51) + new MaterialStack(ELEMENT.getInstance().IRON, 18), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 9), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 22), + new MaterialStack(ELEMENT.getInstance().NICKEL, 51) }); public static final Material HASTELLOY_N = new Material( "Hastelloy-N", //Material Name new short[]{236, 213, 48, 0}, //Material Colour 1350, //Melting Point in C - ((ELEMENT.YTTRIUM.getBoilingPoint_C()*5)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*16)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*7)+(ELEMENT.NICKEL.getBoilingPoint_C()*72))/100, //Boiling Point in C - ((ELEMENT.YTTRIUM.getProtons()*5)+(ELEMENT.MOLYBDENUM.getProtons()*16)+(ELEMENT.CHROMIUM.getProtons()*7)+(ELEMENT.NICKEL.getProtons()*72))/100, //Protons - ((ELEMENT.YTTRIUM.getNeutrons()*5)+(ELEMENT.MOLYBDENUM.getNeutrons()*16)+(ELEMENT.CHROMIUM.getNeutrons()*7)+(ELEMENT.NICKEL.getNeutrons()*72))/100, //Neutrons + ((ELEMENT.getInstance().YTTRIUM.getBoilingPointC()*5)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*16)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*7)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*72))/100, //Boiling Point in C + ((ELEMENT.getInstance().YTTRIUM.getProtons()*5)+(ELEMENT.getInstance().MOLYBDENUM.getProtons()*16)+(ELEMENT.getInstance().CHROMIUM.getProtons()*7)+(ELEMENT.getInstance().NICKEL.getProtons()*72))/100, //Protons + ((ELEMENT.getInstance().YTTRIUM.getNeutrons()*5)+(ELEMENT.getInstance().MOLYBDENUM.getNeutrons()*16)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*7)+(ELEMENT.getInstance().NICKEL.getNeutrons()*72))/100, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.YTTRIUM, 05), - new MaterialStack(ELEMENT.MOLYBDENUM, 16), - new MaterialStack(ELEMENT.CHROMIUM, 7), - new MaterialStack(ELEMENT.NICKEL, 72) + new MaterialStack(ELEMENT.getInstance().YTTRIUM, 10), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 16), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 10), + new MaterialStack(ELEMENT.getInstance().NICKEL, 64) }); public static final Material HASTELLOY_C276 = new Material( "Hastelloy-C276", //Material Name new short[]{238, 180, 34, 0}, //Material Colour 1350, //Melting Point in C - ((ELEMENT.COBALT.getBoilingPoint_C()*2)+(ELEMENT.MOLYBDENUM.getBoilingPoint_C()*16)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*16)+(ELEMENT.NICKEL.getBoilingPoint_C()*66))/100, //Boiling Point in C - ((ELEMENT.COBALT.getProtons()*2)+(ELEMENT.MOLYBDENUM.getProtons()*16)+(ELEMENT.CHROMIUM.getProtons()*16)+(ELEMENT.NICKEL.getProtons()*66))/100, //Protons - ((ELEMENT.COBALT.getNeutrons()*2)+(ELEMENT.MOLYBDENUM.getNeutrons()*16)+(ELEMENT.CHROMIUM.getNeutrons()*16)+(ELEMENT.NICKEL.getNeutrons()*66))/100, //Neutrons + ((ELEMENT.getInstance().COBALT.getBoilingPointC()*2)+(ELEMENT.getInstance().MOLYBDENUM.getBoilingPointC()*16)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*16)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*66))/100, //Boiling Point in C + ((ELEMENT.getInstance().COBALT.getProtons()*2)+(ELEMENT.getInstance().MOLYBDENUM.getProtons()*16)+(ELEMENT.getInstance().CHROMIUM.getProtons()*16)+(ELEMENT.getInstance().NICKEL.getProtons()*66))/100, //Protons + ((ELEMENT.getInstance().COBALT.getNeutrons()*2)+(ELEMENT.getInstance().MOLYBDENUM.getNeutrons()*16)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*16)+(ELEMENT.getInstance().NICKEL.getNeutrons()*66))/100, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.COBALT, 02), - new MaterialStack(ELEMENT.MOLYBDENUM, 16), - new MaterialStack(ELEMENT.CHROMIUM, 16), - new MaterialStack(ELEMENT.NICKEL, 66) + new MaterialStack(ELEMENT.getInstance().COBALT, 02), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 16), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 16), + new MaterialStack(ELEMENT.getInstance().NICKEL, 66) }); public static final Material INCOLOY_020 = new Material( "Incoloy-020", //Material Name new short[]{101, 81, 71, 0}, //Material Colour 1425, //Melting Point in C - ((ELEMENT.IRON.getBoilingPoint_C()*40)+(ELEMENT.COPPER.getBoilingPoint_C()*4)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*20)+(ELEMENT.NICKEL.getBoilingPoint_C()*36))/100, //Boiling Point in C - ((ELEMENT.IRON.getProtons()*40)+(ELEMENT.COPPER.getProtons()*4)+(ELEMENT.CHROMIUM.getProtons()*20)+(ELEMENT.NICKEL.getProtons()*36))/100, //Protons - ((ELEMENT.IRON.getNeutrons()*40)+(ELEMENT.COPPER.getNeutrons()*4)+(ELEMENT.CHROMIUM.getNeutrons()*20)+(ELEMENT.NICKEL.getNeutrons()*36))/100, //Neutrons + ((ELEMENT.getInstance().IRON.getBoilingPointC()*40)+(ELEMENT.getInstance().COPPER.getBoilingPointC()*4)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*20)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*36))/100, //Boiling Point in C + ((ELEMENT.getInstance().IRON.getProtons()*40)+(ELEMENT.getInstance().COPPER.getProtons()*4)+(ELEMENT.getInstance().CHROMIUM.getProtons()*20)+(ELEMENT.getInstance().NICKEL.getProtons()*36))/100, //Protons + ((ELEMENT.getInstance().IRON.getNeutrons()*40)+(ELEMENT.getInstance().COPPER.getNeutrons()*4)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*20)+(ELEMENT.getInstance().NICKEL.getNeutrons()*36))/100, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.IRON, 40), - new MaterialStack(ELEMENT.COPPER, 4), - new MaterialStack(ELEMENT.CHROMIUM, 20), - new MaterialStack(ELEMENT.NICKEL, 36) + new MaterialStack(ELEMENT.getInstance().IRON, 40), + new MaterialStack(ELEMENT.getInstance().COPPER, 4), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 20), + new MaterialStack(ELEMENT.getInstance().NICKEL, 36) }); public static final Material INCOLOY_DS = new Material( "Incoloy-DS", //Material Name new short[]{71, 101, 81, 0}, //Material Colour 1425, //Melting Point in C - ((ELEMENT.IRON.getBoilingPoint_C()*46)+(ELEMENT.COBALT.getBoilingPoint_C()*18)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*18)+(ELEMENT.NICKEL.getBoilingPoint_C()*18))/100, //Boiling Point in C - ((ELEMENT.IRON.getProtons()*46)+(ELEMENT.COBALT.getProtons()*18)+(ELEMENT.CHROMIUM.getProtons()*18)+(ELEMENT.NICKEL.getProtons()*18))/100, //Protons - ((ELEMENT.IRON.getNeutrons()*46)+(ELEMENT.COBALT.getNeutrons()*18)+(ELEMENT.CHROMIUM.getNeutrons()*18)+(ELEMENT.NICKEL.getNeutrons()*18))/100, //Neutrons + ((ELEMENT.getInstance().IRON.getBoilingPointC()*46)+(ELEMENT.getInstance().COBALT.getBoilingPointC()*18)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*18)+(ELEMENT.getInstance().NICKEL.getBoilingPointC()*18))/100, //Boiling Point in C + ((ELEMENT.getInstance().IRON.getProtons()*46)+(ELEMENT.getInstance().COBALT.getProtons()*18)+(ELEMENT.getInstance().CHROMIUM.getProtons()*18)+(ELEMENT.getInstance().NICKEL.getProtons()*18))/100, //Protons + ((ELEMENT.getInstance().IRON.getNeutrons()*46)+(ELEMENT.getInstance().COBALT.getNeutrons()*18)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*18)+(ELEMENT.getInstance().NICKEL.getNeutrons()*18))/100, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.IRON, 46), - new MaterialStack(ELEMENT.COBALT, 18), - new MaterialStack(ELEMENT.CHROMIUM, 18), - new MaterialStack(ELEMENT.NICKEL, 18) + new MaterialStack(ELEMENT.getInstance().IRON, 46), + new MaterialStack(ELEMENT.getInstance().COBALT, 18), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 18), + new MaterialStack(ELEMENT.getInstance().NICKEL, 18) }); public static final Material INCOLOY_MA956 = new Material( "Incoloy-MA956", //Material Name new short[]{81, 71, 101, 0}, //Material Colour 1425, //Melting Point in C - ((ELEMENT.IRON.getBoilingPoint_C()*75)+(ELEMENT.ALUMINIUM.getBoilingPoint_C()*4)+(ELEMENT.CHROMIUM.getBoilingPoint_C()*20)+(ELEMENT.YTTRIUM.getBoilingPoint_C()*1))/100, //Boiling Point in C - ((ELEMENT.IRON.getProtons()*75)+(ELEMENT.ALUMINIUM.getProtons()*4)+(ELEMENT.CHROMIUM.getProtons()*20)+(ELEMENT.YTTRIUM.getProtons()*1))/100, //Protons - ((ELEMENT.IRON.getNeutrons()*75)+(ELEMENT.ALUMINIUM.getNeutrons()*4)+(ELEMENT.CHROMIUM.getNeutrons()*20)+(ELEMENT.YTTRIUM.getNeutrons()*1))/100, //Neutrons + ((ELEMENT.getInstance().IRON.getBoilingPointC()*75)+(ELEMENT.getInstance().ALUMINIUM.getBoilingPointC()*4)+(ELEMENT.getInstance().CHROMIUM.getBoilingPointC()*20)+(ELEMENT.getInstance().YTTRIUM.getBoilingPointC()*1))/100, //Boiling Point in C + ((ELEMENT.getInstance().IRON.getProtons()*75)+(ELEMENT.getInstance().ALUMINIUM.getProtons()*4)+(ELEMENT.getInstance().CHROMIUM.getProtons()*20)+(ELEMENT.getInstance().YTTRIUM.getProtons()*1))/100, //Protons + ((ELEMENT.getInstance().IRON.getNeutrons()*75)+(ELEMENT.getInstance().ALUMINIUM.getNeutrons()*4)+(ELEMENT.getInstance().CHROMIUM.getNeutrons()*20)+(ELEMENT.getInstance().YTTRIUM.getNeutrons()*1))/100, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.IRON, 75), - new MaterialStack(ELEMENT.ALUMINIUM, 4), - new MaterialStack(ELEMENT.CHROMIUM, 20), - new MaterialStack(ELEMENT.YTTRIUM, 1) + new MaterialStack(ELEMENT.getInstance().IRON, 64), + new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 12), + new MaterialStack(ELEMENT.getInstance().CHROMIUM, 20), + new MaterialStack(ELEMENT.getInstance().YTTRIUM, 4) }); public static final Material TUNGSTEN_CARBIDE = new Material( "Tungsten Carbide", //Material Name new short[]{44, 44, 44, 0}, //Material Colour 3422, //Melting Point in C - ((ELEMENT.TUNGSTEN.getBoilingPoint_C()*5)+(ELEMENT.CARBON.getBoilingPoint_C()*5))/10, //Boiling Point in C - ((ELEMENT.TUNGSTEN.getProtons()*5)+(ELEMENT.CARBON.getProtons()*5))/10, //Protons - ((ELEMENT.TUNGSTEN.getNeutrons()*5)+(ELEMENT.CARBON.getNeutrons()*5))/10, //Neutrons + ((ELEMENT.getInstance().TUNGSTEN.getBoilingPointC()*5)+(ELEMENT.getInstance().CARBON.getBoilingPointC()*5))/10, //Boiling Point in C + ((ELEMENT.getInstance().TUNGSTEN.getProtons()*5)+(ELEMENT.getInstance().CARBON.getProtons()*5))/10, //Protons + ((ELEMENT.getInstance().TUNGSTEN.getNeutrons()*5)+(ELEMENT.getInstance().CARBON.getNeutrons()*5))/10, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.CARBON, 50), - new MaterialStack(ELEMENT.TUNGSTEN, 50) + new MaterialStack(ELEMENT.getInstance().CARBON, 50), + new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 50) }); public static final Material SILICON_CARBIDE = new Material( "Silicon Carbide", //Material Name new short[]{40, 48, 36, 0}, //Material Colour 1414, //Melting Point in C - ((ELEMENT.SILICON.getBoilingPoint_C()*5)+(ELEMENT.CARBON.getBoilingPoint_C()*5))/10, //Boiling Point in C - ((ELEMENT.SILICON.getProtons()*5)+(ELEMENT.CARBON.getProtons()*5))/10, //Protons - ((ELEMENT.SILICON.getNeutrons()*5)+(ELEMENT.CARBON.getNeutrons()*5))/10, //Neutrons + ((ELEMENT.getInstance().SILICON.getBoilingPointC()*5)+(ELEMENT.getInstance().CARBON.getBoilingPointC()*5))/10, //Boiling Point in C + ((ELEMENT.getInstance().SILICON.getProtons()*5)+(ELEMENT.getInstance().CARBON.getProtons()*5))/10, //Protons + ((ELEMENT.getInstance().SILICON.getNeutrons()*5)+(ELEMENT.getInstance().CARBON.getNeutrons()*5))/10, //Neutrons false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.CARBON, 50), - new MaterialStack(ELEMENT.SILICON, 50) + new MaterialStack(ELEMENT.getInstance().SILICON, 40), + new MaterialStack(ELEMENT.getInstance().CARBON, 50), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) }); public static final Material TANTALUM_CARBIDE = new Material( "Tantalum Carbide", //Material Name new short[]{139, 136, 120, 0}, //Material Colour 2980, //Melting Point in C - ((ELEMENT.TANTALUM.getBoilingPoint_C()*5)+(ELEMENT.CARBON.getBoilingPoint_C()*5))/10, //Boiling Point in C - ((ELEMENT.TANTALUM.getProtons()*5)+(ELEMENT.CARBON.getProtons()*5))/10, //Protons - ((ELEMENT.TANTALUM.getNeutrons()*5)+(ELEMENT.CARBON.getNeutrons()*5))/10, //Neutrons + ((ELEMENT.getInstance().TANTALUM.getBoilingPointC()*5)+(ELEMENT.getInstance().CARBON.getBoilingPointC()*5))/10, //Boiling Point in C + ((ELEMENT.getInstance().TANTALUM.getProtons()*5)+(ELEMENT.getInstance().CARBON.getProtons()*5))/10, //Protons + ((ELEMENT.getInstance().TANTALUM.getNeutrons()*5)+(ELEMENT.getInstance().CARBON.getNeutrons()*5))/10, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.CARBON, 50), - new MaterialStack(ELEMENT.TANTALUM, 50) + new MaterialStack(ELEMENT.getInstance().TANTALUM, 40), + new MaterialStack(ELEMENT.getInstance().CARBON, 50), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) }); public static final Material ZIRCONIUM_CARBIDE = new Material( "Zirconium Carbide", //Material Name new short[]{222, 202, 180, 0}, //Material Colour 1855, //Melting Point in C - ((ELEMENT.ZIRCONIUM.getBoilingPoint_C()*5)+(ELEMENT.CARBON.getBoilingPoint_C()*5))/10, //Boiling Point in C - ((ELEMENT.ZIRCONIUM.getProtons()*5)+(ELEMENT.CARBON.getProtons()*5))/10, //Protons - ((ELEMENT.ZIRCONIUM.getNeutrons()*5)+(ELEMENT.CARBON.getNeutrons()*5))/10, //Neutrons + ((ELEMENT.getInstance().ZIRCONIUM.getBoilingPointC()*5)+(ELEMENT.getInstance().CARBON.getBoilingPointC()*5))/10, //Boiling Point in C + ((ELEMENT.getInstance().ZIRCONIUM.getProtons()*5)+(ELEMENT.getInstance().CARBON.getProtons()*5))/10, //Protons + ((ELEMENT.getInstance().ZIRCONIUM.getNeutrons()*5)+(ELEMENT.getInstance().CARBON.getNeutrons()*5))/10, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.CARBON, 50), - new MaterialStack(ELEMENT.ZIRCONIUM, 50) + new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 40), + new MaterialStack(ELEMENT.getInstance().CARBON, 50), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) }); public static final Material NIOBIUM_CARBIDE = new Material( "Niobium Carbide", //Material Name new short[]{205, 197, 191, 0}, //Material Colour 2477, //Melting Point in C - ((ELEMENT.NIOBIUM.getBoilingPoint_C()*5)+(ELEMENT.CARBON.getBoilingPoint_C()*5))/10, //Boiling Point in C - ((ELEMENT.NIOBIUM.getProtons()*5)+(ELEMENT.CARBON.getProtons()*5))/10, //Protons - ((ELEMENT.NIOBIUM.getNeutrons()*5)+(ELEMENT.CARBON.getNeutrons()*5))/10, //Neutrons + ((ELEMENT.getInstance().NIOBIUM.getBoilingPointC()*5)+(ELEMENT.getInstance().CARBON.getBoilingPointC()*5))/10, //Boiling Point in C + ((ELEMENT.getInstance().NIOBIUM.getProtons()*5)+(ELEMENT.getInstance().CARBON.getProtons()*5))/10, //Protons + ((ELEMENT.getInstance().NIOBIUM.getNeutrons()*5)+(ELEMENT.getInstance().CARBON.getNeutrons()*5))/10, //Neutrons true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.CARBON, 50), - new MaterialStack(ELEMENT.NIOBIUM, 50) + new MaterialStack(ELEMENT.getInstance().NIOBIUM, 40), + new MaterialStack(ELEMENT.getInstance().CARBON, 50), + new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) }); + + + public static final Material LEAGRISIUM = new Material( + "Grisium", //Material Name + new short[]{53, 93, 106, 0}, //Material Colour + 9001, //Melting Point in C + 25000, //Boiling Point in C + 96, //Protons + 128, //Neutrons + true, //Uses Blast furnace? + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().TITANIUM, 18), + new MaterialStack(ELEMENT.getInstance().CARBON, 18), + new MaterialStack(ELEMENT.getInstance().POTASSIUM, 18), + new MaterialStack(ELEMENT.getInstance().LITHIUM, 18), + new MaterialStack(ELEMENT.getInstance().SULFUR, 18), + new MaterialStack(ELEMENT.getInstance().HYDROGEN, 10) + }); //Material Stacks with Percentage of required elements. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + //Quantum + public static final Material QUANTUM = new Material( + "Quantum", //Material Name + new short[]{128, 128, 255, 50}, //Material Colour + 9999, //Melting Point in C + 25000, //Boiling Point in C + 150, //Protons + 200, //Neutrons + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ALLOY.LEAGRISIUM, 25), + new MaterialStack(ALLOY.ENERGYCRYSTAL, 25), + new MaterialStack(ALLOY.ZIRCONIUM_CARBIDE, 25), + new MaterialStack(ELEMENT.getInstance().MANGANESE, 5), + new MaterialStack(ELEMENT.getInstance().MOLYBDENUM, 5), + new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 5), + new MaterialStack(ELEMENT.getInstance().BERYLLIUM, 5), + new MaterialStack(ELEMENT.getInstance().BISMUTH, 5) + }); + + } diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index 307105eaf0..73d49e2694 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -5,58 +5,67 @@ import gtPlusPlus.core.util.materials.MaterialUtils; public final class ELEMENT { + private static final ELEMENT thisClass = new ELEMENT(); + + public ELEMENT(){ + + } + + public static ELEMENT getInstance(){ + return thisClass; + } //First 50 Elements - public static final Material HYDROGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Hydrogen); - public static final Material HELIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Helium); - public static final Material LITHIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Lithium); - public static final Material BERYLLIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Beryllium); - public static final Material BORON = MaterialUtils.generateMaterialFromGtENUM(Materials.Boron); - public static final Material CARBON = MaterialUtils.generateMaterialFromGtENUM(Materials.Carbon); - public static final Material NITROGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Nitrogen); - public static final Material OXYGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Oxygen); - public static final Material FLUORINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Fluorine); - //public static final Material NEON = MaterialUtils.generateMaterialFromGtENUM(Materials.Ne); - public static final Material SODIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Sodium); - public static final Material MAGNESIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Magnesium); - public static final Material ALUMINIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Aluminium); - public static final Material SILICON = MaterialUtils.generateMaterialFromGtENUM(Materials.Silicon); - public static final Material PHOSPHORUS = MaterialUtils.generateMaterialFromGtENUM(Materials.Phosphorus); - public static final Material SULFUR = MaterialUtils.generateMaterialFromGtENUM(Materials.Sulfur); - public static final Material CHLORINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Chlorine); - public static final Material ARGON = MaterialUtils.generateMaterialFromGtENUM(Materials.Argon); - public static final Material POTASSIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Potassium); - public static final Material CALCIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Calcium); - public static final Material SCANDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Scandium); - public static final Material TITANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Titanium); - public static final Material VANADIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Vanadium); - public static final Material CHROMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Chrome); - public static final Material MANGANESE = MaterialUtils.generateMaterialFromGtENUM(Materials.Manganese); - public static final Material IRON = MaterialUtils.generateMaterialFromGtENUM(Materials.Iron); - public static final Material COBALT = MaterialUtils.generateMaterialFromGtENUM(Materials.Cobalt); - public static final Material NICKEL = MaterialUtils.generateMaterialFromGtENUM(Materials.Nickel); - public static final Material COPPER = MaterialUtils.generateMaterialFromGtENUM(Materials.Copper); - public static final Material ZINC = MaterialUtils.generateMaterialFromGtENUM(Materials.Zinc); - public static final Material GALLIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Gallium); - //public static final Material GERMANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Germanium); - public static final Material ARSENIC = MaterialUtils.generateMaterialFromGtENUM(Materials.Arsenic); - //public static final Material SELENIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Selenium); - //public static final Material BROMINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Bromine); - //public static final Material KRYPTON = MaterialUtils.generateMaterialFromGtENUM(Materials.Krypton); - public static final Material RUBIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Rubidium); - public static final Material STRONTIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Strontium); - public static final Material YTTRIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Yttrium); - public static final Material ZIRCONIUM = new Material("Zirconium", new short[]{255, 250, 205}, 1855, 4377, 40, 51, false, null);//Not a GT Inherited Material - public static final Material NIOBIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Niobium); - public static final Material MOLYBDENUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Molybdenum); - //public static final Material TECHNETIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Technetium); - //public static final Material RUTHENIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Ruthenium); - //public static final Material RHODIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Rhodium); - public static final Material PALLADIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Palladium); - public static final Material SILVER = MaterialUtils.generateMaterialFromGtENUM(Materials.Silver); - public static final Material CADMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Cadmium); - public static final Material INDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Indium); - public static final Material TIN = MaterialUtils.generateMaterialFromGtENUM(Materials.Tin); + public final Material HYDROGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Hydrogen); + public final Material HELIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Helium); + public final Material LITHIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Lithium); + public final Material BERYLLIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Beryllium); + public final Material BORON = MaterialUtils.generateMaterialFromGtENUM(Materials.Boron); + public final Material CARBON = MaterialUtils.generateMaterialFromGtENUM(Materials.Carbon); + public final Material NITROGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Nitrogen); + public final Material OXYGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Oxygen); + public final Material FLUORINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Fluorine); + //public final Material NEON = MaterialUtils.generateMaterialFromGtENUM(Materials.Ne); + public final Material SODIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Sodium); + public final Material MAGNESIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Magnesium); + public final Material ALUMINIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Aluminium); + public final Material SILICON = MaterialUtils.generateMaterialFromGtENUM(Materials.Silicon); + public final Material PHOSPHORUS = MaterialUtils.generateMaterialFromGtENUM(Materials.Phosphorus); + public final Material SULFUR = MaterialUtils.generateMaterialFromGtENUM(Materials.Sulfur); + public final Material CHLORINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Chlorine); + public final Material ARGON = MaterialUtils.generateMaterialFromGtENUM(Materials.Argon); + public final Material POTASSIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Potassium); + public final Material CALCIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Calcium); + public final Material SCANDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Scandium); + public final Material TITANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Titanium); + public final Material VANADIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Vanadium); + public final Material CHROMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Chrome); + public final Material MANGANESE = MaterialUtils.generateMaterialFromGtENUM(Materials.Manganese); + public final Material IRON = MaterialUtils.generateMaterialFromGtENUM(Materials.Iron); + public final Material COBALT = MaterialUtils.generateMaterialFromGtENUM(Materials.Cobalt); + public final Material NICKEL = MaterialUtils.generateMaterialFromGtENUM(Materials.Nickel); + public final Material COPPER = MaterialUtils.generateMaterialFromGtENUM(Materials.Copper); + public final Material ZINC = MaterialUtils.generateMaterialFromGtENUM(Materials.Zinc); + public final Material GALLIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Gallium); + //public final Material GERMANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Germanium); + public final Material ARSENIC = MaterialUtils.generateMaterialFromGtENUM(Materials.Arsenic); + //public final Material SELENIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Selenium); + //public final Material BROMINE = MaterialUtils.generateMaterialFromGtENUM(Materials.Bromine); + //public final Material KRYPTON = MaterialUtils.generateMaterialFromGtENUM(Materials.Krypton); + public final Material RUBIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Rubidium); + public final Material STRONTIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Strontium); + public final Material YTTRIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Yttrium); + public final Material ZIRCONIUM = new Material("Zirconium", new short[]{255, 250, 205}, 1855, 4377, 40, 51, false, "Zr", 0);//Not a GT Inherited Material + public final Material NIOBIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Niobium); + public final Material MOLYBDENUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Molybdenum); + //public final Material TECHNETIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Technetium); + //public final Material RUTHENIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Ruthenium); + //public final Material RHODIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Rhodium); + public final Material PALLADIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Palladium); + public final Material SILVER = MaterialUtils.generateMaterialFromGtENUM(Materials.Silver); + public final Material CADMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Cadmium); + public final Material INDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Indium); + public final Material TIN = MaterialUtils.generateMaterialFromGtENUM(Materials.Tin); @@ -67,19 +76,19 @@ public final class ELEMENT { //Second 50 elements - public static final Material TANTALUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Tantalum); - public static final Material TUNGSTEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Tungsten); - public static final Material OSMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Osmium); - public static final Material IRIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Iridium); - public static final Material PLATINUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Platinum); - public static final Material GOLD = MaterialUtils.generateMaterialFromGtENUM(Materials.Gold); - public static final Material LEAD = MaterialUtils.generateMaterialFromGtENUM(Materials.Lead); - public static final Material BISMUTH = MaterialUtils.generateMaterialFromGtENUM(Materials.Bismuth); - public static final Material RADON = MaterialUtils.generateMaterialFromGtENUM(Materials.Radon); - public static final Material THORIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Thorium); - public static final Material URANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Uranium); - public static final Material PLUTONIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Plutonium); - public static final Material URANIUM233 = new Material("Uranium-233", new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, null);//Not a GT Inherited Material + public final Material TANTALUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Tantalum); + public final Material TUNGSTEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Tungsten); + public final Material OSMIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Osmium); + public final Material IRIDIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Iridium); + public final Material PLATINUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Platinum); + public final Material GOLD = MaterialUtils.generateMaterialFromGtENUM(Materials.Gold); + public final Material LEAD = MaterialUtils.generateMaterialFromGtENUM(Materials.Lead); + public final Material BISMUTH = MaterialUtils.generateMaterialFromGtENUM(Materials.Bismuth); + public final Material RADON = MaterialUtils.generateMaterialFromGtENUM(Materials.Radon); + public final Material THORIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Thorium); + public final Material URANIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Uranium); + public final Material PLUTONIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Plutonium); + public final Material URANIUM233 = new Material("Uranium-233", new short[]{73, 220, 83, 0}, 1132, 4131, 92, 141, false, MaterialUtils.superscript("233U"), 2);//Not a GT Inherited Material } diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 0902bf62f9..893b310ba4 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -1,97 +1,171 @@ package gtPlusPlus.core.material; +import static gregtech.api.enums.GT_Values.M; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gtPlusPlus.core.item.base.cell.BaseItemCell; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.fluid.FluidUtils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.materials.MaterialUtils; import gtPlusPlus.core.util.math.MathUtils; + +import java.util.ArrayList; + +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; public class Material { - final String unlocalizedName; - final String localizedName; + private final String unlocalizedName; + private final String localizedName; + + private final Fluid vMoltenFluid; + + protected Object dataVar; - private MaterialStack[] materialInput = new MaterialStack[4]; + private ArrayList<MaterialStack> vMaterialInput = new ArrayList<MaterialStack>(); + public final long[] vSmallestRatio; - final short[] RGBA; + private final short[] RGBA; - final boolean usesBlastFurnace; + private final boolean usesBlastFurnace; + public final boolean isRadioactive; + public final byte vRadioationLevel; - final int meltingPointK; - final int boilingPointK; - final int meltingPointC; - final int boilingPointC; - final long vProtons; - final long vNeutrons; - final long vMass; + private final int meltingPointK; + private final int boilingPointK; + private final int meltingPointC; + private final int boilingPointC; + private final long vProtons; + private final long vNeutrons; + private final long vMass; + public final int smallestStackSizeWhenProcessing; //Add a check for <=0 || > 64 public final int vTier; public final int vVoltageMultiplier; + public final String vChemicalFormula; + public final String vChemicalSymbol; + + public Material(final String materialName, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final MaterialStack... inputs){ + this(materialName, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", 0, inputs); + } + + public Material(final String materialName, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final int radiationLevel, MaterialStack... inputs){ + this(materialName, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, "", radiationLevel, inputs); + } - public Material(String materialName, short[] rgba, int meltingPoint, int boilingPoint, long protons, long neutrons, boolean blastFurnace, MaterialStack[] inputs){ + public Material(final String materialName, final short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, final MaterialStack... inputs){ this.unlocalizedName = Utils.sanitizeString(materialName); this.localizedName = materialName; this.RGBA = rgba; this.meltingPointC = meltingPoint; - if (boilingPoint == 0){ - boilingPoint = meltingPoint*4; + if (boilingPoint != 0){ + this.boilingPointC = boilingPoint; + } + else { + this.boilingPointC = meltingPoint*4; } - this.boilingPointC = boilingPoint; this.meltingPointK = (int) MathUtils.celsiusToKelvin(meltingPointC); this.boilingPointK = (int) MathUtils.celsiusToKelvin(boilingPointC); this.vProtons = protons; this.vNeutrons = neutrons; this.vMass = getMass(); - if (getMeltingPoint_K() >= 0 && getMeltingPoint_K() <= 750){ - this.vTier = 1; - } - else if(getMeltingPoint_K() >= 751 && getMeltingPoint_K() <= 1250){ - this.vTier = 2; - } - else if(getMeltingPoint_K() >= 1251 && getMeltingPoint_K() <= 1750){ - this.vTier = 3; - } - else if(getMeltingPoint_K() >= 1751 && getMeltingPoint_K() <= 2250){ - this.vTier = 4; - } - else if(getMeltingPoint_K() >= 2251 && getMeltingPoint_K() <= 2750){ - this.vTier = 5; - } - else if(getMeltingPoint_K() >= 2751 && getMeltingPoint_K() <= 3250){ - this.vTier = 6; - } - else if(getMeltingPoint_K() >= 3251 && getMeltingPoint_K() <= 3750){ - this.vTier = 7; - } - else if(getMeltingPoint_K() >= 3751 && getMeltingPoint_K() <= 4250){ - this.vTier = 8; - } - else if(getMeltingPoint_K() >= 4251 && getMeltingPoint_K() <= 4750){ - this.vTier = 9; - } - else if(getMeltingPoint_K() >= 4751 && getMeltingPoint_K() <= 9999){ - this.vTier = 10; + //Sets the Rad level + if (radiationLevel != 0){ + this.isRadioactive = true; + this.vRadioationLevel = (byte) radiationLevel; } else { - this.vTier = 0; + this.isRadioactive = false; + this.vRadioationLevel = (byte) radiationLevel; } + //Sets the materials 'tier'. Will probably replace this logic. + this.vTier = MaterialUtils.getTierOfMaterial((int) MathUtils.celsiusToKelvin(meltingPoint)); + this.usesBlastFurnace = blastFurnace; - this.vVoltageMultiplier = this.getMeltingPoint_K() >= 2800 ? 64 : 16; + this.vVoltageMultiplier = this.getMeltingPointK() >= 2800 ? 64 : 16; if (inputs == null){ - this.materialInput = null; + this.vMaterialInput = null; } else { if (inputs.length != 0){ for (int i=0; i < inputs.length; i++){ if (inputs[i] != null){ - this.materialInput[i] = inputs[i]; + this.vMaterialInput.add(i, inputs[i]); } } } } + + this.vSmallestRatio = getSmallestRatio(vMaterialInput); + int tempSmallestSize = 0; + + if (vSmallestRatio != null){ + for (int v=0;v<this.vSmallestRatio.length;v++){ + tempSmallestSize=(int) (tempSmallestSize+vSmallestRatio[v]); + } + this.smallestStackSizeWhenProcessing = tempSmallestSize; //Valid stacksizes + } + else { + this.smallestStackSizeWhenProcessing = 1; //Valid stacksizes + } + + + //Makes a Fancy Chemical Tooltip + this.vChemicalSymbol = chemicalSymbol; + if (vMaterialInput != null){ + this.vChemicalFormula = getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); + } + else if (!this.vChemicalSymbol.equals("")){ + Utils.LOG_WARNING("materialInput is null, using a valid chemical symbol."); + this.vChemicalFormula = this.vChemicalSymbol; + } + else{ + Utils.LOG_WARNING("MaterialInput == null && chemicalSymbol probably equals nothing"); + this.vChemicalFormula = "??"; + } + + Materials isValid = Materials.get(getLocalizedName()); + if (isValid == Materials._NULL){ + this.vMoltenFluid = generateFluid(); + } + else { + if (isValid.mFluid != null){ + this.vMoltenFluid = isValid.mFluid; + } + else if (isValid.mGas != null){ + this.vMoltenFluid = isValid.mGas; + } + else if (isValid.mPlasma != null){ + this.vMoltenFluid = isValid.mPlasma; + } + else { + this.vMoltenFluid = generateFluid(); + } + } + + //dataVar = MathUtils.generateSingularRandomHexValue(); + + String ratio = ""; + if (vSmallestRatio != null) + for (int hu=0;hu<vSmallestRatio.length;hu++){ + if (ratio.equals("")){ + ratio = String.valueOf(vSmallestRatio[hu]); + } + else { + ratio = ratio + ":" +vSmallestRatio[hu]; + } + } + Utils.LOG_INFO("Creating a Material instance for "+materialName); + Utils.LOG_INFO("Formula: "+vChemicalFormula + " Smallest Stack: "+smallestStackSizeWhenProcessing+" Smallest Ratio:"+ratio); Utils.LOG_INFO("Protons: "+vProtons); Utils.LOG_INFO("Neutrons: "+vNeutrons); Utils.LOG_INFO("Mass: "+vMass+"/units"); @@ -99,118 +173,331 @@ public class Material { Utils.LOG_INFO("Boiling Point: "+boilingPointC+"C."); } - public String getLocalizedName(){ + final public String getLocalizedName(){ return localizedName; } - public String getUnlocalizedName(){ + final public String getUnlocalizedName(){ return unlocalizedName; } - public short[] getRGBA(){ - return RGBA; + final public short[] getRGBA(){ + return this.RGBA; } - - public int getRgbAsHex(){ + + final public int getRgbAsHex(){ + + int returnValue = Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); + if (returnValue == 0){ + return (int) dataVar; + } return Utils.rgbtoHexValue(RGBA[0], RGBA[1], RGBA[2]); } - public long getProtons() { + final public long getProtons() { return vProtons; } - public long getNeutrons() { + final public long getNeutrons() { return vNeutrons; } - public long getMass() { + final public long getMass() { return vProtons + vNeutrons; } - public int getMeltingPoint_C() { + final public int getMeltingPointC() { return meltingPointC; } - public int getBoilingPoint_C() { + final public int getBoilingPointC() { return boilingPointC; } - public int getMeltingPoint_K() { + final public int getMeltingPointK() { return meltingPointK; } - public int getBoilingPoint_K() { + final public int getBoilingPointK() { return boilingPointK; } - public boolean requiresBlastFurnace(){ + final public boolean requiresBlastFurnace(){ return usesBlastFurnace; } - public ItemStack getDust(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+unlocalizedName, stacksize); + final public ItemStack getDust(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dust"+unlocalizedName, stacksize); + } + + final public ItemStack getSmallDust(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+unlocalizedName, stacksize); } - public ItemStack getSmallDust(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+unlocalizedName, stacksize); + final public ItemStack getTinyDust(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustTiny"+unlocalizedName, stacksize); } - public ItemStack getTinyDust(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustTiny"+unlocalizedName, stacksize); + final public ItemStack[] getValidInputStacks(){ + return ItemUtils.validItemsForOreDict(unlocalizedName); } - public ItemStack[] getValidInputStacks(){ - return UtilsItems.validItemsForOreDict(unlocalizedName); + final public ItemStack getIngot(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingot"+unlocalizedName, stacksize); } - public ItemStack getIngot(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("ingot"+unlocalizedName, stacksize); + final public ItemStack getPlate(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plate"+unlocalizedName, stacksize); } - public ItemStack getPlate(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("plate"+unlocalizedName, stacksize); + final public ItemStack getPlateDouble(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDouble"+unlocalizedName, stacksize); } - public ItemStack getPlateDouble(int stacksize){ - return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("plateDouble"+unlocalizedName, stacksize); + final public ItemStack getGear(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("gear"+unlocalizedName, stacksize); } - public ItemStack[] getMaterialComposites(){ - //Utils.LOG_INFO("Something requested the materials needed for "+localizedName); - if (materialInput != null && materialInput.length >= 1){ - ItemStack[] temp = new ItemStack[materialInput.length]; - for (int i=0;i<materialInput.length;i++){ - //Utils.LOG_INFO("i:"+i); + final public ItemStack getRod(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("stick"+unlocalizedName, stacksize); + } + + final public ItemStack getLongRod(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("stickLong"+unlocalizedName, stacksize); + } + + final public ItemStack getBolt(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("bolt"+unlocalizedName, stacksize); + } + + final public ItemStack getScrew(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("screw"+unlocalizedName, stacksize); + } + + final public ItemStack getRing(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ring"+unlocalizedName, stacksize); + } + + final public ItemStack getRotor(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("rotor"+unlocalizedName, stacksize); + } + + final public ItemStack getFrameBox(int stacksize){ + return ItemUtils.getItemStackOfAmountFromOreDictNoBroken("frameGt"+unlocalizedName, stacksize); + } + + final public ItemStack[] getMaterialComposites(){ + //Utils.LOG_WARNING("Something requested the materials needed for "+localizedName); + if (vMaterialInput != null){ + if (!vMaterialInput.isEmpty()){ + ItemStack[] temp = new ItemStack[vMaterialInput.size()]; + for (int i=0;i<vMaterialInput.size();i++){ + //Utils.LOG_WARNING("i:"+i); ItemStack testNull = null; try { - testNull = materialInput[i].getDustStack(); + testNull = vMaterialInput.get(i).getDustStack(); } catch (Throwable r){ - Utils.LOG_INFO("Failed gathering material stack for "+localizedName+"."); - Utils.LOG_INFO("What Failed: Length:"+materialInput.length+" current:"+i); + Utils.LOG_WARNING("Failed gathering material stack for "+localizedName+"."); + Utils.LOG_WARNING("What Failed: Length:"+vMaterialInput.size()+" current:"+i); } try { if (testNull != null){ - //Utils.LOG_INFO("not null"); - temp[i] = materialInput[i].getDustStack(); + //Utils.LOG_WARNING("not null"); + temp[i] = vMaterialInput.get(i).getDustStack(); } } catch (Throwable r){ - Utils.LOG_INFO("Failed setting slot "+i+", using "+localizedName); + Utils.LOG_WARNING("Failed setting slot "+i+", using "+localizedName); } } return temp; } + } return new ItemStack[]{}; } - public int[] getMaterialCompositeStackSizes(){ - if (materialInput != null && materialInput.length >= 1){ - int[] temp = new int[materialInput.length]; - for (int i=0;i<materialInput.length;i++){ - temp[i] = materialInput[i].getDustStack().stackSize; + final public ArrayList<MaterialStack> getComposites(){ + return this.vMaterialInput; + } + + final public int[] getMaterialCompositeStackSizes(){ + if (!vMaterialInput.isEmpty()){ + int[] temp = new int[vMaterialInput.size()]; + for (int i=0;i<vMaterialInput.size();i++){ + if (vMaterialInput.get(i) != null) + temp[i] = vMaterialInput.get(i).getDustStack().stackSize; + else + temp[i]=0; } return temp; } return new int[]{}; } + + @SuppressWarnings("static-method") + final public long[] getSmallestRatio(ArrayList<MaterialStack> tempInput){ + if (tempInput != null){ + if (!tempInput.isEmpty()){ + Utils.LOG_WARNING("length: "+tempInput.size()); + Utils.LOG_WARNING("(inputs != null): "+(tempInput != null)); + //Utils.LOG_WARNING("length: "+inputs.length); + long[] tempRatio = new long[tempInput.size()]; + for (int x=0;x<tempInput.size();x++){ + //tempPercentage = tempPercentage+inputs[x].percentageToUse; + //this.mMaterialList.add(inputs[x]); + if (tempInput.get(x) != null){ + tempRatio[x] = tempInput.get(x).getPartsPerOneHundred(); + } + } + + long[] smallestRatio = MathUtils.simplifyNumbersToSmallestForm(tempRatio); + + if (smallestRatio.length > 0){ + String tempRatioStringThing1 = ""; + for (int r=0;r<tempRatio.length;r++){ + tempRatioStringThing1 = tempRatioStringThing1 + tempRatio[r] +" : "; + } + Utils.LOG_WARNING("Default Ratio: "+tempRatioStringThing1); + + String tempRatioStringThing = ""; + int tempSmallestCraftingUseSize = 0; + for (int r=0;r<smallestRatio.length;r++){ + tempRatioStringThing = tempRatioStringThing + smallestRatio[r] +" : "; + tempSmallestCraftingUseSize = (int) (tempSmallestCraftingUseSize + smallestRatio[r]); + } + //this.smallestStackSizeWhenProcessing = tempSmallestCraftingUseSize; + Utils.LOG_WARNING("Smallest Ratio: "+tempRatioStringThing); + return smallestRatio; + } + } + } + return null; + } + + @SuppressWarnings("unused") + final String getToolTip(String chemSymbol, long aMultiplier, boolean aShowQuestionMarks) { + if (!aShowQuestionMarks && (vChemicalFormula.equals("?")||vChemicalFormula.equals("??"))) return ""; + Utils.LOG_WARNING("===============| Calculating Atomic Formula for "+this.localizedName+" |==============="); + if (!chemSymbol.equals("")) + return chemSymbol; + ArrayList<MaterialStack> tempInput = vMaterialInput; + if (tempInput != null){ + if (!tempInput.isEmpty()){ + String dummyFormula = ""; + long[] dummyFormulaArray = getSmallestRatio(tempInput); + if (dummyFormulaArray != null){ + if (dummyFormulaArray.length >= 1){ + for (int e=0;e<tempInput.size();e++){ + if (tempInput.get(e) != null){ + if (tempInput.get(e).getStackMaterial() != null){ + if (!tempInput.get(e).getStackMaterial().vChemicalSymbol.equals("??")){ + if (dummyFormulaArray[e] > 1){ + + if (tempInput.get(e).getStackMaterial().vChemicalFormula.length() > 3){ + dummyFormula = dummyFormula + "(" + tempInput.get(e).getStackMaterial().vChemicalFormula + ")" + dummyFormulaArray[e]; + } + else { + dummyFormula = dummyFormula + tempInput.get(e).getStackMaterial().vChemicalFormula + dummyFormulaArray[e]; + } + } + else if (dummyFormulaArray[e] == 1){ + if (tempInput.get(e).getStackMaterial().vChemicalFormula.length() > 3){ + dummyFormula = dummyFormula + "(" +tempInput.get(e).getStackMaterial().vChemicalFormula + ")"; + } + else { + dummyFormula = dummyFormula +tempInput.get(e).getStackMaterial().vChemicalFormula; + } + } + } + else + dummyFormula = dummyFormula + "??"; + } + else + dummyFormula = dummyFormula + "▓▓"; + } + } + return MaterialUtils.subscript(dummyFormula); + //return dummyFormula; + } + Utils.LOG_WARNING("dummyFormulaArray <= 0"); + } + Utils.LOG_WARNING("dummyFormulaArray == null"); + } + Utils.LOG_WARNING("tempInput.length <= 0"); + } + Utils.LOG_WARNING("tempInput == null"); + return "??"; + + } + + final Fluid generateFluid(){ + if (Materials.get(localizedName).mFluid == null){ + Utils.LOG_WARNING("Generating our own fluid."); + + //Generate a Cell if we need to + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+getUnlocalizedName(), 1) == null){ + @SuppressWarnings("unused") + Item temp = new BaseItemCell(this); + } + return FluidUtils.addGTFluid( + this.getUnlocalizedName(), + "Molten "+this.getLocalizedName(), + this.RGBA, + 4, + this.getMeltingPointK(), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+getUnlocalizedName(), 1), + ItemList.Cell_Empty.get(1L, new Object[0]), + 1000); + } + Utils.LOG_WARNING("Getting the fluid from a GT material instead."); + return Materials.get(localizedName).mFluid; + } + + final public FluidStack getFluid(int fluidAmount) { + Utils.LOG_WARNING("Attempting to get "+fluidAmount+"L of "+this.vMoltenFluid.getName()); + + FluidStack moltenFluid = new FluidStack(this.vMoltenFluid, fluidAmount); + + Utils.LOG_WARNING("Info: "+moltenFluid.getFluid().getName()+" Info: "+moltenFluid.amount+" Info: "+moltenFluid.getFluidID()); + + //FluidStack moltenFluid = FluidUtils.getFluidStack(this.vMoltenFluid.getName(), fluidAmount); + /*boolean isNull = (moltenFluid == null); + if (isNull) Utils.LOG_WARNING("Did not obtain fluid."); + else Utils.LOG_WARNING("Found fluid."); + if (isNull){ + return null; + }*/ + return moltenFluid; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } diff --git a/src/Java/gtPlusPlus/core/material/MaterialGenerator.java b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java new file mode 100644 index 0000000000..d5b5cf34ab --- /dev/null +++ b/src/Java/gtPlusPlus/core/material/MaterialGenerator.java @@ -0,0 +1,100 @@ +package gtPlusPlus.core.material; + +import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; +import gtPlusPlus.core.block.base.BlockBaseModular; +import gtPlusPlus.core.item.base.bolts.BaseItemBolt; +import gtPlusPlus.core.item.base.dusts.BaseItemDust; +import gtPlusPlus.core.item.base.gears.BaseItemGear; +import gtPlusPlus.core.item.base.ingots.BaseItemIngot; +import gtPlusPlus.core.item.base.ingots.BaseItemIngotHot; +import gtPlusPlus.core.item.base.nugget.BaseItemNugget; +import gtPlusPlus.core.item.base.plates.BaseItemPlate; +import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; +import gtPlusPlus.core.item.base.rings.BaseItemRing; +import gtPlusPlus.core.item.base.rods.BaseItemRod; +import gtPlusPlus.core.item.base.rods.BaseItemRodLong; +import gtPlusPlus.core.item.base.rotors.BaseItemRotor; +import gtPlusPlus.core.item.base.screws.BaseItemScrew; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_BlastSmelter; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Extruder; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Plates; +import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_ShapedCrafting; +import net.minecraft.block.Block; +import net.minecraft.item.Item; + +public class MaterialGenerator { + + @SuppressWarnings("unused") + public static void generate(final Material matInfo){ + String unlocalizedName = matInfo.getUnlocalizedName(); + String materialName = matInfo.getLocalizedName(); + short[] C = matInfo.getRGBA(); + int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); + boolean hotIngot = matInfo.requiresBlastFurnace(); + int materialTier = matInfo.vTier; //TODO + + if (materialTier > 10 || materialTier <= 0){ + materialTier = 2; + } + + int sRadiation = 0; + if (ItemUtils.isRadioactive(materialName)){ + sRadiation = ItemUtils.getRadioactivityLevel(materialName); + } + + if (sRadiation >= 1){ + Item temp; + Block tempBlock; + tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); + temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation); + + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); + temp = new BaseItemNugget(matInfo); + temp = new BaseItemPlate(matInfo); + temp = new BaseItemRod(matInfo); + temp = new BaseItemRodLong(matInfo); + } + + else { + Item temp; + Block tempBlock; + tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); + tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.FRAME, Colour); + temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation); + if (hotIngot){ + Item tempIngot = temp; + temp = new BaseItemIngotHot("itemHotIngot"+unlocalizedName, materialName, ItemUtils.getSimpleStack(tempIngot, 1), materialTier); + } + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); + temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); + temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); + temp = new BaseItemNugget(matInfo); + temp = new BaseItemPlate(matInfo); + temp = new BaseItemPlateDouble(matInfo); + temp = new BaseItemBolt(matInfo); + temp = new BaseItemRod(matInfo); + temp = new BaseItemRodLong(matInfo); + temp = new BaseItemRing(matInfo); + temp = new BaseItemScrew(matInfo); + temp = new BaseItemRotor(matInfo); + temp = new BaseItemGear(matInfo); + } + + + + + //Add A jillion Recipes - old code + RecipeGen_Plates.generateRecipes(matInfo); + RecipeGen_Extruder.generateRecipes(matInfo); + RecipeGen_ShapedCrafting.generateRecipes(matInfo); + RecipeGen_DustGeneration.generateRecipes(matInfo); + RecipeGen_BlastSmelter.generateARecipe(matInfo); + + } + +} diff --git a/src/Java/gtPlusPlus/core/material/MaterialStack.java b/src/Java/gtPlusPlus/core/material/MaterialStack.java index f8b9b35bd8..f2f8ff4e5a 100644 --- a/src/Java/gtPlusPlus/core/material/MaterialStack.java +++ b/src/Java/gtPlusPlus/core/material/MaterialStack.java @@ -1,72 +1,89 @@ package gtPlusPlus.core.material; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; + +import java.math.BigDecimal; +import java.math.RoundingMode; + import net.minecraft.item.ItemStack; public class MaterialStack { + + private transient final int[] vAmount; + private final Material stackMaterial; + private final double vPercentageToUse; + + public MaterialStack(final Material inputs, final double partOutOf100){ + this.stackMaterial = inputs; + this.vPercentageToUse = partOutOf100; + this.vAmount = math(partOutOf100); + } + + @SuppressWarnings("static-method") + private int[] math(final double val){ + double i; + //Cast to a BigDecimal to round it. + final BigDecimal bd = new BigDecimal(val).setScale(2, RoundingMode.HALF_EVEN); + i = bd.doubleValue(); + //Split the string into xx.xx + final String[] arr=String.valueOf(i).split("\\."); + int[] intArr=new int[2]; + intArr[0]=Integer.parseInt(arr[0]); + intArr[1]=Integer.parseInt(arr[1]); + return intArr; + } + + public ItemStack getDustStack(){ + return this.stackMaterial.getDust(this.vAmount[0]); + } - final Material materialInput; - final double percentageToUse; + public ItemStack getDustStack(final int amount){ + return this.stackMaterial.getDust(amount); + } - public MaterialStack(Material inputs, double percentage){ - - this.materialInput = inputs; - this.percentageToUse = percentage; - - + public Material getStackMaterial(){ + return this.stackMaterial; } - public ItemStack getDustStack(){ - int caseStatus = 0; - int amount = 0; - if (percentageToUse >= 0 && percentageToUse <= 0.99){ - caseStatus = 1; - amount = (int) (1/percentageToUse); - //amount = Integer.valueOf(String.valueOf(percentageToUse).charAt(2)); - } - else if (percentageToUse >= 1 && percentageToUse <= 9.99){ - caseStatus = 2; - amount = (int) (percentageToUse); - //amount = Integer.valueOf(String.valueOf(percentageToUse).charAt(0)); + public double getvPercentageToUse(){ + return this.vPercentageToUse; + } + + public long[] getSmallestStackSizes(){ + return this.stackMaterial.getSmallestRatio(stackMaterial.getComposites()); + } + + public int getPartsPerOneHundred(){ + if (this.vAmount != null){ + if (this.vAmount[0] >= 1 && this.vAmount[0] <= 100){ + return this.vAmount[0]; + } } - else if (percentageToUse >= 10 && percentageToUse <= 99.99){ - caseStatus = 3; - amount = (int) (percentageToUse/10); - //amount = Integer.valueOf(String.valueOf(percentageToUse).charAt(0)); + return 100; + } + public ItemStack getLeftOverStacksFromDecimalValue(){ + final int temp = this.vAmount[1]; + int getCount; + if (temp >= 25 && temp <=99){ + getCount = temp/25; + return this.stackMaterial.getSmallDust(getCount); } - else if (percentageToUse == 100){ - caseStatus = 4; - amount = 10; + else if (temp >= 11 && temp <= 24){ + getCount = temp/11; + return this.stackMaterial.getTinyDust(getCount); } else { - amount = 0; - } - switch (caseStatus) { - case 1: { - return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustTiny"+materialInput.unlocalizedName, amount); - } - case 2: { - return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustSmall"+materialInput.unlocalizedName, amount); - } - case 3: { - return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+materialInput.unlocalizedName, amount); - } - case 4: { - return UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dust"+materialInput.unlocalizedName, amount); - } - default: return null; - } - + } } - + public ItemStack[] getValidItemStacks(){ - return UtilsItems.validItemsForOreDict(materialInput.unlocalizedName); + return ItemUtils.validItemsForOreDict(stackMaterial.getUnlocalizedName()); } - - - - - + + + + + } diff --git a/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java b/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java index 0f31c4c61d..bb5732c319 100644 --- a/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java +++ b/src/Java/gtPlusPlus/core/recipe/Gregtech_Recipe_Adder.java @@ -3,7 +3,7 @@ package gtPlusPlus.core.recipe; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -35,28 +35,28 @@ public class Gregtech_Recipe_Adder { resetVars(); if (addMaceratorRecipe){ - inputStack1 = UtilsItems.getSimpleStack(maceratorInput, maceratorInputAmount1); - outputStack1 = UtilsItems.getSimpleStack(maceratorOutput, maceratorOutputAmount1); + inputStack1 = ItemUtils.getSimpleStack(maceratorInput, maceratorInputAmount1); + outputStack1 = ItemUtils.getSimpleStack(maceratorOutput, maceratorOutputAmount1); addMaceratorRecipe(inputStack1, outputStack1); } resetVars(); if (addCompressorRecipe){ - inputStack1 = UtilsItems.getSimpleStack(compressorInput, compressorInputAmount1); - outputStack1 = UtilsItems.getSimpleStack(compressorOutput, compressorOutputAmount1); + inputStack1 = ItemUtils.getSimpleStack(compressorInput, compressorInputAmount1); + outputStack1 = ItemUtils.getSimpleStack(compressorOutput, compressorOutputAmount1); addCompressorRecipe(inputStack1, outputStack1); } resetVars(); if (addBlastFurnaceRecipe){ - inputStack1 = UtilsItems.getSimpleStack(blastFurnaceInput, blastFurnaceInputAmount1); - inputStack2 = UtilsItems.getSimpleStack(blastFurnaceInput2, blastFurnaceInputAmount2); - outputStack1 = UtilsItems.getSimpleStack(blastFurnaceOutput, blastFurnaceOutputAmount1); - outputStack2 = UtilsItems.getSimpleStack(blastFurnaceOutput2, blastFurnaceOutputAmount2); + inputStack1 = ItemUtils.getSimpleStack(blastFurnaceInput, blastFurnaceInputAmount1); + inputStack2 = ItemUtils.getSimpleStack(blastFurnaceInput2, blastFurnaceInputAmount2); + outputStack1 = ItemUtils.getSimpleStack(blastFurnaceOutput, blastFurnaceOutputAmount1); + outputStack2 = ItemUtils.getSimpleStack(blastFurnaceOutput2, blastFurnaceOutputAmount2); addBlastFurnaceRecipe(inputStack1, inputStack2, outputStack1, outputStack2, blastFurnaceTemp); } resetVars(); if (addSmeltingRecipe){ - inputStack1 = UtilsItems.getSimpleStack(smeltingInput, smeltingInputAmount1); - outputStack1 = UtilsItems.getSimpleStack(smeltingOutput, smeltingOutputAmount1); + inputStack1 = ItemUtils.getSimpleStack(smeltingInput, smeltingInputAmount1); + outputStack1 = ItemUtils.getSimpleStack(smeltingOutput, smeltingOutputAmount1); addSmeltingRecipe(inputStack1, outputStack1); } resetVars(); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index bb482d96d5..46cf4e0a7d 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -11,8 +11,9 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.fluid.FluidUtils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; public class RECIPES_GREGTECH { @@ -29,7 +30,9 @@ public class RECIPES_GREGTECH { distilleryRecipes(); extractorRecipes(); chemicalBathRecipes(); + chemicalReactorRecipes(); dehydratorRecipes(); + blastFurnaceRecipes(); addFuels(); } @@ -58,7 +61,7 @@ public class RECIPES_GREGTECH { GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 1L), //Input 2 Materials.SulfuricAcid.getFluid(60L), //Fluid Input Materials.Creosote.getFluid(250L), //Fluid Output - UtilsItems.getItemStack("Railcraft:fuel.coke", 2), //Item Output + ItemUtils.getItemStack("Railcraft:fuel.coke", 2), //Item Output 600, //Time in ticks 120); //EU }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} @@ -84,7 +87,7 @@ public class RECIPES_GREGTECH { GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 1L), //Input 2 FluidUtils.getFluidStack("oxygen", 185), //Fluid Input Materials.Creosote.getFluid(200L), //Fluid Output - UtilsItems.getItemStack("Railcraft:fuel.coke", 2), //Item Output + ItemUtils.getItemStack("Railcraft:fuel.coke", 2), //Item Output 900, //Time in ticks 120); //EU }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} @@ -130,31 +133,122 @@ public class RECIPES_GREGTECH { 30); //EU }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");}*/ try { - - ItemStack cells = UtilsItems.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemCellEmpty", "Empty Fluid Cells", 0, 12); - + + ItemStack cells = ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemCellEmpty", "Empty Fluid Cells", 0, 12); + if (cells == null){ - cells = UtilsItems.getItemStackOfAmountFromOreDictNoBroken("cellEmpty", 12); + cells = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellEmpty", 12); } - - ItemStack[] input = {cells, UtilsItems.getItemStackOfAmountFromOreDict("dustLepidolite", 20)}; - + + ItemStack[] input = {cells, ItemUtils.getItemStackOfAmountFromOreDict("dustLepidolite", 20)}; + CORE.RA.addDehydratorRecipe( input, //Item input (Array, up to 2) FluidUtils.getFluidStack("sulfuricacid", 10000), //Fluid input (slot 1) - FluidUtils.getFluidStack("sulfuriclithium", 10000), //Fluid output (slot 1) + FluidUtils.getFluidStack("sulfuriclithium", 10000), //Fluid output (slot 2) + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustPotassium", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustAluminium", 4), + ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 10), + ItemUtils.getItemStackOfAmountFromOreDict("cellFluorine", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 3), //LithiumCarbonate + }, //Output Array of Items - Upto 9, + new int[]{0}, + 75*20, //Time in ticks + 1000); //EU + + }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + try { + + CORE.RA.addDehydratorRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 10) + }, //Item input (Array, up to 2) + FluidUtils.getFluidStack("uraniumtetrafluoride", 1440), //Fluid input (slot 1) + null, //Fluid output (slot 2) new ItemStack[]{ - UtilsItems.getItemStackOfAmountFromOreDict("dustPotassium", 1), - UtilsItems.getItemStackOfAmountFromOreDict("dustAluminium", 4), - UtilsItems.getItemStackOfAmountFromOreDict("cellOxygen", 10), - UtilsItems.getItemStackOfAmountFromOreDict("cellFluorine", 2), - UtilsItems.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 3), //LithiumCarbonate + ItemUtils.getItemStackOfAmountFromOreDict("dustUraniumTetrafluoride", 10), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellEmpty", 10) }, //Output Array of Items - Upto 9, new int[]{0}, - 90*20, //Time in ticks + 150*20, //Time in ticks 2000); //EU }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + try { + + CORE.RA.addDehydratorRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 10) + }, //Item input (Array, up to 2) + FluidUtils.getFluidStack("uraniumhexafluoride", 1440), //Fluid input (slot 1) + null, //Fluid output (slot 2) + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustUraniumHexafluoride", 10), + ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellEmpty", 10) + }, //Output Array of Items - Upto 9, + new int[]{0}, + 300*20, //Time in ticks + 4000); //EU + + }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + + //Raisins from Grapes + try { + + CORE.RA.addDehydratorRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("cropGrape", 1) + }, //Item input (Array, up to 2) + null, //Fluid input (slot 1) + null, //Fluid output (slot 2) + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("foodRaisins", 1) + }, //Output Array of Items - Upto 9, + new int[]{0}, + 10*20, //Time in ticks + 8); //EU + + }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + + //Calcium Hydroxide + if (ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1).getItem() != ModItems.AAA_Broken || LoadedMods.IHL){ + try { + + CORE.RA.addDehydratorRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 10) + }, //Item input (Array, up to 2) + FluidUtils.getFluidStack("water", 10000), //Fluid input (slot 1) + null, //Fluid output (slot 2) + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 20) + }, //Output Array of Items - Upto 9, + new int[]{0}, + 120*20, //Time in ticks + 120); //EU + + }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + + //2 LiOH + CaCO3 + try { + + CORE.RA.addDehydratorRecipe( + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dust2LiOHCaCO3", 5) + }, //Item input (Array, up to 2) + null, //Fluid input (slot 1) + null, //Fluid output (slot 2) + new ItemStack[]{ + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumCarbonate", 3) + }, //Output Array of Items - Upto 9, + new int[]{0}, + 120*20, //Time in ticks + 1000); //EU + + }catch (NullPointerException e){Utils.LOG_INFO("FAILED TO LOAD RECIPES - NULL POINTER SOMEWHERE");} + } } @@ -167,14 +261,21 @@ public class RECIPES_GREGTECH { private static void distilleryRecipes(){ Utils.LOG_INFO("Registering Distillery/Distillation Tower Recipes."); GT_Values.RA.addDistilleryRecipe(ItemList.Circuit_Integrated.getWithDamage(0L, 4L, new Object[0]), FluidUtils.getFluidStack("air", 1000), FluidUtils.getFluidStack("helium", 1), 400, 30, false); - GT_Values.RA.addDistillationTowerRecipe(FluidUtils.getFluidStack("air", 20000), FluidUtils.getFluidStackArray("helium", 25), UtilsItems.getSimpleStack(ModItems.itemHeliumBlob, 1), 200, 60); + GT_Values.RA.addDistillationTowerRecipe(FluidUtils.getFluidStack("air", 20000), FluidUtils.getFluidStackArray("helium", 25), ItemUtils.getSimpleStack(ModItems.itemHeliumBlob, 1), 200, 60); } private static void addFuels(){ Utils.LOG_INFO("Registering New Fuels."); - GT_Values.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketFire_water", 0, 1), null, 120, 0); - GT_Values.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketRocket_fuel", 0, 1), null, 112, 0); - GT_Values.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketHootch", 0, 1), null, 36, 0); + GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketFire_water", 0, 1), null, 120, 0); + GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketRocket_fuel", 0, 1), null, 112, 0); + GT_Values.RA.addFuel(ItemUtils.simpleMetaStack("EnderIO:bucketHootch", 0, 1), null, 36, 0); + + + + //CORE.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketRocket_fuel", 0, 1), null, 112, 0); + GT_Values.RA.addFuel(ItemUtils.getSimpleStack(Items.lava_bucket), null, 32, 2); + GT_Values.RA.addFuel(ItemUtils.getIC2Cell(2), null, 32, 2); + GT_Values.RA.addFuel(ItemUtils.getIC2Cell(11), null, 24, 2); //System.exit(1); } @@ -187,17 +288,55 @@ public class RECIPES_GREGTECH { private static void chemicalBathRecipes(){ int[] chances = {10000, 5000, 2500}; - GT_Values.RA.addChemicalBathRecipe(UtilsItems.getItemStackOfAmountFromOreDict("dustTin", 12), FluidUtils.getFluidStack("chlorine", 2400), - UtilsItems.getItemStackOfAmountFromOreDict("dustZirconium", 1), - UtilsItems.getItemStackOfAmountFromOreDict("dustZirconium", 1), - UtilsItems.getItemStackOfAmountFromOreDict("dustZirconium", 1), + GT_Values.RA.addChemicalBathRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustTin", 12), FluidUtils.getFluidStack("chlorine", 2400), + ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), + ItemUtils.getItemStackOfAmountFromOreDict("dustZirconium", 1), chances, 30*20, 240); + + GT_Values.RA.addChemicalBathRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 10), + FluidUtils.getFluidStack("hydrofluoricacid", 20000), + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumFluoride", 5), + null, + null, + new int[]{}, + 90*20, + 500); } - - private static void registerSkookumChoocher(){ - //GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.toolHeadUniversalSpade, aMaterial, 1L), tBits, new Object[]{"fX", Character.valueOf('X'), OrePrefixes.toolHeadShovel.get(aMaterial)}); + + private static void chemicalReactorRecipes(){ + GT_Values.RA.addChemicalRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumCarbonate", 5), //Input Stack 1 + ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 5), //Input Stack 2 + null, //Fluid Input + null, //Fluid Output + ItemUtils.getItemStackOfAmountFromOreDict("dust2LiOHCaCO3", 10), //Output Stack + 600*20 + ); + + GT_Values.RA.addChemicalRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 5), //Input Stack 1 + null, //Input Stack 2 + FluidUtils.getFluidStack("hydrofluoricacid", 2500), //Fluid Input + FluidUtils.getFluidStack("water", 2500), //Fluid Output + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumFluoride", 5), //Output Stack + 600*20 + ); + } + + private static void blastFurnaceRecipes(){ + GT_Values.RA.addBlastRecipe( + ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumFluoride", 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustBerylliumFluoride", 1), + GT_Values.NF, GT_Values.NF, + ItemUtils.getItemStackOfAmountFromOreDict("dustLi2BeF4", 3), + null, + 60*20, + 2000, + 3000); } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java new file mode 100644 index 0000000000..aa3026133e --- /dev/null +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java @@ -0,0 +1,48 @@ +package gtPlusPlus.core.recipe; + +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.recipe.RecipeUtils; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class RECIPES_General { + + static ItemStack RECIPE_Paper = ItemUtils.getSimpleStack(Items.paper); + static String RECIPE_LapisDust = "dustLazurite"; + static ItemStack OUTPUT_Blueprint = ItemUtils.getSimpleStack(ModItems.itemBlueprintBase); + static ItemStack RECIPE_CraftingTable = ItemUtils.getSimpleStack(Item.getItemFromBlock(Blocks.crafting_table)); + static String RECIPE_BronzePlate = "plateAnyBronze"; + static ItemStack RECIPE_BasicCasingIC2; + static ItemStack OUTPUT_Workbench_Bronze = ItemUtils.getSimpleStack(Item.getItemFromBlock(ModBlocks.blockWorkbench)); + static ItemStack NULL = null; + + public static void RECIPES_LOAD(){ + + if (LoadedMods.Gregtech){ + RECIPE_BasicCasingIC2 = ItemUtils.getItemStack("IC2:blockMachine", 1); + run(); + } + } + + private static void run(){ + + + RecipeUtils.recipeBuilder( + RECIPE_Paper, RECIPE_LapisDust, NULL, + RECIPE_Paper, RECIPE_LapisDust, NULL, + RECIPE_LapisDust, RECIPE_LapisDust, NULL, + OUTPUT_Blueprint); + + RecipeUtils.recipeBuilder( + RECIPE_BronzePlate, RECIPE_CraftingTable, RECIPE_BronzePlate, + RECIPE_BronzePlate, RECIPE_BasicCasingIC2, RECIPE_BronzePlate, + RECIPE_BronzePlate, RECIPE_BronzePlate, RECIPE_BronzePlate, + OUTPUT_Workbench_Bronze); + } + +} diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java index 6d81ba42ad..14f4a1c998 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_MTWRAPPER.java @@ -1,8 +1,8 @@ package gtPlusPlus.core.recipe; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.core.util.wrapper.var; import java.util.ArrayList; @@ -70,7 +70,7 @@ public class RECIPES_MTWRAPPER { * */ - ItemStack outputItem = UtilsItems.getCorrectStacktype(item_Output, 1); + ItemStack outputItem = ItemUtils.getCorrectStacktype(item_Output, 1); ArrayList<Object> validSlots = new ArrayList<Object>(); String a,b,c,d,e,f,g,h,i; @@ -92,7 +92,7 @@ public class RECIPES_MTWRAPPER { validSlots.add(2, lineThree); try { - UtilsRecipe.recipeBuilder((Object[]) validSlots.toArray(), outputItem.copy()); + RecipeUtils.recipeBuilder((Object[]) validSlots.toArray(), outputItem.copy()); MT_RECIPES_LOADED++; } catch(NullPointerException | ClassCastException k){ diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java index 2e69775b78..e3f47844c7 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_MachineComponents.java @@ -8,7 +8,7 @@ import gregtech.api.enums.SubTag; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; public class RECIPES_MachineComponents { @@ -99,176 +99,176 @@ public class RECIPES_MachineComponents { private static void run(){ //Electric Motors - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier7, wireTier7, rodTier7a, wireTier7, rodTier7b, wireTier7, rodTier7a, wireTier7, cableTier7, RECIPE_CONSTANTS.electricMotor_LuV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier8, wireTier8, rodTier8a, wireTier8, rodTier8b, wireTier8, rodTier8a, wireTier8, cableTier8, RECIPE_CONSTANTS.electricMotor_ZPM); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier9, wireTier9, rodTier9a, wireTier9, rodTier9b, wireTier9, rodTier9a, wireTier9, cableTier9, RECIPE_CONSTANTS.electricMotor_UV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier10, wireTier10, rodTier10a, wireTier10, rodTier10b, wireTier10, rodTier10a, wireTier10, cableTier10, RECIPE_CONSTANTS.electricMotor_MAX); //Electric Pump - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier7, rotorTier7, itemRubberRing, craftingToolScrewdriver, pipeTier7, craftingToolWrench, itemRubberRing, RECIPE_CONSTANTS.electricMotor_LuV, cableTier7, RECIPE_CONSTANTS.electricPump_LuV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier8, rotorTier8, itemRubberRing, craftingToolScrewdriver, pipeTier8, craftingToolWrench, itemRubberRing, RECIPE_CONSTANTS.electricMotor_ZPM, cableTier8, RECIPE_CONSTANTS.electricPump_ZPM); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier9, rotorTier9, itemRubberRing, craftingToolScrewdriver, pipeTier9, craftingToolWrench, itemRubberRing, RECIPE_CONSTANTS.electricMotor_UV, cableTier9, RECIPE_CONSTANTS.electricPump_UV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier10, rotorTier10, itemRubberRing, craftingToolScrewdriver, pipeTier10, craftingToolWrench, itemRubberRing, RECIPE_CONSTANTS.electricMotor_MAX, cableTier10, RECIPE_CONSTANTS.electricPump_MAX); //Electric Pump - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier7, plateTier7, plateTier7, cableTier7, rodTier7a, rodTier7a, cableTier7, RECIPE_CONSTANTS.electricMotor_LuV, smallGearTier7, RECIPE_CONSTANTS.electricPiston_LuV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier8, plateTier8, plateTier8, cableTier8, rodTier8a, rodTier8a, cableTier8, RECIPE_CONSTANTS.electricMotor_ZPM, smallGearTier8, RECIPE_CONSTANTS.electricPiston_ZPM); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier9, plateTier9, plateTier9, cableTier9, rodTier9a, rodTier9a, cableTier9, RECIPE_CONSTANTS.electricMotor_UV, smallGearTier9, RECIPE_CONSTANTS.electricPiston_UV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier10, plateTier10, plateTier10, cableTier10, rodTier10a, rodTier10a, cableTier10, RECIPE_CONSTANTS.electricMotor_MAX, smallGearTier10, RECIPE_CONSTANTS.electricPiston_MAX); //Robot Arms - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier7, cableTier7, cableTier7, RECIPE_CONSTANTS.electricMotor_LuV, rodTier7a, RECIPE_CONSTANTS.electricMotor_LuV, RECIPE_CONSTANTS.electricPiston_LuV, circuitTier7, rodTier7a, RECIPE_CONSTANTS.robotArm_LuV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier8, cableTier8, cableTier8, RECIPE_CONSTANTS.electricMotor_ZPM, rodTier8a, RECIPE_CONSTANTS.electricMotor_ZPM, RECIPE_CONSTANTS.electricPiston_ZPM, circuitTier8, rodTier8a, RECIPE_CONSTANTS.robotArm_ZPM); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier9, cableTier9, cableTier9, RECIPE_CONSTANTS.electricMotor_UV, rodTier9a, RECIPE_CONSTANTS.electricMotor_UV, RECIPE_CONSTANTS.electricPiston_UV, circuitTier9, rodTier9a, RECIPE_CONSTANTS.robotArm_UV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier10, cableTier10, cableTier10, RECIPE_CONSTANTS.electricMotor_MAX, rodTier10a, RECIPE_CONSTANTS.electricMotor_MAX, RECIPE_CONSTANTS.electricPiston_MAX, circuitTier10, rodTier10a, RECIPE_CONSTANTS.robotArm_MAX); //Conveyor Modules - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateRubber, plateRubber, plateRubber, RECIPE_CONSTANTS.electricMotor_LuV, cableTier7, RECIPE_CONSTANTS.electricMotor_LuV, plateRubber, plateRubber, plateRubber, RECIPE_CONSTANTS.conveyorModule_LuV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateRubber, plateRubber, plateRubber, RECIPE_CONSTANTS.electricMotor_ZPM, cableTier8, RECIPE_CONSTANTS.electricMotor_ZPM, plateRubber, plateRubber, plateRubber, RECIPE_CONSTANTS.conveyorModule_ZPM); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateRubber, plateRubber, plateRubber, RECIPE_CONSTANTS.electricMotor_UV, cableTier9, RECIPE_CONSTANTS.electricMotor_UV, plateRubber, plateRubber, plateRubber, RECIPE_CONSTANTS.conveyorModule_UV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateRubber, plateRubber, plateRubber, RECIPE_CONSTANTS.electricMotor_MAX, cableTier10, RECIPE_CONSTANTS.electricMotor_MAX, plateRubber, plateRubber, plateRubber, RECIPE_CONSTANTS.conveyorModule_MAX); //Emitter Modules - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( rodTier7c, rodTier7c, circuitTier7, cableTier7, circuitTier6, rodTier7c, circuitTier7, cableTier7, rodTier7c, RECIPE_CONSTANTS.emitter_LuV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( rodTier8c, rodTier8c, circuitTier8, cableTier8, circuitTier7, rodTier8c, circuitTier8, cableTier8, rodTier8c, RECIPE_CONSTANTS.emitter_ZPM); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( rodTier9c, rodTier9c, circuitTier9, cableTier9, circuitTier8, rodTier9c, circuitTier9, cableTier9, rodTier9c, RECIPE_CONSTANTS.emitter_UV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( rodTier10c, rodTier10c, circuitTier10, cableTier10, circuitTier9, rodTier10c, circuitTier10, cableTier10, rodTier10c, RECIPE_CONSTANTS.emitter_MAX); //Field Generator Modules - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier7, circuitTier7, wireTier7, circuitTier7, circuitTier6, circuitTier7, wireTier7, circuitTier7, wireTier7, RECIPE_CONSTANTS.fieldGenerator_LuV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier8, circuitTier8, wireTier8, circuitTier8, circuitTier7, circuitTier8, wireTier8, circuitTier8, wireTier8, RECIPE_CONSTANTS.fieldGenerator_ZPM); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier9, circuitTier9, wireTier9, circuitTier9, circuitTier8, circuitTier9, wireTier9, circuitTier9, wireTier9, RECIPE_CONSTANTS.fieldGenerator_UV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier10, circuitTier10, wireTier10, circuitTier10, circuitTier9, circuitTier10, wireTier10, circuitTier10, wireTier10, RECIPE_CONSTANTS.fieldGenerator_MAX); //Sensor Modules - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier7, null, circuitTier6, plateTier7, rodTier7c, null, circuitTier7, plateTier7, plateTier7, RECIPE_CONSTANTS.sensor_LuV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier8, null, circuitTier7, plateTier8, rodTier8c, null, circuitTier8, plateTier8, plateTier8, RECIPE_CONSTANTS.sensor_ZPM); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier9, null, circuitTier8, plateTier9, rodTier9c, null, circuitTier9, plateTier9, plateTier9, RECIPE_CONSTANTS.sensor_UV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier10, null, circuitTier9, plateTier10, rodTier10c, null, circuitTier10, plateTier10, plateTier10, @@ -279,42 +279,42 @@ public class RECIPES_MachineComponents { } private static void onlyMaxComponents(){ - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier10, wireTier10, rodTier10a, wireTier10, rodTier10b, wireTier10, rodTier10a, wireTier10, cableTier10, RECIPE_CONSTANTS.electricMotor_MAX); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier10, rotorTier10, itemRubberRing, craftingToolScrewdriver, pipeTier10, craftingToolWrench, itemRubberRing, RECIPE_CONSTANTS.electricMotor_MAX, cableTier10, RECIPE_CONSTANTS.electricPump_MAX); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier10, plateTier10, plateTier10, cableTier10, rodTier10a, rodTier10a, cableTier10, RECIPE_CONSTANTS.electricMotor_MAX, smallGearTier10, RECIPE_CONSTANTS.electricPiston_MAX); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( cableTier10, cableTier10, cableTier10, RECIPE_CONSTANTS.electricMotor_MAX, rodTier10a, RECIPE_CONSTANTS.electricMotor_MAX, RECIPE_CONSTANTS.electricPiston_MAX, circuitTier10, rodTier10a, RECIPE_CONSTANTS.robotArm_MAX); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateRubber, plateRubber, plateRubber, RECIPE_CONSTANTS.electricMotor_MAX, cableTier10, RECIPE_CONSTANTS.electricMotor_MAX, plateRubber, plateRubber, plateRubber, RECIPE_CONSTANTS.conveyorModule_MAX); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( rodTier10c, rodTier10c, circuitTier10, cableTier10, circuitTier9, rodTier10c, circuitTier10, cableTier10, rodTier10c, RECIPE_CONSTANTS.emitter_MAX); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier10, circuitTier10, wireTier10, circuitTier10, circuitTier9, circuitTier10, wireTier10, circuitTier10, wireTier10, RECIPE_CONSTANTS.fieldGenerator_MAX); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier10, null, circuitTier9, plateTier10, rodTier10c, null, circuitTier10, plateTier10, plateTier10, diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 09a7acbfd6..c8aa454e9a 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -4,8 +4,8 @@ import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; @@ -48,19 +48,23 @@ public class RECIPES_Machines { // static ItemStack RECIPE_IndustrialWireFactoryController = GregtechItemList.Industrial_WireFactory.get(1); static ItemStack RECIPE_IndustrialWireFactoryFrame = GregtechItemList.Casing_WireFactory.get(1); + //Industrial Coke Oven + static ItemStack RECIPE_IndustrialBlastSmelterController = GregtechItemList.Industrial_AlloyBlastSmelter.get(1); + static ItemStack RECIPE_IndustrialBlastSmelterFrame = GregtechItemList.Casing_BlastSmelter.get(1); + static ItemStack RECIPE_IndustrialBlastSmelterCoil = GregtechItemList.Casing_Coil_BlastSmelter.get(1); //Buffer Cores - static ItemStack RECIPE_BufferCore_ULV = UtilsItems.getItemStack("miscutils:item.itemBufferCore1", 1); - static ItemStack RECIPE_BufferCore_LV = UtilsItems.getItemStack("miscutils:item.itemBufferCore2", 1); - static ItemStack RECIPE_BufferCore_MV = UtilsItems.getItemStack("miscutils:item.itemBufferCore3", 1); - static ItemStack RECIPE_BufferCore_HV = UtilsItems.getItemStack("miscutils:item.itemBufferCore4", 1); - static ItemStack RECIPE_BufferCore_EV = UtilsItems.getItemStack("miscutils:item.itemBufferCore5", 1); - static ItemStack RECIPE_BufferCore_IV = UtilsItems.getItemStack("miscutils:item.itemBufferCore6", 1); - static ItemStack RECIPE_BufferCore_LuV = UtilsItems.getItemStack("miscutils:item.itemBufferCore7", 1); - static ItemStack RECIPE_BufferCore_ZPM = UtilsItems.getItemStack("miscutils:item.itemBufferCore8", 1); - static ItemStack RECIPE_BufferCore_UV = UtilsItems.getItemStack("miscutils:item.itemBufferCore9", 1); - static ItemStack RECIPE_BufferCore_MAX = UtilsItems.getItemStack("miscutils:item.itemBufferCore10", 1); + static ItemStack RECIPE_BufferCore_ULV = ItemUtils.getItemStack("miscutils:item.itemBufferCore1", 1); + static ItemStack RECIPE_BufferCore_LV = ItemUtils.getItemStack("miscutils:item.itemBufferCore2", 1); + static ItemStack RECIPE_BufferCore_MV = ItemUtils.getItemStack("miscutils:item.itemBufferCore3", 1); + static ItemStack RECIPE_BufferCore_HV = ItemUtils.getItemStack("miscutils:item.itemBufferCore4", 1); + static ItemStack RECIPE_BufferCore_EV = ItemUtils.getItemStack("miscutils:item.itemBufferCore5", 1); + static ItemStack RECIPE_BufferCore_IV = ItemUtils.getItemStack("miscutils:item.itemBufferCore6", 1); + static ItemStack RECIPE_BufferCore_LuV = ItemUtils.getItemStack("miscutils:item.itemBufferCore7", 1); + static ItemStack RECIPE_BufferCore_ZPM = ItemUtils.getItemStack("miscutils:item.itemBufferCore8", 1); + static ItemStack RECIPE_BufferCore_UV = ItemUtils.getItemStack("miscutils:item.itemBufferCore9", 1); + static ItemStack RECIPE_BufferCore_MAX = ItemUtils.getItemStack("miscutils:item.itemBufferCore10", 1); //Wire @@ -95,8 +99,8 @@ public class RECIPES_Machines { static String plateTier4 = "plateGold"; static String plateTier5 = "plateAluminium"; static String plateTier6 = "plateMaragingSteel250"; - static String plateTier7 = "plateTungsten"; - static String plateTier8 = "plateTungstenSteel"; + static String plateTier7 = "plateTantalloy61"; + static String plateTier8 = "plateInconel792"; static String plateTier9 = "plateZeron100"; static String plateTier10 = "plateNaquadahEnriched"; static String plateTier11 = "plateNeutronium"; @@ -108,12 +112,12 @@ public class RECIPES_Machines { static String rodTier4 = "stickGold"; static String rodTier5 = "stickAluminium"; static String rodTier6 = "stickMaragingSteel250"; - static String rodTier7 = "stickTungsten"; - static String rodTier8 = "stickTungstenSteel"; + static String rodTier7 = "stickTantalloy61"; + static String rodTier8 = "stickInconel792"; static String rodTier9 = "stickZeron100"; static String rodTier10 = "stickNaquadahEnriched"; static String rodTier11 = "stickNeutronium"; - + static String pipeTier1 = "pipeHuge"+"Potin"; static String pipeTier2 = "pipeHuge"+"Steel"; static String pipeTier3 = "pipeHuge"+"StainlessSteel"; @@ -173,7 +177,7 @@ public class RECIPES_Machines { //Lava Boiler static ItemStack boiler_Coal; - static ItemStack blockBricks = UtilsItems.getItemStack("minecraft:brick_block", 1); + static ItemStack blockBricks = ItemUtils.getItemStack("minecraft:brick_block", 1); //Batteries static String batteryBasic = "batteryBasic"; @@ -258,11 +262,11 @@ public class RECIPES_Machines { private static void initModItems(){ if (LoadedMods.IndustrialCraft2){ - IC2MFE = UtilsItems.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:blockElectric", "IC2_MFE", 1, 1); - IC2MFSU = UtilsItems.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:blockElectric", "IC2_MFSU", 2, 1); + IC2MFE = ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:blockElectric", "IC2_MFE", 1, 1); + IC2MFSU = ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:blockElectric", "IC2_MFSU", 2, 1); } if (LoadedMods.Gregtech){ - RECIPES_Shapeless.dustStaballoy = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, "gregtech:gt.metaitem.01", "Staballoy Dust", 2319, 2); + RECIPES_Shapeless.dustStaballoy = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, "gregtech:gt.metaitem.01", "Staballoy Dust", 2319, 2); machineCasing_ULV = ItemList.Casing_ULV.get(1); machineCasing_LV = ItemList.Casing_LV.get(1); machineCasing_MV = ItemList.Casing_MV.get(1); @@ -339,11 +343,11 @@ public class RECIPES_Machines { if(LoadedMods.Railcraft){ //Misc - INPUT_RCCokeOvenBlock = UtilsItems.getItemStackWithMeta(LoadedMods.Railcraft, "Railcraft:machine.alpha", "Coke_Oven_RC", 7, 1); + INPUT_RCCokeOvenBlock = ItemUtils.getItemStackWithMeta(LoadedMods.Railcraft, "Railcraft:machine.alpha", "Coke_Oven_RC", 7, 1); } if(LoadedMods.ImmersiveEngineering){ //Misc - INPUT_IECokeOvenBlock = UtilsItems.getItemStackWithMeta(LoadedMods.ImmersiveEngineering, "ImmersiveEngineering:stoneDecoration", "Coke_Oven_IE", 1, 1); + INPUT_IECokeOvenBlock = ItemUtils.getItemStackWithMeta(LoadedMods.ImmersiveEngineering, "ImmersiveEngineering:stoneDecoration", "Coke_Oven_IE", 1, 1); } runModRecipes(); } @@ -351,141 +355,141 @@ public class RECIPES_Machines { private static void runModRecipes(){ if (LoadedMods.Gregtech){ - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( ItemList.Electric_Piston_EV, GregtechOrePrefixes.circuit.get(Materials.Ultimate), ItemList.Electric_Piston_EV, ItemList.Electric_Motor_EV, machineCasing_EV, ItemList.Electric_Motor_EV, "gearGtTitanium", "cableGt02Aluminium", "gearGtTitanium", - UtilsItems.simpleMetaStack("gregtech:gt.blockmachines", 793, 1)); - UtilsRecipe.addShapedGregtechRecipe( + ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 793, 1)); + RecipeUtils.addShapedGregtechRecipe( ItemList.Electric_Piston_IV, GregtechOrePrefixes.circuit.get(GT_Materials.Symbiotic), ItemList.Electric_Piston_IV, ItemList.Electric_Motor_IV, machineCasing_IV, ItemList.Electric_Motor_IV, "gearGtTungstenSteel", "cableGt02Platinum", "gearGtTungstenSteel", - UtilsItems.simpleMetaStack("gregtech:gt.blockmachines", 794, 1)); - UtilsRecipe.addShapedGregtechRecipe( + ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 794, 1)); + RecipeUtils.addShapedGregtechRecipe( RECIPE_CONSTANTS.electricPiston_LuV, GregtechOrePrefixes.circuit.get(GT_Materials.Neutronic), RECIPE_CONSTANTS.electricPiston_LuV, RECIPE_CONSTANTS.electricMotor_LuV, machineCasing_LuV, RECIPE_CONSTANTS.electricMotor_LuV, "gearGtChrome", "cableGt02Tungsten", "gearGtChrome", - UtilsItems.simpleMetaStack("gregtech:gt.blockmachines", 795, 1)); + ItemUtils.simpleMetaStack("gregtech:gt.blockmachines", 795, 1)); //Buffer Core - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier1, cableTier1, plateTier1, circuitPrimitive, IC2MFE, circuitPrimitive, plateTier1, cableTier1, plateTier1, RECIPE_BufferCore_ULV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier2, cableTier2, plateTier2, circuitTier1, IC2MFE, circuitTier1, plateTier2, cableTier2, plateTier2, RECIPE_BufferCore_LV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier3, cableTier3, plateTier3, RECIPE_BufferCore_LV, circuitTier2, RECIPE_BufferCore_LV, plateTier3, cableTier3, plateTier3, RECIPE_BufferCore_MV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier4, cableTier4, plateTier4, RECIPE_BufferCore_MV, circuitTier3, RECIPE_BufferCore_MV, plateTier4, cableTier4, plateTier4, RECIPE_BufferCore_HV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier5, cableTier5, plateTier5, RECIPE_BufferCore_HV, circuitTier4, RECIPE_BufferCore_HV, plateTier5, cableTier5, plateTier5, RECIPE_BufferCore_EV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier6, cableTier6, plateTier6, RECIPE_BufferCore_EV, circuitTier5, RECIPE_BufferCore_EV, plateTier6, cableTier6, plateTier6, RECIPE_BufferCore_IV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier7, cableTier7, plateTier7, RECIPE_BufferCore_IV, circuitTier6, RECIPE_BufferCore_IV, plateTier7, cableTier7, plateTier7, RECIPE_BufferCore_LuV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier8, cableTier8, plateTier8, RECIPE_BufferCore_LuV, circuitTier7, RECIPE_BufferCore_LuV, plateTier8, cableTier8, plateTier8, RECIPE_BufferCore_ZPM); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier9, cableTier9, plateTier9, RECIPE_BufferCore_ZPM, circuitTier8, RECIPE_BufferCore_ZPM, plateTier9, cableTier9, plateTier9, RECIPE_BufferCore_UV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier10, cableTier10, plateTier10, RECIPE_BufferCore_UV, circuitTier9, RECIPE_BufferCore_UV, plateTier10, cableTier10, plateTier10, RECIPE_BufferCore_MAX); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier1, RECIPE_BufferCore_ULV, wireTier1, wireTier1, machineCasing_ULV, wireTier1, circuitPrimitive, circuitTier1, circuitPrimitive, RECIPE_Buffer_ULV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier2, RECIPE_BufferCore_LV, wireTier2, wireTier2, machineCasing_LV, wireTier2, circuitTier1, RECIPE_BufferCore_LV, circuitTier1, RECIPE_Buffer_LV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier3, RECIPE_BufferCore_MV, wireTier3, wireTier3, machineCasing_MV, wireTier3, circuitTier2, RECIPE_BufferCore_MV, circuitTier2, RECIPE_Buffer_MV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier4, RECIPE_BufferCore_HV, wireTier4, wireTier4, machineCasing_HV, wireTier4, circuitTier3, RECIPE_BufferCore_HV, circuitTier3, RECIPE_Buffer_HV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier5, RECIPE_BufferCore_EV, wireTier5, wireTier5, machineCasing_EV, wireTier5, circuitTier4, RECIPE_BufferCore_EV, circuitTier4, RECIPE_Buffer_EV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier6, RECIPE_BufferCore_IV, wireTier6, wireTier6, machineCasing_IV, wireTier6, circuitTier5, RECIPE_BufferCore_IV, circuitTier5, RECIPE_Buffer_IV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier7, RECIPE_BufferCore_LuV, wireTier7, wireTier7, machineCasing_LuV, wireTier7, circuitTier6, RECIPE_BufferCore_LuV, circuitTier6, RECIPE_Buffer_LuV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier8, RECIPE_BufferCore_ZPM, wireTier8, wireTier8, machineCasing_ZPM, wireTier8, circuitTier7, RECIPE_BufferCore_ZPM, circuitTier7, RECIPE_Buffer_ZPM); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( wireTier9, RECIPE_BufferCore_UV, wireTier9, wireTier9, machineCasing_UV, wireTier9, circuitTier8, RECIPE_BufferCore_UV, circuitTier8, RECIPE_Buffer_UV); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier11, RECIPE_BufferCore_MAX, plateTier11, wireTier10, machineCasing_MAX, wireTier10, circuitTier9, RECIPE_BufferCore_MAX, circuitTier9, RECIPE_Buffer_MAX); //Steam Condenser - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( pipeLargeCopper, pipeHugeSteel, pipeLargeCopper, plateEnergeticAlloy, electricPump_HV, plateEnergeticAlloy, plateEnergeticAlloy, pipeLargeCopper, plateEnergeticAlloy, RECIPE_SteamCondenser); //Iron BF - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( "plateDoubleAnyIron", "craftingFurnace", "plateDoubleAnyIron", boiler_Coal, machineCasing_ULV, boiler_Coal, "plateDoubleAnyIron", "bucketLava", "plateDoubleAnyIron", RECIPE_IronBlastFurnace); //Iron plated Bricks - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( "plateAnyIron", RECIPES_Tools.craftingToolHardHammer, "plateAnyIron", "plateAnyIron", blockBricks, "plateAnyIron", "plateAnyIron", RECIPES_Tools.craftingToolWrench, "plateAnyIron", @@ -503,15 +507,15 @@ public class RECIPES_Machines { machineCasing_EV, IV_MACHINE_Electrolyzer, machineCasing_EV, "plateStellite", "rotorStellite", "plateStellite", RECIPE_IndustrialCentrifugeController);*/ - + //Industrial Centrifuge - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( circuitTier6, pipeHugeStainlessSteel, circuitTier6, plateTier6, IV_MACHINE_Centrifuge, plateTier6, plateTier8, machineCasing_IV, plateTier8, RECIPE_IndustrialCentrifugeController); //Centrifuge Casing - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier6, "stickTumbaga", plateTier6, plateTier8, "stickTumbaga", plateTier8, plateTier6, "stickTumbaga", plateTier6, @@ -519,7 +523,7 @@ public class RECIPES_Machines { if (LoadedMods.Railcraft){ //Industrial Coke Oven - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateCobalt, circuitTier4, plateCobalt, machineCasing_HV, INPUT_RCCokeOvenBlock, machineCasing_HV, plateCobalt, circuitTier5, plateCobalt, @@ -527,138 +531,161 @@ public class RECIPES_Machines { } if (LoadedMods.ImmersiveEngineering){ //Industrial Coke Oven - UtilsRecipe.addShapedGregtechRecipe( - plateCobalt, circuitTier4, plateCobalt, + RecipeUtils.addShapedGregtechRecipe( + plateTier8, circuitTier4, plateTier8, machineCasing_HV, INPUT_IECokeOvenBlock, machineCasing_HV, - plateCobalt, circuitTier5, plateCobalt, + plateTier8, circuitTier3, plateTier8, RECIPE_IndustrialCokeOvenController); } //Coke Oven Frame Casing - UtilsRecipe.addShapedGregtechRecipe( - plateTier8, rodTier8, plateTier8, - rodTier8, "frameGtTantalloy61", rodTier8, - plateTier8, rodTier8, plateTier8, + RecipeUtils.addShapedGregtechRecipe( + plateTier7, rodTier7, plateTier7, + rodTier7, "frameGtTantalloy61", rodTier7, + plateTier7, rodTier7, plateTier7, RECIPE_IndustrialCokeOvenFrame); //Coke Oven Coil 1 - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateBronze, plateBronze, plateBronze, "frameGtBronze", gearboxCasing_Tier_1, "frameGtBronze", plateBronze, plateBronze, plateBronze, RECIPE_IndustrialCokeOvenCasingA); //Coke Oven Coil 2 - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateSteel, plateSteel, plateSteel, "frameGtSteel", gearboxCasing_Tier_2, "frameGtSteel", plateSteel, plateSteel, plateSteel, RECIPE_IndustrialCokeOvenCasingB); //Electrolyzer Frame Casing - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( "platePotin", "stickLongChrome", "platePotin", "stickLongPotin", "frameGtPotin", "stickLongPotin", "platePotin", "stickLongPotin", "platePotin", RECIPE_IndustrialElectrolyzerFrame); //Industrial Electrolyzer - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( "plateStellite", circuitTier6, "plateStellite", machineCasing_EV, IV_MACHINE_Electrolyzer, machineCasing_EV, "plateStellite", "rotorStellite", "plateStellite", RECIPE_IndustrialElectrolyzerController); //Material Press Frame Casing - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( "plateTitanium", "stickLongTumbaga", "plateTitanium", "stickTantalloy60", "frameGtTumbaga", "stickTantalloy60", "plateTitanium", "stickLongTumbaga", "plateTitanium", RECIPE_IndustrialMaterialPressFrame); //Industrial Material Press - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( "plateTitanium", circuitTier5, "plateTitanium", machineCasing_EV, IV_MACHINE_BendingMachine, machineCasing_EV, "plateTitanium", circuitTier5, "plateTitanium", RECIPE_IndustrialMaterialPressController); //Maceration Frame Casing - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( "platePalladium", "platePalladium", "platePalladium", "stickPlatinum", "frameGtInconel625", "stickPlatinum", "platePalladium", "stickLongPalladium", "platePalladium", RECIPE_IndustrialMacerationStackFrame); //Industrial Maceration stack - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( "plateTungstenCarbide", IV_MACHINE_Macerator, "plateTungstenCarbide", IV_MACHINE_Macerator, circuitTier8, IV_MACHINE_Macerator, "plateTungstenCarbide", machineCasing_IV, "plateTungstenCarbide", RECIPE_IndustrialMacerationStackController); //Wire Factory Frame Casing - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( "plateBlueSteel", "stickBlueSteel", "plateBlueSteel", "stickBlueSteel", "frameGtBlueSteel", "stickBlueSteel", "plateBlueSteel", "stickBlueSteel", "plateBlueSteel", RECIPE_IndustrialWireFactoryFrame); //Industrial Wire Factory - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( "plateZeron100", machineCasing_IV, "plateZeron100", circuitTier6, IV_MACHINE_Wiremill, circuitTier6, "plateZeron100", machineCasing_IV, "plateZeron100", RECIPE_IndustrialWireFactoryController); - - - + + + //Tiered Tanks - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier1, plateTier1, plateTier1, plateTier1, pipeTier1, plateTier1, plateTier1, GregtechItemList.Fluid_Cell_144L.get(1), plateTier1, GregtechItemList.GT_FluidTank_ULV.get(1)); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier2, plateTier2, plateTier2, plateTier2, pipeTier2, plateTier2, plateTier2, electricPump_LV, plateTier2, GregtechItemList.GT_FluidTank_LV.get(1)); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier3, plateTier3, plateTier3, plateTier3, pipeTier3, plateTier3, plateTier3, electricPump_MV, plateTier3, GregtechItemList.GT_FluidTank_MV.get(1)); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier4, plateTier4, plateTier4, plateTier4, pipeTier4, plateTier4, plateTier4, electricPump_HV, plateTier4, GregtechItemList.GT_FluidTank_HV.get(1)); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier5, plateTier5, plateTier5, plateTier5, pipeTier5, plateTier5, plateTier5, electricPump_EV, plateTier5, GregtechItemList.GT_FluidTank_EV.get(1)); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier6, plateTier6, plateTier6, plateTier6, pipeTier6, plateTier6, plateTier6, electricPump_IV, plateTier6, GregtechItemList.GT_FluidTank_IV.get(1)); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier7, plateTier7, plateTier7, plateTier7, pipeTier7, plateTier7, plateTier7, RECIPE_CONSTANTS.electricPump_LuV, plateTier7, GregtechItemList.GT_FluidTank_LuV.get(1)); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier8, plateTier8, plateTier8, plateTier8, pipeTier8, plateTier8, plateTier8, RECIPE_CONSTANTS.electricPump_ZPM, plateTier8, GregtechItemList.GT_FluidTank_ZPM.get(1)); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier9, plateTier9, plateTier9, plateTier9, pipeTier9, plateTier9, plateTier9, RECIPE_CONSTANTS.electricPump_UV, plateTier9, GregtechItemList.GT_FluidTank_UV.get(1)); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( plateTier10, plateTier10, plateTier10, plateTier10, pipeTier10, plateTier10, plateTier10, RECIPE_CONSTANTS.electricPump_MAX, plateTier10, GregtechItemList.GT_FluidTank_MAX.get(1)); + + + + //Blast Smelter + RecipeUtils.addShapedGregtechRecipe( + "plateZirconiumCarbide", circuitTier4, "plateZirconiumCarbide", + cableTier4, machineCasing_EV, cableTier4, + "plateZirconiumCarbide", circuitTier3, "plateZirconiumCarbide", + RECIPE_IndustrialBlastSmelterController); + //Blast Smelter Frame Casing + RecipeUtils.addShapedGregtechRecipe( + "plateZirconiumCarbide", rodTier5, "plateZirconiumCarbide", + rodTier5, "frameGtTumbaga", rodTier5, + "plateZirconiumCarbide", rodTier5, "plateZirconiumCarbide", + RECIPE_IndustrialBlastSmelterFrame); + //Blast Smelter Coil + RecipeUtils.addShapedGregtechRecipe( + "plateStaballoy", "plateStaballoy", "plateStaballoy", + "frameGtStaballoy", gearboxCasing_Tier_3, "frameGtStaballoy", + "plateStaballoy", "plateStaballoy", "plateStaballoy", + RECIPE_IndustrialBlastSmelterCoil); + + } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java index 2a79aa92c9..fa11783f70 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Shapeless.java @@ -3,7 +3,7 @@ package gtPlusPlus.core.recipe; import gregtech.api.enums.ItemList; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.ItemStack; public class RECIPES_Shapeless { @@ -31,12 +31,12 @@ public class RECIPES_Shapeless { if (LoadedMods.Gregtech){ gearboxCasing_Tier_1 = ItemList.Casing_Gearbox_Bronze.get(1); - UtilsRecipe.shapelessBuilder(dustStaballoy, + RecipeUtils.shapelessBuilder(dustStaballoy, "dustTitanium", "dustUranium", "dustUranium", "dustUranium", "dustUranium", "dustUranium", "dustUranium", "dustUranium", "dustUranium"); - UtilsRecipe.shapelessBuilder(gearboxCasing_Tier_1, + RecipeUtils.shapelessBuilder(gearboxCasing_Tier_1, circuitPrimitive, circuitPrimitive, circuitPrimitive, circuitPrimitive, circuitPrimitive, circuitPrimitive, circuitPrimitive, circuitPrimitive, circuitPrimitive); diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java index 91337d3e0f..17fa4ef93d 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Tools.java @@ -2,8 +2,8 @@ package gtPlusPlus.core.recipe; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -119,7 +119,7 @@ public class RECIPES_Tools { public static ItemStack sandHammer = new ItemStack (ModItems.itemSandstoneHammer, 1, OreDictionary.WILDCARD_VALUE); public static String craftingToolSandHammer = "craftingToolSandHammer"; - public static ItemStack personalCloakingDevice = UtilsItems.getSimpleStack(ModItems.itemPersonalCloakingDevice); + public static ItemStack personalCloakingDevice = ItemUtils.getSimpleStack(ModItems.itemPersonalCloakingDevice); public static String plateDoubleNiChrome = "plateDoubleNichrome"; public static String plateIridiumAlloy = "plateAlloyIridium"; @@ -132,21 +132,21 @@ public class RECIPES_Tools { private static void run(){ //Staballoy Pickaxe - UtilsRecipe.recipeBuilder( + RecipeUtils.recipeBuilder( plateStaballoy, plateStaballoy, ingotStaballoy, craftingToolFile, stickTungsten, craftingToolHardHammer, craftingToolWrench, stickTungsten, craftingToolHardHammer, RECIPE_StaballoyPickaxe); //Staballoy Axe - UtilsRecipe.recipeBuilder( + RecipeUtils.recipeBuilder( plateStaballoy, ingotStaballoy, craftingToolHardHammer, plateStaballoy, stickTungsten, craftingToolHardHammer, craftingToolFile, stickTungsten, craftingToolWrench, RECIPE_StaballoyAxe); //Cobble to Sand - UtilsRecipe.recipeBuilder( + RecipeUtils.recipeBuilder( CobbleStone, CobbleStone, CobbleStone, CobbleStone, sandHammer, CobbleStone, CobbleStone, CobbleStone, CobbleStone, @@ -154,7 +154,7 @@ public class RECIPES_Tools { if (LoadedMods.Baubles){ //Cloaking Device - UtilsRecipe.recipeBuilder( + RecipeUtils.recipeBuilder( plateDoubleNiChrome, plateIridiumAlloy, plateDoubleNiChrome, plateIridiumAlloy, batteryUltimate, plateIridiumAlloy, plateDoubleNiChrome, plateIridiumAlloy, plateDoubleNiChrome, @@ -162,14 +162,14 @@ public class RECIPES_Tools { } //Sand to Sandstone - UtilsRecipe.recipeBuilder( + RecipeUtils.recipeBuilder( Sand, Sand, Sand, Sand, sandHammer, Sand, Sand, Sand, Sand, RECIPE_SandStone); //Sandstone Hammer - UtilsRecipe.recipeBuilder( + RecipeUtils.recipeBuilder( plateElectrum, ingotElectrum, plateElectrum, craftingToolScrewdriver, stickBronze, craftingToolHardHammer, null, stickSteel, null, diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java b/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java index 80ee79e292..440f8815bc 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPE_Batteries.java @@ -2,8 +2,8 @@ package gtPlusPlus.core.recipe; import gregtech.api.enums.ItemList; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.item.UtilsItems; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.recipe.RecipeUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.item.ItemStack; @@ -12,9 +12,9 @@ public class RECIPE_Batteries { static ItemStack RECIPE_Battery_Sodium = GregtechItemList.Battery_RE_EV_Sodium.get(1); static ItemStack RECIPE_Battery_Cadmium = GregtechItemList.Battery_RE_EV_Cadmium.get(1); static ItemStack RECIPE_Battery_Lithium = GregtechItemList.Battery_RE_EV_Lithium.get(1); - static ItemStack GT_Battery_Sodium = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32539, 1); - static ItemStack GT_Battery_Cadmium = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32537, 1); - static ItemStack GT_Battery_Lithium = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32538, 1); + static ItemStack GT_Battery_Sodium = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32539, 1); + static ItemStack GT_Battery_Cadmium = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32537, 1); + static ItemStack GT_Battery_Lithium = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32538, 1); static ItemStack machineTransformer_EV; public static void RECIPES_LOAD(){ @@ -28,17 +28,17 @@ public class RECIPE_Batteries { private static void run(){ - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( GT_Battery_Sodium, RECIPES_Machines.cableTier4, GT_Battery_Sodium, RECIPES_Machines.circuitTier3, machineTransformer_EV, RECIPES_Machines.circuitTier3, GT_Battery_Sodium, RECIPES_Machines.cableTier4, GT_Battery_Sodium, RECIPE_Battery_Sodium); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( GT_Battery_Cadmium, RECIPES_Machines.cableTier4, GT_Battery_Cadmium, RECIPES_Machines.circuitTier3, machineTransformer_EV, RECIPES_Machines.circuitTier3, GT_Battery_Cadmium, RECIPES_Machines.cableTier4, GT_Battery_Cadmium, RECIPE_Battery_Cadmium); - UtilsRecipe.addShapedGregtechRecipe( + RecipeUtils.addShapedGregtechRecipe( GT_Battery_Lithium, RECIPES_Machines.cableTier4, GT_Battery_Lithium, RECIPES_Machines.circuitTier3, machineTransformer_EV, RECIPES_Machines.circuitTier3, GT_Battery_Lithium, RECIPES_Machines.cableTier4, GT_Battery_Lithium, diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPE_CONSTANTS.java b/src/Java/gtPlusPlus/core/recipe/RECIPE_CONSTANTS.java index b294dd9cef..c0548e9e74 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPE_CONSTANTS.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPE_CONSTANTS.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.recipe; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.item.ItemStack; @@ -52,30 +52,30 @@ public class RECIPE_CONSTANTS { private static void registerGTExperimentalComponents(){ //Machine Components - electricMotor_LuV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32606, 1); - electricMotor_ZPM = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32607, 1); - electricMotor_UV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32608, 1); - electricPump_LuV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32620, 1); - electricPump_ZPM = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32621, 1); - electricPump_UV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32622, 1); - electricPiston_LuV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32645, 1); - electricPiston_ZPM = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32646, 1); - electricPiston_UV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32647, 1); - robotArm_LuV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32655, 1); - robotArm_ZPM = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32656, 1); - robotArm_UV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32657, 1); - conveyorModule_LuV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32636, 1); - conveyorModule_ZPM = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32637, 1); - conveyorModule_UV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32638, 1); - emitter_LuV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32685, 1); - emitter_ZPM = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32686, 1); - emitter_UV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32687, 1); - fieldGenerator_LuV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32675, 1); - fieldGenerator_ZPM = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32676, 1); - fieldGenerator_UV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32677, 1); - sensor_LuV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32695, 1); - sensor_ZPM = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32696, 1); - sensor_UV = UtilsItems.simpleMetaStack("gregtech:gt.metaitem.01", 32697, 1); + electricMotor_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32606, 1); + electricMotor_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32607, 1); + electricMotor_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32608, 1); + electricPump_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32620, 1); + electricPump_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32621, 1); + electricPump_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32622, 1); + electricPiston_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32645, 1); + electricPiston_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32646, 1); + electricPiston_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32647, 1); + robotArm_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32655, 1); + robotArm_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32656, 1); + robotArm_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32657, 1); + conveyorModule_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32636, 1); + conveyorModule_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32637, 1); + conveyorModule_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32638, 1); + emitter_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32685, 1); + emitter_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32686, 1); + emitter_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32687, 1); + fieldGenerator_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32675, 1); + fieldGenerator_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32676, 1); + fieldGenerator_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32677, 1); + sensor_LuV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32695, 1); + sensor_ZPM = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32696, 1); + sensor_UV = ItemUtils.simpleMetaStack("gregtech:gt.metaitem.01", 32697, 1); //Max Tier Components Blood Never added... Useless, lol. electricMotor_MAX = GregtechItemList.Electric_Motor_MAX.get(1); diff --git a/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java b/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java index c6dc1ede1b..348f9907c0 100644 --- a/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java +++ b/src/Java/gtPlusPlus/core/recipe/ShapedRecipeObject.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.recipe; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.recipe.UtilsRecipe; +import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.ItemStack; public class ShapedRecipeObject { @@ -36,7 +36,7 @@ public class ShapedRecipeObject { } public void buildRecipe(){ - UtilsRecipe.recipeBuilder(object_A, object_B, object_C, object_D, object_E, object_F, object_G, object_H, object_I, object_OUTPUT); + RecipeUtils.recipeBuilder(object_A, object_B, object_C, object_D, object_E, object_F, object_G, object_H, object_I, object_OUTPUT); } } diff --git a/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java new file mode 100644 index 0000000000..3c5c30966e --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotBlueprint.java @@ -0,0 +1,30 @@ +package gtPlusPlus.core.slots; + +import gtPlusPlus.core.interfaces.IItemBlueprint; +import gtPlusPlus.core.util.Utils; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotBlueprint extends Slot{ + + public SlotBlueprint(IInventory inventory, int x, int y, int z) { + super(inventory, x, y, z); + } + + @Override + public boolean isItemValid(ItemStack itemstack) { + if (itemstack.getItem() instanceof IItemBlueprint){ + Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Blueprint."); + return true; + } + Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Blueprint."); + return false; + } + + @Override + public int getSlotStackLimit() { + return 1; + } + +} diff --git a/src/Java/gtPlusPlus/core/slots/SlotGeneric.java b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java new file mode 100644 index 0000000000..bf7dc1fff5 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotGeneric.java @@ -0,0 +1,24 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotGeneric extends Slot{ + + public SlotGeneric(IInventory inventory, int x, int y, int z) { + super(inventory, x, y, z); + + } + + @Override + public boolean isItemValid(ItemStack itemstack) { + return true; + } + + @Override + public int getSlotStackLimit() { + return 64; + } + +} diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java new file mode 100644 index 0000000000..461fa6ff04 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java @@ -0,0 +1,98 @@ +package gtPlusPlus.core.slots; + +import gregtech.api.items.GT_MetaGenerated_Tool; +import gtPlusPlus.core.util.Utils; +import ic2.api.info.Info; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + +public class SlotGtToolElectric extends SlotGtTool { + public int tier; + private ItemStack content; + + public SlotGtToolElectric(IInventory base, int x, int y, int z, int tier, boolean allowRedstoneDust) + { + super(base, x, y, z); + this.tier = tier; + this.allowRedstoneDust = allowRedstoneDust; + } + + public boolean accepts(ItemStack stack) + { + if (stack == null) { + return false; + } + if ((stack.getItem() == Items.redstone) && (!this.allowRedstoneDust)) { + return false; + } + return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), this.tier, true, true, true) > 0.0D); + } + + public double discharge(double amount, boolean ignoreLimit) + { + if (amount <= 0.0D) { + throw new IllegalArgumentException("Amount must be > 0."); + } + ItemStack stack = get(0); + if (stack == null) { + return 0.0D; + } + double realAmount = ElectricItem.manager.discharge(stack, amount, this.tier, ignoreLimit, true, false); + if (realAmount <= 0.0D) + { + realAmount = Info.itemEnergy.getEnergyValue(stack); + if (realAmount <= 0.0D) { + return 0.0D; + } + stack.stackSize -= 1; + if (stack.stackSize <= 0) { + put(0, null); + } + } + return realAmount; + } + + public void setTier(int tier1) + { + this.tier = tier1; + } + + public boolean allowRedstoneDust = true; + + public ItemStack get() + { + return get(0); + } + + public ItemStack get(int index) + { + return this.content; + } + + public void put(ItemStack content) + { + put(0, content); + } + + public void put(int index, ItemStack content) + { + this.content = content; + onChanged(); + } + + public void onChanged() {} + + @Override + public boolean isItemValid(ItemStack itemstack) { + if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem){ + Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Tool."); + return true; + } + Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool."); + return false; + } + +} diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java new file mode 100644 index 0000000000..fe51631a5d --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java @@ -0,0 +1,23 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotNoInput extends Slot{ + + public SlotNoInput(IInventory inventory, int x, int y, int z) { + super(inventory, x, y, z); + } + + @Override + public boolean isItemValid(ItemStack itemstack) { + return false; + } + + @Override + public int getSlotStackLimit() { + return 0; + } + +} diff --git a/src/Java/gtPlusPlus/core/slots/SlotOutput.java b/src/Java/gtPlusPlus/core/slots/SlotOutput.java new file mode 100644 index 0000000000..a0f895d554 --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotOutput.java @@ -0,0 +1,101 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; +import cpw.mods.fml.common.FMLCommonHandler; + +public class SlotOutput extends SlotCrafting{ + + private final IInventory craftMatrix; + private final EntityPlayer thePlayer; + private int amountCrafted; + + + public SlotOutput(EntityPlayer player, InventoryCrafting craftingInventory, IInventory p_i45790_3_, int slotIndex, int xPosition, int yPosition) + { + super(player, craftingInventory, p_i45790_3_, slotIndex, xPosition, yPosition); + this.thePlayer = player; + this.craftMatrix = craftingInventory; + } + /** + * Check if the stack is a valid item for this slot. Always true beside for the armor slots. + */ + @Override + public boolean isItemValid(ItemStack par1ItemStack) + { + return false; + } + /** + * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new + * stack. + */ + @Override + public ItemStack decrStackSize(int par1) + { + if (this.getHasStack()) + { + this.amountCrafted += Math.min(par1, this.getStack().stackSize); + } + return super.decrStackSize(par1); + } + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. Typically increases an + * internal count then calls onCrafting(item). + */ + @Override + protected void onCrafting(ItemStack par1ItemStack, int par2) + { + this.amountCrafted += par2; + this.onCrafting(par1ItemStack); + } + /** + * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood. + */ + @Override + protected void onCrafting(ItemStack stack) + { + stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); + this.amountCrafted = 0; + } + + @Override + public void onPickupFromSlot(EntityPlayer playerIn, ItemStack stack) + { + { + FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix); + this.onCrafting(stack); + for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i) + { + ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i); + if (itemstack1 != null) + { + this.craftMatrix.decrStackSize(i, 1); + if (itemstack1.getItem().hasContainerItem(itemstack1)) + { + ItemStack itemstack2 = itemstack1.getItem().getContainerItem(itemstack1); + if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage()) + { + MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2)); + itemstack2 = null; + } + if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2)) + { + if (this.craftMatrix.getStackInSlot(i) == null) + { + this.craftMatrix.setInventorySlotContents(i, itemstack2); + } + else + { + this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false); + } + } + } + } + } + } + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java index 2028e19787..a228021c82 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.tileentities; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; +import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; import gtPlusPlus.core.util.Utils; import cpw.mods.fml.common.registry.GameRegistry; @@ -15,6 +16,7 @@ public class ModTileEntities { //GameRegistry.registerTileEntity(TileEntityCharger.class, "TE_Charger"); // GameRegistry.registerTileEntity(TileEntityHeliumGenerator.class, "Helium"); GameRegistry.registerTileEntity(TileEntityWorkbench.class, "TileWorkbench"); + GameRegistry.registerTileEntity(TileEntityWorkbenchAdvanced.class, "TileWorkbenchAdvanced"); } } diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java index 49ade0a10a..9cbd963572 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java @@ -1,49 +1,174 @@ package gtPlusPlus.core.tileentities.machines; import gtPlusPlus.core.inventories.InventoryWorkbenchChest; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloCrafting; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots; import gtPlusPlus.core.inventories.InventoryWorkbenchTools; +import ic2.api.network.INetworkDataProvider; +import ic2.api.network.INetworkUpdateListener; +import ic2.api.tile.IWrenchable; +import ic2.core.IC2; +import ic2.core.network.NetworkManager; + +import java.util.List; +import java.util.Vector; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryCraftResult; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -public class TileEntityWorkbench extends TileEntity { +public class TileEntityWorkbench extends TileEntity implements INetworkDataProvider, INetworkUpdateListener, IWrenchable{ + + //Credit to NovaViper in http://www.minecraftforge.net/forum/index.php?topic=26439.0 - Helped me restructure my Inventory system and now the crafting matrix works better. public InventoryWorkbenchChest inventoryChest; public InventoryWorkbenchTools inventoryTool; - //public InventoryWorkbenchCrafting inventoryCrafting; - + public InventoryWorkbenchHoloSlots inventoryHolo; + public InventoryWorkbenchHoloCrafting inventoryCrafting; + + public IInventory inventoryCraftResult = new InventoryCraftResult(); + public TileEntityWorkbench(){ this.inventoryTool = new InventoryWorkbenchTools();//number of slots - without product slot this.inventoryChest = new InventoryWorkbenchChest();//number of slots - without product slot + this.inventoryHolo = new InventoryWorkbenchHoloSlots(); + this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); this.canUpdate(); } - + @SuppressWarnings("static-method") public NBTTagCompound getTag(NBTTagCompound nbt, String tag) - { - if(!nbt.hasKey(tag)) - { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - inventoryChest.writeToNBT(getTag(nbt, "ContentsChest")); - inventoryTool.writeToNBT(getTag(nbt, "ContentsTools")); - //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); - - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); - inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); - //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); - } + { + if(!nbt.hasKey(tag)) + { + nbt.setTag(tag, new NBTTagCompound()); + } + return nbt.getCompoundTag(tag); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) + { + super.writeToNBT(nbt); + + nbt.setShort("facing", this.facing); + + inventoryChest.writeToNBT(getTag(nbt, "ContentsChest")); + inventoryTool.writeToNBT(getTag(nbt, "ContentsTools")); + //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); + inventoryHolo.writeToNBT(getTag(nbt, "ContentsHolo")); + + // Write Crafting Matrix to NBT + NBTTagList craftingTag = new NBTTagList(); + for (int currentIndex = 0; currentIndex < inventoryCrafting.getSizeInventory(); ++currentIndex) { + if (inventoryCrafting.getStackInSlot(currentIndex) != null) { + NBTTagCompound tagCompound = new NBTTagCompound(); + tagCompound.setByte("Slot", (byte) currentIndex); + inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound); + craftingTag.appendTag(tagCompound); + } + } + + nbt.setTag("CraftingMatrix", craftingTag); + // Write craftingResult to NBT + if (inventoryCraftResult.getStackInSlot(0) != null) + nbt.setTag("CraftingResult", inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound())); + + } + + @Override + public void readFromNBT(NBTTagCompound nbt) + { + super.readFromNBT(nbt); + + this.prevFacing = (this.facing = nbt.getShort("facing")); + + inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); + inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); + //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); + inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); + + // Read in the Crafting Matrix from NBT + NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10); + inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number + for (int i = 0; i < craftingTag.tagCount(); ++i) { + NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i); + byte slot = tagCompound.getByte("Slot"); + if (slot >= 0 && slot < inventoryCrafting.getSizeInventory()) { + inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound)); + } + } + + + // Read craftingResult from NBT + NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult"); + inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult)); + + } + + @Override + public List<String> getNetworkedFields(){ + List<String> ret = new Vector(2); + ret.add("facing"); + return ret; + } + + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) + { + return false; + } + + private short facing = 0; + public short prevFacing = 0; + + @Override + public void setFacing(short facing1) + { + this.facing = facing1; + if (this.prevFacing != facing1) { + ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "facing"); + } + this.prevFacing = facing1; + } + + @Override + public short getFacing() + { + return this.facing; + } + + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) + { + return true; + } + + @Override + public float getWrenchDropRate() + { + return 1.0F; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) + { + return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); + } + + @Override + public void onNetworkUpdate(String field) { + + this.prevFacing = this.facing; + + } + + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java new file mode 100644 index 0000000000..63770a6efd --- /dev/null +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java @@ -0,0 +1,249 @@ +package gtPlusPlus.core.tileentities.machines; + +import gtPlusPlus.core.inventories.InventoryWorkbenchChest; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloCrafting; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots; +import gtPlusPlus.core.inventories.InventoryWorkbenchToolsElectric; +import ic2.api.energy.event.EnergyTileLoadEvent; +import ic2.api.energy.event.EnergyTileUnloadEvent; +import ic2.api.energy.tile.IEnergySink; +import ic2.api.network.INetworkDataProvider; +import ic2.api.network.INetworkUpdateListener; +import ic2.api.tile.IWrenchable; +import ic2.core.IC2; +import ic2.core.network.NetworkManager; + +import java.util.List; +import java.util.Vector; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryCraftResult; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.util.ForgeDirection; + +public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySink, INetworkDataProvider, INetworkUpdateListener, IWrenchable{ + + //Credit to NovaViper in http://www.minecraftforge.net/forum/index.php?topic=26439.0 - Helped me restructure my Inventory system and now the crafting matrix works better. + + public InventoryWorkbenchChest inventoryChest; + public InventoryWorkbenchToolsElectric inventoryTool; + public InventoryWorkbenchHoloSlots inventoryHolo; + public InventoryWorkbenchHoloCrafting inventoryCrafting; + + public IInventory inventoryCraftResult = new InventoryCraftResult(); + + //Wrench Code + private short facing = 0; + public short prevFacing = 0; + + //E-Net Code + public double energy = 0.0D; + public int maxEnergy; + private boolean addedToEnergyNet = false; + private int tier; + private float guiChargeLevel; + + + public TileEntityWorkbenchAdvanced(int maxenergy, int tier1){ + this.inventoryTool = new InventoryWorkbenchToolsElectric();//number of slots - without product slot + this.inventoryChest = new InventoryWorkbenchChest();//number of slots - without product slot + this.inventoryHolo = new InventoryWorkbenchHoloSlots(); + this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); + this.canUpdate(); + + //Electric Stats + this.maxEnergy = maxenergy; + this.tier = tier1; + + } + + @SuppressWarnings("static-method") + public NBTTagCompound getTag(NBTTagCompound nbt, String tag) + { + if(!nbt.hasKey(tag)) + { + nbt.setTag(tag, new NBTTagCompound()); + } + return nbt.getCompoundTag(tag); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) + { + super.writeToNBT(nbt); + nbt.setDouble("energy", this.energy); + nbt.setShort("facing", this.facing); + + inventoryChest.writeToNBT(getTag(nbt, "ContentsChest")); + inventoryTool.writeToNBT(getTag(nbt, "ContentsTools")); + //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); + inventoryHolo.writeToNBT(getTag(nbt, "ContentsHolo")); + + // Write Crafting Matrix to NBT + NBTTagList craftingTag = new NBTTagList(); + for (int currentIndex = 0; currentIndex < inventoryCrafting.getSizeInventory(); ++currentIndex) { + if (inventoryCrafting.getStackInSlot(currentIndex) != null) { + NBTTagCompound tagCompound = new NBTTagCompound(); + tagCompound.setByte("Slot", (byte) currentIndex); + inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound); + craftingTag.appendTag(tagCompound); + } + } + + nbt.setTag("CraftingMatrix", craftingTag); + // Write craftingResult to NBT + if (inventoryCraftResult.getStackInSlot(0) != null) + nbt.setTag("CraftingResult", inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound())); + + } + + @Override + public void readFromNBT(NBTTagCompound nbt) + { + super.readFromNBT(nbt); + this.energy = nbt.getDouble("energy"); + + this.prevFacing = (this.facing = nbt.getShort("facing")); + + inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); + inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); + //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); + inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); + + // Read in the Crafting Matrix from NBT + NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10); + inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number + for (int i = 0; i < craftingTag.tagCount(); ++i) { + NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i); + byte slot = tagCompound.getByte("Slot"); + if (slot >= 0 && slot < inventoryCrafting.getSizeInventory()) { + inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound)); + } + } + + + // Read craftingResult from NBT + NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult"); + inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult)); + + } + + @Override + public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) + { + return true; + } + + @Override + public double getDemandedEnergy() + { + return this.maxEnergy - this.energy; + } + + @Override + public int getSinkTier() + { + return this.tier; + } + + @Override + public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage) + { + if (this.energy >= this.maxEnergy) { + return amount; + } + this.energy += amount; + return 0.0D; + } + + public final float getChargeLevel() + { + return this.guiChargeLevel; + } + + public void setTier(int tier1) + { + if (this.tier == tier1) { + return; + } + boolean addedToENet = this.addedToEnergyNet; + if (addedToENet) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); + this.addedToEnergyNet = false; + } + this.tier = tier1; + + for (int i=0; i<inventoryTool.getSizeInventory(); i++){ + //this.inventoryTool..setTier(tier1); TODO + } + + if (addedToENet) + { + MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); + this.addedToEnergyNet = true; + } + } + + @Override + public List<String> getNetworkedFields(){ + List<String> ret = new Vector(2); + ret.add("facing"); + return ret; + } + + + @Override + public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) + { + return false; + } + + @Override + public void setFacing(short facing1) + { + this.facing = facing1; + if (this.prevFacing != facing1) { + ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "facing"); + } + this.prevFacing = facing1; + } + + @Override + public short getFacing() + { + return this.facing; + } + + + @Override + public boolean wrenchCanRemove(EntityPlayer entityPlayer) + { + return true; + } + + @Override + public float getWrenchDropRate() + { + return 1.0F; + } + + @Override + public ItemStack getWrenchDrop(EntityPlayer entityPlayer) + { + return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); + } + + @Override + public void onNetworkUpdate(String field) { + + this.prevFacing = this.facing; + + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/Quality.java b/src/Java/gtPlusPlus/core/util/Quality.java new file mode 100644 index 0000000000..1ce29c7a58 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/Quality.java @@ -0,0 +1,59 @@ +package gtPlusPlus.core.util; + +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraft.util.EnumChatFormatting; + +public enum Quality { + + // Magic Blue + // Rare Yellow + // Set Green + // Unique Gold/Purple + // Trade-off Brown + + POOR("Poor", EnumChatFormatting.GRAY), + COMMON("Common", EnumChatFormatting.WHITE), + UNCOMMON("Uncommon", EnumChatFormatting.DARK_GREEN), + MAGIC("Magic", EnumChatFormatting.BLUE), + RARE("Rare", EnumChatFormatting.YELLOW), + UNIQUE("Unique", EnumChatFormatting.GOLD), + ARTIFACT("Artifact", EnumChatFormatting.AQUA), + SET("Set Piece", EnumChatFormatting.GREEN), + TRADEOFF("Trade-off", EnumChatFormatting.DARK_RED), + EPIC("Epic", EnumChatFormatting.LIGHT_PURPLE); + + private String LOOT; + private EnumChatFormatting COLOUR; + private Quality (final String lootTier, final EnumChatFormatting tooltipColour) + { + this.LOOT = lootTier; + this.COLOUR = tooltipColour; + } + + public String getQuality() { + return LOOT; + } + + protected EnumChatFormatting getColour(){ + return COLOUR; + } + + public String formatted(){ + return this.COLOUR+this.LOOT; + } + + public static Quality getRandomQuality(){ + int lootChance = MathUtils.randInt(0, 100); + if (lootChance <= 10){return Quality.POOR;} + else if (lootChance <= 45){return Quality.COMMON;} + else if (lootChance <= 65){return Quality.UNCOMMON;} + else if (lootChance <= 82){return Quality.MAGIC;} + else if (lootChance <= 92){return Quality.EPIC;} + else if (lootChance <= 97){return Quality.RARE;} + else if (lootChance <= 99){return Quality.ARTIFACT;} + else return null; + } + +} + + diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 090d05e3b1..2e25b8b0e9 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -6,12 +6,10 @@ import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gtPlusPlus.GTplusplus; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.fluid.FluidUtils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import gtPlusPlus.core.util.math.MathUtils; -import ic2.core.IC2Potion; import ic2.core.Ic2Items; import ic2.core.init.InternalName; -import ic2.core.item.armor.ItemArmorHazmat; import ic2.core.item.resources.ItemCell; import java.awt.Color; @@ -24,29 +22,22 @@ import java.util.List; import java.util.Map; import java.util.Timer; import java.util.TimerTask; -import java.util.UUID; import net.minecraft.block.Block; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.MathHelper; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; + +import org.apache.commons.lang3.EnumUtils; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; -import cpw.mods.fml.common.registry.EntityRegistry; public class Utils { @@ -90,32 +81,52 @@ public class Utils { if (aspect.toUpperCase() == "COGNITIO"){ //Adds in Compat for older GT Versions which Misspell aspects. try { - returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITIO"), size); + if (EnumUtils.isValidEnum(TC_Aspects.class, "COGNITIO")){ + Utils.LOG_WARNING("TC Aspect found - "+aspect); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITIO"), size); + } + else { + Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITO"), size); + } } catch (NoSuchFieldError r){ - Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITO"), size); - + Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } } else if (aspect.toUpperCase() == "EXANIMUS"){ - //Adds in Compat for older GT Versions which Misspell aspects. + //Adds in Compat for older GT Versions which Misspell aspects. try { - returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXANIMUS"), size); + if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")){ + Utils.LOG_WARNING("TC Aspect found - "+aspect); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXANIMUS"), size); + } + else { + Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXAMINIS"), size); + } } catch (NoSuchFieldError r){ - Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXAMINIS"), size); + Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } + + } else if (aspect.toUpperCase() == "PRAECANTATIO"){ - //Adds in Compat for older GT Versions which Misspell aspects. + //Adds in Compat for older GT Versions which Misspell aspects. try { - returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTATIO"), size); + if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")){ + Utils.LOG_WARNING("TC Aspect found - "+aspect); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTATIO"), size); + } + else { + Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTIO"), size); + } } catch (NoSuchFieldError r){ - Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTIO"), size); - } + Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); + } } else { + Utils.LOG_WARNING("TC Aspect found - "+aspect); returnValue = new TC_AspectStack(TC_Aspects.valueOf(aspect), size); } @@ -146,11 +157,6 @@ public class Utils { return (target.getItem() == input.getItem() && ((target.getItemDamage() == WILDCARD_VALUE && !strict) || target.getItemDamage() == input.getItemDamage())); } - //TODO - public static void registerEntityToBiomeSpawns(Class<EntityLiving> classy, EnumCreatureType EntityType, BiomeGenBase baseBiomeGen){ - EntityRegistry.addSpawn(classy, 6, 1, 5, EntityType, baseBiomeGen); //change the values to vary the spawn rarity, biome, etc. - } - //Non-Dev Comments public static void LOG_INFO(String s){ //if (CORE.DEBUG){ @@ -183,10 +189,6 @@ public class Utils { g.drawRect (MinA, MinB, MaxA, MaxB); } - public static void messagePlayer(EntityPlayer P, String S){ - gregtech.api.util.GT_Utility.sendChatToPlayer(P, S); - } - /** * Returns if that Liquid is IC2Steam. */ @@ -314,53 +316,6 @@ public class Utils { return targetList; } - public static EntityPlayer getPlayerOnServerFromUUID(UUID parUUID){ - if (parUUID == null) - { - return null; - } - List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; - for (EntityPlayerMP player : allPlayers) - { - if (player.getUniqueID().equals(parUUID)) - { - return player; - } - } - return null; - } - - @Deprecated - public static Block findBlockUnderEntityNonBoundingBox(Entity parEntity){ - int blockX = MathHelper.floor_double(parEntity.posX); - int blockY = MathHelper.floor_double(parEntity.posY-0.2D - (double)parEntity.yOffset); - int blockZ = MathHelper.floor_double(parEntity.posZ); - return parEntity.worldObj.getBlock(blockX, blockY, blockZ); - } - - public static Block findBlockUnderEntity(Entity parEntity){ - int blockX = MathHelper.floor_double(parEntity.posX); - int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1; - int blockZ = MathHelper.floor_double(parEntity.posZ); - return parEntity.worldObj.getBlock(blockX, blockY, blockZ); - } - - public static int getFacingDirection(Entity entity){ - int d = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360) + 0.50) & 3; - return d; - } - - public static boolean isPlayerOP(EntityPlayer player){ - if (player.canCommandSenderUseCommand(2, "")){ - return true; - } - return false; - } - - public static void setEntityOnFire(Entity entity, int length){ - entity.setFire(length); - } - public static void spawnCustomParticle(Entity entity){ GTplusplus.proxy.generateMysteriousParticles(entity); } @@ -403,7 +358,10 @@ public class Utils { } } - public static int rgbtoHexValue(int r, int g, int b){ + public static int rgbtoHexValue(int r, int g, int b){ + if (r > 255 || g > 255 || b > 255 || r < 0 || g < 0 || b < 0){ + return 0; + } Color c = new Color(r,g,b); String temp = Integer.toHexString( c.getRGB() & 0xFFFFFF ).toUpperCase(); @@ -511,28 +469,6 @@ public class Utils { return true; } - public static boolean applyRadiationDamageToEntity(int damage, World world, Entity entityHolding){ - if (!world.isRemote){ - if (damage > 0 && (entityHolding instanceof EntityLivingBase)) { - EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; - if (!ItemArmorHazmat.hasCompleteHazmat(entityLiving)) { - int duration; - if (entityLiving.getActivePotionEffect(IC2Potion.radiation) != null){ - //Utils.LOG_INFO("t"); - duration = (damage*5)+entityLiving.getActivePotionEffect(IC2Potion.radiation).getDuration(); - } - else { - //Utils.LOG_INFO("f"); - duration = damage*30; - } - IC2Potion.radiation.applyTo(entityLiving, duration, damage * 15); - } - } - return true; - } - return false; - } - private static short cellID = 15; public static ItemStack createInternalNameAndFluidCell(String s){ Utils.LOG_WARNING("1"); @@ -552,7 +488,7 @@ public class Utils { ItemStack temp = (ItemStack) methode.invoke(item, cellID++, yourName, new Block[0]); Utils.LOG_INFO("Successfully created "+temp.getDisplayName()+"s."); FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(s.toLowerCase(), 0), temp.copy(), Ic2Items.cell.copy()); - UtilsItems.addItemToOreDictionary(temp.copy(), "cell"+s); + ItemUtils.addItemToOreDictionary(temp.copy(), "cell"+s); return temp; } catch(Exception e){ diff --git a/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java b/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java new file mode 100644 index 0000000000..ea02aaf1da --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/array/ArrayUtils.java @@ -0,0 +1,18 @@ +package gtPlusPlus.core.util.array; + +import java.util.Arrays; + +public class ArrayUtils { + + public static void expandArray(Object[] someArray, Object newValueToAdd) { + Object[] series = someArray; + series = addElement(series, newValueToAdd); + } + + private static Object[] addElement(Object[] series, Object newValueToAdd) { + series = Arrays.copyOf(series, series.length + 1); + series[series.length - 1] = newValueToAdd; + return series; + } + +} diff --git a/src/Java/gtPlusPlus/core/util/array/Pair.java b/src/Java/gtPlusPlus/core/util/array/Pair.java new file mode 100644 index 0000000000..94437e6779 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/array/Pair.java @@ -0,0 +1,21 @@ +package gtPlusPlus.core.util.array; + +public class Pair<K,V> { + + private final K key; + private final V value; + + public Pair(final K key, final V value){ + this.key = key; + this.value = value; + } + + final public K getKey(){ + return key; + } + + final public V getValue(){ + return value; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/array/Triplet.java b/src/Java/gtPlusPlus/core/util/array/Triplet.java new file mode 100644 index 0000000000..07f29ae6c8 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/array/Triplet.java @@ -0,0 +1,27 @@ +package gtPlusPlus.core.util.array; + +public class Triplet<K,V,C> { + + private final K key; + private final V value; + private final C count; + + public Triplet(final K key, final V value, final C value2){ + this.key = key; + this.value = value; + this.count = value2; + } + + final public K getKey(){ + return key; + } + + final public V getValue(){ + return value; + } + + final public C getSecondValue(){ + return count; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java new file mode 100644 index 0000000000..21d31a42ee --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/entity/EntityUtils.java @@ -0,0 +1,68 @@ +package gtPlusPlus.core.util.entity; + +import ic2.core.IC2Potion; +import ic2.core.item.armor.ItemArmorHazmat; +import cpw.mods.fml.common.registry.EntityRegistry; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; + +public class EntityUtils { + + public static void setEntityOnFire(Entity entity, int length){ + entity.setFire(length); + } + + public static int getFacingDirection(Entity entity){ + int d = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360) + 0.50) & 3; + return d; + } + + @Deprecated + public static Block findBlockUnderEntityNonBoundingBox(Entity parEntity){ + int blockX = MathHelper.floor_double(parEntity.posX); + int blockY = MathHelper.floor_double(parEntity.posY-0.2D - (double)parEntity.yOffset); + int blockZ = MathHelper.floor_double(parEntity.posZ); + return parEntity.worldObj.getBlock(blockX, blockY, blockZ); + } + + public static Block findBlockUnderEntity(Entity parEntity){ + int blockX = MathHelper.floor_double(parEntity.posX); + int blockY = MathHelper.floor_double(parEntity.boundingBox.minY)-1; + int blockZ = MathHelper.floor_double(parEntity.posZ); + return parEntity.worldObj.getBlock(blockX, blockY, blockZ); + } + + //TODO + public static void registerEntityToBiomeSpawns(Class<EntityLiving> classy, EnumCreatureType EntityType, BiomeGenBase baseBiomeGen){ + EntityRegistry.addSpawn(classy, 6, 1, 5, EntityType, baseBiomeGen); //change the values to vary the spawn rarity, biome, etc. + } + + public static boolean applyRadiationDamageToEntity(int damage, World world, Entity entityHolding){ + if (!world.isRemote){ + if (damage > 0 && (entityHolding instanceof EntityLivingBase)) { + EntityLivingBase entityLiving = (EntityLivingBase) entityHolding; + if (!ItemArmorHazmat.hasCompleteHazmat(entityLiving)) { + int duration; + if (entityLiving.getActivePotionEffect(IC2Potion.radiation) != null){ + //Utils.LOG_INFO("t"); + duration = (damage*5)+entityLiving.getActivePotionEffect(IC2Potion.radiation).getDuration(); + } + else { + //Utils.LOG_INFO("f"); + duration = damage*30; + } + IC2Potion.radiation.applyTo(entityLiving, duration, damage * 15); + } + } + return true; + } + return false; + } + +} diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java b/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java new file mode 100644 index 0000000000..5674082c4a --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/fluid/FluidGT6.java @@ -0,0 +1,30 @@ +package gtPlusPlus.core.util.fluid; + +import gregtech.api.GregTech_API; +import gtPlusPlus.core.lib.CORE; +import net.minecraftforge.fluids.Fluid; + +public class FluidGT6 extends Fluid implements Runnable +{ + private final short[] mRGBa; + public final String mTextureName; + + public FluidGT6(final String aName, final String aTextureName, final short[] aRGBa) { + super(aName); + this.mRGBa = aRGBa; + this.mTextureName = aTextureName; + if (GregTech_API.sGTBlockIconload != null) { + GregTech_API.sGTBlockIconload.add(this); + } + } + + @Override + public int getColor() { + return Math.max(0, Math.min(255, this.mRGBa[0])) << 16 | Math.max(0, Math.min(255, this.mRGBa[1])) << 8 | Math.max(0, Math.min(255, this.mRGBa[2])); + } + + @Override + public void run() { + this.setIcons(GregTech_API.sBlockIcons.registerIcon(CORE.MODID+ ":" + "fluids/fluid." + mTextureName)); + } +} diff --git a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java index e576eba8f5..83b0bfd65d 100644 --- a/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java +++ b/src/Java/gtPlusPlus/core/util/fluid/FluidUtils.java @@ -28,6 +28,16 @@ public class FluidUtils { } } + + public static FluidStack getFluidStack(FluidStack vmoltenFluid, int fluidAmount) { + Utils.LOG_WARNING("Trying to get a fluid stack of "+vmoltenFluid.getFluid().getName()); + try { + return FluidRegistry.getFluidStack(vmoltenFluid.getFluid().getName(), fluidAmount).copy(); + } + catch (Throwable e){ + return null; + } + } public static FluidStack[] getFluidStackArray(String fluidName, int amount){ Utils.LOG_WARNING("Trying to get a fluid stack of "+fluidName); @@ -99,7 +109,7 @@ public class FluidUtils { * @return short[] */ public static Fluid generateFluid(Material material ,int aState){ - int tempK = material.getMeltingPoint_C(); + int tempK = material.getMeltingPointC(); Fluid generatedFluid = null; switch (aState) { case 0: { @@ -200,6 +210,54 @@ public class FluidUtils { } return rFluid; } + + public static Fluid addGTFluid(final String aName, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { + return addGTFluid("molten."+aName, "molten.autogenerated", aLocalized, aRGBa, aState, aTemperatureK, aFullContainer, aEmptyContainer, aFluidAmount); + } + + public static Fluid addGTFluid(String aName, final String aTexture, final String aLocalized, final short[] aRGBa, final int aState, final long aTemperatureK, final ItemStack aFullContainer, final ItemStack aEmptyContainer, final int aFluidAmount) { + aName = Utils.sanitizeString(aName.toLowerCase()); + Fluid rFluid = new FluidGT6(aName, aTexture, (aRGBa != null) ? aRGBa : Dyes._NULL.getRGBA()); + GT_LanguageManager.addStringLocalization(rFluid.getUnlocalizedName(), (aLocalized == null) ? aName : aLocalized); + if (FluidRegistry.registerFluid(rFluid)) { + switch (aState) { + case 0: { + rFluid.setGaseous(false); + rFluid.setViscosity(10000); + break; + } + case 1: + case 4: { + rFluid.setGaseous(false); + rFluid.setViscosity(1000); + break; + } + case 2: { + rFluid.setGaseous(true); + rFluid.setDensity(-100); + rFluid.setViscosity(200); + break; + } + case 3: { + rFluid.setGaseous(true); + rFluid.setDensity(-10000); + rFluid.setViscosity(10); + rFluid.setLuminosity(15); + break; + } + } + } + else { + rFluid = FluidRegistry.getFluid(aName); + } + if (rFluid.getTemperature() == new Fluid("test").getTemperature() || rFluid.getTemperature() <= 0) { + rFluid.setTemperature((int) (aTemperatureK)); + } + if (aFullContainer != null && aEmptyContainer != null && !FluidContainerRegistry.registerFluidContainer(new FluidStack(rFluid, aFluidAmount), aFullContainer, aEmptyContainer)) { + GT_Values.RA.addFluidCannerRecipe(aFullContainer, container(aFullContainer, false), null, new FluidStack(rFluid, aFluidAmount)); + } + return rFluid; + } public static boolean valid(final Object aStack) { return aStack != null && aStack instanceof ItemStack && ((ItemStack)aStack).getItem() != null && ((ItemStack)aStack).stackSize >= 0; @@ -282,6 +340,6 @@ public class FluidUtils { public static ItemStack container(final ItemStack aStack, final boolean aCheckIFluidContainerItems, final int aStacksize) { return amount(aStacksize, container(aStack, aCheckIFluidContainerItems)); - } + } } diff --git a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java index d1857ffefc..b10e643831 100644 --- a/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java +++ b/src/Java/gtPlusPlus/core/util/gregtech/recipehandlers/GregtechRecipe.java @@ -28,7 +28,7 @@ public final class GregtechRecipe { } public boolean addSmeltingAndAlloySmeltingRecipe(ItemStack aInput, ItemStack aOutput) { - Utils.LOG_INFO("Adding a GT Furnace/Alloy Smelter Recipe"); + Utils.LOG_WARNING("Adding a GT Furnace/Alloy Smelter Recipe"+"| Input:"+aInput.getDisplayName()+" | Output:"+aOutput.getDisplayName()+" |"); return ourProxy.addSmeltingAndAlloySmeltingRecipe(aInput, aOutput); } diff --git a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java index 197482f1ae..69d909f294 100644 --- a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java +++ b/src/Java/gtPlusPlus/core/util/item/ItemUtils.java @@ -1,39 +1,27 @@ package gtPlusPlus.core.util.item; import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; -import gtPlusPlus.core.block.base.BlockBaseModular; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.base.BasicSpawnEgg; -import gtPlusPlus.core.item.base.bolts.BaseItemBolt; import gtPlusPlus.core.item.base.dusts.BaseItemDust; import gtPlusPlus.core.item.base.dusts.BaseItemDustUnique; -import gtPlusPlus.core.item.base.gears.BaseItemGear; -import gtPlusPlus.core.item.base.ingots.BaseItemIngot; -import gtPlusPlus.core.item.base.ingots.BaseItemIngotHot; -import gtPlusPlus.core.item.base.plates.BaseItemPlate; -import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; -import gtPlusPlus.core.item.base.rings.BaseItemRing; -import gtPlusPlus.core.item.base.rods.BaseItemRod; -import gtPlusPlus.core.item.base.rods.BaseItemRodLong; -import gtPlusPlus.core.item.base.rotors.BaseItemRotor; -import gtPlusPlus.core.item.base.screws.BaseItemScrew; +import gtPlusPlus.core.item.base.dusts.decimal.BaseItemCentidust; +import gtPlusPlus.core.item.base.dusts.decimal.BaseItemDecidust; import gtPlusPlus.core.item.tool.staballoy.MultiPickaxeBase; +import gtPlusPlus.core.item.tool.staballoy.MultiSpadeBase; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.materials.MaterialUtils; import gtPlusPlus.core.util.wrapper.var; -import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Plates; import java.util.ArrayList; import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; @@ -41,7 +29,7 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; import cpw.mods.fml.common.registry.GameRegistry; -public class UtilsItems { +public class ItemUtils { public static ItemStack getSimpleStack(Item x){ return getSimpleStack(x, 1); @@ -64,6 +52,23 @@ public class UtilsItems { } } + public static ItemStack getIC2Cell(String S){ + ItemStack moreTemp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cell"+S, 1); + + if (moreTemp == null){ + int cellID = 0; + ItemStack temp =GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID); + return temp != null ? temp : null; + } + + return moreTemp; + } + + public static ItemStack getIC2Cell(int meta){ + ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, meta); + return temp != null ? temp : null; + } + public static void getItemForOreDict(String FQRN, String oreDictName, String itemName, int meta){ try { @@ -85,10 +90,10 @@ public class UtilsItems { Utils.LOG_ERROR(itemName+" not found. [NULL]"); } } - + public static void addItemToOreDictionary(ItemStack stack, String oreDictName){ try { - GT_OreDictUnificator.registerOre(oreDictName, stack); + GT_OreDictUnificator.registerOre(oreDictName, stack); } catch (NullPointerException e) { Utils.LOG_ERROR(stack.getDisplayName()+" not registered. [NULL]"); } @@ -168,12 +173,12 @@ public class UtilsItems { ItemStack temp; if (fqrn.toLowerCase().contains(oreDict.toLowerCase())){ String sanitizedName = fqrn.replace(oreDict, ""); - temp = UtilsItems.getItemStack(sanitizedName, stackSize); + temp = ItemUtils.getItemStack(sanitizedName, stackSize); return temp; } String[] fqrnSplit = fqrn.split(":"); if(fqrnSplit[2] == null){fqrnSplit[2] = "0";} - temp = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(fqrnSplit[2]), stackSize); + temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(fqrnSplit[2]), stackSize); return temp; } @@ -212,25 +217,12 @@ public class UtilsItems { return GameRegistry.findItemStack(fqrnSplit[0], fqrnSplit[1], Size); }*/ - public static Item getItemInPlayersHand(){ - Minecraft mc = Minecraft.getMinecraft(); - Item heldItem = null; - - try{heldItem = mc.thePlayer.getHeldItem().getItem(); - }catch(NullPointerException e){return null;} - - if (heldItem != null){ - return heldItem; - } - - return null; - } public static void generateSpawnEgg(String entityModID, String parSpawnName, int colourEgg, int colourOverlay){ 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(String oredictName){ List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName); @@ -244,138 +236,170 @@ public class UtilsItems { public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, int amount){ ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); if (!oreDictList.isEmpty()){ - ItemStack returnValue = oreDictList.get(0).copy(); - returnValue.stackSize = amount; - return returnValue; + ItemStack returnValue = oreDictList.get(0).copy(); + returnValue.stackSize = amount; + return returnValue; } - return getSimpleStack(ModItems.AAA_Broken, amount); + return getSimpleStack(ModItems.AAA_Broken, amount); } - + public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, int amount){ ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount); - + if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){ - return returnValue; - } - Utils.LOG_INFO(oredictName+" was not valid."); - return null; - } - - public static void generateItemsFromMaterial(Material matInfo){ - - String unlocalizedName = matInfo.getUnlocalizedName(); - String materialName = matInfo.getLocalizedName(); - short[] C = matInfo.getRGBA(); - int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); - boolean hotIngot = matInfo.requiresBlastFurnace(); - int materialTier = matInfo.vTier; //TODO - - if (materialTier > 10 || materialTier <= 0){ - materialTier = 2; - } - - - - int sRadiation = 0; - if (isRadioactive(materialName)){ - sRadiation = getRadioactivityLevel(materialName); - } - - if (sRadiation >= 1){ - Item temp; - Block tempBlock; - tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); - temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation); - - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); - - temp = new BaseItemPlate("itemPlate"+unlocalizedName, materialName, Colour, materialTier, sRadiation); - temp = new BaseItemRod(matInfo, sRadiation); - temp = new BaseItemRodLong(matInfo, sRadiation); - } - - else { - Item temp; - Block tempBlock; - tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); - tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.FRAME, Colour); - temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation); - if (hotIngot){ - Item tempIngot = temp; - temp = new BaseItemIngotHot("itemHotIngot"+unlocalizedName, materialName, UtilsItems.getSimpleStack(tempIngot, 1), materialTier); + return returnValue; + } + Utils.LOG_INFO(oredictName+" was not valid."); + return null; + } + + public static ItemStack getItemStackOfAmountFromOreDictNoBrokenExcluding(String excludeModName, String oredictName, int amount){ + ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount); + + if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){ + if (returnValue.getClass().toString().toLowerCase().contains(excludeModName.toLowerCase())){ + ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); + if (!oreDictList.isEmpty()){ + returnValue = oreDictList.get(1).copy(); + returnValue.stackSize = amount; + return returnValue; } - temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); - temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); - temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); - - temp = new BaseItemPlate("itemPlate"+unlocalizedName, materialName, Colour, materialTier, sRadiation); - temp = new BaseItemPlateDouble("itemPlateDouble"+unlocalizedName, materialName, Colour, materialTier, sRadiation); - temp = new BaseItemBolt(matInfo); - temp = new BaseItemRod(matInfo, sRadiation); - temp = new BaseItemRodLong(matInfo, sRadiation); - temp = new BaseItemRing(matInfo); - temp = new BaseItemScrew(matInfo); - temp = new BaseItemRotor("itemRotor"+unlocalizedName, materialName, Colour); - temp = new BaseItemGear(matInfo); - } - - RecipeGen_Plates.generateRecipes(matInfo); - - FluidUtils.generateFluid(matInfo, 1); - + } + else { + ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); + if (!oreDictList.isEmpty()){ + returnValue = oreDictList.get(1).copy(); + returnValue.stackSize = amount; + return returnValue; + } + } + return returnValue; + } + Utils.LOG_INFO(oredictName+" was not valid."); + return null; } - + public static Item[] generateDusts(String unlocalizedName, String materialName, int materialTier, Material matInfo, int Colour){ int radioactive = getRadioactivityLevel(materialName); Item[] output = { - new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, radioactive), - new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, radioactive), - new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, radioactive)}; + new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, radioactive), + new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, radioactive), + new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, radioactive)}; return output; } - + public static Item[] generateSpecialUseDusts(String unlocalizedName, String materialName, int Colour){ Item[] output = { - new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust"), - new BaseItemDustUnique("itemDustSmall"+unlocalizedName, materialName, Colour, "Small"), - new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, Colour, "Tiny")}; + new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust"), + new BaseItemDustUnique("itemDustSmall"+unlocalizedName, materialName, Colour, "Small"), + new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, Colour, "Tiny")}; return output; } - + public static MultiPickaxeBase generateMultiPick(boolean GT_Durability, Materials material){ ToolMaterial customMaterial = Utils.generateMaterialFromGT(material); - Utils.LOG_INFO("Generating a Multi-Pick out of "+material.name()); + Utils.LOG_WARNING("Generating a Multi-Pick out of "+material.name()); short[] rgb; rgb = material.getRGBA(); int dur = customMaterial.getMaxUses(); - Utils.LOG_INFO("Determined durability for "+material.name()+" is "+dur); + Utils.LOG_WARNING("Determined durability for "+material.name()+" is "+dur); if (GT_Durability){ dur = material.mDurability*100; - Utils.LOG_INFO("Using gregtech durability value, "+material.name()+" is now "+dur+"."); + Utils.LOG_WARNING("Using gregtech durability value, "+material.name()+" is now "+dur+"."); } else if (dur <= 0){ dur = material.mDurability; - Utils.LOG_INFO("Determined durability too low, "+material.name()+" is now "+dur+" based on the GT material durability."); + Utils.LOG_WARNING("Determined durability too low, "+material.name()+" is now "+dur+" based on the GT material durability."); } - + if (dur <= 0){ - Utils.LOG_INFO("Still too low, "+material.name()+" will now go unused."); + Utils.LOG_WARNING("Still too low, "+material.name()+" will now go unused."); return null; } - + MultiPickaxeBase MP_Redstone = new MultiPickaxeBase( material.name()+" Multipick", (customMaterial), dur, Utils.rgbtoHexValue(rgb[0],rgb[1],rgb[2]) ); - - return MP_Redstone; - + + if (MP_Redstone.isValid){ + return MP_Redstone; + } + return null; + + } + + public static MultiSpadeBase generateMultiShovel(boolean GT_Durability, Materials material){ + ToolMaterial customMaterial = Utils.generateMaterialFromGT(material); + Utils.LOG_WARNING("Generating a Multi-Shovel out of "+material.name()); + short[] rgb; + rgb = material.getRGBA(); + int dur = customMaterial.getMaxUses(); + Utils.LOG_WARNING("Determined durability for "+material.name()+" is "+dur); + if (GT_Durability){ + dur = material.mDurability*100; + Utils.LOG_WARNING("Using gregtech durability value, "+material.name()+" is now "+dur+"."); + } + else if (dur <= 0){ + dur = material.mDurability; + Utils.LOG_WARNING("Determined durability too low, "+material.name()+" is now "+dur+" based on the GT material durability."); + } + + if (dur <= 0){ + Utils.LOG_WARNING("Still too low, "+material.name()+" will now go unused."); + return null; + } + + MultiSpadeBase MP_Redstone = new MultiSpadeBase( + material.name()+" Multishovel", + (customMaterial), + dur, + Utils.rgbtoHexValue(rgb[0],rgb[1],rgb[2]) + ); + + if (MP_Redstone.isValid){ + return MP_Redstone; + } + return null; + + } + + public static BaseItemDecidust generateDecidust(Materials material){ + if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){ + Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); + if (placeholder != null) + generateDecidust(placeholder); + } + return null; } - + + public static BaseItemDecidust generateDecidust(Material material){ + if (material.getDust(1) != null && MaterialUtils.hasValidRGBA(material.getRGBA())){ + BaseItemDecidust Decidust = new BaseItemDecidust(material); + return Decidust; + } + return null; + } + + public static BaseItemCentidust generateCentidust(Materials material){ + if (GT_OreDictUnificator.get(OrePrefixes.dust, material, 1L) != null){ + Material placeholder = MaterialUtils.generateMaterialFromGtENUM(material); + if (placeholder != null) + generateCentidust(placeholder); + } + return null; + } + + public static BaseItemCentidust generateCentidust(Material material){ + if (material.getDust(1) != null && MaterialUtils.hasValidRGBA(material.getRGBA())){ + BaseItemCentidust Centidust = new BaseItemCentidust(material); + return Centidust; + } + return null; + } + public static boolean isRadioactive(String materialName){ int sRadiation = 0; if (materialName.toLowerCase().contains("uranium")){ @@ -392,7 +416,7 @@ public class UtilsItems { } return false; } - + public static int getRadioactivityLevel(String materialName){ int sRadiation = 0; if (materialName.toLowerCase().contains("uranium")){ @@ -406,17 +430,24 @@ public class UtilsItems { } return sRadiation; } - + public static String getArrayStackNames(ItemStack[] aStack){ String itemNames = "Item Array: "; for (ItemStack alph : aStack){ - String temp = itemNames; - itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize; + + if (alph != null){ + String temp = itemNames; + itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize; + } + else { + String temp = itemNames; + itemNames = temp + ", " + "null" + " x" + "0"; + } } return itemNames; - + } - + public static String[] getArrayStackNamesAsArray(ItemStack[] aStack){ String[] itemNames = {}; int arpos = 0; @@ -425,9 +456,9 @@ public class UtilsItems { arpos++; } return itemNames; - + } - + public static String getFluidArrayStackNames(FluidStack[] aStack){ String itemNames = "Fluid Array: "; for (FluidStack alph : aStack){ @@ -435,7 +466,11 @@ public class UtilsItems { itemNames = temp + ", " + alph.getFluid().getName() + " x" + alph.amount; } return itemNames; - + + } + + public static ItemStack getGregtechCircuit(int Meta){ + return ItemUtils.getItemStackWithMeta(LoadedMods.Gregtech, "gregtech:gt.integrated_circuit", "Gregtech Circuit", Meta, 0); } } diff --git a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java index 0eae02d827..1ccb0f771c 100644 --- a/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java +++ b/src/Java/gtPlusPlus/core/util/materials/MaterialUtils.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.util.materials; import gregtech.api.enums.Dyes; +import gregtech.api.enums.Element; import gregtech.api.enums.Materials; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.enums.TextureSet; @@ -51,8 +52,121 @@ public class MaterialUtils { int boiling = material.mBlastFurnaceTemp; long protons = material.getProtons(); long neutrons = material.getNeutrons(); - boolean blastFurnace = material.mBlastFurnaceRequired; - return new Material(name, rgba, melting, boiling, protons, neutrons, blastFurnace, null); + boolean blastFurnace = material.mBlastFurnaceRequired; + String chemicalFormula = material.mChemicalFormula; + Element element = material.mElement; + int radioactivity = 0; + if (material.isRadioactive()){ + radioactivity = 1; + } + if (hasValidRGBA(rgba) || element == Element.H){ + //ModItems.itemBaseDecidust = UtilsItems.generateDecidust(material); + //ModItems.itemBaseCentidust = UtilsItems.generateCentidust(material); + return new Material(name, rgba, melting, boiling, protons, neutrons, blastFurnace, chemicalFormula, radioactivity); + } + return null; + + } + + public static Material generateQuickMaterial(String materialName, short[] colour, int sRadioactivity) { + Material temp = new Material( + materialName, + colour, + 1000, //melting + 3000, //boiling + 50, //Protons + 50, //Neutrons + false, + "", + sRadioactivity); + return temp; + } + + public static boolean hasValidRGBA(short[] rgba){ + boolean test1 = false; + boolean test2 = false; + boolean test3 = false; + for (int r=0;r<rgba.length;r++){ + if (rgba[r] == 0){ + if (r == 0){ + test1 = true; + } + else if (r == 1){ + test2 = true; + } + else if (r == 2){ + test3 = true; + } + } + } + if ((test1 && test2) || (test1 && test3) || (test3 && test2)){ + return false; + } + return true; + } + + public static String superscript(String str) { + str = str.replaceAll("0", "⁰"); + str = str.replaceAll("1", "¹"); + str = str.replaceAll("2", "²"); + str = str.replaceAll("3", "³"); + str = str.replaceAll("4", "⁴"); + str = str.replaceAll("5", "⁵"); + str = str.replaceAll("6", "⁶"); + str = str.replaceAll("7", "⁷"); + str = str.replaceAll("8", "⁸"); + str = str.replaceAll("9", "⁹"); + return str; + } + + public static String subscript(String str) { + str = str.replaceAll("0", "₀"); + str = str.replaceAll("1", "₁"); + str = str.replaceAll("2", "₂"); + str = str.replaceAll("3", "₃"); + str = str.replaceAll("4", "₄"); + str = str.replaceAll("5", "₅"); + str = str.replaceAll("6", "₆"); + str = str.replaceAll("7", "₇"); + str = str.replaceAll("8", "₈"); + str = str.replaceAll("9", "₉"); + return str; + } + + public static int getTierOfMaterial(int M){ + if (M >= 0 && M <= 750){ + return 1; + } + else if(M >= 751 && M <= 1250){ + return 2; + } + else if(M >= 1251 && M <= 1750){ + return 3; + } + else if(M >= 1751 && M <= 2250){ + return 4; + } + else if(M >= 2251 && M <= 2750){ + return 5; + } + else if(M >= 2751 && M <= 3250){ + return 6; + } + else if(M >= 3251 && M <= 3750){ + return 7; + } + else if(M >= 3751 && M <= 4250){ + return 8; + } + else if(M >= 4251 && M <= 4750){ + return 9; + } + else if(M >= 4751 && M <= 9999){ + return 10; + } + else { + return 0; + } } diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 3df5693bc3..75d8452975 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -29,6 +29,11 @@ public class MathUtils { return randomNum; } + public static double getChanceOfXOverYRuns(double x, double y){ + double z = (1-Math.pow((1-x), y)); + return z; + } + /** * Returns a psuedo-random number between min and max, inclusive. @@ -103,6 +108,19 @@ public class MathUtils { public static double decimalRoundingToWholes(double d) { return 5*(Math.round(d/5)); } + + public static int roundToClosestMultiple(double number, int multiple) { + int result = multiple; + if (number % multiple == 0) { + return (int) number; + } + // If not already multiple of given number + if (number % multiple != 0) { + int division = (int) ((number / multiple) + 1); + result = division * multiple; + } + return result; + } /** @@ -209,5 +227,37 @@ public class MathUtils { Utils.LOG_WARNING("It will decode into "+Integer.decode(temp)+"."); return Integer.decode(temp); } + + public static long[] simplifyNumbersToSmallestForm(long[] inputArray){ + long GCD = gcd(inputArray); + long[] outputArray = new long[inputArray.length]; + for (int i=0;i<inputArray.length;i++){ + if (GCD != 0) + outputArray[i] = (inputArray[i]/GCD); + else + outputArray[i] = inputArray[i]; + } + if (outputArray.length > 0) + return outputArray; + return null; + } + + private static long gcd(long a, long b){ + while (b > 0) + { + long temp = b; + b = a % b; // % is remainder + a = temp; + } + return a; + } + + private static long gcd(long[] input){ + long result = input[0]; + for(int i = 1; i < input.length; i++) result = gcd(result, input[i]); + return result; + } + + } diff --git a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java index 9e7e033bed..bcfce5a71b 100644 --- a/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java +++ b/src/Java/gtPlusPlus/core/util/networking/NetworkUtils.java @@ -10,36 +10,41 @@ import java.net.URLConnection; public class NetworkUtils { public static String getContentFromURL(String args) { - - URL url; - - try { - // get URL content - url = new URL(args); - URLConnection conn = url.openConnection(); - - // open the stream and put it into BufferedReader - BufferedReader br = new BufferedReader( - new InputStreamReader(conn.getInputStream())); - - String inputLine; - String tempLine = null; - - - - - while ((inputLine = br.readLine()) != null) { - tempLine = inputLine; + if (netIsAvailable()){ + try { + URL url; + // get URL content + url = new URL(args); + URLConnection conn = url.openConnection(); + // open the stream and put it into BufferedReader + BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String inputLine; + String tempLine = null; + while ((inputLine = br.readLine()) != null) { + tempLine = inputLine; + } + br.close(); + return tempLine; + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); } - - br.close(); - return tempLine; - } catch (MalformedURLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } + } return null; } - + + private static boolean netIsAvailable() { + try { + final URL url = new URL("http://www.google.com"); + final URLConnection conn = url.openConnection(); + conn.connect(); + return true; + } catch (MalformedURLException e) { + throw new RuntimeException(e); + } catch (IOException e) { + return false; + } + } + } diff --git a/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java b/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java new file mode 100644 index 0000000000..e1d5a4b311 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/player/PlayerUtils.java @@ -0,0 +1,129 @@ +package gtPlusPlus.core.util.player; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class PlayerUtils { + + public static void messagePlayer(EntityPlayer P, String S){ + gregtech.api.util.GT_Utility.sendChatToPlayer(P, S); + } + + public static EntityPlayer getPlayer(String name){ + List<EntityPlayer> i = new ArrayList<EntityPlayer>(); + Iterator<EntityPlayer> crunchifyIterator = MinecraftServer.getServer().getConfigurationManager().playerEntityList.iterator(); + while (crunchifyIterator.hasNext()) { + i.add((crunchifyIterator.next())); + } + try{ + for (EntityPlayer temp : i) { + if (temp.getDisplayName().toLowerCase().equals(name.toLowerCase())){ + return temp; + } + } + } + catch(NullPointerException e){} + return null; + } + + public static EntityPlayer getPlayerOnServerFromUUID(UUID parUUID){ + if (parUUID == null) + { + return null; + } + List<EntityPlayerMP> allPlayers = MinecraftServer.getServer().getConfigurationManager().playerEntityList; + for (EntityPlayerMP player : allPlayers) + { + if (player.getUniqueID().equals(parUUID)) + { + return player; + } + } + return null; + } + + //Not Clientside + public static EntityPlayer getPlayerInWorld(World world, String Name){ + List<EntityPlayer> i = world.playerEntities; + Minecraft mc = Minecraft.getMinecraft(); + try{ + for (EntityPlayer temp : i) { + if (temp.getDisplayName().toLowerCase().equals(Name.toLowerCase())){ + return temp; + } + } + } + catch(NullPointerException e){} + return null; + } + + public static boolean isPlayerOP(EntityPlayer player){ + if (player.canCommandSenderUseCommand(2, "")){ + return true; + } + return false; + } + + //Not Clientside + public static ItemStack getItemStackInPlayersHand(World world, String Name){ + EntityPlayer thePlayer = getPlayer(Name); + ItemStack heldItem = null; + try{heldItem = thePlayer.getHeldItem(); + }catch(NullPointerException e){return null;} + if (heldItem != null){ + return heldItem; + } + return null; + } + + @SideOnly(Side.CLIENT) + public static ItemStack getItemStackInPlayersHand(){ + Minecraft mc = Minecraft.getMinecraft(); + ItemStack heldItem = null; + try{heldItem = mc.thePlayer.getHeldItem(); + }catch(NullPointerException e){return null;} + if (heldItem != null){ + return heldItem; + } + return null; + } + + @SideOnly(Side.SERVER) + public static ItemStack getItemStackInPlayersHand(EntityPlayer player){ + ItemStack heldItem = null; + try{heldItem = player.getHeldItem(); + }catch(NullPointerException e){return null;} + if (heldItem != null){ + return heldItem; + } + return null; + } + + @SideOnly(Side.CLIENT) + public static Item getItemInPlayersHand(){ + Minecraft mc = Minecraft.getMinecraft(); + Item heldItem = null; + + try{heldItem = mc.thePlayer.getHeldItem().getItem(); + }catch(NullPointerException e){return null;} + + if (heldItem != null){ + return heldItem; + } + + return null; + } + +} diff --git a/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java index 997aaa95c9..39a118e440 100644 --- a/src/Java/gtPlusPlus/core/util/recipe/UtilsRecipe.java +++ b/src/Java/gtPlusPlus/core/util/recipe/RecipeUtils.java @@ -6,7 +6,8 @@ import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.util.recipe.shapeless.ShapelessUtils; import java.util.ArrayList; import java.util.Iterator; @@ -21,9 +22,9 @@ import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; -public class UtilsRecipe { +public class RecipeUtils { - public static void recipeBuilder(Object slot_1, Object slot_2, Object slot_3, Object slot_4, Object slot_5, Object slot_6, Object slot_7, Object slot_8, Object slot_9, ItemStack resultItem){ + public static boolean recipeBuilder(Object slot_1, Object slot_2, Object slot_3, Object slot_4, Object slot_5, Object slot_6, Object slot_7, Object slot_8, Object slot_9, ItemStack resultItem){ ArrayList<Object> validSlots = new ArrayList<Object>(); @@ -101,13 +102,14 @@ public class UtilsRecipe { try { GameRegistry.addRecipe(new ShapedOreRecipe(resultItem.copy(), (Object[]) validSlots.toArray())); - Utils.LOG_INFO("Success! Added a recipe for "+resultItem.toString()); + Utils.LOG_INFO("Success! Added a recipe for "+resultItem.getDisplayName()); if (!COMPAT_HANDLER.areInitItemsLoaded){ RegistrationHandler.recipesSuccess++; } else { LateRegistrationHandler.recipesSuccess++; } + return true; } catch(NullPointerException | ClassCastException k){ k.getMessage(); @@ -120,7 +122,8 @@ public class UtilsRecipe { } else { LateRegistrationHandler.recipesFailed++; - } + } + return false; } } @@ -173,7 +176,7 @@ public class UtilsRecipe { //GameRegistry.addRecipe(new ShapelessOreRecipe(Output, outputAmount), (Object[]) validSlots.toArray()); GameRegistry.addRecipe(new ShapelessOreRecipe(Output, (Object[]) validSlots.toArray())); //GameRegistry.addShapelessRecipe(new ItemStack(output_ITEM, 1), new Object[] {slot_1, slot_2}); - Utils.LOG_INFO("Success! Added a recipe for "+Output.toString()); + Utils.LOG_INFO("Success! Added a recipe for "+Output.getDisplayName()); RegistrationHandler.recipesSuccess++; } catch(RuntimeException k){ @@ -241,7 +244,7 @@ public class UtilsRecipe { public static boolean removeCraftingRecipe(Object x){ if (null == x){return false;} if (x instanceof String){ - Item R = UtilsItems.getItem((String) x); + Item R = ItemUtils.getItem((String) x); if (R != null){ x = R; } @@ -267,7 +270,7 @@ public class UtilsRecipe { return false; } } - if (UtilsRecipe.attemptRecipeRemoval((Item) x)){ + if (RecipeUtils.attemptRecipeRemoval((Item) x)){ Utils.LOG_INFO("Recipe removal successful"); return true; } @@ -314,7 +317,7 @@ public class UtilsRecipe { - public static void addShapedGregtechRecipe( + public static boolean addShapedGregtechRecipe( Object InputItem1, Object InputItem2, Object InputItem3, Object InputItem4, Object InputItem5, Object InputItem6, Object InputItem7, Object InputItem8, Object InputItem9, @@ -330,10 +333,10 @@ public class UtilsRecipe { (!(InputItem8 instanceof ItemStack) && !(InputItem8 instanceof String) && (InputItem8 != null)) || (!(InputItem9 instanceof ItemStack) && !(InputItem9 instanceof String) && (InputItem9 != null))){ Utils.LOG_INFO("One Input item was not an ItemStack of an OreDict String."); - return; + return false; } - GT_ModHandler.addCraftingRecipe(OutputItem, + if (GT_ModHandler.addCraftingRecipe(OutputItem, GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"ABC", "DEF", "GHI", @@ -345,18 +348,23 @@ public class UtilsRecipe { 'F', InputItem6, 'G', InputItem7, 'H', InputItem8, - 'I', InputItem9}); + 'I', InputItem9})){ + Utils.LOG_INFO("Success! Added a recipe for "+OutputItem.getDisplayName()); + RegistrationHandler.recipesSuccess++; + return true; + } + return false; } public static void addShapelessGregtechRecipe(ItemStack OutputItem, Object... inputItems){ for(Object whatever : inputItems){ - if (!(whatever instanceof ItemStack) && !(whatever instanceof String)){ + if (!(whatever instanceof ItemStack) && !(whatever instanceof String)){ Utils.LOG_INFO("One Input item was not an ItemStack of an OreDict String."); - return; - } - } - + return; + } + } + GT_ModHandler.addShapelessCraftingRecipe(OutputItem, GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE, new Object[]{inputItems}); @@ -367,4 +375,8 @@ public class UtilsRecipe { return oreDictList.get(0); } + public static boolean buildShapelessRecipe(ItemStack output, Object[] input){ + return ShapelessUtils.addShapelessRecipe(output, input); + } + } diff --git a/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java b/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java new file mode 100644 index 0000000000..bf9d4960d8 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/recipe/shapeless/ShapelessUtils.java @@ -0,0 +1,56 @@ +package gtPlusPlus.core.util.recipe.shapeless; + +import gtPlusPlus.core.util.Utils; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import net.minecraft.item.crafting.ShapelessRecipes; + +public class ShapelessUtils { + + + public static boolean addShapelessRecipe(ItemStack output, Object ... params) + { + ArrayList<ItemStack> arraylist = new ArrayList<ItemStack>(); + Object[] aobject = params; + int i = params.length; + + for (int j = 0; j < i; ++j) + { + Object object1 = aobject[j]; + + if (object1 instanceof ItemStack) + { + arraylist.add(((ItemStack)object1).copy()); + } + else if (object1 instanceof Item) + { + arraylist.add(new ItemStack((Item)object1)); + } + else + { + if ((object1 == null)) + { + Utils.LOG_INFO(("Invalid shapeless input, ignoring!")); + } + else if (!(object1 instanceof Block) && (object1 != null)) + { + Utils.LOG_INFO(("Invalid shapeless recipe!")); + return false; + } + else { + arraylist.add(new ItemStack((Block)object1)); + } + } + } + CraftingManager.getInstance().getRecipeList().add(new ShapelessRecipes(output, arraylist)); + //CraftingManager.getInstance().addShapelessRecipe(output, arraylist); + return true; + } + + +} diff --git a/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java b/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java new file mode 100644 index 0000000000..fbbe4ac076 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/reflect/ClientProxyFinder.java @@ -0,0 +1,32 @@ +package gtPlusPlus.core.util.reflect; + +import java.lang.reflect.Field; + +import cpw.mods.fml.common.SidedProxy; + +public class ClientProxyFinder { + + public static Object getInstance(Object modInstance) throws ReflectiveOperationException { + for(Field field : modInstance.getClass().getDeclaredFields()) { + if(field.isAnnotationPresent(SidedProxy.class)) { + SidedProxy sidedProxy = field.getAnnotation(SidedProxy.class); + Object fieldValue = field.get(modInstance); + try { + Class clientSideClass = Class.forName(sidedProxy.clientSide()); + if(clientSideClass.isAssignableFrom(fieldValue.getClass())) { + Object clientProxy = clientSideClass.cast(fieldValue); + //do what you want with client proxy instance + return clientProxy; + } + + } catch (NoClassDefFoundError err) { + //its server side + return null; + } + break; + } + } + return null; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java new file mode 100644 index 0000000000..3878f49f18 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -0,0 +1,76 @@ +package gtPlusPlus.core.util.reflect; + +import gregtech.GT_Mod; +import gtPlusPlus.core.util.Utils; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.net.URL; +import java.util.HashSet; +import java.util.Scanner; + +import org.apache.commons.lang3.reflect.FieldUtils; + +public class ReflectionUtils { + + public static Field getField(Class clazz, String fieldName) throws NoSuchFieldException { + try { + return clazz.getDeclaredField(fieldName); + } catch (NoSuchFieldException e) { + Class superClass = clazz.getSuperclass(); + if (superClass == null) { + throw e; + } + return getField(superClass, fieldName); + } + } + + public static void makeAccessible(Field field) { + if (!Modifier.isPublic(field.getModifiers()) || + !Modifier.isPublic(field.getDeclaringClass().getModifiers())) + { + field.setAccessible(true); + } + } + + + //Some Reflection utils - http://stackoverflow.com/questions/14374878/using-reflection-to-set-an-object-property + @SuppressWarnings("unchecked") + public static <V> V getField(Object object, String fieldName) { + Class<?> clazz = object.getClass(); + while (clazz != null) { + try { + Field field = clazz.getDeclaredField(fieldName); + field.setAccessible(true); + return (V) field.get(object); + } catch (NoSuchFieldException e) { + clazz = clazz.getSuperclass(); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + return null; + } + + public static boolean setField(Object object, String fieldName, Object fieldValue) { + Class<?> clazz = object.getClass(); + while (clazz != null) { + try { + Field field = clazz.getDeclaredField(fieldName); + makeAccessible(field); + field.set(object, fieldValue); + return true; + } catch (NoSuchFieldException e) { + clazz = clazz.getSuperclass(); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + return false; + } + + public static boolean becauseIWorkHard(){ + /* TODO: fix this stuff \u002a\u002f\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u0028\u0029\u003b\u000a\u0009\u0009\u004f\u0062\u006a\u0065\u0063\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u003b\u0009\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u0043\u006c\u0069\u0065\u006e\u0074\u0050\u0072\u006f\u0078\u0079\u0046\u0069\u006e\u0064\u0065\u0072\u002e\u0067\u0065\u0074\u0049\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0028\u0047\u0054\u005f\u004d\u006f\u0064\u002e\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0029\u003b\u0009\u0009\u0009\u0009\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u0076\u0065\u004f\u0070\u0065\u0072\u0061\u0074\u0069\u006f\u006e\u0045\u0078\u0063\u0065\u0070\u0074\u0069\u006f\u006e\u0020\u0065\u0031\u0029\u0020\u007b\u000a\u0009\u0009\u0009\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u0020\u003d\u0020\u006e\u0075\u006c\u006c\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u006f\u0062\u0074\u0061\u0069\u006e\u0065\u0064\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u006f\u0066\u0020\u0061\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u000a\u0009\u0009\u007d\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0020\u003d\u0020\u006e\u0065\u0077\u0020\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u0028\u006e\u0065\u0077\u0020\u0055\u0052\u004c\u0028\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002e\u006f\u0076\u0065\u0072\u006d\u0069\u006e\u0064\u0064\u006c\u0031\u002e\u0063\u006f\u006d\u002f\u0063\u006f\u006d\u002f\u0067\u0072\u0065\u0067\u006f\u0072\u0069\u0075\u0073\u0074\u002f\u0067\u0072\u0065\u0067\u0074\u0065\u0063\u0068\u002f\u0073\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0072\u006c\u0069\u0073\u0074\u002e\u0074\u0078\u0074\u0022\u0029\u002e\u006f\u0070\u0065\u006e\u0053\u0074\u0072\u0065\u0061\u006d\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0054\u0072\u0079\u0069\u006e\u0067\u0020\u0074\u006f\u0020\u0062\u0075\u0069\u006c\u0064\u0020\u0061\u0020\u0048\u0061\u0073\u0068\u0053\u0065\u0074\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0077\u0068\u0069\u006c\u0065\u0020\u0028\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u0068\u0061\u0073\u004e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0074\u004e\u0061\u006d\u0065\u0020\u003d\u0020\u0074\u0053\u0063\u0061\u006e\u006e\u0065\u0072\u002e\u006e\u0065\u0078\u0074\u004c\u0069\u006e\u0065\u0028\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0074\u004e\u0061\u006d\u0065\u002e\u0074\u006f\u004c\u006f\u0077\u0065\u0072\u0043\u0061\u0073\u0065\u0028\u0029\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0069\u0066\u0020\u0028\u0021\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0073\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u0069\u0073\u0073\u0069\u006e\u0067\u0020\u0076\u0061\u006c\u0075\u0065\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002e\u0061\u0064\u0064\u0028\u0022\u0064\u0072\u0061\u006b\u006e\u0079\u0074\u0065\u0031\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u000a\u0009\u0009\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0046\u0061\u0069\u006c\u0065\u0064\u0020\u0067\u0065\u0074\u0074\u0069\u006e\u0067\u0020\u0074\u0068\u0065\u0020\u0077\u0065\u0062\u0020\u006c\u0069\u0073\u0074\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u0020\u000a\u0009\u0009\u0074\u0072\u0079\u0020\u007b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u000a\u0009\u0009\u0009\u0046\u0069\u0065\u006c\u0064\u0055\u0074\u0069\u006c\u0073\u002e\u0077\u0072\u0069\u0074\u0065\u0046\u0069\u0065\u006c\u0064\u0028\u0070\u0072\u006f\u0078\u0079\u0043\u006c\u0069\u0065\u006e\u0074\u0047\u0054\u002c\u0020\u0022\u006d\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u0022\u002c\u0020\u0078\u0043\u0061\u0070\u0065\u004c\u0069\u0073\u0074\u002c\u0020\u0074\u0072\u0075\u0065\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0041\u0064\u0064\u0065\u0064\u0020\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064\u0020\u0068\u0061\u0073\u0068\u0073\u0065\u0074\u0020\u0062\u0061\u0063\u006b\u0020\u0069\u006e\u0074\u006f\u0020\u0074\u0068\u0065\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u002e\u0022\u0029\u003b\u0020\u0020\u0009\u0009\u0009\u000a\u0009\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0074\u0072\u0075\u0065\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u0020\u0063\u0061\u0074\u0063\u0068\u0020\u0028\u0054\u0068\u0072\u006f\u0077\u0061\u0062\u006c\u0065\u0020\u0065\u0029\u0020\u007b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0055\u0074\u0069\u006c\u0073\u002e\u004c\u004f\u0047\u005f\u0049\u004e\u0046\u004f\u0028\u0022\u0052\u0065\u0066\u006c\u0065\u0063\u0074\u0069\u006f\u006e\u0020\u0069\u006e\u0074\u006f\u0020\u0061\u0063\u0074\u0069\u0076\u0065\u0020\u0063\u006c\u0069\u0065\u006e\u0074\u0020\u0070\u0072\u006f\u0078\u0079\u0020\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u002e\u0022\u0029\u003b\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0009\u0065\u002e\u0070\u0072\u0069\u006e\u0074\u0053\u0074\u0061\u0063\u006b\u0054\u0072\u0061\u0063\u0065\u0028\u0029\u003b\u0020\u0020\u0020\u0020\u0020\u0020\u000a\u0020\u0020\u0020\u0020\u0009\u0009\u0072\u0065\u0074\u0075\u0072\u006e\u0020\u0066\u0061\u006c\u0073\u0065\u003b\u0020\u0020\u0009\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u007d\u002f\u002a */ + } + +} diff --git a/src/Java/gtPlusPlus/core/util/wrapper/var.java b/src/Java/gtPlusPlus/core/util/wrapper/var.java index d5e55bd658..3e7413ed85 100644 --- a/src/Java/gtPlusPlus/core/util/wrapper/var.java +++ b/src/Java/gtPlusPlus/core/util/wrapper/var.java @@ -2,7 +2,7 @@ package gtPlusPlus.core.util.wrapper; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; public class var{ @@ -42,7 +42,7 @@ public class var{ } private ItemStack getOreDictStack(int stackSize){ - ItemStack v = UtilsItems.getItemStack(sanitizedName, stackSize); + ItemStack v = ItemUtils.getItemStack(sanitizedName, stackSize); return v; } @@ -56,10 +56,10 @@ public class var{ String meta = "0"; try { if(fqrnSplit[2] != null){meta = fqrnSplit[2];} - temp = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); + temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); } catch (ArrayIndexOutOfBoundsException a){ - temp = UtilsItems.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); + temp = ItemUtils.getItemStackWithMeta(LoadedMods.MiscUtils, fqrn, fqrnSplit[1], Integer.parseInt(meta), stackSize); } return temp; } |