aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item
diff options
context:
space:
mode:
authordraknyte1 <draknyte1@hotmail.com>2016-11-02 15:49:00 +1000
committerdraknyte1 <draknyte1@hotmail.com>2016-11-02 15:49:00 +1000
commitd594987b2cfdefa447ee585a68d4a4bef4ece3a5 (patch)
tree814813fc14ce5dcd8dfa7aeaecd939ac42d12877 /src/Java/gtPlusPlus/core/item
parent26292158575a0f0acb51ae50715887f871d2b5a0 (diff)
parent49a520da5da01594b5c42652d9db5c7c04e49ad8 (diff)
downloadGT5-Unofficial-d594987b2cfdefa447ee585a68d4a4bef4ece3a5.tar.gz
GT5-Unofficial-d594987b2cfdefa447ee585a68d4a4bef4ece3a5.tar.bz2
GT5-Unofficial-d594987b2cfdefa447ee585a68d4a4bef4ece3a5.zip
Merge branch 'master' of https://github.com/draknyte1/GTplusplus
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java330
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseEuItem.java517
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java108
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java160
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java2
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java108
-rw-r--r--src/Java/gtPlusPlus/core/item/base/CoreItem.java2
-rw-r--r--src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java76
-rw-r--r--src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java42
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java104
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java9
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java56
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java56
-rw-r--r--src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java76
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java11
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java6
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java8
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java43
-rw-r--r--src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java11
-rw-r--r--src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java91
-rw-r--r--src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java118
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java89
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java128
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java95
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java92
-rw-r--r--src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java73
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java292
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java6
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java11
-rw-r--r--src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java12
-rw-r--r--src/Java/gtPlusPlus/core/item/init/ItemsFoods.java14
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java68
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java115
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java51
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java316
39 files changed, 2219 insertions, 1093 deletions
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);
+ }
+}