aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java744
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseEuItem.java920
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java106
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java108
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java194
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java29
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java135
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java67
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java27
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java435
-rw-r--r--src/Java/gtPlusPlus/core/item/base/CoreItem.java132
-rw-r--r--src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java43
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java326
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java40
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java126
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java54
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java54
-rw-r--r--src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java33
-rw-r--r--src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java87
-rw-r--r--src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java6
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java127
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java66
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java21
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java84
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java59
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java19
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java46
-rw-r--r--src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java6
-rw-r--r--src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java15
-rw-r--r--src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java10
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java25
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java45
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java25
-rw-r--r--src/Java/gtPlusPlus/core/item/effects/RarityEffect.java22
-rw-r--r--src/Java/gtPlusPlus/core/item/effects/RarityEpic.java18
-rw-r--r--src/Java/gtPlusPlus/core/item/effects/RarityRare.java18
-rw-r--r--src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java14
-rw-r--r--src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java107
-rw-r--r--src/Java/gtPlusPlus/core/item/general/BufferCore.java100
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java384
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java308
-rw-r--r--src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java276
-rw-r--r--src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java331
-rw-r--r--src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java378
-rw-r--r--src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java300
-rw-r--r--src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/init/ItemsFoods.java66
-rw-r--r--src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java73
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java260
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java134
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java519
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java526
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java483
57 files changed, 4157 insertions, 4394 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index 79b813c745..2fa0d2c698 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -1,11 +1,14 @@
package gtPlusPlus.core.item;
-
-import cpw.mods.fml.common.registry.GameRegistry;
+import static gtPlusPlus.core.creative.AddToCreativeTab.tabMachines;
+import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc;
+import static gtPlusPlus.core.lib.CORE.LOAD_ALL_CONTENT;
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.*;
+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;
@@ -13,390 +16,350 @@ 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.*;
+import gtPlusPlus.core.item.general.BufferCore;
+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.*;
+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;
import gtPlusPlus.core.lib.CORE.configSwitches;
import gtPlusPlus.core.lib.LoadedMods;
-import gtPlusPlus.core.material.*;
+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.ItemUtils;
-import net.minecraft.item.*;
+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 {
- public static ToolMaterial STABALLOY = EnumHelper.addToolMaterial("Staballoy", 3, 2500, 7, 1.0F, 18);
-
- public static Item AAA_Broken;
-
- public static Item itemDebugShapeSpawner;
-
- public static Item itemBaseSpawnEgg;
-
- // EnderIO
- public static Item itemPlateSoularium;
- public static Item itemPlateRedstoneAlloy;
- public static Item itemPlateElectricalSteel;
- public static Item itemPlatePulsatingIron;
- public static Item itemPlateEnergeticAlloy;
- public static Item itemPlateVibrantAlloy;
- public static Item itemPlateConductiveIron;
- public static Item itemPlateDarkSteel;
- // Big Reactors
- public static Item itemPlateBlutonium;
- public static Item itemPlateCyanite;
- public static Item itemPlateLudicrite;
- // Thaumcraft
- public static Item itemPlateVoidMetal;
- // Pneumaticraft
- public static Item itemPlateCompressedIron;
- // SimplyJetpacks
- public static Item itemPlateEnrichedSoularium;
- // rfTools
- public static Item itemPlateDimensionShard;
- // Staballoy
- public static Item itemStaballoyPickaxe;
- public static Item itemStaballoyAxe;
- // Tools
- public static Item itemSandstoneHammer;
- // Machine Related
- public static Item itemBufferCore0;
- // Material related
- public static Item itemStickyRubber;
- public static Item itemIngotBatteryAlloy;
- public static Item itemPlateBatteryAlloy;
- public static Item itemHeliumBlob;
- public static Item itemPLACEHOLDER_Circuit;
-
- public static Item FuelRod_Empty;
- public static Item FuelRod_Thorium;
- public static Item FuelRod_Uranium;
- public static Item FuelRod_Plutonium;
-
- public static Item itemBedLocator_Base;
- public static Item itemBaseItemWithCharge;
-
- public static Item itemIngotRaisinBread;
- public static Item itemHotIngotRaisinBread;
-
- public static ItemFood itemFoodRaisinToast;
- 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;
- public static BaseItemBackpack backpack_Yellow;
- public static BaseItemBackpack backpack_Purple;
- public static BaseItemBackpack backpack_Cyan;
- public static BaseItemBackpack backpack_Maroon;
- public static BaseItemBackpack backpack_Olive;
- public static BaseItemBackpack backpack_DarkGreen;
- public static BaseItemBackpack backpack_DarkPurple;
- public static BaseItemBackpack backpack_Teal;
- public static BaseItemBackpack backpack_Navy;
- public static BaseItemBackpack backpack_Silver;
- 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")
+ public static ToolMaterial STABALLOY = EnumHelper.addToolMaterial("Staballoy", 3, 2500, 7, 1.0F, 18);
+
+ public static Item AAA_Broken;
+
+ public static Item itemDebugShapeSpawner;
+
+ public static Item itemBaseSpawnEgg;
+
+ //EnderIO
+ public static Item itemPlateSoularium;
+ public static Item itemPlateRedstoneAlloy;
+ public static Item itemPlateElectricalSteel;
+ public static Item itemPlatePulsatingIron;
+ public static Item itemPlateEnergeticAlloy;
+ public static Item itemPlateVibrantAlloy;
+ public static Item itemPlateConductiveIron;
+ public static Item itemPlateDarkSteel;
+ //Big Reactors
+ public static Item itemPlateBlutonium;
+ public static Item itemPlateCyanite;
+ public static Item itemPlateLudicrite;
+ //Thaumcraft
+ public static Item itemPlateVoidMetal;
+ //Pneumaticraft
+ public static Item itemPlateCompressedIron;
+ //SimplyJetpacks
+ public static Item itemPlateEnrichedSoularium;
+ //rfTools
+ public static Item itemPlateDimensionShard;
+ //Staballoy
+ public static Item itemStaballoyPickaxe;
+ public static Item itemStaballoyAxe;
+ //Tools
+ public static Item itemSandstoneHammer;
+ //Machine Related
+ public static Item itemBufferCore0;
+ //Material related
+ public static Item itemStickyRubber;
+ public static Item itemIngotBatteryAlloy;
+ public static Item itemPlateBatteryAlloy;
+ public static Item itemHeliumBlob;
+ public static Item itemPLACEHOLDER_Circuit;
+
+ public static Item FuelRod_Empty;
+ public static Item FuelRod_Thorium;
+ public static Item FuelRod_Uranium;
+ public static Item FuelRod_Plutonium;
+
+ public static Item itemBedLocator_Base;
+ public static Item itemBaseItemWithCharge;
+
+ public static Item itemIngotRaisinBread;
+ public static Item itemHotIngotRaisinBread;
+
+ public static ItemFood itemFoodRaisinToast;
+ 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;
+ public static BaseItemBackpack backpack_Yellow;
+ public static BaseItemBackpack backpack_Purple;
+ public static BaseItemBackpack backpack_Cyan;
+ public static BaseItemBackpack backpack_Maroon;
+ public static BaseItemBackpack backpack_Olive;
+ public static BaseItemBackpack backpack_DarkGreen;
+ public static BaseItemBackpack backpack_DarkPurple;
+ public static BaseItemBackpack backpack_Teal;
+ public static BaseItemBackpack backpack_Navy;
+ public static BaseItemBackpack backpack_Silver;
+ 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() {
+ public static final void init(){
- ModItems.AAA_Broken = new BaseItemIngot("AAA_Broken", "Errors - Tell Alkalus",
- Utils.rgbtoHexValue(128, 128, 128), 0);
+ AAA_Broken = new BaseItemIngot("AAA_Broken", "Errors - Tell Alkalus", Utils.rgbtoHexValue(128, 128, 128), 0);
- // Debug Loading
- if (CORE.DEBUG) {
+ //Debug Loading
+ if (CORE.DEBUG){
DEBUG_INIT.registerItems();
- }
-
- // Some Simple forms of materials
- ModItems.itemStickyRubber = new Item().setUnlocalizedName("itemStickyRubber")
- .setCreativeTab(AddToCreativeTab.tabMachines).setTextureName(CORE.MODID + ":itemStickyRubber");
- GameRegistry.registerItem(ModItems.itemStickyRubber, "itemStickyRubber");
- GT_OreDictUnificator.registerOre("ingotRubber", ItemUtils.getItemStack(CORE.MODID + ":itemStickyRubber", 1));
-
- ModItems.itemHeliumBlob = new CoreItem("itemHeliumBlob", AddToCreativeTab.tabMisc)
- .setTextureName(CORE.MODID + ":itemHeliumBlob");
+ }
+
+
+ //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
- ModItems.backpack_Red = new BaseItemBackpack("backpackRed", Utils.rgbtoHexValue(200, 0, 0));
- ModItems.backpack_Green = new BaseItemBackpack("backpackGreen", Utils.rgbtoHexValue(0, 200, 0));
- ModItems.backpack_Blue = new BaseItemBackpack("backpackBlue", Utils.rgbtoHexValue(0, 0, 200));
- // Secondary Colours
- ModItems.backpack_Yellow = new BaseItemBackpack("backpackYellow", Utils.rgbtoHexValue(200, 200, 0));
- ModItems.backpack_Purple = new BaseItemBackpack("backpackPurple", Utils.rgbtoHexValue(200, 0, 200));
- ModItems.backpack_Cyan = new BaseItemBackpack("backpackCyan", Utils.rgbtoHexValue(0, 200, 200));
- // Tertiary Colours
- ModItems.backpack_Maroon = new BaseItemBackpack("backpackMaroon", Utils.rgbtoHexValue(128, 0, 0));
- ModItems.backpack_Olive = new BaseItemBackpack("backpackOlive", Utils.rgbtoHexValue(128, 128, 0));
- ModItems.backpack_DarkGreen = new BaseItemBackpack("backpackDarkGreen", Utils.rgbtoHexValue(0, 128, 0));
- ModItems.backpack_DarkPurple = new BaseItemBackpack("backpackDarkPurple", Utils.rgbtoHexValue(128, 0, 128));
- ModItems.backpack_Teal = new BaseItemBackpack("backpackTeal", Utils.rgbtoHexValue(0, 128, 128));
- ModItems.backpack_Navy = new BaseItemBackpack("backpackNavy", Utils.rgbtoHexValue(0, 0, 128));
- // Shades
- ModItems.backpack_Silver = new BaseItemBackpack("backpackSilver", Utils.rgbtoHexValue(192, 192, 192));
- ModItems.backpack_Gray = new BaseItemBackpack("backpackGray", Utils.rgbtoHexValue(128, 128, 128));
- ModItems.backpack_Black = new BaseItemBackpack("backpackBlack", Utils.rgbtoHexValue(20, 20, 20));
- ModItems.backpack_White = new BaseItemBackpack("backpackWhite", Utils.rgbtoHexValue(240, 240, 240));
-
- ModItems.itemBlueprintBase = new ItemBlueprint("itemBlueprint");
-
- // Start meta Item Generation
+ //GameRegistry.registerItem(itemHeliumBlob, "itemHeliumBlob");
+
+ //Make some backpacks
+ //Primary colours
+ backpack_Red = new BaseItemBackpack("backpackRed", Utils.rgbtoHexValue(200, 0, 0));
+ backpack_Green = new BaseItemBackpack("backpackGreen", Utils.rgbtoHexValue(0, 200, 0));
+ backpack_Blue = new BaseItemBackpack("backpackBlue", Utils.rgbtoHexValue(0, 0, 200));
+ //Secondary Colours
+ backpack_Yellow = new BaseItemBackpack("backpackYellow", Utils.rgbtoHexValue(200, 200, 0));
+ backpack_Purple = new BaseItemBackpack("backpackPurple", Utils.rgbtoHexValue(200, 0, 200));
+ backpack_Cyan = new BaseItemBackpack("backpackCyan", Utils.rgbtoHexValue(0, 200, 200));
+ //Tertiary Colours
+ backpack_Maroon = new BaseItemBackpack("backpackMaroon", Utils.rgbtoHexValue(128, 0, 0));
+ backpack_Olive = new BaseItemBackpack("backpackOlive", Utils.rgbtoHexValue(128, 128, 0));
+ backpack_DarkGreen = new BaseItemBackpack("backpackDarkGreen", Utils.rgbtoHexValue(0, 128, 0));
+ backpack_DarkPurple = new BaseItemBackpack("backpackDarkPurple", Utils.rgbtoHexValue(128, 0, 128));
+ backpack_Teal = new BaseItemBackpack("backpackTeal", Utils.rgbtoHexValue(0, 128, 128));
+ backpack_Navy = new BaseItemBackpack("backpackNavy", Utils.rgbtoHexValue(0, 0, 128));
+ //Shades
+ backpack_Silver = new BaseItemBackpack("backpackSilver", Utils.rgbtoHexValue(192, 192, 192));
+ 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 {
- // 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) {
+ try{
+ //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.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
+ //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
+ //Potin is traditionally an alloy of bronze, tin and lead, with varying quantities of each possible
MaterialGenerator.generate(ALLOY.POTIN);
-
- // Staballoy & Tantalloy
+
+ //Staballoy & Tantalloy
MaterialGenerator.generate(ALLOY.STABALLOY);
MaterialGenerator.generate(ALLOY.TANTALLOY_60);
MaterialGenerator.generate(ALLOY.TANTALLOY_61);
- // Inconel
+ //Inconel
MaterialGenerator.generate(ALLOY.INCONEL_625);
MaterialGenerator.generate(ALLOY.INCONEL_690);
MaterialGenerator.generate(ALLOY.INCONEL_792);
- // Maraging Steel
+
+ //Maraging Steel
MaterialGenerator.generate(ALLOY.MARAGING250);
MaterialGenerator.generate(ALLOY.MARAGING300);
MaterialGenerator.generate(ALLOY.MARAGING350);
-
- // Composite Alloys
+
+ //Composite Alloys
MaterialGenerator.generate(ALLOY.STELLITE);
- MaterialGenerator.generate(ALLOY.TALONITE);
+ MaterialGenerator.generate(ALLOY.TALONITE);
- // Hastelloy
+ //Hastelloy
MaterialGenerator.generate(ALLOY.HASTELLOY_W);
MaterialGenerator.generate(ALLOY.HASTELLOY_X);
MaterialGenerator.generate(ALLOY.HASTELLOY_C276);
MaterialGenerator.generate(ALLOY.HASTELLOY_N);
- // Incoloy
+ //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);
-
- }
- catch (final Throwable r) {
- Utils.LOG_INFO("Failed to Generated a Material. " + r.getMessage());
- // Utils.LOG_INFO("Failed to Generated a Material.
- // "+r.getCause().getMessage());
- Utils.LOG_INFO("Failed to Generated a Material. " + r.getStackTrace()[0].getMethodName());
- Utils.LOG_INFO("Failed to Generated a Material. " + r.getStackTrace()[1].getMethodName());
+
+ //Leagrisium
+ MaterialGenerator.generate(ALLOY.LEAGRISIUM);
+ //Must be the final Alloy to Generate
+ MaterialGenerator.generate(ALLOY.QUANTUM);
+
+
+ } catch (Throwable r){
+ Utils.LOG_INFO("Failed to Generated a Material. "+r.getMessage());
+ //Utils.LOG_INFO("Failed to Generated a Material. "+r.getCause().getMessage());
+ Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[0].getMethodName());
+ Utils.LOG_INFO("Failed to Generated a Material. "+r.getStackTrace()[1].getMethodName());
r.printStackTrace();
System.exit(1);
}
- // Nuclear Fuel Dusts
- ModItems.dustUraniumTetraFluoride = ItemUtils.generateSpecialUseDusts("UraniumTetrafluoride",
- "Uranium Tetrafluoride", Utils.rgbtoHexValue(17, 179, 42))[0];
- ModItems.dustUraniumHexaFluoride = ItemUtils.generateSpecialUseDusts("UraniumHexafluoride",
- "Uranium Hexafluoride", Utils.rgbtoHexValue(9, 199, 32))[0];
-
- ModItems.dustBerylliumFluoride = ItemUtils.generateSpecialUseDusts("BerylliumFluoride", "Beryllium Fluoride",
- Utils.rgbtoHexValue(175, 175, 175))[0]; // https://en.wikipedia.org/wiki/Beryllium_fluoride
-
- ModItems.dustLithiumCarbonate = ItemUtils.generateSpecialUseDusts("LithiumCarbonate", "Lithium Carbonate",
- Utils.rgbtoHexValue(240, 240, 240))[0]; // https://en.wikipedia.org/wiki/Lithium_carbonate
- ModItems.dustLithiumFluoride = ItemUtils.generateSpecialUseDusts("LithiumFluoride", "Lithium Fluoride",
- Utils.rgbtoHexValue(245, 245, 245))[0]; // https://en.wikipedia.org/wiki/Lithium_fluoride
- ModItems.dustLithiumPeroxide = ItemUtils.generateSpecialUseDusts("LithiumPeroxide", "Lithium Peroxide",
- Utils.rgbtoHexValue(250, 250, 250))[0]; // https://en.wikipedia.org/wiki/Lithium_peroxide
- ModItems.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) {
- ModItems.dustQuicklime = ItemUtils.generateSpecialUseDusts("Quicklime", "Quicklime",
- Utils.rgbtoHexValue(255, 255, 255))[0]; // https://en.wikipedia.org/wiki/Calcium_oxide
- }
- ModItems.dustCalciumHydroxide = ItemUtils.generateSpecialUseDusts("CalciumHydroxide", "Hydrated Lime",
- Utils.rgbtoHexValue(255, 255, 255))[0]; // https://en.wikipedia.org/wiki/Calcium_hydroxide
- ModItems.dustCalciumCarbonate = ItemUtils.generateSpecialUseDusts("CalciumCarbonate", "Calcium Carbonate",
- Utils.rgbtoHexValue(255, 255, 255))[0]; // https://en.wikipedia.org/wiki/Calcium_carbonate
- ModItems.dust2LiOH_CaCO3 = ItemUtils.generateSpecialUseDusts("2LiOHCaCO3", "2LiOH & CaCO3 Compound",
- Utils.rgbtoHexValue(255, 255, 255))[0]; // https://en.wikipedia.org/wiki/Calcium_carbonate
-
- // FLiBe Fuel Compounds
- ModItems.dustLi2BeF4 = ItemUtils.generateSpecialUseDusts("Li2BeF4", "Li2BeF4 Fuel Compound",
- Utils.rgbtoHexValue(255, 255, 255))[0]; // https://en.wikipedia.org/wiki/FLiBe
-
- ModItems.metaItem2 = new BaseEuItem();
- ModItems.metaItem2.registerItem(0, EnumChatFormatting.BLACK + "Test Item 0", 0, 0, "I am 0.");
- ModItems.metaItem2.registerItem(1, EnumChatFormatting.GREEN + "Test Item 1", 1006346000, 1, "I Hold EU 1.",
- 500);
- ModItems.metaItem2.registerItem(2, EnumChatFormatting.GOLD + "Test Item 2", 1004630000, 2, "I Hold EU 2.",
- 8000);
- ModItems.metaItem2.registerItem(3, "Test Item 3", 1000765000, 4, "I Hold EU 3.", 32000);
- ModItems.metaItem2.registerItem(4, "Whirlygig", 1043644000, (short) 5, "Spin me right round.", EnumRarity.rare,
- EnumChatFormatting.DARK_GREEN, true);
- ModItems.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);
+ //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
- final boolean gtStyleTools = LoadedMods.Gregtech;
+ 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
- final Materials[] rm = Materials.values();
- for (final Materials m : rm) {
- ModItems.MP_GTMATERIAL = ItemUtils.generateMultiPick(gtStyleTools, m);
- ModItems.MS_GTMATERIAL = ItemUtils.generateMultiShovel(gtStyleTools, m);
- /*
- * itemBaseDecidust = UtilsItems.generateDecidust(m);
- * itemBaseCentidust = UtilsItems.generateCentidust(m);
- */
+ 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.
- // EnderIO Resources
- if (LoadedMods.EnderIO || CORE.LOAD_ALL_CONTENT) {
+ //GameRegistry.registerItem(this, unlocalName);
+
+ boolean gtStyleTools = LoadedMods.Gregtech;
+
+ 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
- ModItems.itemPlateSoularium = new BaseItemPlate("itemPlate" + "Soularium", "Soularium", new short[] {
- 95, 90, 54
- }, 2, 0);
- ModItems.itemPlateRedstoneAlloy = new BaseItemPlate("itemPlate" + "RedstoneAlloy", "Redstone Alloy",
- new short[] {
- 178, 34, 34
- }, 2, 0);
- ModItems.itemPlateElectricalSteel = new BaseItemPlate("itemPlate" + "ElectricalSteel", "Electrical Steel",
- new short[] {
- 194, 194, 194
- }, 2, 0);
- ModItems.itemPlatePulsatingIron = new BaseItemPlate("itemPlate" + "PhasedIron", "Phased Iron", new short[] {
- 50, 91, 21
- }, 2, 0);
- ModItems.itemPlateEnergeticAlloy = new BaseItemPlate("itemPlate" + "EnergeticAlloy", "Energetic Alloy",
- new short[] {
- 252, 152, 45
- }, 2, 0);
- ModItems.itemPlateVibrantAlloy = new BaseItemPlate("itemPlate" + "VibrantAlloy", "Vibrant Alloy",
- new short[] {
- 204, 242, 142
- }, 2, 0);
- ModItems.itemPlateConductiveIron = new BaseItemPlate("itemPlate" + "ConductiveIron", "Conductive Iron",
- new short[] {
- 164, 109, 100
- }, 2, 0);
+ //Item Init
+ 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.");
}
- // Big Reactors
- if (LoadedMods.Big_Reactors || CORE.LOAD_ALL_CONTENT) {
+ //Big Reactors
+ if (LoadedMods.Big_Reactors|| LOAD_ALL_CONTENT){
Utils.LOG_INFO("BigReactors Found - Loading Resources.");
- // Item Init
- ModItems.itemPlateBlutonium = new BaseItemPlate("itemPlate" + "Blutonium", "Blutonium", new short[] {
- 0, 0, 255
- }, 2, 0);
- ModItems.itemPlateCyanite = new BaseItemPlate("itemPlate" + "Cyanite", "Cyanite", new short[] {
- 0, 191, 255
- }, 2, 0);
- ModItems.itemPlateLudicrite = new BaseItemPlate("itemPlate" + "Ludicrite", "Ludicrite", new short[] {
- 167, 5, 179
- }, 2, 0);
+ //Item Init
+ 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.");
}
- // Thaumcraft
- if (LoadedMods.Thaumcraft || CORE.LOAD_ALL_CONTENT) {
+ //Thaumcraft
+ if (LoadedMods.Thaumcraft|| LOAD_ALL_CONTENT){
Utils.LOG_INFO("Thaumcraft Found - Loading Resources.");
- // Item Init
+ //Item Init
try {
- ItemUtils.getItemForOreDict("Thaumcraft:ItemResource", "ingotVoidMetal", "Void Metal Ingot", 16);
- ModItems.itemPlateVoidMetal = new BaseItemPlate("itemPlate" + "Void", "Void", new short[] {
- 82, 17, 82
- }, 2, 0);
+ 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));
- }
- catch (final NullPointerException e) {
+ } catch (NullPointerException e){
e.getClass();
}
@@ -404,146 +367,123 @@ public final class ModItems {
else {
Utils.LOG_WARNING("Thaumcraft not Found - Skipping Resources.");
}
- // ExtraUtils
- if (LoadedMods.Extra_Utils || CORE.LOAD_ALL_CONTENT) {
+ //ExtraUtils
+ if (LoadedMods.Extra_Utils|| LOAD_ALL_CONTENT){
Utils.LOG_INFO("ExtraUtilities Found - Loading Resources.");
- // Item Init
+ //Item Init
try {
- // itemPlateBedrockium = new
- // Item().setUnlocalizedName("itemPlateBedrockium").setCreativeTab(AddToCreativeTab.tabMisc).setTextureName(CORE.MODID
- // + ":itemPlateBedrockium");
- }
- catch (final NullPointerException e) {
+ //itemPlateBedrockium = new Item().setUnlocalizedName("itemPlateBedrockium").setCreativeTab(AddToCreativeTab.tabMisc).setTextureName(CORE.MODID + ":itemPlateBedrockium");
+ } catch (NullPointerException e){
e.getClass();
}
- // Registry
- // GameRegistry.registerItem(itemPlateBedrockium,
- // "itemPlateBedrockium");
+ //Registry
+ //GameRegistry.registerItem(itemPlateBedrockium, "itemPlateBedrockium");
}
else {
Utils.LOG_WARNING("ExtraUtilities not Found - Skipping Resources.");
}
- // Pneumaticraft
- if (LoadedMods.PneumaticCraft || CORE.LOAD_ALL_CONTENT) {
+ //Pneumaticraft
+ if (LoadedMods.PneumaticCraft|| LOAD_ALL_CONTENT){
Utils.LOG_INFO("PneumaticCraft Found - Loading Resources.");
- // Item Init
- ModItems.itemPlateCompressedIron = new BaseItemPlate("itemPlate" + "CompressedIron", "Compressed Iron",
- new short[] {
- 128, 128, 128
- }, 2, 0);
+ //Item Init
+ itemPlateCompressedIron = new BaseItemPlate("itemPlate"+"CompressedIron", "Compressed Iron", new short[]{128, 128, 128}, 2, 0);
}
else {
Utils.LOG_WARNING("PneumaticCraft not Found - Skipping Resources.");
}
- // Simply Jetpacks
- if (LoadedMods.Simply_Jetpacks || CORE.LOAD_ALL_CONTENT) {
+ //Simply Jetpacks
+ if (LoadedMods.Simply_Jetpacks|| LOAD_ALL_CONTENT){
Utils.LOG_INFO("SimplyJetpacks Found - Loading Resources.");
- // Item Init
- ModItems.itemPlateEnrichedSoularium = new RarityUncommon().setUnlocalizedName("itemPlateEnrichedSoularium")
- .setCreativeTab(AddToCreativeTab.tabMisc).setTextureName(CORE.MODID + ":itemPlateSoularium");
- // Registry
- GameRegistry.registerItem(ModItems.itemPlateEnrichedSoularium, "itemPlateEnrichedSoularium");
+ //Item Init
+ itemPlateEnrichedSoularium = new RarityUncommon().setUnlocalizedName("itemPlateEnrichedSoularium").setCreativeTab(AddToCreativeTab.tabMisc).setTextureName(CORE.MODID + ":itemPlateSoularium");
+ //Registry
+ GameRegistry.registerItem(itemPlateEnrichedSoularium, "itemPlateEnrichedSoularium");
}
else {
Utils.LOG_WARNING("SimplyJetpacks not Found - Skipping Resources.");
}
- // rfTools
- if (LoadedMods.RFTools || CORE.LOAD_ALL_CONTENT) {
+ //rfTools
+ if (LoadedMods.RFTools|| LOAD_ALL_CONTENT){
Utils.LOG_INFO("rfTools Found - Loading Resources.");
- // Item Init
- ModItems.itemPlateDimensionShard = new BaseItemPlate("itemPlate" + "DimensionShard", "Dimensional Shard",
- new short[] {
- 170, 230, 230
- }, 2, 0);
+ //Item Init
+ itemPlateDimensionShard = new BaseItemPlate("itemPlate"+"DimensionShard", "Dimensional Shard", new short[]{170, 230, 230}, 2, 0);
}
else {
Utils.LOG_WARNING("rfTools not Found - Skipping Resources.");
}
- // IC2 Exp
- if (LoadedMods.IndustrialCraft2 || CORE.LOAD_ALL_CONTENT) {
+ //IC2 Exp
+ if (LoadedMods.IndustrialCraft2|| LOAD_ALL_CONTENT){
Utils.LOG_INFO("IndustrialCraft2 Found - Loading Resources.");
- // Item Init
- ModItems.FuelRod_Empty = new FuelRod_Base("itemFuelRod_Empty", "Empty", 0, 1000);
- ModItems.FuelRod_Thorium = new FuelRod_Base("itemFuelRod_Thorium", "Thorium", 1000, 1000);
- ModItems.FuelRod_Uranium = new FuelRod_Base("itemFuelRod_Uranium", "Uranium", 2500, 2500);
- ModItems.FuelRod_Plutonium = new FuelRod_Base("itemFuelRod_Plutonium", "Plutonium", 5000, 5000);
- ModItems.RfEuBattery = new RF2EU_Battery();
-
- try {
- final Class baublesTest = Class.forName("baubles.api.IBauble");
- if (baublesTest != null) {
- COMPAT_Baubles.run();
- }
- else {
- Utils.LOG_INFO("Baubles Not Found - Skipping Resources.");
- }
+ //Item Init
+ FuelRod_Empty = new FuelRod_Base("itemFuelRod_Empty", "Empty", 0, 1000);
+ FuelRod_Thorium = new FuelRod_Base("itemFuelRod_Thorium", "Thorium", 1000, 1000);
+ FuelRod_Uranium = new FuelRod_Base("itemFuelRod_Uranium", "Uranium", 2500, 2500);
+ FuelRod_Plutonium = new FuelRod_Base("itemFuelRod_Plutonium", "Plutonium", 5000, 5000);
+ RfEuBattery = new RF2EU_Battery();
+
+ try {Class baublesTest = Class.forName("baubles.api.IBauble");
+ if (baublesTest != null){
+ COMPAT_Baubles.run();
+ }
+ else {
+ Utils.LOG_INFO("Baubles Not Found - Skipping Resources.");
}
- catch (final Throwable T) {
- 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"));
+ //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.");
}
- // Special Item Handling Case
+
+ //Special Item Handling Case
if (configSwitches.enableAlternativeBatteryAlloy) {
- // 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);
+ //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);
}
- // UtilsItems.generateSpawnEgg("ic2", "boatcarbon",
- // Utils.generateSingularRandomHexValue(),
- // Utils.generateSingularRandomHexValue());
+
+ //UtilsItems.generateSpawnEgg("ic2", "boatcarbon", Utils.generateSingularRandomHexValue(), Utils.generateSingularRandomHexValue());
+
+
/*
* Misc Items
*/
- // Staballoy Equipment
- ModItems.itemStaballoyPickaxe = new StaballoyPickaxe("itemStaballoyPickaxe", ModItems.STABALLOY)
- .setCreativeTab(AddToCreativeTab.tabTools);
- GameRegistry.registerItem(ModItems.itemStaballoyPickaxe, ModItems.itemStaballoyPickaxe.getUnlocalizedName());
- ModItems.itemStaballoyAxe = new StaballoyAxe("itemStaballoyAxe", ModItems.STABALLOY)
- .setCreativeTab(AddToCreativeTab.tabTools);
- GameRegistry.registerItem(ModItems.itemStaballoyAxe, ModItems.itemStaballoyAxe.getUnlocalizedName());
+ //Staballoy Equipment
+ itemStaballoyPickaxe = new StaballoyPickaxe("itemStaballoyPickaxe", STABALLOY).setCreativeTab(AddToCreativeTab.tabTools);
+ GameRegistry.registerItem(itemStaballoyPickaxe, itemStaballoyPickaxe.getUnlocalizedName());
+ itemStaballoyAxe = new StaballoyAxe("itemStaballoyAxe", STABALLOY).setCreativeTab(AddToCreativeTab.tabTools);
+ GameRegistry.registerItem(itemStaballoyAxe, itemStaballoyAxe.getUnlocalizedName());
- // Sandstone Hammer
- ModItems.itemSandstoneHammer = new SandstoneHammer("itemSandstoneHammer")
- .setCreativeTab(AddToCreativeTab.tabTools);
- GameRegistry.registerItem(ModItems.itemSandstoneHammer, ModItems.itemSandstoneHammer.getUnlocalizedName());
+ //Sandstone Hammer
+ itemSandstoneHammer = new SandstoneHammer("itemSandstoneHammer").setCreativeTab(AddToCreativeTab.tabTools);
+ GameRegistry.registerItem(itemSandstoneHammer, itemSandstoneHammer.getUnlocalizedName());
- // Buffer Cores!
+ //Buffer Cores!
Item itemBufferCore;
- for (int i = 1; i <= 10; i++) {
- // Utils.LOG_INFO(""+i);
+ for(int i=1; i<=10; i++){
+ //Utils.LOG_INFO(""+i);
itemBufferCore = new BufferCore("itemBufferCore", i).setCreativeTab(AddToCreativeTab.tabMachines);
- GameRegistry.registerItem(itemBufferCore, itemBufferCore.getUnlocalizedName() + i);
- // System.out.println("Buffer Core registration count is: "+i);
+ GameRegistry.registerItem(itemBufferCore, itemBufferCore.getUnlocalizedName()+i);
+ //System.out.println("Buffer Core registration count is: "+i);
}
- ModItems.itemPLACEHOLDER_Circuit = new Item().setUnlocalizedName("itemPLACEHOLDER_Circuit")
- .setTextureName(CORE.MODID + ":itemPLACEHOLDER_Circuit");
- GameRegistry.registerItem(ModItems.itemPLACEHOLDER_Circuit, "itemPLACEHOLDER_Circuit");
+ 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");
+ //ItemBlockGtFrameBox = new ItemBlockGtFrameBox(ModBlocks.blockGtFrameSet1);
+ //GameRegistry.registerItem(ItemBlockGtFrameBox, "itemGtFrameBoxSet1");
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java
index e92e69f0e0..80412fdd3c 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java
@@ -1,10 +1,7 @@
package gtPlusPlus.core.item.base;
-import java.util.*;
-
-import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
+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;
@@ -12,620 +9,509 @@ 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.*;
+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.*;
+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.*;
+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 final ArrayList<Pair<Integer, EnumRarity>> rarity = new ArrayList<Pair<Integer, EnumRarity>>();
- private final ArrayList<Pair<Integer, EnumChatFormatting>> descColour = new ArrayList<Pair<Integer, EnumChatFormatting>>();
- private final ArrayList<Pair<Integer, String>> itemName = new ArrayList<Pair<Integer, String>>();
- private final ArrayList<Pair<Integer, String>> itemDescription = new ArrayList<Pair<Integer, String>>();
- private final 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>();
+ 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(final String unlocalizedName, final CreativeTabs creativeTab, final short aOffset,
- final short aItemAmount) {
- this.mEnabledItems = new BitSet(aItemAmount);
- this.mVisibleItems = new BitSet(aItemAmount);
- this.mOffset = (short) Math.min(32766, aOffset);
- this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset);
- this.mIconList = new IIcon[aItemAmount][1];
- this.setHasSubtypes(true);
- this.setMaxDamage(0);
- this.setUnlocalizedName(unlocalizedName);
- this.setCreativeTab(creativeTab);
- this.setMaxStackSize(1);
+ 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));
+ }
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
@Override
- public final void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList,
- final boolean aF3_H) {
- // aList.add("Meta: "+(aStack.getItemDamage()-mOffset));
- if (this.descColour.get(aStack.getItemDamage() - this.mOffset) != null
- && this.itemDescription.get(aStack.getItemDamage() - this.mOffset) != null) {
- aList.add(this.descColour.get(aStack.getItemDamage() - this.mOffset).getValue()
- + this.itemDescription.get(aStack.getItemDamage() - this.mOffset).getValue());
- }
- final String tKey = this.getUnlocalizedName(aStack) + ".tooltip",
- tString = GT_LanguageManager.getTranslation(tKey);
- if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) {
- aList.add(tString);
- }
- final Long[] tStats = this.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 {
- final long tCharge = this.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: "
- + GT_Values.V[(int) (tStats[2] >= 0
- ? tStats[2] < GT_Values.V.length ? tStats[2] : GT_Values.V.length - 1 : 1)]
- + EnumChatFormatting.GRAY);
- }
- }
- }
- final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack));
- if (tList != null) {
- for (final IItemBehaviour<BaseEuItem> tBehavior : tList) {
- aList = tBehavior.getAdditionalToolTips(this, aList, aStack);
- }
- }
+ @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;
}
- /**
- * 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(final int aID, final String aEnglish, String aToolTip, final Object... aRandomData) {
- if (aToolTip == null) {
- aToolTip = "";
- }
- if (aID >= 0 && aID < this.mItemAmount) {
- final ItemStack rStack = new ItemStack(this, 1, this.mOffset + aID);
- this.mEnabledItems.set(aID);
- this.mVisibleItems.set(aID);
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".name", aEnglish);
- GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".tooltip", aToolTip);
- final List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>();
- // Important Stuff to do first
- for (final Object tRandomData : aRandomData) {
- if (tRandomData instanceof SubTag) {
- if (tRandomData == SubTag.INVISIBLE) {
- this.mVisibleItems.set(aID, false);
- continue;
- }
- if (tRandomData == SubTag.NO_UNIFICATION) {
- GT_OreDictUnificator.addToBlacklist(rStack);
- continue;
- }
- }
- }
- // now check for the rest
- for (final Object tRandomData : aRandomData) {
- if (tRandomData != null) {
- boolean tUseOreDict = true;
- if (tRandomData instanceof IItemBehaviour) {
- this.addItemBehavior(this.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 boolean hasEffect(ItemStack par1ItemStack){
+ if (hasEffect.get(par1ItemStack.getItemDamage()-mOffset) != null)
+ return hasEffect.get(par1ItemStack.getItemDamage()-mOffset).getValue();
+ 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(final int aMetaValue, final IItemBehaviour<BaseEuItem> aBehavior) {
- if (aMetaValue < 0 || aMetaValue >= 32766 || aBehavior == null) {
- return this;
- }
- ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) aMetaValue);
- if (tList == null) {
- tList = new ArrayList<IItemBehaviour<BaseEuItem>>(1);
- this.mItemBehaviors.put((short) aMetaValue, tList);
- }
- tList.add(aBehavior);
+
+ @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 boolean canProvideEnergy(final ItemStack aStack) {
- final Long[] tStats = this.getElectricStats(aStack);
- if (tStats == null) {
- return false;
- }
- return tStats[3] > 0 || aStack.stackSize == 1 && (tStats[3] == -2 || tStats[3] == -3);
+ public final Item getEmptyItem(ItemStack itemStack) {
+ return this;
}
@Override
- public final boolean canUse(final ItemStack aStack, final double aAmount) {
- return this.getRealCharge(aStack) >= aAmount;
+ public final double getMaxCharge(ItemStack aStack) {
+ Long[] tStats = getElectricStats(aStack);
+ if (tStats == null) return 0;
+ return Math.abs(tStats[0]);
}
@Override
- public final double charge(final ItemStack aStack, final double aCharge, final int aTier,
- final boolean aIgnoreTransferLimit, final boolean aSimulate) {
- final Long[] tStats = this.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;
- }
- final long tChargeBefore = this.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) {
- this.setCharge(aStack, tNewCharge);
- }
- return tNewCharge - tChargeBefore;
+ 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 void chargeFromArmor(final ItemStack aStack, final EntityLivingBase aPlayer) {
- if (aPlayer == null || aPlayer.worldObj.isRemote) {
- return;
- }
- for (int i = 1; i < 5; i++) {
- final ItemStack tArmor = aPlayer.getEquipmentInSlot(i);
- if (GT_ModHandler.isElectricItem(tArmor)) {
- final IElectricItem tArmorItem = (IElectricItem) tArmor.getItem();
- if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= this.getTier(aStack)) {
- final double tCharge = ElectricItem.manager.discharge(tArmor,
- this.charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true),
- Integer.MAX_VALUE, true, true, false);
- if (tCharge > 0) {
- this.charge(aStack, tCharge, Integer.MAX_VALUE, true, false);
- if (aPlayer instanceof EntityPlayer) {
- final Container tContainer = ((EntityPlayer) aPlayer).openContainer;
- if (tContainer != null) {
- tContainer.detectAndSendChanges();
- }
- }
- }
- }
- }
- }
+ public final int getTier(ItemStack aStack) {
+ Long[] tStats = getElectricStats(aStack);
+ return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]);
}
@Override
- public final double discharge(final ItemStack aStack, final double aCharge, final int aTier,
- final boolean aIgnoreTransferLimit, final boolean aBatteryAlike, final boolean aSimulate) {
- final Long[] tStats = this.getElectricStats(aStack);
- if (tStats == null || tStats[2] > aTier) {
+ 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;
- }
- if (aBatteryAlike && !this.canProvideEnergy(aStack)) {
- 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--;
- }
+ if (aCharge < tStats[3] || aStack.stackSize < 1) return 0;
+ if (!aSimulate) aStack.stackSize--;
return tStats[3];
}
- final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = Math.max(0,
- tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge)));
- if (!aSimulate) {
- this.setCharge(aStack, tNewCharge);
- }
+ 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(final ItemStack aStack) {
- return this.getRealCharge(aStack);
+ public final double getCharge(ItemStack aStack) {
+ return getRealCharge(aStack);
}
@Override
- public final Item getChargedItem(final ItemStack itemStack) {
- return this;
+ public final boolean canUse(ItemStack aStack, double aAmount) {
+ return getRealCharge(aStack) >= aAmount;
}
- @SuppressWarnings("static-method")
- public short getChargedMetaData(final ItemStack aStack) {
- return (short) aStack.getItemDamage();
+ @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;
}
- public final Long[] getElectricStats(final ItemStack aStack) {
- return this.mElectricStats.get((short) aStack.getItemDamage());
+ @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 Item getEmptyItem(final ItemStack itemStack) {
- return this;
+ 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 getEmptyMetaData(final ItemStack aStack) {
+ public short getChargedMetaData(ItemStack aStack) {
return (short) aStack.getItemDamage();
}
- @Override
- public final IIcon getIconFromDamage(final int aMetaData) {
- if (aMetaData < 0) {
- return null;
- }
- return aMetaData - this.mOffset < this.mIconList.length ? this.mIconList[aMetaData - this.mOffset][0] : null;
+ @SuppressWarnings("static-method")
+ public short getEmptyMetaData(ItemStack aStack) {
+ return (short) aStack.getItemDamage();
}
- @Override
- public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) {
- return false;
- }
- @Override
- public int getItemEnchantability() {
- return 0;
+ 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 String getItemStackDisplayName(final ItemStack par1ItemStack) {
- return this.itemName.get(par1ItemStack.getItemDamage() - this.mOffset).getValue();
- }
+ 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(final ItemStack aStack) {
+ public final IElectricItemManager getManager(ItemStack aStack) {
return this;
} // We are our own Manager
- @Override
- public final double getMaxCharge(final ItemStack aStack) {
- final Long[] tStats = this.getElectricStats(aStack);
- if (tStats == null) {
- return 0;
- }
- return Math.abs(tStats[0]);
+ /**
+ * 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;
}
- @Override
- @SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
- if (this.rarity.get(par1ItemStack.getItemDamage() - this.mOffset) != null) {
- return this.rarity.get(par1ItemStack.getItemDamage() - this.mOffset).getValue();
+ /**
+ * @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 EnumRarity.common;
+ return this;
}
- public final long getRealCharge(final ItemStack aStack) {
- final Long[] tStats = this.getElectricStats(aStack);
- if (tStats == null) {
- return 0;
- }
- if (tStats[3] > 0) {
- return (int) (long) tStats[3];
- }
- final NBTTagCompound tNBT = aStack.getTagCompound();
- return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge");
- }
- @SuppressWarnings({
- "rawtypes", "unchecked"
- })
+ @SuppressWarnings({ "rawtypes", "unchecked" })
@Override
@SideOnly(Side.CLIENT)
- public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) {
- for (int i = 0, j = this.mEnabledItems.length(); i < j; i++) {
- if (this.mVisibleItems.get(i) || GT_Values.D1 && this.mEnabledItems.get(i)) {
- final Long[] tStats = this.mElectricStats.get((short) (this.mOffset + i));
+ 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) {
- final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i);
- this.setCharge(tStack, Math.abs(tStats[0]));
- this.isItemStackUsable(tStack);
+ 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) {
- final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i);
- this.isItemStackUsable(tStack);
+ ItemStack tStack = new ItemStack(this, 1, mOffset + i);
+ isItemStackUsable(tStack);
aList.add(tStack);
}
}
- }
- }
-
- @Override
- public final int getTier(final ItemStack aStack) {
- final Long[] tStats = this.getElectricStats(aStack);
- return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]);
- }
-
- @Override
- public final String getToolTip(final 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 double getTransferLimit(final ItemStack aStack) {
- final Long[] tStats = this.getElectricStats(aStack);
- if (tStats == null) {
- return 0;
- }
- return Math.max(tStats[1], tStats[3]);
- }
-
- /**
- * Returns the unlocalized name of this item.
- */
- @Override
- public String getUnlocalizedName() {
- return this.unlocalizedName;
- }
-
- @Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
- if (this.hasEffect.get(par1ItemStack.getItemDamage() - this.mOffset) != null) {
- return this.hasEffect.get(par1ItemStack.getItemDamage() - this.mOffset).getValue();
- }
- return false;
- }
-
- @Override
- public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) {
- return false;
- }
-
- public boolean isItemStackUsable(final ItemStack aStack) {
- final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack));
- if (tList != null) {
- for (final IItemBehaviour<BaseEuItem> tBehavior : tList) {
- if (!tBehavior.isItemStackUsable(this, aStack)) {
- return false;
- }
- }
- }
- return true;
}
@Override
@SideOnly(Side.CLIENT)
- public final void registerIcons(final IIconRegister aIconRegister) {
- for (short i = 0, j = (short) this.mEnabledItems.length(); i < j; i++) {
- if (this.mEnabledItems.get(i)) {
- for (byte k = 1; k < this.mIconList[i].length; k++) {
- this.mIconList[i][k] = aIconRegister
- .registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i + "/" + k);
+ 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));
}
- this.mIconList[i][0] = aIconRegister
- .registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i);
+ mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":" + (getUnlocalizedName() + "/" + i));
}
- }
- }
-
- public void registerItem(final int id, final String localizedName, final long euStorage, final int tier,
- final String description) {
- this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common,
- EnumChatFormatting.GRAY, false);
- }
-
- public void registerItem(final int id, final String localizedName, final long euStorage, final int tier,
- final String description, final int burnTime) {
- this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common,
- EnumChatFormatting.GRAY, false);
- this.setBurnValue(id, burnTime);
- }
-
- public void registerItem(final int id, final String localizedName, final long euStorage, final short tier,
- final String description, final EnumRarity regRarity, final EnumChatFormatting colour,
- final boolean Effect) {
- this.addItem(id, localizedName, EnumChatFormatting.YELLOW + "Electric", new Object[] {});
- this.setElectricStats(this.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
+ public final IIcon getIconFromDamage(int aMetaData) {
+ if (aMetaData < 0) return null;
+ return aMetaData - mOffset < mIconList.length ? mIconList[aMetaData - mOffset][0] : null;
+ }
+
/**
- * 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(final int aMetaValue, final int aValue) {
- if (aMetaValue < 0 || aValue < 0) {
- return this;
- }
- if (aValue == 0) {
- this.mBurnValues.remove((short) aMetaValue);
- }
- else {
- this.mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue);
- }
- return this;
- }
-
- public final boolean setCharge(final ItemStack aStack, long aCharge) {
- final Long[] tStats = this.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(this.getChargedMetaData(aStack));
- tNBT.setLong("GT.ItemCharge", aCharge);
- }
- else {
- aStack.setItemDamage(this.getEmptyMetaData(aStack));
- }
- if (tNBT.hasNoTags()) {
- aStack.setTagCompound(null);
- }
- else {
- aStack.setTagCompound(tNBT);
- }
- this.isItemStackUsable(aStack);
- return true;
- }
-
- /**
- * @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(final int aMetaValue, final long aMaxCharge, final long aTransferLimit,
- final long aTier, final long aSpecialData, final boolean aUseAnimations) {
- if (aMetaValue < 0) {
- return this;
- }
- if (aMaxCharge == 0) {
- this.mElectricStats.remove((short) aMetaValue);
- }
- else {
- this.mElectricStats.put((short) aMetaValue, new Long[] {
- aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData
- });
- }
- return this;
- }
-
+ * 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;
+ }
+
/**
- * Sets the unlocalized name of this item to the string passed as the
- * parameter"
- */
+ * 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 Item setUnlocalizedName(final String p_77655_1_) {
- this.unlocalizedName = p_77655_1_;
- super.setUnlocalizedName(p_77655_1_);
- return this;
- }
+ 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 final boolean use(final ItemStack aStack, final double aAmount, final EntityLivingBase aPlayer) {
- this.chargeFromArmor(aStack, aPlayer);
- if (aPlayer instanceof EntityPlayer && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) {
- return true;
- }
- final double tTransfer = this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true);
- if (tTransfer == aAmount) {
- this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false);
- this.chargeFromArmor(aStack, aPlayer);
- return true;
- }
- this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false);
- this.chargeFromArmor(aStack, aPlayer);
- return false;
+ 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 eb61454f15..391f7bb986 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java
@@ -1,8 +1,5 @@
package gtPlusPlus.core.item.base;
-import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.creative.AddToCreativeTab;
@@ -15,75 +12,78 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
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 BaseItemBackpack extends Item {
-
- protected final int colourValue;
- protected final String unlocalName;
-
- public BaseItemBackpack(final String unlocalizedName, final int colour) {
- this.unlocalName = unlocalizedName;
- this.setUnlocalizedName(unlocalizedName);
- this.setTextureName(CORE.MODID + ":" + "itemBackpack");
- this.colourValue = colour;
- GameRegistry.registerItem(this, unlocalizedName);
- GT_OreDictUnificator.registerOre("storageBackpack", ItemUtils.getSimpleStack(this));
- this.setMaxStackSize(1);
- this.setCreativeTab(AddToCreativeTab.tabOther);
- }
-
- @Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- if (this.colourValue == 0) {
- return MathUtils.generateSingularRandomHexValue();
- }
- return this.colourValue;
-
- }
-
- @Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
- // Name Formatting.
- String temp = this.unlocalName.replace("backpack", "");
- // Lets find the colour.
- if (temp.toLowerCase().contains("dark")) {
- temp = this.unlocalName.substring(12, this.unlocalName.length());
- temp = "Dark " + temp;
- }
- return temp + " Backpack";
+public class BaseItemBackpack extends Item{
+
+ protected final int colourValue;
+ protected final String unlocalName;
+
+
+ public BaseItemBackpack(String unlocalizedName, int colour){
+ this.unlocalName = unlocalizedName;
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + "itemBackpack");
+ this.colourValue = colour;
+ GameRegistry.registerItem(this, unlocalizedName);
+ GT_OreDictUnificator.registerOre("storageBackpack", ItemUtils.getSimpleStack(this));
+ setMaxStackSize(1);
+ setCreativeTab(AddToCreativeTab.tabOther);
}
// Without this method, your inventory will NOT work!!!
@Override
- public int getMaxItemUseDuration(final ItemStack stack) {
+ public int getMaxItemUseDuration(ItemStack stack) {
return 1; // return any value greater than zero
}
-
- @Override
- public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) {
- if (!world.isRemote) {
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
+ {
+ if (!world.isRemote)
+ {
// If player not sneaking, open the inventory gui
if (!player.isSneaking()) {
player.openGui(GTplusplus.instance, GuiHandler.GUI3, world, 0, 0, 0);
}
-
- // Otherwise, stealthily place some diamonds in there for a nice
- // surprise next time you open it up :)
+
+ // Otherwise, stealthily place some diamonds in there for a nice surprise next time you open it up :)
else {
- // Utils.LOG_INFO("Player is Sneaking, giving them sneaky
- // diamonds.");
- // new
- // BaseInventoryBackpack(player.getHeldItem()).setInventorySlotContents(0,
- // new ItemStack(Items.diamond,4));
+ // Utils.LOG_INFO("Player is Sneaking, giving them sneaky diamonds.");
+ // new BaseInventoryBackpack(player.getHeldItem()).setInventorySlotContents(0, new ItemStack(Items.diamond,4));
}
}
-
+
return itemstack;
}
+
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ if (colourValue == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return colourValue;
+
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ //Name Formatting.
+ String temp = unlocalName.replace("backpack", "");
+ //Lets find the colour.
+ if (temp.toLowerCase().contains("dark")){
+ temp = unlocalName.substring(12, unlocalName.length());
+ temp = "Dark "+ temp;
+ }
+ return (temp+" Backpack");
+ }
@Override
@SideOnly(Side.CLIENT)
- public void registerIcons(final IIconRegister iconRegister) {
+ public void registerIcons(IIconRegister iconRegister)
+ {
this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + "itemBackpack");
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java
index 1a1c6fd3c9..86cd1c8046 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java
@@ -2,18 +2,18 @@ package gtPlusPlus.core.item.base;
import java.util.List;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
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:
@@ -21,80 +21,88 @@ import net.minecraft.util.StatCollector;
Create an NBTTagCompound and fill it with the appropriate data
Call ItemStack#setTagCompound() method to set it.
- *
+ *
*/
-public class BaseItemBrain extends Item {
+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"
- };
+ String[] brainTypes = { "dead", "preserved", "fresh", "tasty" };
- // 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.
+ // This method allows us to have different language translation keys for
+ // each item we add.
@Override
- @SideOnly(Side.CLIENT)
- public void addInformation(final ItemStack stack, final EntityPlayer player, final List tooltip,
- final 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
+ 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())
{
- tooltip.add(StatCollector.translateToLocal("tooltip.yourmod.nullbrain.desc"));
+ // 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
+ // 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(final Item item, final CreativeTabs tab, final List itemList) {
+ 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
+ // every listing in brainTypes, and gives us a number associated
// with each listing.
- for (int pos = 0; pos < this.brainTypes.length; pos++) {
- // This creates a new ItemStack instance. The item parameter
+ for (int pos = 0; pos < brainTypes.length; pos++)
+ {
+ // This creates a new ItemStack instance. The item parameter
// supplied is this item.
- final ItemStack brainStack = new ItemStack(item);
- // By default, a new ItemStack does not have any nbt compound data.
+ 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
+ // 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", this.brainTypes[pos]);
+ 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 method allows us to have different language translation keys for
- // each item we add.
+ // 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
- public String getUnlocalizedName(final 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.
- final 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");
- }
+ @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"));
}
- // This will be used if the item is obtained without nbt data on it.
- return "item.nullBrain";
}
}
+
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
index f03b5ac83f..ee9d451948 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
@@ -1,121 +1,96 @@
package gtPlusPlus.core.item.base;
-import java.util.List;
-
-import cpw.mods.fml.common.registry.GameRegistry;
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 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, final String DisplayName, final String OreDictName) {
- this.COMPONENT_NAME = LocalName;
- this.DISPLAY_NAME = DisplayName;
- this.OREDICT_NAME = OreDictName;
- }
-
- public String getComponent() {
- return this.COMPONENT_NAME;
- }
-
- public String getName() {
- return this.DISPLAY_NAME;
- }
-
- public String getOreDictName() {
- return this.OREDICT_NAME;
- }
+public class BaseItemComponent extends Item{
- }
- public final Material componentMaterial;
- public final String materialName;
- public final String unlocalName;
+ public final Material componentMaterial;
+ public final String materialName;
+ public final String unlocalName;
+ public final ComponentTypes componentType;
- public final ComponentTypes componentType;
-
- public BaseItemComponent(final Material material, final ComponentTypes componentType) {
+ public BaseItemComponent(Material material, ComponentTypes componentType) {
this.componentMaterial = material;
- this.unlocalName = "item" + componentType.COMPONENT_NAME + material.getUnlocalizedName();
+ this.unlocalName = "item"+componentType.COMPONENT_NAME+material.getUnlocalizedName();
this.materialName = material.getLocalizedName();
this.componentType = componentType;
this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(this.unlocalName);
+ this.setUnlocalizedName(unlocalName);
this.setMaxStackSize(64);
- this.setTextureName(CORE.MODID + ":" + "item" + componentType.COMPONENT_NAME);
- GameRegistry.registerItem(this, this.unlocalName);
- GT_OreDictUnificator.registerOre(componentType.getOreDictName() + material.getUnlocalizedName(),
- ItemUtils.getSimpleStack(this));
+ this.setTextureName(CORE.MODID + ":" + "item"+componentType.COMPONENT_NAME);
+ GameRegistry.registerItem(this, unlocalName);
+ GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this));
}
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+
+ return (componentMaterial.getLocalizedName()+componentType.DISPLAY_NAME);
+ }
- if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")) {
+ public final String getMaterialName() {
+ return materialName;
+ }
- if (this.componentType == ComponentTypes.DUST) {
- list.add(EnumChatFormatting.GRAY + "A pile of " + this.materialName + " dust.");
+ @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 (this.componentType == ComponentTypes.INGOT) {
- list.add(EnumChatFormatting.GRAY + "A solid ingot of " + this.materialName + ".");
- if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")
- && this.unlocalName.toLowerCase().contains("ingothot")) {
- list.add(EnumChatFormatting.GRAY + "Warning: " + EnumChatFormatting.RED + "Very hot! "
- + EnumChatFormatting.GRAY + " Avoid direct handling..");
+ 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 (this.componentType == ComponentTypes.PLATE) {
- list.add(EnumChatFormatting.GRAY + "A flat plate of " + this.materialName + ".");
+ if (componentType == ComponentTypes.PLATE){
+ list.add(EnumChatFormatting.GRAY+"A flat plate of " + materialName + ".");
}
- if (this.componentType == ComponentTypes.PLATEDOUBLE) {
- list.add(EnumChatFormatting.GRAY + "A double plate of " + this.materialName + ".");
+ if (componentType == ComponentTypes.PLATEDOUBLE){
+ list.add(EnumChatFormatting.GRAY+"A double plate of " + materialName + ".");
}
- if (this.componentType == ComponentTypes.ROD) {
- list.add(EnumChatFormatting.GRAY + "A 40cm Rod of " + this.materialName + ".");
+ if (componentType == ComponentTypes.ROD){
+ list.add(EnumChatFormatting.GRAY+"A 40cm Rod of " + materialName + ".");
}
- if (this.componentType == ComponentTypes.RODLONG) {
- list.add(EnumChatFormatting.GRAY + "A 80cm Rod of " + this.materialName + ".");
+ if (componentType == ComponentTypes.RODLONG){
+ list.add(EnumChatFormatting.GRAY+"A 80cm Rod of " + materialName + ".");
}
- if (this.componentType == ComponentTypes.ROTOR) {
- list.add(EnumChatFormatting.GRAY + "A Rotor made out of " + this.materialName + ". ");
+ if (componentType == ComponentTypes.ROTOR){
+ list.add(EnumChatFormatting.GRAY+"A Rotor made out of " + materialName + ". ");
}
- if (this.componentType == ComponentTypes.BOLT) {
- list.add(EnumChatFormatting.GRAY + "A small Bolt, constructed from " + this.materialName + ".");
+ if (componentType == ComponentTypes.BOLT){
+ list.add(EnumChatFormatting.GRAY+"A small Bolt, constructed from " + materialName + ".");
}
- if (this.componentType == ComponentTypes.SCREW) {
- list.add(EnumChatFormatting.GRAY + "A 8mm Screw, fabricated out of some " + this.materialName + ".");
+ if (componentType == ComponentTypes.SCREW){
+ list.add(EnumChatFormatting.GRAY+"A 8mm Screw, fabricated out of some " + materialName + ".");
}
- if (this.componentType == ComponentTypes.GEAR) {
- list.add(EnumChatFormatting.GRAY + "A large Gear, constructed from " + this.materialName + ".");
+ if (componentType == ComponentTypes.GEAR){
+ list.add(EnumChatFormatting.GRAY+"A large Gear, constructed from " + materialName + ".");
}
- if (this.componentType == ComponentTypes.RING) {
- list.add(EnumChatFormatting.GRAY + "A " + this.materialName + " Ring.");
+ if (componentType == ComponentTypes.RING){
+ list.add(EnumChatFormatting.GRAY+"A " + materialName + " Ring.");
}
- if (this.componentMaterial.isRadioactive) {
+ if (componentMaterial.isRadioactive){
list.add(CORE.GT_Tooltip_Radioactive);
}
@@ -124,25 +99,62 @@ public class BaseItemComponent extends Item {
super.addInformation(stack, aPlayer, list, bool);
}
+
@Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- return this.componentMaterial.getRgbAsHex();
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ return componentMaterial.getRgbAsHex();
}
@Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
-
- return this.componentMaterial.getLocalizedName() + this.componentType.DISPLAY_NAME;
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+ EntityUtils.applyRadiationDamageToEntity(componentMaterial.vRadioationLevel, world, entityHolding);
}
- public final String getMaterialName() {
- return this.materialName;
- }
- @Override
- public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
- final boolean p_77663_5_) {
- EntityUtils.applyRadiationDamageToEntity(this.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 769baa6d3c..431f93b3e6 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java
@@ -1,27 +1,28 @@
package gtPlusPlus.core.item.base;
+import gtPlusPlus.core.lib.CORE;
+
import java.util.List;
-import gtPlusPlus.core.lib.CORE;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-public class BaseItemGeneric extends Item {
- public BaseItemGeneric(final String unlocalizedName, final CreativeTabs c, final int stackSize, final int maxDmg) {
- this.setUnlocalizedName(CORE.MODID + "_" + unlocalizedName);
- this.setTextureName(CORE.MODID + ":" + unlocalizedName);
- this.setCreativeTab(c);
- this.setMaxStackSize(stackSize);
- this.setMaxDamage(maxDmg);
+public class BaseItemGeneric extends Item
+{
+ public BaseItemGeneric(String unlocalizedName, CreativeTabs c, int stackSize, int maxDmg)
+ {
+ setUnlocalizedName(CORE.MODID + "_" + unlocalizedName);
+ setTextureName(CORE.MODID + ":" + unlocalizedName);
+ setCreativeTab(c);
+ setMaxStackSize(stackSize);
+ setMaxDamage(maxDmg);
}
-
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
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
index b8d89e461b..ed87677970 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java
@@ -1,103 +1,108 @@
package gtPlusPlus.core.item.base;
-import java.util.List;
-
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 {
-
- 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 class BaseItemLoot extends Item{
- public String getLootType() {
- return this.LOOT_TYPE;
- }
+ private final String materialName;
+ private final String unlocalName;
+ private final LootTypes lootTypes;
+ private Quality lootQuality;
+ private final Materials lootMaterial;
- public String getName() {
- return this.DISPLAY_SUFFIX;
- }
-
- public String getOreDictName() {
- return this.OREDICT_NAME;
- }
- }
- private final String materialName;
- private final String unlocalName;
- private final LootTypes lootTypes;
- private Quality lootQuality;
-
- private final Materials lootMaterial;
-
- public BaseItemLoot(final LootTypes lootType, final Materials material) {
+ 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(this.unlocalName);
+ 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);
+ this.setTextureName(CORE.MODID + ":" + "item"+lootType.LOOT_TYPE);
+ }
+
+ public ItemStack generateLootStack(){
+ lootQuality = Quality.getRandomQuality();
+ return ItemUtils.getSimpleStack(this, 1);
}
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add(this.lootQuality.getQuality());
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ return (materialName+lootTypes.DISPLAY_SUFFIX);
+ }
- /*
- * if (componentMaterial.isRadioactive){
- * list.add(CORE.GT_Tooltip_Radioactive); }
- */
+ 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);
}
- public ItemStack generateLootStack() {
- this.lootQuality = Quality.getRandomQuality();
- return ItemUtils.getSimpleStack(this, 1);
- }
@Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- final short[] temp = this.lootMaterial.mRGBa;
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ short[] temp = lootMaterial.mRGBa;
return Utils.rgbtoHexValue(temp[0], temp[1], temp[2]);
}
@Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
- return this.materialName + this.lootTypes.DISPLAY_SUFFIX;
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+ //EntityUtils.applyRadiationDamageToEntity(lootQuality.vRadioationLevel, world, entityHolding);
}
- public final String getMaterialName() {
- return this.materialName;
- }
- @Override
- public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
- final 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/BaseItemWithCharge.java b/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java
index cd0053cb2f..c793776e37 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java
@@ -1,9 +1,10 @@
package gtPlusPlus.core.item.base;
-import java.util.List;
-
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
+
+import java.util.List;
+
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -12,61 +13,63 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class BaseItemWithCharge extends Item {
-
- public int int_Charge = 0;
- public int int_Max_Charge = 0;
+public class BaseItemWithCharge extends Item{
- public BaseItemWithCharge(final String unlocalizedName, final int constructor_Charge,
- final int constructor_Max_Charge) {
+ public int int_Charge = 0;
+ public int int_Max_Charge = 0;
+
+ public BaseItemWithCharge(String unlocalizedName, int constructor_Charge, int constructor_Max_Charge) {
this.setUnlocalizedName(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName);
- this.setMaxStackSize(1);
+ this.setMaxStackSize(1);
this.setCreativeTab(AddToCreativeTab.tabMachines);
this.int_Charge = constructor_Charge;
this.int_Max_Charge = constructor_Max_Charge;
}
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- int NBT_Charge = this.int_Charge;
- int NBT_Max_Charge = this.int_Max_Charge;
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ int NBT_Charge = int_Charge;
+ int NBT_Max_Charge = int_Max_Charge;
if (stack.stackTagCompound != null) {
NBT_Charge = stack.stackTagCompound.getInteger("charge_Current");
NBT_Max_Charge = stack.stackTagCompound.getInteger("charge_Max");
- final String tempX = String.valueOf(NBT_Charge);
- final String tempY = String.valueOf(NBT_Max_Charge);
- final String formattedX = EnumChatFormatting.RED + tempX + EnumChatFormatting.GRAY;
- final String formattedY = EnumChatFormatting.DARK_RED + tempY + EnumChatFormatting.GRAY;
- list.add(EnumChatFormatting.GRAY + "Charge:" + formattedX + "/" + formattedY + ".");
- super.addInformation(stack, aPlayer, list, bool);
- }
+ String tempX = String.valueOf(NBT_Charge);
+ String tempY = String.valueOf(NBT_Max_Charge);
+ String formattedX = EnumChatFormatting.RED+tempX+EnumChatFormatting.GRAY;
+ String formattedY = EnumChatFormatting.DARK_RED+tempY+EnumChatFormatting.GRAY;
+ list.add(EnumChatFormatting.GRAY+"Charge:"+formattedX+"/"+formattedY+".");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
}
- // Ticking and NBT Handling
- /*
- * Called each tick as long the item is on a player inventory. Uses by maps
- * to check if is on a player hand and update it's contents.
- *
- * public int fuelRemaining = 0; public int maximumFuel = 0; public String
- * fuelType = ""; public float heat = 0; public float maxHeat = 5000;
+ //Ticking and NBT Handling
+ /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
+ * update it's contents.
*
+ * public int fuelRemaining = 0;
+ public int maximumFuel = 0;
+ public String fuelType = "";
+ public float heat = 0;
+ public float maxHeat = 5000;
+ *
*/
@Override
- public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) {
+ public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
+
+ }
+ @Override
+ public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
+
}
@Override
- public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) {
+ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) {
itemStack.stackTagCompound = new NBTTagCompound();
return super.onItemRightClick(itemStack, world, par3Entity);
}
- @Override
- public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4,
- final boolean par5) {
- }
}
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java b/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java
index 8533ad20e9..ec052ef1f9 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java
@@ -1,32 +1,29 @@
package gtPlusPlus.core.item.base;
+import gtPlusPlus.core.lib.CORE;
+
import java.util.List;
-import gtPlusPlus.core.lib.CORE;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
-public class BaseItemWithDamageValue extends Item {
- public BaseItemWithDamageValue(final String unlocalizedName) {
+public class BaseItemWithDamageValue extends Item{
+ public BaseItemWithDamageValue(String unlocalizedName) {
this.setUnlocalizedName(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName);
this.setMaxStackSize(1);
this.setMaxDamage(100);
}
-
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add(EnumChatFormatting.GOLD + "");
- super.addInformation(stack, aPlayer, list, bool);
- }
-
- @Override
- public void setDamage(final ItemStack stack, final int damage) {
+ public void setDamage(ItemStack stack, int damage) {
super.setDamage(stack, damage);
- }
+ }
+ @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/BasicSpawnEgg.java b/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java
index cfa871fd2b..9407689cfc 100644
--- a/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java
+++ b/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java
@@ -1,236 +1,259 @@
package gtPlusPlus.core.item.base;
-import java.util.List;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.util.Utils;
+
+import java.util.List;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.*;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityList;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.*;
-import net.minecraft.util.*;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemMonsterPlacer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.Facing;
+import net.minecraft.util.IIcon;
+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 BasicSpawnEgg extends ItemMonsterPlacer {
- @SideOnly(Side.CLIENT)
- private IIcon theIcon;
- protected int colorBase = 0x000000;
- protected int colorSpots = 0xFFFFFF;
- protected String entityMODID = "";
- protected String entityToSpawnName = "";
- protected String entityToSpawnNameFull = "";
- protected EntityLiving entityToSpawn = null;
-
- public BasicSpawnEgg() {
- super();
- }
-
- public BasicSpawnEgg(final String MODID, final String parEntityToSpawnName, final int parPrimaryColor,
- final int parSecondaryColor) {
- this.setHasSubtypes(false);
- this.maxStackSize = 64;
- this.setCreativeTab(AddToCreativeTab.tabOther);
- this.setEntityToSpawnName(parEntityToSpawnName);
- this.colorBase = parPrimaryColor;
- this.colorSpots = parSecondaryColor;
- this.entityMODID = MODID;
-
- // DEBUG
- Utils.LOG_WARNING("Spawn egg constructor for " + this.entityToSpawnName);
- }
-
- public int getColorBase() {
- return this.colorBase;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public int getColorFromItemStack(final ItemStack par1ItemStack, final int parColorType) {
- return parColorType == 0 ? this.colorBase : this.colorSpots;
- }
-
- public int getColorSpots() {
- return this.colorSpots;
- }
-
- /**
- * Gets an icon index based on an item's damage value and the given render
- * pass
- */
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIconFromDamageForRenderPass(final int parDamageVal, final int parRenderPass) {
- return parRenderPass > 0 ? this.theIcon : super.getIconFromDamageForRenderPass(parDamageVal, parRenderPass);
- }
-
- @Override
- // Doing this override means that there is no localization for language
- // unless you specifically check for localization here and convert
- public String getItemStackDisplayName(final ItemStack par1ItemStack) {
- return "Spawn " + this.entityToSpawnName;
- }
-
- /**
- * returns a list of items with the same ID, but different meta (eg: dye
- * returns 16 items)
- */
- @Override
- @SideOnly(Side.CLIENT)
- public void getSubItems(final Item parItem, final CreativeTabs parTab, final List parList) {
- parList.add(new ItemStack(parItem, 1, 0));
- }
-
- /**
- * Called whenever this item is equipped and the right mouse button is
- * pressed.
- *
- * Args: itemStack, world, entityPlayer
- */
- @Override
- public ItemStack onItemRightClick(final ItemStack par1ItemStack, final World par2World,
- final EntityPlayer par3EntityPlayer) {
- if (par2World.isRemote) {
- return par1ItemStack;
- }
- final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World,
- par3EntityPlayer, true);
-
- if (movingobjectposition == null) {
- return par1ItemStack;
- }
- if (movingobjectposition.typeOfHit == MovingObjectPosition
-
- .MovingObjectType.BLOCK)
- {
- final int i = movingobjectposition.blockX;
- final int j = movingobjectposition.blockY;
- final int k = movingobjectposition.blockZ;
-
- if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) {
- return par1ItemStack;
- }
-
- if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) {
- return par1ItemStack;
- }
-
- if (par2World.getBlock(i, j, k) instanceof BlockLiquid) {
- final Entity entity = this.spawnEntity(par2World, i, j, k);
-
- if (entity != null) {
- if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) {
- ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
- }
-
- if (!par3EntityPlayer.capabilities.isCreativeMode) {
- --par1ItemStack.stackSize;
- }
- }
- }
- }
- return par1ItemStack;
- }
-
- /**
- * Callback for item usage. If the item does something special on right
- * clicking,
- *
- * he will have one of those. Return True if something happen and false if
- * it don't. This is for ITEMS, not BLOCKS
- */
- @Override
- public boolean onItemUse(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final World par3World,
- int par4, int par5, int par6, final int par7, final float par8, final float par9, final float par10) {
- if (par3World.isRemote) {
- return true;
- }
- final Block block = par3World.getBlock(par4, par5, par6);
+public class BasicSpawnEgg extends ItemMonsterPlacer
+{
+ @SideOnly(Side.CLIENT)
+ private IIcon theIcon;
+ protected int colorBase = 0x000000;
+ protected int colorSpots = 0xFFFFFF;
+ protected String entityMODID = "";
+ protected String entityToSpawnName = "";
+ protected String entityToSpawnNameFull = "";
+ protected EntityLiving entityToSpawn = null;
+
+ public BasicSpawnEgg(){
+ super();
+ }
+
+ public BasicSpawnEgg(String MODID, String parEntityToSpawnName, int parPrimaryColor, int parSecondaryColor){
+ setHasSubtypes(false);
+ maxStackSize = 64;
+ setCreativeTab(AddToCreativeTab.tabOther);
+ setEntityToSpawnName(parEntityToSpawnName);
+ colorBase = parPrimaryColor;
+ colorSpots = parSecondaryColor;
+ entityMODID = MODID;
+
+ // DEBUG
+ Utils.LOG_WARNING("Spawn egg constructor for "+entityToSpawnName);
+ }
+
+ /**
+ * Callback for item usage. If the item does something special on right clicking,
+
+ * he will have one of those. Return
+ * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
+ */
+ @Override
+ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10){
+ if (par3World.isRemote)
+ {
+ return true;
+ }
+ Block block = par3World.getBlock(par4, par5, par6);
par4 += Facing.offsetsXForSide[par7];
par5 += Facing.offsetsYForSide[par7];
par6 += Facing.offsetsZForSide[par7];
double d0 = 0.0D;
- if (par7 == 1 && block.getRenderType() == 11) {
- d0 = 0.5D;
+ if (par7 == 1 && block.getRenderType() == 11)
+ {
+ d0 = 0.5D;
}
- final Entity entity = this.spawnEntity(par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D);
+ Entity entity = spawnEntity(par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D);
- if (entity != null) {
- if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) {
- ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName());
- }
-
- if (!par2EntityPlayer.capabilities.isCreativeMode) {
- --par1ItemStack.stackSize;
- }
+ if (entity != null)
+ {
+ if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName())
+ {
+ ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName());
+ }
+
+ if (!par2EntityPlayer.capabilities.isCreativeMode)
+ {
+ --par1ItemStack.stackSize;
+ }
}
return true;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public void registerIcons(final IIconRegister par1IconRegister) {
- super.registerIcons(par1IconRegister);
- this.theIcon = par1IconRegister.registerIcon(this.getIconString() + "_overlay");
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public boolean requiresMultipleRenderPasses() {
- return true;
- }
-
- public void setColors(final int parColorBase, final int parColorSpots) {
- this.colorBase = parColorBase;
- this.colorSpots = parColorSpots;
- }
-
- public void setEntityToSpawnName(final String parEntityToSpawnName) {
- this.entityToSpawnName = parEntityToSpawnName;
- this.entityToSpawnNameFull = this.entityMODID + "." + this.entityToSpawnName;
- }
-
- /**
- * Spawns the creature specified by the egg's type in the location specified
- * by
- *
- * the last three parameters. Parameters: world, entityID, x, y, z.
- */
- public Entity spawnEntity(final World parWorld, final double parX, final double parY, final double parZ) {
-
- if (!parWorld.isRemote) // never spawn entity on client side
+ }
+
+ /**
+ * Called whenever this item is equipped and the right mouse button is pressed.
+
+ *Args: itemStack, world, entityPlayer
+ */
+ @Override
+ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
+ if (par2World.isRemote)
+ {
+ return par1ItemStack;
+ }
+ MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true);
+
+ if (movingobjectposition == null)
{
- this.entityToSpawnNameFull = this.entityMODID + "." + this.entityToSpawnName;
- if (EntityList.stringToClassMapping.containsKey(this.entityToSpawnNameFull)) {
- this.entityToSpawn = (EntityLiving) EntityList
-
- .createEntityByName(this.entityToSpawnNameFull, parWorld);
- this.entityToSpawn.setLocationAndAngles(parX, parY, parZ,
-
- MathHelper.wrapAngleTo180_float(parWorld.rand.nextFloat()
-
- * 360.0F),
- 0.0F);
- parWorld.spawnEntityInWorld(this.entityToSpawn);
- this.entityToSpawn.onSpawnWithEgg((IEntityLivingData) null);
- this.entityToSpawn.playLivingSound();
- }
- else {
- // DEBUG
- Utils.LOG_WARNING("Entity not found " + this.entityToSpawnName);
- }
+ return par1ItemStack;
}
+ if (movingobjectposition.typeOfHit == MovingObjectPosition
+
+ .MovingObjectType.BLOCK)
- return this.entityToSpawn;
- }
+ {
+ int i = movingobjectposition.blockX;
+ int j = movingobjectposition.blockY;
+ int k = movingobjectposition.blockZ;
+
+ if (!par2World.canMineBlock(par3EntityPlayer, i, j, k))
+ {
+ return par1ItemStack;
+ }
+
+ if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack))
+ {
+ return par1ItemStack;
+ }
+
+ if (par2World.getBlock(i, j, k) instanceof BlockLiquid)
+ {
+ Entity entity = spawnEntity(par2World, i, j, k);
+
+ if (entity != null)
+ {
+ if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName())
+ {
+ ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName());
+ }
+
+ if (!par3EntityPlayer.capabilities.isCreativeMode)
+ {
+ --par1ItemStack.stackSize;
+ }
+ }
+ }
+ }
+
+ return par1ItemStack;
+ }
+
+ /**
+ * Spawns the creature specified by the egg's type in the location specified by
+
+ * the last three parameters.
+ * Parameters: world, entityID, x, y, z.
+ */
+ public Entity spawnEntity(World parWorld, double parX, double parY, double parZ){
+
+ if (!parWorld.isRemote) // never spawn entity on client side
+ {
+ entityToSpawnNameFull = entityMODID+"."+entityToSpawnName;
+ if (EntityList.stringToClassMapping.containsKey(entityToSpawnNameFull))
+ {
+ entityToSpawn = (EntityLiving) EntityList
+
+ .createEntityByName(entityToSpawnNameFull, parWorld);
+ entityToSpawn.setLocationAndAngles(parX, parY, parZ,
+
+ MathHelper.wrapAngleTo180_float(parWorld.rand.nextFloat()
+
+ * 360.0F), 0.0F);
+ parWorld.spawnEntityInWorld(entityToSpawn);
+ entityToSpawn.onSpawnWithEgg((IEntityLivingData)null);
+ entityToSpawn.playLivingSound();
+ }
+ else
+ {
+ //DEBUG
+ Utils.LOG_WARNING("Entity not found "+entityToSpawnName);
+ }
+ }
+
+ return entityToSpawn;
+ }
+
+
+ /**
+ * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item parItem, CreativeTabs parTab, List parList){
+ parList.add(new ItemStack(parItem, 1, 0));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack par1ItemStack, int parColorType){
+ return (parColorType == 0) ? colorBase : colorSpots;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ return true;
+ }
+
+ @Override
+ // Doing this override means that there is no localization for language
+ // unless you specifically check for localization here and convert
+ public String getItemStackDisplayName(ItemStack par1ItemStack){
+ return "Spawn "+entityToSpawnName;
+ }
+
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister par1IconRegister){
+ super.registerIcons(par1IconRegister);
+ theIcon = par1IconRegister.registerIcon(getIconString() + "_overlay");
+ }
+
+ /**
+ * Gets an icon index based on an item's damage value and the given render pass
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamageForRenderPass(int parDamageVal, int parRenderPass){
+ return parRenderPass > 0 ? theIcon : super.getIconFromDamageForRenderPass(parDamageVal, parRenderPass);
+ }
+
+ public void setColors(int parColorBase, int parColorSpots){
+ colorBase = parColorBase;
+ colorSpots = parColorSpots;
+ }
+
+ public int getColorBase(){
+ return colorBase;
+ }
+
+ public int getColorSpots(){
+ return colorSpots;
+ }
+
+ public void setEntityToSpawnName(String parEntityToSpawnName){
+ entityToSpawnName = parEntityToSpawnName;
+ entityToSpawnNameFull = entityMODID+"."+entityToSpawnName;
+ }
}
+
diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java
index aa83b6857d..0653cddbb8 100644
--- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java
+++ b/src/Java/gtPlusPlus/core/item/base/CoreItem.java
@@ -1,90 +1,96 @@
package gtPlusPlus.core.item.base;
+import gtPlusPlus.core.lib.CORE;
+
import java.util.List;
-import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gtPlusPlus.core.lib.CORE;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.*;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
-public class CoreItem extends Item {
+public class CoreItem extends Item
+{
- private final EnumRarity rarity;
- private final EnumChatFormatting descColour;
- private final String itemDescription;
- private final boolean hasEffect;
+ private final EnumRarity rarity;
+ private final EnumChatFormatting descColour;
+ private final String itemDescription;
+ private final boolean hasEffect;
- // 0
+ //0
/*
* Name, Tab - 64 Stack, 0 Dmg
*/
- public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab) {
- this(unlocalizedName, creativeTab, 64, 0); // Calls 3
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab)
+ {
+ this(unlocalizedName, creativeTab, 64, 0); //Calls 3
}
-
- // 1
+ //1
/*
* Name, Tab, Stack - 0 Dmg
*/
- public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize) {
- this(unlocalizedName, creativeTab, stackSize, 0); // Calls 3
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize)
+ {
+ this(unlocalizedName, creativeTab, stackSize, 0); //Calls 3
}
-
- // 3
+ //2
+ /*
+ * Name, Tab, Stack, Description - 0 Dmg
+ */
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, String description)
+ {
+ this(unlocalizedName, creativeTab, stackSize, 0, description); //Calls 4
+ }
+ //3
/*
* Name, Tab, Stack, Dmg - Description
*/
- public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize,
- final int maxDmg) {
- this(unlocalizedName, creativeTab, stackSize, maxDmg, ""); // Calls 4
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg)
+ {
+ this(unlocalizedName, creativeTab, stackSize, maxDmg, ""); //Calls 4
}
-
- // 4 //Not Rare + basic tooltip
+ //4 //Not Rare + basic tooltip
/*
* Name, Tab, Stack, Dmg, Description
*/
- public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg,
- final String description) {
- this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, EnumChatFormatting.GRAY,
- false); // Calls 4.5
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description)
+ {
+ this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, EnumChatFormatting.GRAY, false); //Calls 4.5
}
-
- // 4.5
+ //4.5
/*
* Name, Tab, Stack, Dmg, Description, Text Colour - Common
*/
- public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg,
- final String description, final EnumChatFormatting colour) {
- this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, colour, false); // Calls
- // 5
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumChatFormatting colour)
+ {
+ this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, colour, false); //Calls 5
}
- // 4.75
+ //4.75
/*
* Name, Tab, Stack, Dmg, Description, Rarity - Gray text
*/
- public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg,
- final String description, final EnumRarity rarity) {
- this(unlocalizedName, creativeTab, stackSize, maxDmg, description, rarity, EnumChatFormatting.GRAY, false); // Calls
- // 5
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumRarity rarity)
+ {
+ this(unlocalizedName, creativeTab, stackSize, maxDmg, description, rarity, EnumChatFormatting.GRAY, false); //Calls 5
}
- // 5
+ //5
/*
* Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect
*/
- public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg,
- final String description, final EnumRarity regRarity, final EnumChatFormatting colour,
- final boolean Effect) {
- this.setUnlocalizedName(unlocalizedName);
- this.setTextureName(CORE.MODID + ":" + unlocalizedName);
- this.setCreativeTab(creativeTab);
- this.setMaxStackSize(stackSize);
- this.setMaxDamage(maxDmg);
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect)
+ {
+ setUnlocalizedName(unlocalizedName);
+ setTextureName(CORE.MODID + ":" + unlocalizedName);
+ setCreativeTab(creativeTab);
+ setMaxStackSize(stackSize);
+ setMaxDamage(maxDmg);
this.rarity = regRarity;
this.itemDescription = description;
this.descColour = colour;
@@ -92,33 +98,21 @@ public class CoreItem extends Item {
GameRegistry.registerItem(this, unlocalizedName);
}
- // 2
- /*
- * Name, Tab, Stack, Description - 0 Dmg
- */
- public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize,
- final String description) {
- this(unlocalizedName, creativeTab, stackSize, 0, description); // Calls
- // 4
- }
-
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add(this.descColour + this.itemDescription);
- // super.addInformation(stack, aPlayer, list, bool);
- }
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ list.add(descColour+itemDescription);
+ //super.addInformation(stack, aPlayer, list, bool);
+ }
@Override
@SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
- return this.rarity;
+ public EnumRarity getRarity(ItemStack par1ItemStack){
+ return rarity;
}
@Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
- return this.hasEffect;
+ public boolean hasEffect(ItemStack par1ItemStack){
+ return hasEffect;
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
index 8d4d70ea9a..6292c5cde6 100644
--- a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
+++ b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
@@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.bolts;
import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
-public class BaseItemBolt extends BaseItemComponent {
+public class BaseItemBolt extends BaseItemComponent{
- public BaseItemBolt(final Material material) {
+ public BaseItemBolt(Material material) {
super(material, BaseItemComponent.ComponentTypes.BOLT);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
index 9736d3281d..f2c2187558 100644
--- a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
+++ b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
@@ -1,41 +1,42 @@
package gtPlusPlus.core.item.base.cell;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
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 class BaseItemCell extends BaseItemComponent{
- public BaseItemCell(final Material material) {
- super(material, BaseItemComponent.ComponentTypes.CELL);
+ private IIcon base;
+ private IIcon overlay;
+ ComponentTypes Cell = ComponentTypes.CELL;
+
+ public BaseItemCell(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.CELL);
}
@Override
- public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
- if (pass == 0) {
- return this.base;
- }
- return this.overlay;
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ return true;
}
- @Override
- public void registerIcons(final IIconRegister i) {
- this.base = i.registerIcon(CORE.MODID + ":" + "item" + this.Cell.getComponent());
- this.overlay = i.registerIcon(CORE.MODID + ":" + "item" + this.Cell.getComponent() + "_Overlay");
+ @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
- @SideOnly(Side.CLIENT)
- public boolean requiresMultipleRenderPasses() {
- return true;
+ 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 58f1076dbb..69d5363240 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
@@ -1,49 +1,45 @@
package gtPlusPlus.core.item.base.dusts;
-import java.util.List;
-
-import cpw.mods.fml.common.registry.GameRegistry;
+import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc;
import gregtech.api.enums.GT_Values;
import gregtech.api.util.GT_ModHandler;
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.Utils;
import gtPlusPlus.core.util.entity.EntityUtils;
import gtPlusPlus.core.util.item.ItemUtils;
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 net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
+import cpw.mods.fml.common.registry.GameRegistry;
-public class BaseItemDust extends Item {
+public class BaseItemDust extends Item{
- protected int colour;
- protected String materialName;
- protected String pileType;
- String name = "";
- private final int mTier;
- private final Material dustInfo;
- private String oredictName;
+ protected int colour;
+ protected String materialName;
+ protected String pileType;
+ String name = "";
+ private int mTier;
+ private Material dustInfo;
+ private String oredictName;
- protected final int sRadiation;
-
- public BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo,
- final int colour, final String pileSize, final int tier, final int sRadioactivity) {
- this.setUnlocalizedName(unlocalizedName);
+ public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, int sRadioactivity) {
+ setUnlocalizedName(unlocalizedName);
this.setUnlocalizedName(unlocalizedName);
- this.setMaxStackSize(64);
- if (pileSize == "dust" || pileSize == "Dust") {
- this.setTextureName(CORE.MODID + ":" + "dust");
- }
- else {
- this.setTextureName(CORE.MODID + ":" + "dust" + pileSize);
- }
- this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setMaxStackSize(64);
+ if (pileSize == "dust" || pileSize == "Dust"){
+ this.setTextureName(CORE.MODID + ":" + "dust");}
+ else{
+ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);}
+ this.setCreativeTab(tabMisc);
this.colour = colour;
this.mTier = tier;
this.materialName = materialName;
@@ -52,215 +48,215 @@ public class BaseItemDust extends Item {
GameRegistry.registerItem(this, unlocalizedName);
String temp = "";
- Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: " + this.getUnlocalizedName());
- if (this.getUnlocalizedName().contains("item.")) {
- temp = this.getUnlocalizedName().replace("item.", "");
- Utils.LOG_WARNING("Generating OreDict Name: " + temp);
+ Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName());
+ if (getUnlocalizedName().contains("item.")){
+ temp = getUnlocalizedName().replace("item.", "");
+ Utils.LOG_WARNING("Generating OreDict Name: "+temp);
}
else {
- temp = this.getUnlocalizedName();
+ temp = getUnlocalizedName();
}
- if (temp.contains("DustTiny")) {
+ if (temp.contains("DustTiny")){
temp = temp.replace("itemD", "d");
- Utils.LOG_WARNING("Generating OreDict Name: " + temp);
+ Utils.LOG_WARNING("Generating OreDict Name: "+temp);
}
- else if (temp.contains("DustSmall")) {
+ else if (temp.contains("DustSmall")){
temp = temp.replace("itemD", "d");
- Utils.LOG_WARNING("Generating OreDict Name: " + temp);
+ Utils.LOG_WARNING("Generating OreDict Name: "+temp);
}
else {
temp = temp.replace("itemD", "d");
- Utils.LOG_WARNING("Generating OreDict Name: " + temp);
- }
- if (temp != null && temp != "") {
- this.oredictName = temp;
+ Utils.LOG_WARNING("Generating OreDict Name: "+temp);
+ }
+ if (temp != null && temp != ""){
+ oredictName = temp;
GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
}
- this.addFurnaceRecipe();
- this.addMacerationRecipe();
+ addFurnaceRecipe();
+ addMacerationRecipe();
}
- private void addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1,
- final ItemStack output2, final int tempRequired) {
- // Special Cases
- /*
- * if
- * (input1.getUnlocalizedName().toLowerCase().contains("tantalloy61")){
- * Utils.LOG_INFO(
- * "Adding Special handler for Staballoy-61 in the Blast Furnace");
- * input2 =
- * UtilsItems.getItemStackOfAmountFromOreDict("dustTantalloy60", 2); if
- * (input2 == null){ Utils.LOG_INFO("invalid itemstack."); } else {
- * Utils.LOG_INFO("Found "+input2.getDisplayName()); } }
- */
- GT_Values.RA.addBlastRecipe(input1, input2, GT_Values.NF, GT_Values.NF, output1, output2, 250 * this.mTier * 20,
- this.mTier * 64, tempRequired);
-
- }
-
- private void addFurnaceRecipe() {
+ @Override
+ public String getItemStackDisplayName(ItemStack iStack) {
- String temp = "";
- if (this.getUnlocalizedName().contains("item.")) {
- temp = this.getUnlocalizedName().replace("item.", "");
+ if (getUnlocalizedName().contains("DustTiny")){
+ name = "Tiny Pile of "+materialName + " Dust";
}
- else {
- temp = this.getUnlocalizedName();
+ else if (getUnlocalizedName().contains("DustSmall")){
+ name = "Small Pile of "+materialName + " Dust";
}
- if (temp.contains("DustTiny") || temp.contains("DustSmall")) {
- return;
+ else {
+ name = materialName + " Dust";
}
- temp = temp.replace("itemDust", "ingot");
- if (temp != null && temp != "") {
-
- if (this.dustInfo.requiresBlastFurnace()) {
- Utils.LOG_WARNING("Adding recipe for Hot " + this.materialName + " Ingots in a Blast furnace.");
- final String tempIngot = temp.replace("ingot", "ingotHot");
- final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1);
- Utils.LOG_WARNING("This will produce " + tempOutputStack.getDisplayName() + " Debug: " + tempIngot);
- if (null != tempOutputStack) {
- this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null,
- 350 * this.mTier);
- }
- return;
- }
- Utils.LOG_WARNING("Adding recipe for " + this.materialName + " Ingots in a furnace.");
- final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1);
- Utils.LOG_WARNING("This will produce an ingot of " + tempOutputStack.getDisplayName() + " Debug: " + temp);
- if (null != tempOutputStack) {
- if (this.mTier < 5 || !this.dustInfo.requiresBlastFurnace()) {
- if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(ItemUtils.getSimpleStack(this),
- tempOutputStack)) {
- Utils.LOG_WARNING("Successfully added a furnace recipe for " + this.materialName);
- }
- else {
- Utils.LOG_WARNING("Failed to add a furnace recipe for " + this.materialName);
- }
- }
- else if (this.mTier >= 5 || this.dustInfo.requiresBlastFurnace()) {
- Utils.LOG_WARNING("Adding recipe for " + this.materialName + " Ingots in a Blast furnace.");
- Utils.LOG_WARNING("This will produce " + tempOutputStack.getDisplayName());
- if (null != tempOutputStack) {
- this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null,
- 350 * this.mTier);
- }
- return;
- }
- }
+ return name;
+ }
- }
+ protected final int sRadiation;
+ @Override
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+ EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
}
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- // if (pileType != null && materialName != null && pileType != "" &&
- // materialName != "" && !pileType.equals("") &&
- // !materialName.equals("")){
- if (this.getUnlocalizedName().contains("DustTiny")) {
- list.add(EnumChatFormatting.GRAY + "A tiny pile of " + this.materialName + " dust.");
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ //if (pileType != null && materialName != null && pileType != "" && materialName != "" && !pileType.equals("") && !materialName.equals("")){
+ if (getUnlocalizedName().contains("DustTiny")){
+ list.add(EnumChatFormatting.GRAY+"A tiny pile of " + materialName + " dust.");
}
- else if (this.getUnlocalizedName().contains("DustSmall")) {
- list.add(EnumChatFormatting.GRAY + "A small pile of " + this.materialName + " dust.");
+ else if (getUnlocalizedName().contains("DustSmall")){
+ list.add(EnumChatFormatting.GRAY+"A small pile of " + materialName + " dust.");
}
else {
- list.add(EnumChatFormatting.GRAY + "A pile of " + this.materialName + " dust.");
+ list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust.");
}
- if (this.sRadiation > 0) {
+ if (sRadiation > 0){
list.add(CORE.GT_Tooltip_Radioactive);
}
- if (this.dustInfo != null) {
- list.add(this.dustInfo.vChemicalFormula);
+ if (dustInfo != null){
+ list.add(dustInfo.vChemicalFormula);
}
- // }
+ //}
super.addInformation(stack, aPlayer, list, bool);
}
- private void addMacerationRecipe() {
- Utils.LOG_WARNING("Adding recipe for " + this.materialName + " Dusts");
+ public final String getMaterialName() {
+ return materialName;
+ }
+
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ if (colour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return colour;
- String tempIngot = this.getUnlocalizedName().replace("item.itemDust", "ingot");
- final String tempDust = this.getUnlocalizedName().replace("item.itemDust", "dust");
+ }
+
+ private void addMacerationRecipe(){
+ Utils.LOG_WARNING("Adding recipe for "+materialName+" Dusts");
+
+ String tempIngot = getUnlocalizedName().replace("item.itemDust", "ingot");
+ String tempDust = getUnlocalizedName().replace("item.itemDust", "dust");
ItemStack tempInputStack;
ItemStack tempOutputStack;
- if (this.getUnlocalizedName().contains("DustSmall") || this.getUnlocalizedName().contains("DustTiny")) {
+ if (getUnlocalizedName().contains("DustSmall") || getUnlocalizedName().contains("DustTiny")){
return;
}
- Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: " + this.getUnlocalizedName());
- if (this.getUnlocalizedName().contains("item.")) {
- tempIngot = this.getUnlocalizedName().replace("item.", "");
- Utils.LOG_WARNING("Generating OreDict Name: " + tempIngot);
+ Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName());
+ if (getUnlocalizedName().contains("item.")){
+ tempIngot = getUnlocalizedName().replace("item.", "");
+ Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot);
}
else {
- tempIngot = this.getUnlocalizedName();
+ tempIngot = getUnlocalizedName();
}
tempIngot = tempIngot.replace("itemDust", "ingot");
- Utils.LOG_WARNING("Generating OreDict Name: " + tempIngot);
- final ItemStack[] outputStacks = {
- this.dustInfo.getDust(1)
- };
- if (tempIngot != null && tempIngot != "") {
+ Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot);
+ ItemStack[] outputStacks = {dustInfo.getDust(1)};
+ if (tempIngot != null && tempIngot != ""){
tempInputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1);
tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempDust, 1);
ItemStack tempStackOutput2 = null;
- final int chance = this.mTier * 10 / MathUtils.randInt(10, 20);
- if (outputStacks.length != 0) {
- if (outputStacks.length == 1) {
+ int chance = mTier*10/MathUtils.randInt(10, 20);
+ if (outputStacks.length != 0){
+ if (outputStacks.length == 1){
tempStackOutput2 = null;
}
else {
- if (!outputStacks[1].getUnlocalizedName().toLowerCase().contains("aaa_broken")) {
+ if (!outputStacks[1].getUnlocalizedName().toLowerCase().contains("aaa_broken")){
tempStackOutput2 = outputStacks[1];
tempOutputStack = outputStacks[0];
}
else {
tempStackOutput2 = null;
}
- }
+ }
}
else {
tempStackOutput2 = null;
}
- if (null != tempOutputStack && null != tempInputStack) {
- GT_ModHandler.addPulverisationRecipe(tempInputStack, tempOutputStack.splitStack(1), tempStackOutput2,
- chance);
+ if (null != tempOutputStack && null != tempInputStack){
+ GT_ModHandler.addPulverisationRecipe(tempInputStack, tempOutputStack.splitStack(1), tempStackOutput2, chance);
}
}
}
- @Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- if (this.colour == 0) {
- return MathUtils.generateSingularRandomHexValue();
- }
- return this.colour;
+ private void addFurnaceRecipe(){
- }
-
- @Override
- public String getItemStackDisplayName(final ItemStack iStack) {
-
- if (this.getUnlocalizedName().contains("DustTiny")) {
- this.name = "Tiny Pile of " + this.materialName + " Dust";
- }
- else if (this.getUnlocalizedName().contains("DustSmall")) {
- this.name = "Small Pile of " + this.materialName + " Dust";
+ String temp = "";
+ if (getUnlocalizedName().contains("item.")){
+ temp = getUnlocalizedName().replace("item.", "");
}
else {
- this.name = this.materialName + " Dust";
+ temp = getUnlocalizedName();
}
- return this.name;
- }
+ if (temp.contains("DustTiny") || temp.contains("DustSmall")){
+ return;
+ }
+ temp = temp.replace("itemDust", "ingot");
+ if (temp != null && temp != ""){
- public final String getMaterialName() {
- return this.materialName;
+ if (dustInfo.requiresBlastFurnace()){
+ Utils.LOG_WARNING("Adding recipe for Hot "+materialName+" Ingots in a Blast furnace.");
+ String tempIngot = temp.replace("ingot", "ingotHot");
+ ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1);
+ Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName() + " Debug: "+tempIngot);
+ if (null != tempOutputStack){
+ addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*mTier);
+ }
+ return;
+ }
+ Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a furnace.");
+ 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()){
+ 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(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*mTier);
+ }
+ return;
+ }
+ }
+
+ }
}
- @Override
- public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
- final boolean p_77663_5_) {
- EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding);
+ private void addBlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tempRequired){
+ //Special Cases
+ /*if (input1.getUnlocalizedName().toLowerCase().contains("tantalloy61")){
+ Utils.LOG_INFO("Adding Special handler for Staballoy-61 in the Blast Furnace");
+ input2 = UtilsItems.getItemStackOfAmountFromOreDict("dustTantalloy60", 2);
+ if (input2 == null){
+ Utils.LOG_INFO("invalid itemstack.");
+ }
+ else {
+ Utils.LOG_INFO("Found "+input2.getDisplayName());
+ }
+ }*/
+ GT_Values.RA.addBlastRecipe(
+ input1,
+ input2,
+ GT_Values.NF, GT_Values.NF,
+ output1,
+ output2,
+ 250*mTier*20,
+ mTier*64,
+ tempRequired);
+
+
+
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java
index 7ab194ba49..a49dc58188 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java
@@ -1,42 +1,42 @@
package gtPlusPlus.core.item.base.dusts;
+import gtPlusPlus.core.lib.CORE;
+
import java.util.List;
-import cpw.mods.fml.common.registry.GameRegistry;
-import gtPlusPlus.core.lib.CORE;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import cpw.mods.fml.common.registry.GameRegistry;
-public abstract class BaseItemDustAbstract extends Item {
-
- protected int colour = 0;
- protected String materialName;
- protected String pileType;
-
- public BaseItemDustAbstract(final String unlocalizedName, final String materialName, final int colour,
- final String pileSize) {
+public abstract class BaseItemDustAbstract extends Item{
+
+ protected int colour = 0;
+ protected String materialName;
+ protected String pileType;
+
+ public BaseItemDustAbstract(String unlocalizedName, String materialName, int colour, String pileSize) {
this.setUnlocalizedName(unlocalizedName);
- this.setMaxStackSize(64);
- if (pileSize == "dust" || pileSize == "Dust") {
- this.setTextureName(CORE.MODID + ":" + "dust");
+ this.setMaxStackSize(64);
+ if (pileSize == "dust" || pileSize == "Dust"){
+ this.setTextureName(CORE.MODID + ":" + "dust");
}
- else {
- this.setTextureName(CORE.MODID + ":" + "dust" + pileSize);
+ else{
+ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);
}
this.setMaxStackSize(64);
this.colour = colour;
- this.materialName = materialName;
- this.setUnlocalizedName(unlocalizedName);
+ this.materialName = materialName;
+ setUnlocalizedName(unlocalizedName);
GameRegistry.registerItem(this, unlocalizedName);
}
@Override
public abstract void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool);
- @Override
- public abstract int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF);
-
public abstract String getMaterialName();
+ @Override
+ public abstract int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF);
+
}
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
index 24b721ff0e..d5dd78a49b 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
@@ -1,127 +1,121 @@
package gtPlusPlus.core.item.base.dusts;
-import java.util.List;
-
-import cpw.mods.fml.common.registry.GameRegistry;
+import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc;
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.entity.EntityUtils;
import gtPlusPlus.core.util.item.ItemUtils;
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 net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
+import cpw.mods.fml.common.registry.GameRegistry;
-public class BaseItemDustUnique extends Item {
+public class BaseItemDustUnique extends Item{
- protected int colour;
- protected String materialName;
- protected String pileType;
- String name = "";
+ protected int colour;
+ protected String materialName;
+ protected String pileType;
+ String name = "";
- protected final int sRadiation;
-
- public BaseItemDustUnique(final String unlocalizedName, final String materialName, final int colour,
- final String pileSize) {
- this.setUnlocalizedName(unlocalizedName);
+ public BaseItemDustUnique(String unlocalizedName, String materialName, int colour, String pileSize) {
+ setUnlocalizedName(unlocalizedName);
this.setUnlocalizedName(unlocalizedName);
- this.setMaxStackSize(64);
- if (pileSize == "dust" || pileSize == "Dust") {
- this.setTextureName(CORE.MODID + ":" + "dust");
- }
- else {
- this.setTextureName(CORE.MODID + ":" + "dust" + pileSize);
- }
- this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setMaxStackSize(64);
+ if (pileSize == "dust" || pileSize == "Dust"){
+ this.setTextureName(CORE.MODID + ":" + "dust");}
+ else{
+ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);}
+ this.setCreativeTab(tabMisc);
this.colour = colour;
this.materialName = materialName;
this.sRadiation = ItemUtils.getRadioactivityLevel(materialName);
GameRegistry.registerItem(this, unlocalizedName);
String temp = "";
- Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: " + this.getUnlocalizedName());
- if (this.getUnlocalizedName().contains("item.")) {
- temp = this.getUnlocalizedName().replace("item.", "");
- Utils.LOG_WARNING("Generating OreDict Name: " + temp);
+ Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName());
+ if (getUnlocalizedName().contains("item.")){
+ temp = getUnlocalizedName().replace("item.", "");
+ Utils.LOG_WARNING("Generating OreDict Name: "+temp);
}
else {
- temp = this.getUnlocalizedName();
+ temp = getUnlocalizedName();
}
- if (temp.contains("DustTiny")) {
+ if (temp.contains("DustTiny")){
temp = temp.replace("itemD", "d");
- Utils.LOG_WARNING("Generating OreDict Name: " + temp);
+ Utils.LOG_WARNING("Generating OreDict Name: "+temp);
}
- else if (temp.contains("DustSmall")) {
+ else if (temp.contains("DustSmall")){
temp = temp.replace("itemD", "d");
- Utils.LOG_WARNING("Generating OreDict Name: " + temp);
+ Utils.LOG_WARNING("Generating OreDict Name: "+temp);
}
else {
temp = temp.replace("itemD", "d");
- Utils.LOG_WARNING("Generating OreDict Name: " + temp);
- }
- if (temp != null && temp != "") {
+ Utils.LOG_WARNING("Generating OreDict Name: "+temp);
+ }
+ if (temp != null && temp != ""){
GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
}
}
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- // if (pileType != null && materialName != null && pileType != "" &&
- // materialName != "" && !pileType.equals("") &&
- // !materialName.equals("")){
- if (this.getUnlocalizedName().contains("DustTiny")) {
- list.add(EnumChatFormatting.GRAY + "A tiny pile of " + this.materialName + " dust.");
+ public String getItemStackDisplayName(ItemStack iStack) {
+
+ if (getUnlocalizedName().contains("DustTiny")){
+ name = "Tiny Pile of "+materialName + " Dust";
}
- else if (this.getUnlocalizedName().contains("DustSmall")) {
- list.add(EnumChatFormatting.GRAY + "A small pile of " + this.materialName + " dust.");
+ else if (getUnlocalizedName().contains("DustSmall")){
+ name = "Small Pile of "+materialName + " Dust";
}
else {
- list.add(EnumChatFormatting.GRAY + "A pile of " + this.materialName + " dust.");
+ name = materialName + " Dust";
}
- if (this.sRadiation > 0) {
- list.add(CORE.GT_Tooltip_Radioactive);
- }
- // }
- super.addInformation(stack, aPlayer, list, bool);
+ return name;
}
+ protected final int sRadiation;
@Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- if (this.colour == 0) {
- return MathUtils.generateSingularRandomHexValue();
- }
- return this.colour;
-
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+ EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
}
@Override
- public String getItemStackDisplayName(final ItemStack iStack) {
-
- if (this.getUnlocalizedName().contains("DustTiny")) {
- this.name = "Tiny Pile of " + this.materialName + " Dust";
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ //if (pileType != null && materialName != null && pileType != "" && materialName != "" && !pileType.equals("") && !materialName.equals("")){
+ if (getUnlocalizedName().contains("DustTiny")){
+ list.add(EnumChatFormatting.GRAY+"A tiny pile of " + materialName + " dust.");
}
- else if (this.getUnlocalizedName().contains("DustSmall")) {
- this.name = "Small Pile of " + this.materialName + " Dust";
+ else if (getUnlocalizedName().contains("DustSmall")){
+ list.add(EnumChatFormatting.GRAY+"A small pile of " + materialName + " dust.");
}
else {
- this.name = this.materialName + " Dust";
+ list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust.");
+ }
+ if (sRadiation > 0){
+ list.add(CORE.GT_Tooltip_Radioactive);
}
- return this.name;
+ //}
+ super.addInformation(stack, aPlayer, list, bool);
}
public final String getMaterialName() {
- return this.materialName;
+ return materialName;
}
@Override
- public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
- final boolean p_77663_5_) {
- EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding);
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ if (colour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return colour;
+
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java
index d60aff043f..0faa781fd9 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java
@@ -1,56 +1,56 @@
package gtPlusPlus.core.item.base.dusts.decimal;
-import java.util.List;
-
-import cpw.mods.fml.common.registry.GameRegistry;
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 {
+public class BaseItemCentidust extends Item{
- final Material dustMaterial;
- final String materialName;
- final String unlocalName;
+ final Material dustMaterial;
+ final String materialName;
+ final String unlocalName;
- public BaseItemCentidust(final Material material) {
+ public BaseItemCentidust(Material material) {
this.dustMaterial = material;
- this.unlocalName = "itemCentidust" + material.getUnlocalizedName();
+ this.unlocalName = "itemCentidust"+material.getUnlocalizedName();
this.materialName = material.getLocalizedName();
this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(this.unlocalName);
+ this.setUnlocalizedName(unlocalName);
this.setMaxStackSize(10);
- this.setTextureName(CORE.MODID + ":" + "itemCentidust"); // TODO
- GameRegistry.registerItem(this, this.unlocalName);
- // GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"),
- // UtilsItems.getSimpleStack(this)); //TODO
+ this.setTextureName(CORE.MODID + ":" + "itemCentidust"); //TODO
+ GameRegistry.registerItem(this, unlocalName);
+ //GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO
}
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")) {
- list.add(EnumChatFormatting.GRAY + "1% of a " + this.materialName + " dust pile.");
- }
- super.addInformation(stack, aPlayer, list, bool);
- }
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
- @Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- return this.dustMaterial.getRgbAsHex();
+ return (materialName+ " Centidust");
}
@Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
-
- return this.materialName + " Centidust";
+ 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 this.materialName;
+ 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
index 3b81d46de2..afb9eef473 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java
@@ -1,56 +1,56 @@
package gtPlusPlus.core.item.base.dusts.decimal;
-import java.util.List;
-
-import cpw.mods.fml.common.registry.GameRegistry;
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 {
+public class BaseItemDecidust extends Item{
- final Material dustMaterial;
- final String materialName;
- final String unlocalName;
+ final Material dustMaterial;
+ final String materialName;
+ final String unlocalName;
- public BaseItemDecidust(final Material material) {
+ public BaseItemDecidust(Material material) {
this.dustMaterial = material;
- this.unlocalName = "itemDecidust" + material.getUnlocalizedName();
+ this.unlocalName = "itemDecidust"+material.getUnlocalizedName();
this.materialName = material.getLocalizedName();
this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(this.unlocalName);
+ this.setUnlocalizedName(unlocalName);
this.setMaxStackSize(10);
- this.setTextureName(CORE.MODID + ":" + "itemDecidust"); // TODO
- GameRegistry.registerItem(this, this.unlocalName);
- // GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"),
- // UtilsItems.getSimpleStack(this)); //TODO
+ this.setTextureName(CORE.MODID + ":" + "itemDecidust"); //TODO
+ GameRegistry.registerItem(this, unlocalName);
+ //GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO
}
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")) {
- list.add(EnumChatFormatting.GRAY + "10% of a " + this.materialName + " dust pile.");
- }
- super.addInformation(stack, aPlayer, list, bool);
- }
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
- @Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- return this.dustMaterial.getRgbAsHex();
+ return (materialName+ " Decidust");
}
@Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
-
- return this.materialName + " Decidust";
+ 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 this.materialName;
+ return materialName;
+ }
+
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ return dustMaterial.getRgbAsHex();
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java
index ba97e34c08..7b0663d9cf 100644
--- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java
+++ b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java
@@ -1,6 +1,5 @@
package gtPlusPlus.core.item.base.foods;
-import cpw.mods.fml.common.registry.GameRegistry;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import net.minecraft.entity.player.EntityPlayer;
@@ -8,14 +7,14 @@ import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
+import cpw.mods.fml.common.registry.GameRegistry;
public class BaseItemFood extends ItemFood {
- private final PotionEffect[] effects;
- protected String localName;
+ private PotionEffect[] effects;
+ protected String localName;
- public BaseItemFood(final String unlocalizedName, final String localizedName, final int healAmount,
- final float saturationModifier, final boolean wolvesFavorite, final PotionEffect... effects) {
+ public BaseItemFood(String unlocalizedName, String localizedName, int healAmount, float saturationModifier, boolean wolvesFavorite, PotionEffect... effects) {
super(healAmount, saturationModifier, wolvesFavorite);
this.setUnlocalizedName(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName.replace("Hot", ""));
@@ -26,21 +25,23 @@ public class BaseItemFood extends ItemFood {
}
@Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
+ super.onFoodEaten(stack, world, player);
- return "A Serving of " + this.localName;
+ for (int i = 0; i < effects.length; i ++) {
+ if (!world.isRemote && effects[i] != null && effects[i].getPotionID() > 0)
+ player.addPotionEffect(new PotionEffect(this.effects[i].getPotionID(),
+ this.effects[i].getDuration(), this.effects[i].getAmplifier(),
+ this.effects[i].getIsAmbient()
+ )
+ );
+ }
}
-
+
@Override
- protected void onFoodEaten(final ItemStack stack, final World world, final EntityPlayer player) {
- super.onFoodEaten(stack, world, player);
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
- for (int i = 0; i < this.effects.length; i++) {
- if (!world.isRemote && this.effects[i] != null && this.effects[i].getPotionID() > 0) {
- player.addPotionEffect(new PotionEffect(this.effects[i].getPotionID(), this.effects[i].getDuration(),
- this.effects[i].getAmplifier(), this.effects[i].getIsAmbient()));
- }
- }
+ return ("A Serving of "+localName);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java
index d20cad018e..92b8c8c224 100644
--- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java
+++ b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java
@@ -1,10 +1,11 @@
package gtPlusPlus.core.item.base.foods;
-import java.util.List;
-
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.item.ItemUtils;
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;
@@ -13,16 +14,15 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class BaseItemHotFood extends BaseItemFood {
+public class BaseItemHotFood extends BaseItemFood{
- protected String materialName;
- protected String unlocalName;
- protected int cooldownTime;
- protected Item output;
+ protected String materialName;
+ protected String unlocalName;
+ protected int cooldownTime;
+ protected Item output;
- public BaseItemHotFood(final String unlocalizedName, final int healAmount, final float healSaturation,
- final String foodName, final int timeToCoolInSeconds, final Item cooledFood) {
- super(unlocalizedName, "Hot " + foodName, healAmount, healSaturation, false);
+ public BaseItemHotFood(String unlocalizedName, int healAmount, float healSaturation, String foodName, int timeToCoolInSeconds, Item cooledFood) {
+ super(unlocalizedName, "Hot "+foodName, healAmount, healSaturation, false);
this.unlocalName = unlocalizedName;
this.cooldownTime = timeToCoolInSeconds * 20;
this.materialName = foodName;
@@ -31,53 +31,48 @@ public class BaseItemHotFood extends BaseItemFood {
}
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")) {
- list.add(EnumChatFormatting.GRAY + "Warning: " + EnumChatFormatting.RED + "Very hot!"
- + EnumChatFormatting.GRAY + " Avoid direct handling..");
- list.add(EnumChatFormatting.GRAY + "This food has " + (this.cooldownTime - stack.getItemDamage()) / 20
- + " seconds left, until it is cool.");
- }
- super.addInformation(stack, aPlayer, list, bool);
+ public ItemStack onEaten(ItemStack iStack, World world, EntityPlayer player) {
+ return super.onEaten(iStack, world, player);
}
@Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- return Utils.rgbtoHexValue(230, 96, 96);
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+ //Utils.LOG_INFO("Item Damage: "+iStack.getItemDamage()+" Max Damage: "+iStack.getMaxDamage());
+ if (!world.isRemote){
+ if(iStack.getItemDamage() == cooldownTime) {
+ if (entityHolding instanceof EntityPlayer){
+ Utils.LOG_INFO("Foods Done.");
+ ((EntityPlayer) entityHolding).inventory.addItemStackToInventory(ItemUtils.getSimpleStack(output));
+ ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
+ }
+ }else if(iStack.getItemDamage() < cooldownTime){
+ iStack.setItemDamage(iStack.getItemDamage() + 1);
+ }
+ if(MathUtils.divideXintoY(iStack.getItemDamage(), 150)){
+ entityHolding.attackEntityFrom(DamageSource.onFire, 1);
+ }
+
+ }
+ super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_);
}
- public final String getMaterialName() {
- return this.materialName;
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ if (materialName != null && materialName != "" && !materialName.equals("")){
+ list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot!"+EnumChatFormatting.GRAY+" Avoid direct handling..");
+ list.add(EnumChatFormatting.GRAY+"This food has "+((cooldownTime-(int) stack.getItemDamage())/20)+" seconds left, until it is cool.");
+ }
+ super.addInformation(stack, aPlayer, list, bool);
}
- @Override
- public ItemStack onEaten(final ItemStack iStack, final World world, final EntityPlayer player) {
- return super.onEaten(iStack, world, player);
+ public final String getMaterialName() {
+ return materialName;
}
@Override
- public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
- final boolean p_77663_5_) {
- // Utils.LOG_INFO("Item Damage: "+iStack.getItemDamage()+" Max Damage:
- // "+iStack.getMaxDamage());
- if (!world.isRemote) {
- if (iStack.getItemDamage() == this.cooldownTime) {
- if (entityHolding instanceof EntityPlayer) {
- Utils.LOG_INFO("Foods Done.");
- ((EntityPlayer) entityHolding).inventory
- .addItemStackToInventory(ItemUtils.getSimpleStack(this.output));
- ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
- }
- }
- else if (iStack.getItemDamage() < this.cooldownTime) {
- iStack.setItemDamage(iStack.getItemDamage() + 1);
- }
- if (MathUtils.divideXintoY(iStack.getItemDamage(), 150)) {
- entityHolding.attackEntityFrom(DamageSource.onFire, 1);
- }
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ return Utils.rgbtoHexValue(230, 96, 96);
- }
- super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
index c74e90401f..7c4fe89568 100644
--- a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
+++ b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
@@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.gears;
import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
-public class BaseItemGear extends BaseItemComponent {
+public class BaseItemGear extends BaseItemComponent{
- public BaseItemGear(final Material material) {
- super(material, BaseItemComponent.ComponentTypes.GEAR);
+ public BaseItemGear(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.GEAR);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java
index a41fe9a0e9..9a0ef0d097 100644
--- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java
+++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java
@@ -1,8 +1,5 @@
package gtPlusPlus.core.item.base.ingots;
-import java.util.List;
-
-import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.core.creative.AddToCreativeTab;
@@ -11,24 +8,25 @@ import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.entity.EntityUtils;
import gtPlusPlus.core.util.item.ItemUtils;
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 net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
+import cpw.mods.fml.common.registry.GameRegistry;
-public class BaseItemIngot extends Item {
-
- protected int colour;
- protected String materialName;
- protected String unlocalName;
+public class BaseItemIngot extends Item{
- protected final int sRadiation;
+ protected int colour;
+ protected String materialName;
+ protected String unlocalName;
- public BaseItemIngot(final String unlocalizedName, final String materialName, final int colour,
- final int sRadioactivity) {
- this.setUnlocalizedName(unlocalizedName);
+ public BaseItemIngot(String unlocalizedName, String materialName, int colour, int sRadioactivity) {
+ setUnlocalizedName(unlocalizedName);
this.setCreativeTab(AddToCreativeTab.tabMisc);
this.setUnlocalizedName(unlocalizedName);
this.unlocalName = unlocalizedName;
@@ -40,83 +38,82 @@ public class BaseItemIngot extends Item {
this.sRadiation = sRadioactivity;
GameRegistry.registerItem(this, unlocalizedName);
String temp = "";
- if (this.unlocalName.contains("itemIngot")) {
- temp = this.unlocalName.replace("itemI", "i");
+ if (unlocalName.contains("itemIngot")){
+ temp = unlocalName.replace("itemI", "i");
}
- else if (this.unlocalName.contains("itemHotIngot")) {
- temp = this.unlocalName.replace("itemHotIngot", "ingotHot");
+ else if (unlocalName.contains("itemHotIngot")){
+ temp = unlocalName.replace("itemHotIngot", "ingotHot");
}
- if (temp != null && temp != "") {
+ if (temp != null && temp != ""){
GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
- }
- this.generateCompressorRecipe();
+ }
+ generateCompressorRecipe();
}
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")
- && !this.unlocalName.contains("HotIngot")) {
- list.add(EnumChatFormatting.GRAY + "A solid ingot of " + this.materialName + ".");
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+
+ return (materialName+ " Ingot");
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ if (materialName != null && materialName != "" && !materialName.equals("") && !unlocalName.contains("HotIngot")){
+ list.add(EnumChatFormatting.GRAY+"A solid ingot of " + materialName + ".");
}
- else if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")
- && this.unlocalName.toLowerCase().contains("ingothot")) {
- list.add(EnumChatFormatting.GRAY + "Warning: " + EnumChatFormatting.RED + "Very hot! "
- + EnumChatFormatting.GRAY + " Avoid direct handling..");
+ else 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 (this.sRadiation > 0) {
+ if (sRadiation > 0){
list.add(CORE.GT_Tooltip_Radioactive);
- }
+ }
super.addInformation(stack, aPlayer, list, bool);
}
- private void generateCompressorRecipe() {
- if (this.unlocalName.contains("itemIngot")) {
- final ItemStack tempStack = ItemUtils.getSimpleStack(this, 9);
+ public final String getMaterialName() {
+ return materialName;
+ }
+
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ if (colour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return colour;
+
+ }
+
+ private void generateCompressorRecipe(){
+ if (unlocalName.contains("itemIngot")){
+ ItemStack tempStack = ItemUtils.getSimpleStack(this, 9);
ItemStack tempOutput = null;
- String temp = this.getUnlocalizedName().replace("item.itemIngot", "block");
- Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: " + this.getUnlocalizedName());
- if (this.getUnlocalizedName().contains("item.")) {
- temp = this.getUnlocalizedName().replace("item.", "");
- Utils.LOG_WARNING("Generating OreDict Name: " + temp);
+ String temp = getUnlocalizedName().replace("item.itemIngot", "block");
+ Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName());
+ if (getUnlocalizedName().contains("item.")){
+ temp = getUnlocalizedName().replace("item.", "");
+ Utils.LOG_WARNING("Generating OreDict Name: "+temp);
}
temp = temp.replace("itemIngot", "block");
- Utils.LOG_WARNING("Generating OreDict Name: " + temp);
- if (temp != null && temp != "") {
+ Utils.LOG_WARNING("Generating OreDict Name: "+temp);
+ if (temp != null && temp != ""){
tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1);
- if (tempOutput != null) {
+ if (tempOutput != null){
GT_ModHandler.addCompressionRecipe(tempStack, tempOutput);
}
-
+
}
}
- else if (this.unlocalName.contains("itemHotIngot")) {
+ else if (unlocalName.contains("itemHotIngot")){
return;
}
+
}
+
- @Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- if (this.colour == 0) {
- return MathUtils.generateSingularRandomHexValue();
+ protected final int sRadiation;
+ @Override
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+ EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
}
- return this.colour;
-
- }
-
- @Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
-
- return this.materialName + " Ingot";
- }
-
- public final String getMaterialName() {
- return this.materialName;
- }
-
- @Override
- public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
- final boolean p_77663_5_) {
- EntityUtils.applyRadiationDamageToEntity(this.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 5f43c513af..6b60e7f8d3 100644
--- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java
+++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java
@@ -1,11 +1,12 @@
package gtPlusPlus.core.item.base.ingots;
-import java.util.List;
-
import gregtech.api.enums.GT_Values;
import gtPlusPlus.core.lib.CORE;
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.ItemStack;
@@ -13,61 +14,60 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class BaseItemIngotHot extends BaseItemIngot {
+public class BaseItemIngotHot extends BaseItemIngot{
- private final ItemStack outputIngot;
- private int tickCounter = 0;
- private final int tickCounterMax = 200;
- private final int mTier;
+ private ItemStack outputIngot;
+ private int tickCounter = 0;
+ private int tickCounterMax = 200;
+ private int mTier;
- public BaseItemIngotHot(final String unlocalizedName, final String materialName, final ItemStack coldIngot,
- final int tier) {
+ public BaseItemIngotHot(String unlocalizedName, String materialName, ItemStack coldIngot, int tier) {
super(unlocalizedName, materialName, Utils.rgbtoHexValue(225, 225, 225), 0);
this.setTextureName(CORE.MODID + ":" + "itemIngotHot");
this.outputIngot = coldIngot;
this.mTier = tier;
- this.generateRecipe();
+ generateRecipe();
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+
+ return ("Hot "+materialName+ " Ingot");
}
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")) {
- list.add(EnumChatFormatting.GRAY + "A " + EnumChatFormatting.RED + "burning hot" + EnumChatFormatting.GRAY
- + " ingot of " + this.materialName + ".");
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ if (materialName != null && materialName != "" && !materialName.equals("")){
+ list.add(EnumChatFormatting.GRAY+"A "+EnumChatFormatting.RED+"burning hot"+EnumChatFormatting.GRAY+" ingot of " + materialName + ".");
}
super.addInformation(stack, aPlayer, list, bool);
}
- private void generateRecipe() {
- Utils.LOG_WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of " + this.materialName + ".");
- GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), this.outputIngot.copy(), 60 * this.mTier);
-
- }
-
@Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
return Utils.rgbtoHexValue(225, 225, 225);
}
- @Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ private void generateRecipe(){
+ Utils.LOG_WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+materialName+".");
+ GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), outputIngot.copy(), 60*mTier);
- return "Hot " + this.materialName + " Ingot";
- }
+
+ }
@Override
- public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
- final boolean p_77663_5_) {
- if (!world.isRemote) {
- if (this.tickCounter < this.tickCounterMax) {
- this.tickCounter++;
- }
- else if (this.tickCounter == this.tickCounterMax) {
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+ if (!world.isRemote){
+ if(tickCounter < tickCounterMax){
+ tickCounter++;
+ }
+ else if(tickCounter == tickCounterMax){
entityHolding.attackEntityFrom(DamageSource.onFire, 1);
- this.tickCounter = 0;
+ tickCounter = 0;
}
super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_);
}
}
+
}
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java
index 1ad2ab0f24..488f9a6f60 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java
@@ -7,15 +7,16 @@ import net.minecraft.item.ItemStack;
public class ItemBlockBase extends ItemBlock {
- public ItemBlockBase(final Block block) {
- super(block);
- this.setCreativeTab(AddToCreativeTab.tabBlock);
- }
-
- @Override
- public int getColorFromItemStack(final ItemStack p_82790_1_, final int p_82790_2_) {
-
- return super.getColorFromItemStack(p_82790_1_, p_82790_2_);
- }
+ public ItemBlockBase(Block block) {
+ super(block);
+ this.setCreativeTab(AddToCreativeTab.tabBlock);
+ }
+ @Override
+ public int getColorFromItemStack(ItemStack p_82790_1_, int p_82790_2_) {
+
+ return super.getColorFromItemStack(p_82790_1_, p_82790_2_);
+ }
+
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java
index 373305dc25..2e39a47f81 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java
@@ -1,82 +1,78 @@
package gtPlusPlus.core.item.base.itemblock;
-import java.util.List;
-
import gtPlusPlus.core.fluids.BlockFluidBase;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
+
+import java.util.List;
+
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
-public class ItemBlockFluid extends ItemBlock {
+public class ItemBlockFluid extends ItemBlock{
- protected final int blockColour;
- protected final int sRadiation;
- protected Material thisFluid;
- final BlockFluidBase baseBlock;
- String name;
+ protected final int blockColour;
+ protected final int sRadiation;
+ protected Material thisFluid;
+ final BlockFluidBase baseBlock;
+ String name;
- public ItemBlockFluid(final Block block) {
+ public ItemBlockFluid(Block block) {
super(block);
this.baseBlock = (BlockFluidBase) block;
- this.blockColour = this.baseBlock.getRenderColor(1);
- this.thisFluid = this.baseBlock.getFluidMaterial();
- this.sRadiation = ItemUtils.getRadioactivityLevel(this.baseBlock.getUnlocalizedName());
- this.name = this.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));
+ this.blockColour = baseBlock.getRenderColor(1);
+ this.thisFluid = baseBlock.getFluidMaterial();
+ 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));
+ }
+
+ public final Material setFluidMaterial(Material M){
+ return thisFluid=M;
}
+ public int getRenderColor(int aMeta) {
+ return blockColour;
+ }
+
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add("Temperature: " + MathUtils.celsiusToKelvin(this.thisFluid.getMeltingPointC()) + "K");
- if (this.sRadiation > 0) {
- list.add(CORE.GT_Tooltip_Radioactive);
+ public String getItemStackDisplayName(ItemStack iStack) {
+ if (thisFluid != null){
+ this.name = "Molten "+thisFluid.getLocalizedName();
+ return name;
}
- super.addInformation(stack, aPlayer, list, bool);
+ this.name = "Molten "+baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", "");
+ return name;
}
-
+
@Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- if (this.blockColour == 0) {
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ if (blockColour == 0){
return MathUtils.generateSingularRandomHexValue();
}
- return this.blockColour;
+ return blockColour;
}
@Override
- public String getItemStackDisplayName(final ItemStack iStack) {
- if (this.thisFluid != null) {
- this.name = "Molten " + this.thisFluid.getLocalizedName();
- return this.name;
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ list.add("Temperature: "+MathUtils.celsiusToKelvin(thisFluid.getMeltingPointC())+"K");
+ if (sRadiation > 0){
+ list.add(CORE.GT_Tooltip_Radioactive);
}
- this.name = "Molten " + this.baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "")
- .replace("name", "").replace("block", "").replace(".", "");
- return this.name;
+ super.addInformation(stack, aPlayer, list, bool);
}
public String GetProperName() {
- String tempIngot;
+ String tempIngot;
- tempIngot = "Molten " + this.baseBlock.getLocalizedName();
+ tempIngot = "Molten "+baseBlock.getLocalizedName();
return tempIngot;
}
- public int getRenderColor(final int aMeta) {
- return this.blockColour;
- }
-
- public final Material setFluidMaterial(final Material M) {
- return this.thisFluid = M;
- }
-
}
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
index 2fe88ff3c2..8bf5346084 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
@@ -1,12 +1,13 @@
package gtPlusPlus.core.item.base.itemblock;
-import java.util.List;
-
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.core.block.base.BlockBaseModular;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.entity.EntityUtils;
import gtPlusPlus.core.util.item.ItemUtils;
+
+import java.util.List;
+
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -14,45 +15,39 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-public class ItemBlockGtBlock extends ItemBlock {
-
- protected final int blockColour;
- protected final int sRadiation;
+public class ItemBlockGtBlock extends ItemBlock{
- public ItemBlockGtBlock(final Block block) {
+ protected final int blockColour;
+ protected final int sRadiation;
+
+ public ItemBlockGtBlock(Block block) {
super(block);
- final BlockBaseModular baseBlock = (BlockBaseModular) block;
+ BlockBaseModular baseBlock = (BlockBaseModular) block;
this.blockColour = baseBlock.getRenderColor(0);
- if (block.getLocalizedName().toLowerCase().contains("uranium")
- || block.getLocalizedName().toLowerCase().contains("plutonium")
- || block.getLocalizedName().toLowerCase().contains("thorium")) {
- this.sRadiation = 2;
+ if (block.getLocalizedName().toLowerCase().contains("uranium") || block.getLocalizedName().toLowerCase().contains("plutonium") || block.getLocalizedName().toLowerCase().contains("thorium")){
+ sRadiation = 2;
}
else {
- this.sRadiation = 0;
+ sRadiation = 0;
}
- GT_OreDictUnificator.registerOre(
- "block" + block.getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "")
- .replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""),
- ItemUtils.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));
}
- @Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- if (this.sRadiation > 0) {
- list.add(CORE.GT_Tooltip_Radioactive);
- }
+ public int getRenderColor(int aMeta) {
+ return blockColour;
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ if (sRadiation > 0){
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }
super.addInformation(stack, aPlayer, list, bool);
}
-
- public int getRenderColor(final int aMeta) {
- return this.blockColour;
- }
-
- @Override
- public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
- final boolean p_77663_5_) {
- EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding);
- }
+
+ @Override
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+ 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 6151e4818d..9d442e3102 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java
@@ -6,22 +6,19 @@ import gtPlusPlus.core.util.item.ItemUtils;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
-public class ItemBlockGtFrameBox extends ItemBlock {
+public class ItemBlockGtFrameBox extends ItemBlock{
protected int blockColour;
-
- public ItemBlockGtFrameBox(final Block block) {
+
+ public ItemBlockGtFrameBox(Block block) {
super(block);
- final BlockBaseModular baseBlock = (BlockBaseModular) 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", ""),
- ItemUtils.getSimpleStack(this));
+ GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), ItemUtils.getSimpleStack(this));
}
- public int getRenderColor(final int aMeta) {
- return this.blockColour;
- }
+ public int getRenderColor(int aMeta) {
+ return blockColour;
+ }
}
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java
index 6436012e4d..73fcbc2ab6 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java
@@ -9,35 +9,35 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-public class ItemBlockTileEntity extends ItemBlock {
+public class ItemBlockTileEntity extends ItemBlock{
String[] description;
-
- public ItemBlockTileEntity(final Block block) {
+
+ public ItemBlockTileEntity(Block block) {
super(block);
}
-
- @Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- for (int i = 0; i < this.description.length; i++) {
- if (!this.description[i].equals("")) {
- list.add(this.description[i]);
- }
- }
-
+
+ @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(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_,
- final boolean p_77663_5_) {
-
- }
-
- public void setDecription(final String[] description) {
- for (int i = 0; i < description.length; i++) {
- this.description[i] = description[i];
+
+ @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
index 5e20f3c714..d4f7ac02a6 100644
--- a/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java
+++ b/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java
@@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.nugget;
import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
-public class BaseItemNugget extends BaseItemComponent {
+public class BaseItemNugget extends BaseItemComponent{
- public BaseItemNugget(final Material material) {
- super(material, BaseItemComponent.ComponentTypes.NUGGET);
+ 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 a2b4ce4d28..3d1153eb6a 100644
--- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java
+++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java
@@ -4,17 +4,16 @@ import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.materials.MaterialUtils;
-public class BaseItemPlate extends BaseItemComponent {
+public class BaseItemPlate extends BaseItemComponent{
- public BaseItemPlate(final Material material) {
+ public BaseItemPlate(Material material) {
super(material, BaseItemComponent.ComponentTypes.PLATE);
}
-
- public BaseItemPlate(final String unlocalizedName, final String materialName, final short[] colour, final int tier,
- final int sRadioactivity) {
- this(MaterialUtils.generateQuickMaterial(materialName, new short[] {
- colour[0], colour[1], colour[2], 0
- }, sRadioactivity));
+
+ 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));
}
+
+
}
diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java
index 41b067d3fd..ce8bbe8191 100644
--- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java
+++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java
@@ -4,15 +4,15 @@ import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
import net.minecraft.item.ItemStack;
-public class BaseItemPlateDouble extends BaseItemComponent {
+public class BaseItemPlateDouble extends BaseItemComponent{
- public BaseItemPlateDouble(final Material material) {
- super(material, BaseItemComponent.ComponentTypes.PLATEDOUBLE);
+ public BaseItemPlateDouble(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.PLATEDOUBLE);
this.setMaxStackSize(32);
}
@Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
- return "Double " + this.materialName + " Plate";
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ return ("Double "+materialName+ " Plate");
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java
index 436b1809fc..6ad3509876 100644
--- a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java
+++ b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java
@@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.rings;
import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
-public class BaseItemRing extends BaseItemComponent {
+public class BaseItemRing extends BaseItemComponent{
- public BaseItemRing(final Material material) {
+ public BaseItemRing(Material material) {
super(material, BaseItemComponent.ComponentTypes.RING);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
index b1eb28f4d5..2e4acd6ccb 100644
--- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
+++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
@@ -6,21 +6,26 @@ import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
import net.minecraft.item.ItemStack;
-public class BaseItemRod extends BaseItemComponent {
+public class BaseItemRod extends BaseItemComponent{
- public BaseItemRod(final Material material) {
- super(material, BaseItemComponent.ComponentTypes.ROD);
- this.addExtruderRecipe();
+ public BaseItemRod(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.ROD);
+ addExtruderRecipe();
}
- private void addExtruderRecipe() {
- Utils.LOG_WARNING("Adding cutter recipe for " + this.materialName + " Rods");
- final ItemStack stackStick = this.componentMaterial.getRod(1);
- final ItemStack stackBolt = this.componentMaterial.getBolt(4);
+ private void addExtruderRecipe(){
+ Utils.LOG_WARNING("Adding cutter recipe for "+materialName+" Rods");
- GT_Values.RA.addCutterRecipe(stackStick, stackBolt, null,
- (int) Math.max(this.componentMaterial.getMass() * 2L, 1L), 4);
+ ItemStack stackStick = componentMaterial.getRod(1);
+ ItemStack stackBolt = componentMaterial.getBolt(4);
+
+ GT_Values.RA.addCutterRecipe(
+ stackStick,
+ stackBolt,
+ null,
+ (int) Math.max(componentMaterial.getMass() * 2L, 1L),
+ 4);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
index df69bf5a8d..882dc8b2bf 100644
--- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
+++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
@@ -7,32 +7,41 @@ import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.item.ItemUtils;
import net.minecraft.item.ItemStack;
-public class BaseItemRodLong extends BaseItemComponent {
+public class BaseItemRodLong extends BaseItemComponent{
- public BaseItemRodLong(final Material material) {
+ public BaseItemRodLong(Material material) {
super(material, BaseItemComponent.ComponentTypes.RODLONG);
- this.addExtruderRecipe();
+ addExtruderRecipe();
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ return ("Long "+materialName+ " Rod");
}
- private void addExtruderRecipe() {
- Utils.LOG_WARNING("Adding recipe for Long " + this.materialName + " Rods");
+ private void addExtruderRecipe(){
+ Utils.LOG_WARNING("Adding recipe for Long "+materialName+" Rods");
- final String tempStick = this.unlocalName.replace("itemRodLong", "stick");
- final String tempStickLong = this.unlocalName.replace("itemRodLong", "stickLong");
- final ItemStack stackStick = ItemUtils.getItemStackOfAmountFromOreDict(tempStick, 1);
- final ItemStack stackLong = ItemUtils.getItemStackOfAmountFromOreDict(tempStickLong, 1);
+ String tempStick = unlocalName.replace("itemRodLong", "stick");
+ String tempStickLong = unlocalName.replace("itemRodLong", "stickLong");
+ ItemStack stackStick = ItemUtils.getItemStackOfAmountFromOreDict(tempStick, 1);
+ ItemStack stackLong = ItemUtils.getItemStackOfAmountFromOreDict(tempStickLong, 1);
- final ItemStack temp = stackStick;
+ ItemStack temp = stackStick;
temp.stackSize = 2;
- GT_Values.RA.addForgeHammerRecipe(temp, stackLong, (int) Math.max(this.componentMaterial.getMass(), 1L), 16);
-
- GT_Values.RA.addCutterRecipe(stackLong, temp, null, (int) Math.max(this.componentMaterial.getMass(), 1L), 4);
- }
-
- @Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
- return "Long " + this.materialName + " Rod";
+ GT_Values.RA.addForgeHammerRecipe(
+ temp,
+ stackLong,
+ (int) Math.max(componentMaterial.getMass(), 1L),
+ 16);
+
+ GT_Values.RA.addCutterRecipe(
+ stackLong,
+ temp,
+ null,
+ (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 46270623c9..f993cc64b2 100644
--- a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java
+++ b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java
@@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.rotors;
import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
-public class BaseItemRotor extends BaseItemComponent {
+public class BaseItemRotor extends BaseItemComponent{
- public BaseItemRotor(final Material material) {
+ public BaseItemRotor(Material material) {
super(material, BaseItemComponent.ComponentTypes.ROTOR);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java
index 11b365d1e3..93aa5b7526 100644
--- a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java
+++ b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java
@@ -7,21 +7,24 @@ import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.item.ItemUtils;
import net.minecraft.item.ItemStack;
-public class BaseItemScrew extends BaseItemComponent {
+public class BaseItemScrew extends BaseItemComponent{
- public BaseItemScrew(final Material material) {
+ public BaseItemScrew(Material material) {
super(material, BaseItemComponent.ComponentTypes.SCREW);
- this.addLatheRecipe();
+ addLatheRecipe();
}
- private void addLatheRecipe() {
- Utils.LOG_WARNING("Adding recipe for " + this.materialName + " Screws");
- final ItemStack boltStack = ItemUtils
- .getItemStackOfAmountFromOreDict(this.unlocalName.replace("itemScrew", "bolt"), 1);
- if (null != boltStack) {
- GT_Values.RA.addLatheRecipe(boltStack, ItemUtils.getSimpleStack(this), null,
- (int) Math.max(this.componentMaterial.getMass() / 8L, 1L), 4);
- }
+ private void addLatheRecipe(){
+ Utils.LOG_WARNING("Adding recipe for "+materialName+" Screws");
+ ItemStack boltStack = ItemUtils.getItemStackOfAmountFromOreDict(unlocalName.replace("itemScrew", "bolt"), 1);
+ if (null != boltStack){
+ GT_Values.RA.addLatheRecipe(
+ boltStack,
+ ItemUtils.getSimpleStack(this),
+ null,
+ (int) Math.max(componentMaterial.getMass() / 8L, 1L),
+ 4);
+ }
}
}
diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java b/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java
index 16fe9bf2bf..cd5149b622 100644
--- a/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java
+++ b/src/Java/gtPlusPlus/core/item/effects/RarityEffect.java
@@ -1,12 +1,14 @@
package gtPlusPlus.core.item.effects;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.item.*;
/*
- *
+ *
This determines the name colour. EnumRarity can be:
EnumRarity.common - the standard white colour.
EnumRarity.uncommon - a yellow colour.
@@ -15,25 +17,25 @@ EnumRarity.epic - the purple colour used on the Golden Apple.
@SideOnly is an FML annotation. It marks the method below it for existing only on one side. Possible values are:
Side.CLIENT is probably the most common one. This marks the method as existing only on the client side.
Side.SERVER marks the method as existing only on the server side.
- *
+ *
*/
public class RarityEffect extends Item {
- public RarityEffect(final int par1) {
+ public RarityEffect(int par1){
super();
this.setCreativeTab(CreativeTabs.tabMaterials);
}
-
+
@Override
@SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
+ public EnumRarity getRarity(ItemStack par1ItemStack){
return EnumRarity.common;
}
-
+
@Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
+ public boolean hasEffect(ItemStack par1ItemStack){
return true;
}
-
+
}
diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java b/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java
index 6e313e21e4..35c5527d16 100644
--- a/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java
+++ b/src/Java/gtPlusPlus/core/item/effects/RarityEpic.java
@@ -1,26 +1,28 @@
package gtPlusPlus.core.item.effects;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.item.*;
public class RarityEpic extends Item {
- public RarityEpic(final int par1) {
+ public RarityEpic(int par1){
super();
this.setCreativeTab(CreativeTabs.tabMaterials);
}
-
+
@Override
@SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
+ public EnumRarity getRarity(ItemStack par1ItemStack){
return EnumRarity.epic;
}
-
+
@Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
+ public boolean hasEffect(ItemStack par1ItemStack){
return true;
}
-
+
}
diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityRare.java b/src/Java/gtPlusPlus/core/item/effects/RarityRare.java
index acff879d90..c64accb7aa 100644
--- a/src/Java/gtPlusPlus/core/item/effects/RarityRare.java
+++ b/src/Java/gtPlusPlus/core/item/effects/RarityRare.java
@@ -1,26 +1,28 @@
package gtPlusPlus.core.item.effects;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.item.*;
public class RarityRare extends Item {
- public RarityRare(final int par1) {
+ public RarityRare(int par1){
super();
this.setCreativeTab(CreativeTabs.tabMaterials);
}
-
+
@Override
@SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
+ public EnumRarity getRarity(ItemStack par1ItemStack){
return EnumRarity.rare;
}
-
+
@Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
+ public boolean hasEffect(ItemStack par1ItemStack){
return true;
}
-
+
}
diff --git a/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java b/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java
index c2d78767c3..398217a24a 100644
--- a/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java
+++ b/src/Java/gtPlusPlus/core/item/effects/RarityUncommon.java
@@ -1,20 +1,22 @@
package gtPlusPlus.core.item.effects;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import net.minecraft.item.*;
public class RarityUncommon extends Item {
-
+
@Override
@SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
+ public EnumRarity getRarity(ItemStack par1ItemStack){
return EnumRarity.uncommon;
}
-
+
@Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
+ public boolean hasEffect(ItemStack par1ItemStack){
return true;
}
-
+
}
diff --git a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java
index fe93fdf70e..5a05ac7655 100644
--- a/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java
+++ b/src/Java/gtPlusPlus/core/item/general/BedLocator_Base.java
@@ -1,9 +1,10 @@
package gtPlusPlus.core.item.general;
-import java.util.List;
-
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
+
+import java.util.List;
+
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -12,91 +13,95 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class BedLocator_Base extends Item {
-
- public int bed_X = 0;
- public int bed_Y = 0;
- public int bed_Z = 0;
+public class BedLocator_Base extends Item{
- public BedLocator_Base(final String unlocalizedName) {
+ public int bed_X = 0;
+ public int bed_Y = 0;
+ public int bed_Z = 0;
+
+ public BedLocator_Base(String unlocalizedName) {
this.setUnlocalizedName(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName);
- this.setMaxStackSize(1);
+ this.setMaxStackSize(1);
this.setCreativeTab(AddToCreativeTab.tabMachines);
}
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- int NBT_X = this.bed_X;
- int NBT_Y = this.bed_Y;
- int NBT_Z = this.bed_Z;
+
+ int NBT_X = bed_X;
+ int NBT_Y = bed_Y;
+ int NBT_Z = bed_Z;
+
if (stack.stackTagCompound != null) {
NBT_X = stack.stackTagCompound.getInteger("pos_x");
NBT_Y = stack.stackTagCompound.getInteger("pos_y");
NBT_Z = stack.stackTagCompound.getInteger("pos_z");
- final String tempX = String.valueOf(NBT_X);
- final String tempY = String.valueOf(NBT_Y);
- final String tempZ = String.valueOf(NBT_Z);
- final String formattedX = EnumChatFormatting.DARK_RED + tempX + EnumChatFormatting.GRAY;
- final String formattedY = EnumChatFormatting.RED + tempY + EnumChatFormatting.GRAY;
- final String formattedZ = EnumChatFormatting.RED + tempZ + EnumChatFormatting.GRAY;
-
- list.add(EnumChatFormatting.GRAY + "X: " + formattedX + ".");
- list.add(EnumChatFormatting.GRAY + "Y: " + formattedY + ".");
- list.add(EnumChatFormatting.GRAY + "Z: " + formattedZ + ".");
- super.addInformation(stack, aPlayer, list, bool);
- }
+ String tempX = String.valueOf(NBT_X);
+ String tempY = String.valueOf(NBT_Y);
+ String tempZ = String.valueOf(NBT_Z);
+ String formattedX = EnumChatFormatting.DARK_RED+tempX+EnumChatFormatting.GRAY;
+ String formattedY = EnumChatFormatting.RED+tempY+EnumChatFormatting.GRAY;
+ String formattedZ = EnumChatFormatting.RED+tempZ+EnumChatFormatting.GRAY;
+
+ list.add(EnumChatFormatting.GRAY+"X: "+formattedX+".");
+ list.add(EnumChatFormatting.GRAY+"Y: "+formattedY+".");
+ list.add(EnumChatFormatting.GRAY+"Z: "+formattedZ+".");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
}
- // Ticking and NBT Handling
- /*
- * Called each tick as long the item is on a player inventory. Uses by maps
- * to check if is on a player hand and update it's contents.
- *
- * public int fuelRemaining = 0; public int maximumFuel = 0; public String
- * fuelType = ""; public float heat = 0; public float maxHeat = 5000;
+ //Ticking and NBT Handling
+ /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
+ * update it's contents.
*
+ * public int fuelRemaining = 0;
+ public int maximumFuel = 0;
+ public String fuelType = "";
+ public float heat = 0;
+ public float maxHeat = 5000;
+ *
*/
@Override
- public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) {
+ public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
itemStack.stackTagCompound = new NBTTagCompound();
this.bed_X = 0;
this.bed_Y = 0;
this.bed_Z = 0;
- itemStack.stackTagCompound.setInteger("pos_x", this.bed_X);
- itemStack.stackTagCompound.setInteger("pos_y", this.bed_Y);
- itemStack.stackTagCompound.setInteger("pos_z", this.bed_Z);
+ itemStack.stackTagCompound.setInteger("pos_x", bed_X);
+ itemStack.stackTagCompound.setInteger("pos_y", bed_Y);
+ itemStack.stackTagCompound.setInteger("pos_z", bed_Z);
}
@Override
- public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) {
+ public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
+
+
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) {
itemStack.stackTagCompound = new NBTTagCompound();
- if (par3Entity.getBedLocation() != null) {
- this.bed_X = par3Entity.getBedLocation().posX;
- this.bed_Y = par3Entity.getBedLocation().posY;
- this.bed_Z = par3Entity.getBedLocation().posZ;
+ if (par3Entity.getBedLocation() != null){
+ this.bed_X = par3Entity.getBedLocation().posX;
+ this.bed_Y = par3Entity.getBedLocation().posY;
+ this.bed_Z = par3Entity.getBedLocation().posZ;
}
else {
this.bed_X = 0;
this.bed_Y = 0;
this.bed_Z = 0;
}
- itemStack.stackTagCompound.setInteger("pos_x", this.bed_X);
- itemStack.stackTagCompound.setInteger("pos_y", this.bed_Y);
- itemStack.stackTagCompound.setInteger("pos_z", this.bed_Z);
+ itemStack.stackTagCompound.setInteger("pos_x", bed_X);
+ itemStack.stackTagCompound.setInteger("pos_y", bed_Y);
+ itemStack.stackTagCompound.setInteger("pos_z", bed_Z);
return super.onItemRightClick(itemStack, world, par3Entity);
}
- @Override
- public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4,
- final boolean par5) {
- }
}
diff --git a/src/Java/gtPlusPlus/core/item/general/BufferCore.java b/src/Java/gtPlusPlus/core/item/general/BufferCore.java
index 12d78b6f83..42f8c99c70 100644
--- a/src/Java/gtPlusPlus/core/item/general/BufferCore.java
+++ b/src/Java/gtPlusPlus/core/item/general/BufferCore.java
@@ -1,98 +1,98 @@
package gtPlusPlus.core.item.general;
-import java.util.List;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.item.base.BaseItemWithDamageValue;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
+
+import java.util.List;
+
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
-public class BufferCore extends BaseItemWithDamageValue {
-
+public class BufferCore extends BaseItemWithDamageValue{
+
public int coreTier = 0;
-
- public BufferCore(final String unlocalizedName, final int i) {
+
+ public BufferCore(String unlocalizedName, int i) {
super(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName);
this.setMaxStackSize(2);
this.coreTier = i;
}
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add(EnumChatFormatting.GRAY + "A key crafting component for making energy buffers.");
+ public String getItemStackDisplayName(ItemStack stack) {
+ return super.getItemStackDisplayName(stack)+" ["+CORE.VOLTAGES[this.coreTier-1]+"].";
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses()
+ {
+ return true;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ list.add(EnumChatFormatting.GRAY+"A key crafting component for making energy buffers.");
super.addInformation(stack, aPlayer, list, bool);
}
+ public final int getCoreTier() {
+ return coreTier;
+ }
+
@Override
- public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
- // Figure Out Damage
- final String s = String.format("%X", HEX_OxFFFFFF);
- // Utils.LOG_INFO(s);
- // String rgb = Utils.hex2Rgb(s);
- // Utils.LOG_INFO(rgb);
- if (this.coreTier == 1) {
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ //Figure Out Damage
+ String s = String.format("%X", HEX_OxFFFFFF);
+ //Utils.LOG_INFO(s);
+ //String rgb = Utils.hex2Rgb(s);
+ //Utils.LOG_INFO(rgb);
+ if (coreTier == 1){
HEX_OxFFFFFF = 0x4d4d4d;
}
- else if (this.coreTier == 2) {
+ else if (coreTier == 2){
HEX_OxFFFFFF = 0x666666;
}
- else if (this.coreTier == 3) {
+ else if (coreTier == 3){
HEX_OxFFFFFF = 0x8c8c8c;
}
- else if (this.coreTier == 4) {
+ else if (coreTier == 4){
HEX_OxFFFFFF = 0xa6a6a6;
}
- else if (this.coreTier == 5) {
+ else if (coreTier == 5){
HEX_OxFFFFFF = 0xcccccc;
}
- else if (this.coreTier == 6) {
+ else if (coreTier == 6){
HEX_OxFFFFFF = 0xe6e6e6;
}
- else if (this.coreTier == 7) {
+ else if (coreTier == 7){
HEX_OxFFFFFF = 0xffffcc;
}
- else if (this.coreTier == 8) {
+ else if (coreTier == 8){
HEX_OxFFFFFF = 0xace600;
}
- else if (this.coreTier == 9) {
+ else if (coreTier == 9){
HEX_OxFFFFFF = 0xffff00;
}
- /*
- * else if (coreTier == 10){ HEX_OxFFFFFF = 0xff0000; }
- */
- else if (this.coreTier == 10) {
- HEX_OxFFFFFF = Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251),
- MathUtils.randInt(220, 250));
+ /*else if (coreTier == 10){
+ HEX_OxFFFFFF = 0xff0000;
+ }*/
+ else if (coreTier == 10){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250));
}
else {
HEX_OxFFFFFF = 0xffffff;
}
+
return HEX_OxFFFFFF;
}
-
- public final int getCoreTier() {
- return this.coreTier;
- }
-
- @Override
- public String getItemStackDisplayName(final ItemStack stack) {
- return super.getItemStackDisplayName(stack) + " [" + CORE.VOLTAGES[this.coreTier - 1] + "].";
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public boolean requiresMultipleRenderPasses() {
- return true;
- }
-
+
}
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java
index 22bb194fde..3c8e09e9e5 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemBlueprint.java
@@ -1,8 +1,5 @@
package gtPlusPlus.core.item.general;
-import java.util.List;
-
-import cpw.mods.fml.common.registry.GameRegistry;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.interfaces.IItemBlueprint;
import gtPlusPlus.core.lib.CORE;
@@ -10,6 +7,9 @@ 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;
@@ -19,208 +19,97 @@ 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 class ItemBlueprint extends Item implements IItemBlueprint{
- public ItemBlueprint(final String unlocalizedName) {
+ public ItemBlueprint(String unlocalizedName) {
this.setUnlocalizedName(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName);
- this.setMaxStackSize(1);
+ this.setMaxStackSize(1);
this.setCreativeTab(AddToCreativeTab.tabMachines);
- // this.bpID = MathUtils.randInt(0, 1000);
+ //this.bpID = MathUtils.randInt(0, 1000);
GameRegistry.registerItem(this, unlocalizedName);
}
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public void addInformation(final ItemStack itemStack, final EntityPlayer aPlayer, final List list,
- final boolean bool) {
- // Create some NBT if it's not there, otherwise this does nothing.
- if (!itemStack.hasTagCompound()) {
- this.createNBT(itemStack);
+ 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.
+ //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) this.getNBT(itemStack, "mID");
- name = (String) this.getNBT(itemStack, "mName");
- blueprint = (boolean) this.getNBT(itemStack, "mBlueprint");
+ //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.
+ //Write to tooltip list for each viable setting.
if (itemStack.hasTagCompound()) {
- if (id != -1) {
- list.add(EnumChatFormatting.GRAY + "Technical Document No. " + id);
+ if (id != -1){
+ list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id);
}
- if (blueprint) {
- list.add(EnumChatFormatting.BLUE + "Currently holding a blueprint for " + name);
+ if(blueprint){
+ list.add(EnumChatFormatting.BLUE+"Currently holding a blueprint for "+name);
}
else {
- list.add(EnumChatFormatting.RED + "Currently not holding a blueprint for anything.");
+ list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything.");
}
- }
+ }
else {
- list.add(EnumChatFormatting.RED + "Currently not holding a blueprint for anything.");
+ list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything.");
}
super.addInformation(itemStack, aPlayer, list, bool);
}
- public boolean createNBT(final 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()) {
- final int bpID = MathUtils.randInt(0, 1000);
- final boolean hasRecipe = false;
- final 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 {
- final int bpID = MathUtils.randInt(0, 1000);
- final boolean hasRecipe = false;
- final 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;
- }
- }
-
- @Override
- public ItemStack[] getBlueprint(final ItemStack stack) {
- ItemStack[] blueprint = new ItemStack[9];
- if (stack.hasTagCompound()) {
- blueprint = this.readItemsFromNBT(stack);
- }
- try {
- final 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 (final Throwable t) {
- return null;
- }
- }
-
@Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
return "Blueprint [I am useless]";
}
- public Object getNBT(final ItemStack itemStack, final 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;
- }
-
@Override
- public boolean hasBlueprint(final ItemStack stack) {
- if (stack.hasTagCompound()) {
- return (boolean) this.getNBT(stack, "mBlueprint");
- }
- return false;
+ public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
+ createNBT(itemStack);
}
@Override
- public boolean isBlueprint(final ItemStack stack) {
- return true;
- }
+ public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
- @Override
- public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) {
- this.createNBT(itemStack);
}
@Override
- public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) {
- // Let the player know what blueprint is held
+ 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. " + "|" + this.getNBT(itemStack, "mID") + "|"
- + this.getNBT(itemStack, "mBlueprint") + "|" + this.getNBT(itemStack, "mName") + "|"
- + ItemUtils.getArrayStackNames(this.readItemsFromNBT(itemStack)));
+ PlayerUtils.messagePlayer(par3Entity, "This Blueprint holds NBT data. "+"|"+getNBT(itemStack, "mID")+"|"+getNBT(itemStack, "mBlueprint")+"|"+getNBT(itemStack, "mName")+"|"+ItemUtils.getArrayStackNames(readItemsFromNBT(itemStack)));
}
else {
- this.createNBT(itemStack);
- PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. " + this.getNBT(itemStack, "mID"));
+ createNBT(itemStack);
+ PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. "+getNBT(itemStack, "mID"));
}
- return super.onItemRightClick(itemStack, world, par3Entity);
- }
-
- @Override
- public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4,
- final boolean par5) {
+ return super.onItemRightClick(itemStack, world, par3Entity);
}
- public ItemStack[] readItemsFromNBT(final ItemStack itemStack) {
+ public ItemStack[] readItemsFromNBT(ItemStack itemStack){
ItemStack[] blueprint = new ItemStack[9];
- if (itemStack.hasTagCompound()) {
- final NBTTagCompound nbt = itemStack.getTagCompound();
- final NBTTagList list = nbt.getTagList("Items", 10);
- blueprint = new ItemStack[IItemBlueprint.INV_SIZE];
- for (int i = 0; i < list.tagCount(); i++) {
- final NBTTagCompound data = list.getCompoundTagAt(i);
- final int slot = data.getInteger("Slot");
- if (slot >= 0 && slot < IItemBlueprint.INV_SIZE) {
+ 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);
}
}
@@ -229,72 +118,175 @@ public class ItemBlueprint extends Item implements IItemBlueprint {
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 setBlueprint(final ItemStack stack, final IInventory craftingTable, final ItemStack output) {
+ 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) this.getNBT(stack, "mBlueprint");
- blueprint = this.readItemsFromNBT(stack);
+ if (stack.hasTagCompound()){
+ hasBP = (boolean) getNBT(stack, "mBlueprint");
+ blueprint = readItemsFromNBT(stack);
}
- if (!hasBP) {
+ if (!hasBP){
try {
- for (int o = 0; o < craftingTable.getSizeInventory(); o++) {
+ for (int o=0; o<craftingTable.getSizeInventory(); o++){
blueprint[o] = craftingTable.getStackInSlot(o);
- if (blueprint[0] != null) {
+ if (blueprint[0] != null){
blueprint[0].stackSize = 0;
}
}
- this.writeItemsToNBT(stack, blueprint);
- if (stack.hasTagCompound()) {
- if (stack.getTagCompound().getCompoundTag("Items") != null) {
+ writeItemsToNBT(stack, blueprint);
+ if (stack.hasTagCompound()){
+ if(stack.getTagCompound().getCompoundTag("Items") != null){
stack.stackTagCompound.setBoolean("mBlueprint", true);
}
else {
- // Invalid BP saved?
+ //Invalid BP saved?
}
- hasBP = (boolean) this.getNBT(stack, "mBlueprint");
+ hasBP = (boolean) getNBT(stack, "mBlueprint");
}
-
- if (output != null) {
- this.setBlueprintName(stack, output.getDisplayName());
- return hasBP = true;
+
+ if (output != null){
+ setBlueprintName(stack, output.getDisplayName());
+ return (hasBP = true);
}
return false;
- }
- catch (final Throwable t) {
- return false;
+ } catch (Throwable t){
+ return false;
}
}
return false;
}
@Override
- public void setBlueprintName(final ItemStack stack, final String name) {
+ public void setBlueprintName(ItemStack stack, String name) {
stack.stackTagCompound.setString("mName", name);
}
- public ItemStack writeItemsToNBT(final ItemStack itemStack, final ItemStack[] craftingGrid) {
- final ItemStack[] blueprint = craftingGrid;
- if (itemStack.hasTagCompound()) {
- final NBTTagCompound nbt = itemStack.getTagCompound();
- final NBTTagList list = new NBTTagList();
- for (int i = 0; i < IItemBlueprint.INV_SIZE; i++) {
- final ItemStack stack = blueprint[i];
- if (stack != null) {
- final NBTTagCompound data = new NBTTagCompound();
- stack.writeToNBT(data);
- data.setInteger("Slot", i);
- list.appendTag(data);
+ @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;
}
}
- nbt.setTag("Items", list);
- itemStack.setTagCompound(nbt);
- return itemStack;
+ return returnStack;
+ } catch (Throwable t){
+ return null;
}
- 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 d0316730bf..c5f383955c 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemCloakingDevice.java
@@ -1,16 +1,15 @@
package gtPlusPlus.core.item.general;
-import java.util.List;
-
-import baubles.api.BaubleType;
-import baubles.api.IBauble;
-import cpw.mods.fml.common.Optional;
-import cpw.mods.fml.common.registry.GameRegistry;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
-import ic2.api.item.*;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import ic2.api.item.IElectricItemManager;
+
+import java.util.List;
+
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -20,235 +19,240 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
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 {
+@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 static int maxValueEU = 10000 * 20 * 500;
- private final String unlocalizedName = "personalCloakingDevice";
- private final ItemStack thisStack;
- protected double chargeEU = 0;
+ private final String unlocalizedName = "personalCloakingDevice";
+ private final ItemStack thisStack;
+ private final static int maxValueEU = 10000*20*500;
+ protected double chargeEU = 0;
- public ItemCloakingDevice(final double charge) {
+ public ItemCloakingDevice(double charge){
this.chargeEU = charge;
this.setCreativeTab(AddToCreativeTab.tabMachines);
- this.setUnlocalizedName(this.unlocalizedName);
+ this.setUnlocalizedName(unlocalizedName);
this.setMaxStackSize(1);
this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice");
this.thisStack = ItemUtils.getSimpleStack(this);
- this.charge(this.thisStack, charge, 3, true, false);
- if (charge == 10000 * 20 * 500) {
- this.setDamage(this.thisStack, 13);
+ this.charge(thisStack, charge, 3, true, false);
+ if (charge == 10000*20*500){
+ this.setDamage(thisStack, 13);
}
- GameRegistry.registerItem(this, this.unlocalizedName + "-" + charge);
- }
-
- @Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add("");
- list.add(EnumChatFormatting.GREEN + "Worn as a Belt within Baubles." + EnumChatFormatting.GRAY);
- list.add(EnumChatFormatting.GREEN + "Drains 10,000EU/t to provide invisibility." + EnumChatFormatting.GRAY);
- list.add("");
- list.add(EnumChatFormatting.GOLD + "IC2/EU Information" + EnumChatFormatting.GRAY);
- list.add(EnumChatFormatting.GRAY + "Tier: [" + EnumChatFormatting.YELLOW + this.getTier(this.thisStack)
- + EnumChatFormatting.GRAY + "] Input Limit: [" + EnumChatFormatting.YELLOW
- + this.getTransferLimit(this.thisStack) + EnumChatFormatting.GRAY + "EU/t]");
- list.add(EnumChatFormatting.GRAY + "Current Power: [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack)
- + EnumChatFormatting.GRAY + "EU] [" + EnumChatFormatting.YELLOW
- + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY
- + "%]");
- list.add(EnumChatFormatting.GRAY + "Time Remaining: [" + EnumChatFormatting.YELLOW + this.secondsLeft(stack)
- + EnumChatFormatting.GRAY + " seconds]");
- super.addInformation(stack, aPlayer, list, bool);
+ GameRegistry.registerItem(this, unlocalizedName+"-"+charge);
}
@Override
- public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) {
- return true;
+ public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) {
+ if (worldObj.isRemote) {
+ return;
+ }
+
+ if (player instanceof EntityPlayer){
+ for (ItemStack is : ((EntityPlayer) player).inventory.mainInventory) {
+ if (is == itemStack) {
+ continue;
+ }
+ if (is != null) {
+ if (is.getItem() instanceof IElectricItem) {
+ IElectricItem electricItem = (IElectricItem) is.getItem();
+ chargeEU = ElectricItem.manager.getCharge(is);
+ }
+
+ }
+ }
+ }
+
+
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
}
@Override
- public boolean canProvideEnergy(final ItemStack itemStack) {
+ public boolean canProvideEnergy(ItemStack itemStack) {
return true;
}
@Override
- public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) {
- return true;
+ public Item getChargedItem(ItemStack itemStack) {
+ ItemStack x = itemStack.copy();
+ x.setItemDamage(maxValueEU);
+ return x.getItem();
}
@Override
- public boolean canUse(final ItemStack stack, final double amount) {
- return ElectricItem.manager.canUse(stack, amount);
+ public Item getEmptyItem(ItemStack itemStack) {
+ ItemStack x = itemStack.copy();
+ x.setItemDamage(0);
+ return x.getItem();
}
@Override
- public double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit,
- final boolean simulate) {
-
- if (!simulate) {
- ElectricItem.manager.charge(stack, amount, tier, true, simulate);
-
- }
- return ElectricItem.manager.charge(stack, amount, tier, true, simulate);
+ public double getMaxCharge(ItemStack itemStack) {
+ return maxValueEU;
}
@Override
- public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) {
- ElectricItem.manager.chargeFromArmor(stack, entity);
+ public int getTier(ItemStack itemStack) {
+ return 5;
}
@Override
- public double discharge(final ItemStack stack, final double amount, final int tier,
- final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) {
- if (!simulate) {
- ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
- }
-
- return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
+ public double getTransferLimit(ItemStack itemStack) {
+ return 8196;
}
@Override
- public BaubleType getBaubleType(final ItemStack arg0) {
- return BaubleType.BELT;
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+
+ return (EnumChatFormatting.BLUE+"Personal Cloaking Device"+EnumChatFormatting.GRAY);
}
@Override
- public double getCharge(final ItemStack stack) {
- return ElectricItem.manager.getCharge(stack);
+ public double getDurabilityForDisplay(ItemStack stack)
+ {
+ //return 1.0D - getEnergyStored(stack) / this.capacity;
+ return 1.0D - (double)getCharge(stack) / (double)getMaxCharge(stack);
}
@Override
- public Item getChargedItem(final ItemStack itemStack) {
- final ItemStack x = itemStack.copy();
- x.setItemDamage(ItemCloakingDevice.maxValueEU);
- return x.getItem();
+ public boolean showDurabilityBar(ItemStack stack)
+ {
+ return true;
+ }
+
+ public int secondsLeft(ItemStack stack){
+ double r = 0;
+ r = getCharge(stack)/(10000*20);
+ return (int) MathUtils.decimalRounding(r);
}
@Override
- public double getDurabilityForDisplay(final ItemStack stack) {
- // return 1.0D - getEnergyStored(stack) / this.capacity;
- return 1.0D - this.getCharge(stack) / this.getMaxCharge(stack);
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ list.add("");
+ list.add(EnumChatFormatting.GREEN+"Worn as a Belt within Baubles."+EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN+"Drains 10,000EU/t to provide invisibility."+EnumChatFormatting.GRAY);
+ list.add("");
+ list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Input Limit: ["+EnumChatFormatting.YELLOW+getTransferLimit(thisStack)+EnumChatFormatting.GRAY +"EU/t]");
+ list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) getCharge(stack)+EnumChatFormatting.GRAY+"EU] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(getCharge(stack), getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]");
+ list.add(EnumChatFormatting.GRAY+"Time Remaining: ["+EnumChatFormatting.YELLOW+secondsLeft(stack)+ EnumChatFormatting.GRAY +" seconds]");
+ super.addInformation(stack, aPlayer, list, bool);
}
- /*
- * @Override public ItemStack getContainerItem(ItemStack itemStack) {
- * ItemStack newItem = itemStack.copy(); newItem.stackSize = 1;
- * extractEnergy(newItem, 150000, false); return newItem; }
- */
-
- /*
- * @Override public boolean hasContainerItem(ItemStack stack) { return true;
- * }
- */
+ /*@Override
+ public ItemStack getContainerItem(ItemStack itemStack)
+ {
+ ItemStack newItem = itemStack.copy();
+ newItem.stackSize = 1;
+ extractEnergy(newItem, 150000, false);
+ return newItem;
+ }*/
+
+ /*@Override
+ public boolean hasContainerItem(ItemStack stack)
+ {
+ return true;
+ }*/
- /*
- * @Override public int getBurnTime(ItemStack fuel) { if ((fuel == null) ||
- * (fuel.getItem() != this)) { return 0; } return extractEnergy(fuel,
- * 150000, true) / 50 / 100; }
- */
+ /*@Override
+ public int getBurnTime(ItemStack fuel) {
+ if ((fuel == null) || (fuel.getItem() != this)) {
+ return 0;
+ }
+ return extractEnergy(fuel, 150000, true) / 50 / 100;
+ }*/
@Override
- public Item getEmptyItem(final ItemStack itemStack) {
- final ItemStack x = itemStack.copy();
- x.setItemDamage(0);
- return x.getItem();
+ public double charge(ItemStack stack, double amount, int tier,
+ boolean ignoreTransferLimit, boolean simulate) {
+
+ if (!simulate)
+ {
+ ElectricItem.manager.charge(stack, amount, tier, true, simulate);
+
+ }
+ return ElectricItem.manager.charge(stack, amount, tier, true, simulate);
}
@Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ public double discharge(ItemStack stack, double amount, int tier,
+ boolean ignoreTransferLimit, boolean externally, boolean simulate) {
+ if (!simulate)
+ {
+ ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
+ }
- return EnumChatFormatting.BLUE + "Personal Cloaking Device" + EnumChatFormatting.GRAY;
+ return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
}
@Override
- public double getMaxCharge(final ItemStack itemStack) {
- return ItemCloakingDevice.maxValueEU;
+ public double getCharge(ItemStack stack) {
+ return ElectricItem.manager.getCharge(stack);
}
@Override
- public int getTier(final ItemStack itemStack) {
- return 5;
+ public boolean canUse(ItemStack stack, double amount) {
+ return ElectricItem.manager.canUse(stack, amount);
}
@Override
- public String getToolTip(final ItemStack stack) {
- return ElectricItem.manager.getToolTip(stack);
+ public boolean use(ItemStack stack, double amount, EntityLivingBase entity) {
+ return ElectricItem.manager.use(stack, amount, entity);
}
@Override
- public double getTransferLimit(final ItemStack itemStack) {
- return 8196;
+ public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) {
+ ElectricItem.manager.chargeFromArmor(stack, entity);
}
- @Override // TODO
- public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) {
-
+ @Override
+ public String getToolTip(ItemStack stack) {
+ return ElectricItem.manager.getToolTip(stack);
}
- @Override // TODO
- public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) {
+ @Override
+ public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) {
+ return true;
+ }
+ @Override
+ public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) {
+ return true;
}
@Override
- public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_,
- final boolean p_77663_5_) {
- if (worldObj.isRemote) {
- return;
- }
+ public BaubleType getBaubleType(ItemStack arg0) {
+ return BaubleType.BELT;
+ }
- if (player instanceof EntityPlayer) {
- for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) {
- if (is == itemStack) {
- continue;
- }
- if (is != null) {
- if (is.getItem() instanceof IElectricItem) {
- final IElectricItem electricItem = (IElectricItem) is.getItem();
- this.chargeEU = ElectricItem.manager.getCharge(is);
- }
+ @Override //TODO
+ public void onEquipped(ItemStack arg0, EntityLivingBase arg1) {
- }
- }
- }
+ }
+
+ @Override //TODO
+ public void onUnequipped(ItemStack arg0, EntityLivingBase arg1) {
- super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
}
- @Override // TODO
- public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) {
- // Utils.LOG_INFO("Trying to Tick Belt. 1");
- if (!arg1.worldObj.isRemote) {
- if (this.getCharge(arg0) >= 10000) {
+ @Override //TODO
+ public void onWornTick(ItemStack arg0, EntityLivingBase arg1) {
+ //Utils.LOG_INFO("Trying to Tick Belt. 1");
+ if (!arg1.worldObj.isRemote){
+ if (getCharge(arg0) >= 10000){
arg1.addPotionEffect(new PotionEffect(Potion.invisibility.id, 10, 2));
- this.discharge(arg0, 10000, 5, true, true, false);
+ discharge(arg0, 10000, 5, true, true, false);
}
else {
- if (arg1.isPotionActive(Potion.invisibility)) {
+ if (arg1.isPotionActive((Potion.invisibility))){
arg1.removePotionEffect(Potion.invisibility.id);
}
}
}
}
- public int secondsLeft(final ItemStack stack) {
- double r = 0;
- r = this.getCharge(stack) / (10000 * 20);
- return (int) MathUtils.decimalRounding(r);
- }
-
- @Override
- public boolean showDurabilityBar(final ItemStack stack) {
- return true;
- }
-
- @Override
- public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) {
- return ElectricItem.manager.use(stack, amount, entity);
- }
-
}
diff --git a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java
index 6a60809fce..4f1d7f4ecf 100644
--- a/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java
+++ b/src/Java/gtPlusPlus/core/item/general/ItemHealingDevice.java
@@ -1,18 +1,17 @@
package gtPlusPlus.core.item.general;
-import java.util.List;
-
-import baubles.api.BaubleType;
-import baubles.api.IBauble;
-import cpw.mods.fml.common.Optional;
-import cpw.mods.fml.common.registry.GameRegistry;
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.player.PlayerUtils;
-import ic2.api.item.*;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import ic2.api.item.IElectricItemManager;
+
+import java.util.List;
+
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -20,216 +19,213 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
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 {
+@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 static int maxValueEU = 1000000000;
- private final String unlocalizedName = "personalHealingDevice";
- private final ItemStack thisStack;
- protected double chargeEU = 0;
+ private final String unlocalizedName = "personalHealingDevice";
+ private final ItemStack thisStack;
+ private final static int maxValueEU = 1000000000;
+ protected double chargeEU = 0;
- public ItemHealingDevice() {
+ public ItemHealingDevice(){
this.setCreativeTab(AddToCreativeTab.tabMachines);
- this.setUnlocalizedName(this.unlocalizedName);
+ this.setUnlocalizedName(unlocalizedName);
this.setMaxStackSize(1);
this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice");
this.thisStack = ItemUtils.getSimpleStack(this);
- GameRegistry.registerItem(this, this.unlocalizedName);
- }
-
- @Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add("");
- list.add(EnumChatFormatting.GREEN + "Worn as a Necklace within Baubles." + EnumChatFormatting.GRAY);
- list.add(EnumChatFormatting.GREEN + "Drains 1638400eu to restore hunger." + EnumChatFormatting.GRAY);
- list.add("");
- list.add(EnumChatFormatting.GOLD + "IC2/EU Information" + EnumChatFormatting.GRAY);
- list.add(EnumChatFormatting.GRAY + "Tier: [" + EnumChatFormatting.YELLOW + this.getTier(this.thisStack)
- + EnumChatFormatting.GRAY + "] Transfer Limit: [" + EnumChatFormatting.YELLOW
- + this.getTransferLimit(this.thisStack) + EnumChatFormatting.GRAY + "Eu/t]");
- list.add(EnumChatFormatting.GRAY + "Current Power: [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack)
- + EnumChatFormatting.GRAY + "Eu] [" + EnumChatFormatting.YELLOW
- + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY
- + "%]");
- list.add(EnumChatFormatting.GRAY + "Uses Remaining: [" + EnumChatFormatting.YELLOW + this.secondsLeft(stack)
- + EnumChatFormatting.GRAY + "]");
- super.addInformation(stack, aPlayer, list, bool);
+ GameRegistry.registerItem(this, unlocalizedName);
}
@Override
- public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) {
- return true;
+ public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) {
+ if (worldObj.isRemote) {
+ return;
+ }
+
+ if (player instanceof EntityPlayer){
+ for (ItemStack is : ((EntityPlayer) player).inventory.mainInventory) {
+ if (is == itemStack) {
+ continue;
+ }
+ if (is != null) {
+ if (is.getItem() instanceof IElectricItem) {
+ IElectricItem electricItem = (IElectricItem) is.getItem();
+ chargeEU = ElectricItem.manager.getCharge(is);
+ }
+
+ }
+ }
+ }
+
+
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
}
@Override
- public boolean canProvideEnergy(final ItemStack itemStack) {
+ public boolean canProvideEnergy(ItemStack itemStack) {
return true;
}
@Override
- public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) {
- return true;
+ public Item getChargedItem(ItemStack itemStack) {
+ ItemStack x = itemStack.copy();
+ x.setItemDamage(maxValueEU);
+ return x.getItem();
}
@Override
- public boolean canUse(final ItemStack stack, final double amount) {
- return ElectricItem.manager.canUse(stack, amount);
+ public Item getEmptyItem(ItemStack itemStack) {
+ ItemStack x = itemStack.copy();
+ x.setItemDamage(0);
+ return x.getItem();
}
@Override
- public double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit,
- final boolean simulate) {
-
- if (!simulate) {
- ElectricItem.manager.charge(stack, amount, tier, true, simulate);
+ public double getMaxCharge(ItemStack itemStack) {
+ return maxValueEU;
+ }
- }
- return ElectricItem.manager.charge(stack, amount, tier, true, simulate);
+ @Override
+ public int getTier(ItemStack itemStack) {
+ return 5;
}
@Override
- public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) {
- ElectricItem.manager.chargeFromArmor(stack, entity);
+ public double getTransferLimit(ItemStack itemStack) {
+ return 32784;
}
@Override
- public double discharge(final ItemStack stack, final double amount, final int tier,
- final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) {
- if (!simulate) {
- ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
- }
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
- return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
+ return (EnumChatFormatting.BLUE+"Personal Healing NanoBooster"+EnumChatFormatting.RESET);
}
@Override
- public BaubleType getBaubleType(final ItemStack arg0) {
- return BaubleType.AMULET;
+ public double getDurabilityForDisplay(ItemStack stack)
+ {
+ //return 1.0D - getEnergyStored(stack) / this.capacity;
+ return 1.0D - (double)getCharge(stack) / (double)getMaxCharge(stack);
}
@Override
- public double getCharge(final ItemStack stack) {
- return ElectricItem.manager.getCharge(stack);
+ public boolean showDurabilityBar(ItemStack stack)
+ {
+ return true;
+ }
+
+ public double secondsLeft(ItemStack stack){
+
+ double r = 0;
+ r = getCharge(stack)/(1638400/4);
+ return (int) r;
}
@Override
- public Item getChargedItem(final ItemStack itemStack) {
- final ItemStack x = itemStack.copy();
- x.setItemDamage(ItemHealingDevice.maxValueEU);
- return x.getItem();
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ list.add("");
+ list.add(EnumChatFormatting.GREEN+"Worn as a Necklace within Baubles."+EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN+"Drains 1638400eu to restore hunger."+EnumChatFormatting.GRAY);
+ list.add("");
+ list.add(EnumChatFormatting.GOLD+"IC2/EU Information"+EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Transfer Limit: ["+EnumChatFormatting.YELLOW+getTransferLimit(thisStack)+EnumChatFormatting.GRAY +"Eu/t]");
+ list.add(EnumChatFormatting.GRAY+"Current Power: ["+EnumChatFormatting.YELLOW+(long) getCharge(stack)+EnumChatFormatting.GRAY+"Eu] ["+EnumChatFormatting.YELLOW+MathUtils.findPercentage(getCharge(stack), getMaxCharge(stack))+EnumChatFormatting.GRAY +"%]");
+ list.add(EnumChatFormatting.GRAY+"Uses Remaining: ["+EnumChatFormatting.YELLOW+secondsLeft(stack)+ EnumChatFormatting.GRAY +"]");
+ super.addInformation(stack, aPlayer, list, bool);
}
@Override
- public double getDurabilityForDisplay(final ItemStack stack) {
- // return 1.0D - getEnergyStored(stack) / this.capacity;
- return 1.0D - this.getCharge(stack) / this.getMaxCharge(stack);
+ public double charge(ItemStack stack, double amount, int tier,
+ boolean ignoreTransferLimit, boolean simulate) {
+
+ if (!simulate)
+ {
+ ElectricItem.manager.charge(stack, amount, tier, true, simulate);
+
+ }
+ return ElectricItem.manager.charge(stack, amount, tier, true, simulate);
}
@Override
- public Item getEmptyItem(final ItemStack itemStack) {
- final ItemStack x = itemStack.copy();
- x.setItemDamage(0);
- return x.getItem();
+ public double discharge(ItemStack stack, double amount, int tier,
+ boolean ignoreTransferLimit, boolean externally, boolean simulate) {
+ if (!simulate)
+ {
+ ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
+ }
+
+ return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
}
@Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ public double getCharge(ItemStack stack) {
+ return ElectricItem.manager.getCharge(stack);
+ }
- return EnumChatFormatting.BLUE + "Personal Healing NanoBooster" + EnumChatFormatting.RESET;
+ @Override
+ public boolean canUse(ItemStack stack, double amount) {
+ return ElectricItem.manager.canUse(stack, amount);
}
@Override
- public double getMaxCharge(final ItemStack itemStack) {
- return ItemHealingDevice.maxValueEU;
+ public boolean use(ItemStack stack, double amount, EntityLivingBase entity) {
+ return ElectricItem.manager.use(stack, amount, entity);
}
@Override
- public int getTier(final ItemStack itemStack) {
- return 5;
+ public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) {
+ ElectricItem.manager.chargeFromArmor(stack, entity);
}
@Override
- public String getToolTip(final ItemStack stack) {
+ public String getToolTip(ItemStack stack) {
return ElectricItem.manager.getToolTip(stack);
}
@Override
- public double getTransferLimit(final ItemStack itemStack) {
- return 32784;
+ public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) {
+ return true;
}
- @Override // TODO
- public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) {
-
+ @Override
+ public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) {
+ return true;
}
- @Override // TODO
- public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) {
-
+ @Override
+ public BaubleType getBaubleType(ItemStack arg0) {
+ return BaubleType.AMULET;
}
- @Override
- public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_,
- final boolean p_77663_5_) {
- if (worldObj.isRemote) {
- return;
- }
+ @Override //TODO
+ public void onEquipped(ItemStack arg0, EntityLivingBase arg1) {
- if (player instanceof EntityPlayer) {
- for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) {
- if (is == itemStack) {
- continue;
- }
- if (is != null) {
- if (is.getItem() instanceof IElectricItem) {
- final IElectricItem electricItem = (IElectricItem) is.getItem();
- this.chargeEU = ElectricItem.manager.getCharge(is);
- }
+ }
- }
- }
- }
+ @Override //TODO
+ public void onUnequipped(ItemStack arg0, EntityLivingBase arg1) {
- super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
}
- @Override // TODO
- public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) {
- if (!arg1.worldObj.isRemote) {
- if (this.getCharge(arg0) >= 1638400 / 4) {
- if (arg1.getHealth() < arg1.getMaxHealth()) {
- final float rx = arg1.getMaxHealth() - arg1.getHealth();
- Utils.LOG_INFO("rx:" + rx);
- arg1.heal(rx * 2);
- this.discharge(arg0, 1638400 / 4 * rx, 6, true, true, false);
- 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 " + this.secondsLeft(arg0) + ".");
+ @Override //TODO
+ public void onWornTick(ItemStack arg0, EntityLivingBase arg1) {
+ if (!arg1.worldObj.isRemote){
+ if (getCharge(arg0) >= 1638400/4){
+ if (arg1.getHealth() < arg1.getMaxHealth()){
+ float rx = arg1.getMaxHealth()-arg1.getHealth();
+ Utils.LOG_INFO("rx:"+rx);
+ arg1.heal(rx*2);
+ discharge(arg0, (1638400/4)*rx, 6, true, true, false);
+ 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)+".");
}
}
}
}
- public double secondsLeft(final ItemStack stack) {
-
- double r = 0;
- r = this.getCharge(stack) / (1638400 / 4);
- return (int) r;
- }
-
- @Override
- public boolean showDurabilityBar(final ItemStack stack) {
- return true;
- }
-
- @Override
- public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) {
- return ElectricItem.manager.use(stack, amount, entity);
- }
-
}
diff --git a/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java b/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java
index a80a998aed..f452b83a73 100644
--- a/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java
+++ b/src/Java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java
@@ -1,6 +1,5 @@
package gtPlusPlus.core.item.general;
-import cpw.mods.fml.common.eventhandler.Event;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@@ -13,169 +12,199 @@ import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.FillBucketEvent;
+import cpw.mods.fml.common.eventhandler.Event;
-public class NuclearFuelRodBase extends Item {
- /** field for checking if the bucket has been filled. */
- private final Block isFull;
-
- public NuclearFuelRodBase(final Block p_i45331_1_) {
- this.maxStackSize = 1;
- this.isFull = p_i45331_1_;
- this.setCreativeTab(CreativeTabs.tabMisc);
- }
-
- @SuppressWarnings("static-method")
- private ItemStack func_150910_a(final ItemStack p_150910_1_, final EntityPlayer p_150910_2_,
- final Item p_150910_3_) {
- if (p_150910_2_.capabilities.isCreativeMode) {
- return p_150910_1_;
- }
- else if (--p_150910_1_.stackSize <= 0) {
- return new ItemStack(p_150910_3_);
- }
- else {
- if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) {
- p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false);
- }
-
- return p_150910_1_;
- }
- }
-
- /**
- * Called whenever this item is equipped and the right mouse button is
- * pressed. Args: itemStack, world, entityPlayer
- */
- @Override
- public ItemStack onItemRightClick(final ItemStack p_77659_1_, final World p_77659_2_,
- final EntityPlayer p_77659_3_) {
- final boolean flag = this.isFull == Blocks.air;
- final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(p_77659_2_, p_77659_3_,
- flag);
-
- if (movingobjectposition == null) {
- return p_77659_1_;
- }
- final FillBucketEvent event = new FillBucketEvent(p_77659_3_, p_77659_1_, p_77659_2_, movingobjectposition);
- if (MinecraftForge.EVENT_BUS.post(event)) {
- return p_77659_1_;
+public class NuclearFuelRodBase extends Item
+{
+ /** field for checking if the bucket has been filled. */
+ private Block isFull;
+ public NuclearFuelRodBase(Block p_i45331_1_)
+ {
+ this.maxStackSize = 1;
+ this.isFull = p_i45331_1_;
+ this.setCreativeTab(CreativeTabs.tabMisc);
+ }
+
+ /**
+ * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
+ */
+ @Override
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_)
+ {
+ boolean flag = this.isFull == Blocks.air;
+ MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(p_77659_2_, p_77659_3_, flag);
+
+ if (movingobjectposition == null)
+ {
+ return p_77659_1_;
+ }
+ FillBucketEvent event = new FillBucketEvent(p_77659_3_, p_77659_1_, p_77659_2_, movingobjectposition);
+ if (MinecraftForge.EVENT_BUS.post(event))
+ {
+ return p_77659_1_;
}
- if (event.getResult() == Event.Result.ALLOW) {
- if (p_77659_3_.capabilities.isCreativeMode) {
- return p_77659_1_;
- }
+ if (event.getResult() == Event.Result.ALLOW)
+ {
+ if (p_77659_3_.capabilities.isCreativeMode)
+ {
+ return p_77659_1_;
+ }
- if (--p_77659_1_.stackSize <= 0) {
- return event.result;
- }
+ if (--p_77659_1_.stackSize <= 0)
+ {
+ return event.result;
+ }
- if (!p_77659_3_.inventory.addItemStackToInventory(event.result)) {
- p_77659_3_.dropPlayerItemWithRandomChoice(event.result, false);
- }
+ if (!p_77659_3_.inventory.addItemStackToInventory(event.result))
+ {
+ p_77659_3_.dropPlayerItemWithRandomChoice(event.result, false);
+ }
- return p_77659_1_;
+ return p_77659_1_;
}
- if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
- int i = movingobjectposition.blockX;
- int j = movingobjectposition.blockY;
- int k = movingobjectposition.blockZ;
-
- if (!p_77659_2_.canMineBlock(p_77659_3_, i, j, k)) {
- return p_77659_1_;
- }
-
- if (flag) {
- if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) {
- return p_77659_1_;
- }
-
- final Material material = p_77659_2_.getBlock(i, j, k).getMaterial();
- final int l = p_77659_2_.getBlockMetadata(i, j, k);
-
- if (material == Material.water && l == 0) {
- p_77659_2_.setBlockToAir(i, j, k);
- return this.func_150910_a(p_77659_1_, p_77659_3_, Items.water_bucket);
- }
-
- if (material == Material.lava && l == 0) {
- p_77659_2_.setBlockToAir(i, j, k);
- return this.func_150910_a(p_77659_1_, p_77659_3_, Items.lava_bucket);
- }
- }
- else {
- if (this.isFull == Blocks.air) {
- return new ItemStack(Items.bucket);
- }
-
- if (movingobjectposition.sideHit == 0) {
- --j;
- }
-
- if (movingobjectposition.sideHit == 1) {
- ++j;
- }
-
- if (movingobjectposition.sideHit == 2) {
- --k;
- }
-
- if (movingobjectposition.sideHit == 3) {
- ++k;
- }
-
- if (movingobjectposition.sideHit == 4) {
- --i;
- }
-
- if (movingobjectposition.sideHit == 5) {
- ++i;
- }
-
- if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_)) {
- return p_77659_1_;
- }
-
- if (this.tryPlaceContainedLiquid(p_77659_2_, i, j, k) && !p_77659_3_.capabilities.isCreativeMode) {
- return new ItemStack(Items.bucket);
- }
- }
+ if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
+ {
+ int i = movingobjectposition.blockX;
+ int j = movingobjectposition.blockY;
+ int k = movingobjectposition.blockZ;
+
+ if (!p_77659_2_.canMineBlock(p_77659_3_, i, j, k))
+ {
+ return p_77659_1_;
+ }
+
+ if (flag)
+ {
+ if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_))
+ {
+ return p_77659_1_;
+ }
+
+ Material material = p_77659_2_.getBlock(i, j, k).getMaterial();
+ int l = p_77659_2_.getBlockMetadata(i, j, k);
+
+ if (material == Material.water && l == 0)
+ {
+ p_77659_2_.setBlockToAir(i, j, k);
+ return this.func_150910_a(p_77659_1_, p_77659_3_, Items.water_bucket);
+ }
+
+ if (material == Material.lava && l == 0)
+ {
+ p_77659_2_.setBlockToAir(i, j, k);
+ return this.func_150910_a(p_77659_1_, p_77659_3_, Items.lava_bucket);
+ }
+ }
+ else
+ {
+ if (this.isFull == Blocks.air)
+ {
+ return new ItemStack(Items.bucket);
+ }
+
+ if (movingobjectposition.sideHit == 0)
+ {
+ --j;
+ }
+
+ if (movingobjectposition.sideHit == 1)
+ {
+ ++j;
+ }
+
+ if (movingobjectposition.sideHit == 2)
+ {
+ --k;
+ }
+
+ if (movingobjectposition.sideHit == 3)
+ {
+ ++k;
+ }
+
+ if (movingobjectposition.sideHit == 4)
+ {
+ --i;
+ }
+
+ if (movingobjectposition.sideHit == 5)
+ {
+ ++i;
+ }
+
+ if (!p_77659_3_.canPlayerEdit(i, j, k, movingobjectposition.sideHit, p_77659_1_))
+ {
+ return p_77659_1_;
+ }
+
+ if (this.tryPlaceContainedLiquid(p_77659_2_, i, j, k) && !p_77659_3_.capabilities.isCreativeMode)
+ {
+ return new ItemStack(Items.bucket);
+ }
+ }
}
return p_77659_1_;
- }
-
- /**
- * Attempts to place the liquid contained inside the bucket.
- */
- public boolean tryPlaceContainedLiquid(final World p_77875_1_, final int p_77875_2_, final int p_77875_3_,
- final int p_77875_4_) {
- if (this.isFull == Blocks.air) {
- return false;
+ }
+
+ @SuppressWarnings("static-method")
+ private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_)
+ {
+ if (p_150910_2_.capabilities.isCreativeMode)
+ {
+ return p_150910_1_;
+ }
+ else if (--p_150910_1_.stackSize <= 0)
+ {
+ return new ItemStack(p_150910_3_);
+ }
+ else
+ {
+ if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_)))
+ {
+ p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false);
+ }
+
+ return p_150910_1_;
+ }
+ }
+
+ /**
+ * Attempts to place the liquid contained inside the bucket.
+ */
+ public boolean tryPlaceContainedLiquid(World p_77875_1_, int p_77875_2_, int p_77875_3_, int p_77875_4_)
+ {
+ if (this.isFull == Blocks.air)
+ {
+ return false;
+ }
+ Material material = p_77875_1_.getBlock(p_77875_2_, p_77875_3_, p_77875_4_).getMaterial();
+ boolean flag = !material.isSolid();
+
+ if (!p_77875_1_.isAirBlock(p_77875_2_, p_77875_3_, p_77875_4_) && !flag)
+ {
+ return false;
}
- final Material material = p_77875_1_.getBlock(p_77875_2_, p_77875_3_, p_77875_4_).getMaterial();
- final boolean flag = !material.isSolid();
-
- if (!p_77875_1_.isAirBlock(p_77875_2_, p_77875_3_, p_77875_4_) && !flag) {
- return false;
+ if (p_77875_1_.provider.isHellWorld && this.isFull == Blocks.flowing_water)
+ {
+ p_77875_1_.playSoundEffect((double)((float)p_77875_2_ + 0.5F), (double)((float)p_77875_3_ + 0.5F), (double)((float)p_77875_4_ + 0.5F), "random.fizz", 0.5F, 2.6F + (p_77875_1_.rand.nextFloat() - p_77875_1_.rand.nextFloat()) * 0.8F);
+
+ for (int l = 0; l < 8; ++l)
+ {
+ p_77875_1_.spawnParticle("largesmoke", (double)p_77875_2_ + Math.random(), (double)p_77875_3_ + Math.random(), (double)p_77875_4_ + Math.random(), 0.0D, 0.0D, 0.0D);
+ }
}
- if (p_77875_1_.provider.isHellWorld && this.isFull == Blocks.flowing_water) {
- p_77875_1_.playSoundEffect(p_77875_2_ + 0.5F, p_77875_3_ + 0.5F, p_77875_4_ + 0.5F, "random.fizz", 0.5F,
- 2.6F + (p_77875_1_.rand.nextFloat() - p_77875_1_.rand.nextFloat()) * 0.8F);
-
- for (int l = 0; l < 8; ++l) {
- p_77875_1_.spawnParticle("largesmoke", p_77875_2_ + Math.random(), p_77875_3_ + Math.random(),
- p_77875_4_ + Math.random(), 0.0D, 0.0D, 0.0D);
- }
- }
- else {
- if (!p_77875_1_.isRemote && flag && !material.isLiquid()) {
- p_77875_1_.func_147480_a(p_77875_2_, p_77875_3_, p_77875_4_, true);
- }
-
- p_77875_1_.setBlock(p_77875_2_, p_77875_3_, p_77875_4_, this.isFull, 0, 3);
+ else
+ {
+ if (!p_77875_1_.isRemote && flag && !material.isLiquid())
+ {
+ p_77875_1_.func_147480_a(p_77875_2_, p_77875_3_, p_77875_4_, true);
+ }
+
+ p_77875_1_.setBlock(p_77875_2_, p_77875_3_, p_77875_4_, this.isFull, 0, 3);
}
return true;
- }
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java b/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java
index db278134de..7844d96f3f 100644
--- a/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java
+++ b/src/Java/gtPlusPlus/core/item/general/RF2EU_Battery.java
@@ -1,17 +1,15 @@
package gtPlusPlus.core.item.general;
-import java.util.List;
-
-import cofh.api.energy.ItemEnergyContainer;
-import cpw.mods.fml.common.IFuelHandler;
-import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
-import ic2.api.item.*;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import ic2.api.item.IElectricItemManager;
+
+import java.util.List;
+
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -22,287 +20,295 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
+import cofh.api.energy.ItemEnergyContainer;
+import cpw.mods.fml.common.IFuelHandler;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
-public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, IElectricItemManager, IFuelHandler {
+public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, IElectricItemManager, IFuelHandler{
- public static int rfPerEU = 4;
- private final static int maxValueEU = 100000000;
- private final static int maxValueRF = RF2EU_Battery.maxValueEU * RF2EU_Battery.rfPerEU;
- private final String unlocalizedName = "rfEUBattery";
- private final ItemStack thisStack;
- protected double chargeEU = 0;
+ public static int rfPerEU = 4;
+ private final String unlocalizedName = "rfEUBattery";
+ private final ItemStack thisStack;
+ private final static int maxValueEU = 100000000;
+ private final static int maxValueRF = maxValueEU * rfPerEU;
+ protected double chargeEU = 0;
- public RF2EU_Battery() {
- super(RF2EU_Battery.maxValueRF, RF2EU_Battery.maxValueRF, RF2EU_Battery.maxValueRF);
+ public RF2EU_Battery(){
+ super(maxValueRF, maxValueRF, maxValueRF);
GameRegistry.registerFuelHandler(this);
- // this.setMaxDamage(Integer.MAX_VALUE);
- // this.setDamage(UtilsItems.getSimpleStack(this), 0);
+ //this.setMaxDamage(Integer.MAX_VALUE);
+ //this.setDamage(UtilsItems.getSimpleStack(this), 0);
this.setCreativeTab(AddToCreativeTab.tabMachines);
- this.setUnlocalizedName(this.unlocalizedName);
+ this.setUnlocalizedName(unlocalizedName);
this.setMaxStackSize(1);
this.setTextureName(CORE.MODID + ":" + "itemIngot");
this.thisStack = ItemUtils.getSimpleStack(this);
- GameRegistry.registerItem(this, this.unlocalizedName);
+ GameRegistry.registerItem(this, unlocalizedName);
}
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add(EnumChatFormatting.YELLOW + "IC2/EU Information" + EnumChatFormatting.GRAY);
- list.add(EnumChatFormatting.GRAY + "Tier: [" + EnumChatFormatting.YELLOW + this.getTier(this.thisStack)
- + EnumChatFormatting.GRAY + "] Current Power: [" + EnumChatFormatting.YELLOW
- + (long) this.getCharge(stack) + EnumChatFormatting.GRAY + "/EU]");
- list.add(EnumChatFormatting.GRAY + "Transfer Limit: [" + EnumChatFormatting.YELLOW
- + this.getTransferLimit(this.thisStack) + EnumChatFormatting.GRAY + "Eu/t]" + "Burn Time: ["
- + EnumChatFormatting.YELLOW + this.getBurnTime(stack) / 20 + EnumChatFormatting.GRAY + "s]");
- list.add("");
- list.add(EnumChatFormatting.RED + "RF Information");
- list.add(EnumChatFormatting.GRAY + "Extraction Rate: [" + EnumChatFormatting.RED + this.maxExtract
- + EnumChatFormatting.GRAY + "Rf/t]" + " Insert Rate: [" + EnumChatFormatting.RED + this.maxReceive
- + EnumChatFormatting.GRAY + "Rf/t]");
- list.add(EnumChatFormatting.GRAY + "Current Charge: [" + EnumChatFormatting.RED + this.getEnergyStored(stack)
- + EnumChatFormatting.GRAY + "Rf / " + this.getMaxEnergyStored(stack) + "Rf] " + EnumChatFormatting.RED
- + MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack))
- + EnumChatFormatting.GRAY + "%");
- super.addInformation(stack, aPlayer, list, bool);
+ public void onUpdate(ItemStack itemStack, World worldObj, Entity player, int p_77663_4_, boolean p_77663_5_) {
+ getEnergyStored(itemStack);
+ if (worldObj.isRemote) {
+ return;
+ }
+
+ if (player instanceof EntityPlayer){
+ for (ItemStack is : ((EntityPlayer) player).inventory.mainInventory) {
+ if (is == itemStack) {
+ continue;
+ }
+ if (is != null) {
+ if (is.getItem() instanceof IElectricItem) {
+ IElectricItem electricItem = (IElectricItem) is.getItem();
+ chargeEU = ElectricItem.manager.getCharge(is);
+ }
+
+ }
+ }
+ }
+
+
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
}
@Override
- public boolean canProvideEnergy(final ItemStack itemStack) {
+ public boolean canProvideEnergy(ItemStack itemStack) {
return true;
}
@Override
- public boolean canUse(final ItemStack stack, final double amount) {
- return ElectricItem.manager.canUse(stack, amount);
+ public Item getChargedItem(ItemStack itemStack) {
+ ItemStack x = itemStack.copy();
+ x.setItemDamage(maxValueEU);
+ return x.getItem();
}
@Override
- public double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit,
- final boolean simulate) {
- if (stack.stackTagCompound == null) {
- stack.stackTagCompound = new NBTTagCompound();
- }
- int energy = stack.stackTagCompound.getInteger("Energy");
- final int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, this.maxReceive));
- if (!simulate) {
- energy += energyReceived;
- stack.stackTagCompound.setInteger("Energy", energy);
- ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false);
- ElectricItem.manager.charge(stack, energy / RF2EU_Battery.rfPerEU, 3, true, false);
-
- }
- return ElectricItem.manager.charge(stack, amount, tier, ignoreTransferLimit, simulate);
+ public Item getEmptyItem(ItemStack itemStack) {
+ ItemStack x = itemStack.copy();
+ x.setItemDamage(0);
+ return x.getItem();
}
@Override
- public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) {
- ElectricItem.manager.chargeFromArmor(stack, entity);
+ public double getMaxCharge(ItemStack itemStack) {
+ return maxValueEU;
}
@Override
- public double discharge(final ItemStack stack, final double amount, final int tier,
- final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) {
- if (stack.stackTagCompound == null || !stack.stackTagCompound.hasKey("Energy")) {
- final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this));
- if (euCharge != 0 && euCharge >= 1) {
- return (int) MathUtils.decimalRoundingToWholes(euCharge * RF2EU_Battery.rfPerEU);
- }
- return 0;
- }
- int energy = stack.stackTagCompound.getInteger("Energy");
- final int energyExtracted = Math.min(energy, Math.min(this.maxExtract, this.maxExtract));
- if (!simulate) {
- energy -= energyExtracted;
- stack.stackTagCompound.setInteger("Energy", energy);
- ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false);
- ElectricItem.manager.charge(stack, energy / RF2EU_Battery.rfPerEU, 3, true, false);
- }
-
- return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
+ public int getTier(ItemStack itemStack) {
+ return 3;
}
@Override
- public int extractEnergy(final ItemStack container, final int maxExtract, final boolean simulate) {
- if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
- final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this));
- if (euCharge != 0 && euCharge >= 1) {
- return (int) MathUtils.decimalRoundingToWholes(euCharge * RF2EU_Battery.rfPerEU);
- }
- return 0;
- }
- int energy = container.stackTagCompound.getInteger("Energy");
- final int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
- if (!simulate) {
- energy -= energyExtracted;
- container.stackTagCompound.setInteger("Energy", energy);
- ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false);
- ElectricItem.manager.charge(container, energy / RF2EU_Battery.rfPerEU, 3, true, false);
- }
- return energyExtracted;
+ public double getTransferLimit(ItemStack itemStack) {
+ return 8196;
}
@Override
- public int getBurnTime(final ItemStack fuel) {
- if (fuel == null || fuel.getItem() != this) {
- return 0;
- }
- return this.extractEnergy(fuel, 150000, true) / 50 / 100;
- }
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
- @Override
- public double getCharge(final ItemStack stack) {
- return ElectricItem.manager.getCharge(stack);
+ return ("Universally Chargeable Battery");
}
@Override
- public Item getChargedItem(final ItemStack itemStack) {
- final ItemStack x = itemStack.copy();
- x.setItemDamage(RF2EU_Battery.maxValueEU);
- return x.getItem();
+ public double getDurabilityForDisplay(ItemStack stack)
+ {
+ //return 1.0D - getEnergyStored(stack) / this.capacity;
+ return MathUtils.findPercentage(getEnergyStored(stack), getMaxEnergyStored(stack));
}
@Override
@SideOnly(Side.CLIENT)
- public int getColorFromItemStack(final ItemStack par1ItemStack, final int par2) {
- final int i = 30;
+ public int getColorFromItemStack(ItemStack par1ItemStack, int par2)
+ {
+ int i = 30;
- final float f13 = Minecraft.getSystemTime() % 6000L / 3000.0F * 3.141592F * 2.0F;
+ float f13 = (float)(Minecraft.getSystemTime() % 6000L) / 3000.0F * 3.141592F * 2.0F;
- final float t = 0.9F + 0.1F * MathHelper.cos(f13);
+ float t = 0.9F + 0.1F * MathHelper.cos(f13);
- final double v = 1.0D - this.getDurabilityForDisplay(par1ItemStack);
+ double v = 1.0D - getDurabilityForDisplay(par1ItemStack);
- int r = i + (int) (v * (255 - i) * t);
+ int r = i + (int)(v * (255 - i) * t);
if (r > 255) {
r = 255;
}
- final int g = i + (int) (v * (64 - i) * t);
+ int g = i + (int)(v * (64 - i) * t);
return r << 16 | g << 8 | i;
}
@Override
- public ItemStack getContainerItem(final ItemStack itemStack) {
- final ItemStack newItem = itemStack.copy();
- newItem.stackSize = 1;
- this.extractEnergy(newItem, 150000, false);
- return newItem;
+ public boolean showDurabilityBar(ItemStack stack)
+ {
+ return false;
}
@Override
- public double getDurabilityForDisplay(final ItemStack stack) {
- // return 1.0D - getEnergyStored(stack) / this.capacity;
- return MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack));
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ list.add(EnumChatFormatting.YELLOW+"IC2/EU Information"+EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GRAY+"Tier: ["+EnumChatFormatting.YELLOW+getTier(thisStack)+EnumChatFormatting.GRAY+"] Current Power: ["+EnumChatFormatting.YELLOW+(long) getCharge(stack)+EnumChatFormatting.GRAY+"/EU]");
+ list.add(EnumChatFormatting.GRAY+"Transfer Limit: ["+EnumChatFormatting.YELLOW+getTransferLimit(thisStack)+ EnumChatFormatting.GRAY +"Eu/t]" +"Burn Time: ["+EnumChatFormatting.YELLOW+getBurnTime(stack)/20+EnumChatFormatting.GRAY+"s]");
+ list.add("");
+ list.add(EnumChatFormatting.RED+"RF Information");
+ list.add(EnumChatFormatting.GRAY+"Extraction Rate: [" +EnumChatFormatting.RED+ this.maxExtract + EnumChatFormatting.GRAY + "Rf/t]" + " Insert Rate: [" +EnumChatFormatting.RED+ this.maxReceive+EnumChatFormatting.GRAY+"Rf/t]");
+ list.add(EnumChatFormatting.GRAY+"Current Charge: ["+EnumChatFormatting.RED+getEnergyStored(stack) + EnumChatFormatting.GRAY + "Rf / " + getMaxEnergyStored(stack)+"Rf] "+EnumChatFormatting.RED+MathUtils.findPercentage(getEnergyStored(stack), getMaxEnergyStored(stack))+EnumChatFormatting.GRAY+"%");
+ super.addInformation(stack, aPlayer, list, bool);
}
@Override
- public Item getEmptyItem(final ItemStack itemStack) {
- final ItemStack x = itemStack.copy();
- x.setItemDamage(0);
- return x.getItem();
+ public ItemStack getContainerItem(ItemStack itemStack)
+ {
+ ItemStack newItem = itemStack.copy();
+ newItem.stackSize = 1;
+ extractEnergy(newItem, 150000, false);
+ return newItem;
}
@Override
- public int getEnergyStored(final ItemStack container) {
- if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
- final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this));
- if (euCharge != 0 && euCharge >= 1) {
- return (int) MathUtils.decimalRoundingToWholes(euCharge * RF2EU_Battery.rfPerEU);
- }
+ public boolean hasContainerItem(ItemStack stack)
+ {
+ return true;
+ }
+
+ @Override
+ public int getBurnTime(ItemStack fuel) {
+ if ((fuel == null) || (fuel.getItem() != this)) {
return 0;
}
- final int energy = container.stackTagCompound.getInteger("Energy");
- ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false);
- ElectricItem.manager.charge(container, energy / RF2EU_Battery.rfPerEU, 3, true, false);
- return energy;
+ return extractEnergy(fuel, 150000, true) / 50 / 100;
}
@Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
-
- return "Universally Chargeable Battery";
+ public double charge(ItemStack stack, double amount, int tier,
+ boolean ignoreTransferLimit, boolean simulate) {
+ if (stack.stackTagCompound == null) {
+ stack.stackTagCompound = new NBTTagCompound();
+ }
+ int energy = stack.stackTagCompound.getInteger("Energy");
+ int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive));
+ if (!simulate)
+ {
+ energy += energyReceived;
+ stack.stackTagCompound.setInteger("Energy", energy);
+ ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false);
+ ElectricItem.manager.charge(stack, energy/rfPerEU, 3, true, false);
+
+ }
+ return ElectricItem.manager.charge(stack, amount, tier, ignoreTransferLimit, simulate);
}
@Override
- public double getMaxCharge(final ItemStack itemStack) {
- return RF2EU_Battery.maxValueEU;
+ 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(ItemUtils.getSimpleStack(this));
+ if (euCharge != 0 && euCharge >= 1){
+ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU));
+ }
+ return 0;
+ }
+ int energy = stack.stackTagCompound.getInteger("Energy");
+ int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
+ if (!simulate)
+ {
+ energy -= energyExtracted;
+ stack.stackTagCompound.setInteger("Energy", energy);
+ ElectricItem.manager.discharge(stack, ElectricItem.manager.getCharge(stack), 3, true, true, false);
+ ElectricItem.manager.charge(stack, energy/rfPerEU, 3, true, false);
+ }
+
+ return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
}
@Override
- public int getTier(final ItemStack itemStack) {
- return 3;
+ public double getCharge(ItemStack stack) {
+ return ElectricItem.manager.getCharge(stack);
}
@Override
- public String getToolTip(final ItemStack stack) {
- return ElectricItem.manager.getToolTip(stack);
+ public boolean canUse(ItemStack stack, double amount) {
+ return ElectricItem.manager.canUse(stack, amount);
}
@Override
- public double getTransferLimit(final ItemStack itemStack) {
- return 8196;
+ public boolean use(ItemStack stack, double amount, EntityLivingBase entity) {
+ return ElectricItem.manager.use(stack, amount, entity);
}
@Override
- public boolean hasContainerItem(final ItemStack stack) {
- return true;
+ public void chargeFromArmor(ItemStack stack, EntityLivingBase entity) {
+ ElectricItem.manager.chargeFromArmor(stack, entity);
}
@Override
- public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_,
- final boolean p_77663_5_) {
- this.getEnergyStored(itemStack);
- if (worldObj.isRemote) {
- return;
- }
-
- if (player instanceof EntityPlayer) {
- for (final ItemStack is : ((EntityPlayer) player).inventory.mainInventory) {
- if (is == itemStack) {
- continue;
- }
- if (is != null) {
- if (is.getItem() instanceof IElectricItem) {
- final IElectricItem electricItem = (IElectricItem) is.getItem();
- this.chargeEU = ElectricItem.manager.getCharge(is);
- }
-
- }
- }
- }
-
- super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
+ public String getToolTip(ItemStack stack) {
+ return ElectricItem.manager.getToolTip(stack);
}
@Override
- public int receiveEnergy(final ItemStack container, final int maxReceive, final boolean simulate) {
- if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
- final double euCharge = this.getCharge(ItemUtils.getSimpleStack(this));
- if (euCharge != 0 && euCharge >= 1) {
- return (int) MathUtils.decimalRoundingToWholes(euCharge * RF2EU_Battery.rfPerEU);
+ public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate)
+ {
+ if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) {
+ double euCharge = getCharge(ItemUtils.getSimpleStack(this));
+ if (euCharge != 0 && euCharge >= 1){
+ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU));
}
return 0;
}
int energy = container.stackTagCompound.getInteger("Energy");
- final int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive));
- if (!simulate) {
+ int energyReceived = Math.min(this.capacity - energy, Math.min(this.maxReceive, maxReceive));
+ if (!simulate)
+ {
energy += energyReceived;
container.stackTagCompound.setInteger("Energy", energy);
ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false);
- ElectricItem.manager.charge(container, energy / RF2EU_Battery.rfPerEU, 3, true, false);
-
+ ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false);
+
}
return energyReceived;
}
@Override
- public boolean showDurabilityBar(final ItemStack stack) {
- return false;
+ public int extractEnergy(ItemStack container, int maxExtract, boolean simulate)
+ {
+ if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) {
+ double euCharge = getCharge(ItemUtils.getSimpleStack(this));
+ if (euCharge != 0 && euCharge >= 1){
+ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU));
+ }
+ return 0;
+ }
+ int energy = container.stackTagCompound.getInteger("Energy");
+ int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
+ if (!simulate)
+ {
+ energy -= energyExtracted;
+ container.stackTagCompound.setInteger("Energy", energy);
+ ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false);
+ ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false);
+ }
+ return energyExtracted;
}
@Override
- public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) {
- return ElectricItem.manager.use(stack, amount, entity);
+ public int getEnergyStored(ItemStack container)
+ {
+ if ((container.stackTagCompound == null) || (!container.stackTagCompound.hasKey("Energy"))) {
+ double euCharge = getCharge(ItemUtils.getSimpleStack(this));
+ if (euCharge != 0 && euCharge >= 1){
+ return (int) (MathUtils.decimalRoundingToWholes(euCharge*rfPerEU));
+ }
+ return 0;
+ }
+ int energy = container.stackTagCompound.getInteger("Energy");
+ ElectricItem.manager.discharge(container, ElectricItem.manager.getCharge(container), 3, true, true, false);
+ ElectricItem.manager.charge(container, energy/rfPerEU, 3, true, false);
+ return energy;
}
}
diff --git a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java
index 63638d9055..36e6c66df8 100644
--- a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java
+++ b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java
@@ -1,9 +1,10 @@
package gtPlusPlus.core.item.general.fuelrods;
-import java.util.List;
-
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
+
+import java.util.List;
+
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -12,15 +13,14 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class FuelRod_Base extends Item {
+public class FuelRod_Base extends Item{
- public int fuelRemaining = 0;
- public int maximumFuel = 0;
- public String fuelType = "";
- public float heat = 0;
- public float maxHeat = this.getMaxHeat();
-
- public FuelRod_Base(final String unlocalizedName, final String type, final int fuelLeft, final int maxFuel) {
+ public int fuelRemaining = 0;
+ public int maximumFuel = 0;
+ public String fuelType = "";
+ public float heat = 0;
+ public float maxHeat = getMaxHeat();
+ public FuelRod_Base(String unlocalizedName, String type, int fuelLeft, int maxFuel) {
this.setUnlocalizedName(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName);
this.setMaxStackSize(1);
@@ -30,192 +30,194 @@ public class FuelRod_Base extends Item {
this.fuelType = type;
this.setCreativeTab(AddToCreativeTab.tabMachines);
}
-
- public boolean addFuel(final int i) {
- final int tempFuel = this.fuelRemaining;
- this.fuelRemaining = tempFuel + i;
- if (this.fuelRemaining != tempFuel) {
- return true;
+
+ private float getMaxHeat(){
+ float tempvar;
+ if (fuelType == "Thorium"){
+ tempvar = 2500;
}
- return false;
- }
-
- public boolean addHeat(final float i) {
- final float tempFuel = this.heat;
- this.heat = tempFuel + i;
- if (this.heat != tempFuel) {
- return true;
+
+ else if (fuelType == "Uranium"){
+ tempvar = 5000;
}
- return false;
+
+ else if (fuelType == "Plutonium"){
+ tempvar = 10000;
+ }
+
+ else {
+ tempvar = 5000;
+ }
+ return tempvar;
+
}
-
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
+
+ private void updateVars(ItemStack stack){
+ if (stack.stackTagCompound != null) {
+ heat = stack.stackTagCompound.getFloat("heat");
+ fuelRemaining = stack.stackTagCompound.getInteger("fuelRemaining");
+ }
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- Float NBT_Heat = this.heat;
- Float NBT_MaxHeat = this.maxHeat;
- int NBT_Fuel = this.fuelRemaining;
- String NBT_Type = this.fuelType;
+ Float NBT_Heat = heat;
+ Float NBT_MaxHeat = maxHeat;
+ int NBT_Fuel = fuelRemaining;
+ String NBT_Type= fuelType;
if (stack.stackTagCompound != null) {
NBT_Heat = stack.stackTagCompound.getFloat("heat");
NBT_MaxHeat = stack.stackTagCompound.getFloat("maxHeat");
NBT_Fuel = stack.stackTagCompound.getInteger("fuelRemaining");
NBT_Type = stack.stackTagCompound.getString("fuelType");
- }
-
- final String tempHeat = String.valueOf(NBT_Heat);
- final String tempMaxHeat = String.valueOf(NBT_MaxHeat);
- final String tempFuel = String.valueOf(NBT_Fuel);
- final String formattedType = EnumChatFormatting.DARK_RED + NBT_Type + EnumChatFormatting.GRAY;
- String formattedHeat = EnumChatFormatting.RED + tempHeat + EnumChatFormatting.GRAY;
- final String formattedMaxHeat = EnumChatFormatting.RED + tempMaxHeat + EnumChatFormatting.GRAY;
- String formattedFuelLeft = tempFuel + EnumChatFormatting.GRAY;
-
- final int tempMax = this.maximumFuel;
- final float tempCurrentHeat = this.heat;
- final int tempFuelLeft = this.fuelRemaining;
-
- // Fuel Usage Formatting
- if (tempFuelLeft <= this.maximumFuel / 3) {
- formattedFuelLeft = EnumChatFormatting.RED + tempFuel + EnumChatFormatting.GRAY;
- }
- else if (tempFuelLeft >= this.maximumFuel / 3 && tempFuelLeft <= this.maximumFuel / 3 * 2) {
- formattedFuelLeft = EnumChatFormatting.YELLOW + tempFuel + EnumChatFormatting.GRAY;
- }
- else if (tempFuelLeft >= this.maximumFuel / 3 * 2 && tempFuelLeft <= this.maximumFuel) {
- formattedFuelLeft = EnumChatFormatting.GREEN + tempFuel + EnumChatFormatting.GRAY;
+ }
+
+ String tempHeat = String.valueOf(NBT_Heat);
+ String tempMaxHeat = String.valueOf(NBT_MaxHeat);
+ String tempFuel = String.valueOf(NBT_Fuel);
+ String formattedType = EnumChatFormatting.DARK_RED+NBT_Type+EnumChatFormatting.GRAY;
+ String formattedHeat = EnumChatFormatting.RED+tempHeat+EnumChatFormatting.GRAY;
+ String formattedMaxHeat = EnumChatFormatting.RED+tempMaxHeat+EnumChatFormatting.GRAY;
+ String formattedFuelLeft = tempFuel+EnumChatFormatting.GRAY;
+
+ int tempMax = maximumFuel;
+ float tempCurrentHeat = heat;
+ int tempFuelLeft = fuelRemaining;
+
+ //Fuel Usage Formatting
+ if (tempFuelLeft <= maximumFuel/3){
+ formattedFuelLeft = EnumChatFormatting.RED+tempFuel+EnumChatFormatting.GRAY;
+ }
+ else if (tempFuelLeft >= maximumFuel/3 && tempFuelLeft <= (maximumFuel/3)*2){
+ formattedFuelLeft = EnumChatFormatting.YELLOW+tempFuel+EnumChatFormatting.GRAY;
+ }
+ else if (tempFuelLeft >= (maximumFuel/3)*2 && tempFuelLeft <= maximumFuel){
+ formattedFuelLeft = EnumChatFormatting.GREEN+tempFuel+EnumChatFormatting.GRAY;
}
else {
- formattedFuelLeft = EnumChatFormatting.GRAY + tempFuel + EnumChatFormatting.GRAY;
+ formattedFuelLeft = EnumChatFormatting.GRAY+tempFuel+EnumChatFormatting.GRAY;
}
-
- // Heat Formatting
- if (tempCurrentHeat <= 200 && tempCurrentHeat >= 0) {
- formattedHeat = EnumChatFormatting.GRAY + tempHeat + EnumChatFormatting.GRAY;
+
+ //Heat Formatting
+ if (tempCurrentHeat <= 200 && tempCurrentHeat >= 0){
+ formattedHeat = EnumChatFormatting.GRAY+tempHeat+EnumChatFormatting.GRAY;
}
- else if (tempCurrentHeat <= this.maxHeat / 3 && tempCurrentHeat > 200) {
- formattedHeat = EnumChatFormatting.YELLOW + tempHeat + EnumChatFormatting.GRAY;
+ else if (tempCurrentHeat <= maxHeat/3 && tempCurrentHeat > 200){
+ formattedHeat = EnumChatFormatting.YELLOW+tempHeat+EnumChatFormatting.GRAY;
}
- else if (tempCurrentHeat >= this.maxHeat / 3 && tempMax < this.maxHeat / 3 * 2 && tempCurrentHeat != 0) {
- formattedHeat = EnumChatFormatting.GOLD + tempHeat + EnumChatFormatting.GRAY;
+ else if (tempCurrentHeat >= maxHeat/3 && tempMax < (maxHeat/3)*2 && tempCurrentHeat != 0){
+ formattedHeat = EnumChatFormatting.GOLD+tempHeat+EnumChatFormatting.GRAY;
}
- else if (tempCurrentHeat >= this.maxHeat / 3 * 2 && tempMax <= this.maxHeat && tempCurrentHeat != 0) {
- formattedHeat = EnumChatFormatting.RED + tempHeat + EnumChatFormatting.GRAY;
+ else if (tempCurrentHeat >= ((maxHeat/3)*2) && tempMax <= maxHeat && tempCurrentHeat != 0){
+ formattedHeat = EnumChatFormatting.RED+tempHeat+EnumChatFormatting.GRAY;
}
else {
- formattedHeat = EnumChatFormatting.BLUE + tempHeat + EnumChatFormatting.GRAY;
+ formattedHeat = EnumChatFormatting.BLUE+tempHeat+EnumChatFormatting.GRAY;
}
- list.add(EnumChatFormatting.GRAY + "A " + formattedType + " Fuel Rod.");
- list.add(EnumChatFormatting.GRAY + "Running at " + formattedHeat + "/" + formattedMaxHeat + " Kelvin.");
- list.add(EnumChatFormatting.GRAY + "Fuel Remaining: " + formattedFuelLeft + "L.");
+ list.add(EnumChatFormatting.GRAY+"A "+formattedType+" Fuel Rod.");
+ list.add(EnumChatFormatting.GRAY+"Running at "+formattedHeat+"/"+formattedMaxHeat+" Kelvin.");
+ list.add(EnumChatFormatting.GRAY+"Fuel Remaining: "+formattedFuelLeft+"L.");
super.addInformation(stack, aPlayer, list, bool);
}
- public int getFuel(final ItemStack stack) {
- if (stack != null) {
- final int i = stack.getItemDamage();
- final int r = this.maximumFuel - i;
- return r;
- }
- return this.getFuelRemaining(stack);
+ public String getType(ItemStack stack){
+ if (stack.stackTagCompound != null){
+ return stack.stackTagCompound.getString("fuelType");
+ }
+ return fuelType;
}
- public int getFuelRemaining(final ItemStack stack) {
- if (stack.stackTagCompound != null) {
+ public int getFuelRemaining(ItemStack stack){
+ if (stack.stackTagCompound != null){
return stack.stackTagCompound.getInteger("fuelRemaining");
- }
- return 0;
+ }
+ return 0;
}
- public float getHeat(final ItemStack value) {
- if (value.stackTagCompound != null) {
- return value.stackTagCompound.getFloat("heat");
- }
- return 0f;
+ public int getMaxFuel(){
+ return maximumFuel;
}
- public int getMaxFuel() {
- return this.maximumFuel;
- }
-
- private float getMaxHeat() {
- float tempvar;
- if (this.fuelType == "Thorium") {
- tempvar = 2500;
+ public int getFuel(ItemStack stack){
+ if (stack != null){
+ int i = stack.getItemDamage();
+ int r = maximumFuel - i;
+ return r;
}
+ return getFuelRemaining(stack);
+ }
- else if (this.fuelType == "Uranium") {
- tempvar = 5000;
- }
+ public boolean setFuelRemainingExplicitly(int i){
+ int tempFuel = fuelRemaining;
+ fuelRemaining = i;
+ if (i != tempFuel){
+ return true;
+ }
+ return false;
+ }
- else if (this.fuelType == "Plutonium") {
- tempvar = 10000;
- }
+ public boolean addFuel(int i){
+ int tempFuel = fuelRemaining;
+ fuelRemaining = tempFuel+i;
+ if (fuelRemaining != tempFuel){
+ return true;
+ }
+ return false;
+ }
- else {
- tempvar = 5000;
+ public float getHeat(ItemStack value){
+ if (value.stackTagCompound != null){
+ return value.stackTagCompound.getFloat("heat");
}
- return tempvar;
-
+ return 0f;
}
- public String getType(final ItemStack stack) {
- if (stack.stackTagCompound != null) {
- return stack.stackTagCompound.getString("fuelType");
- }
- return this.fuelType;
+ public boolean addHeat(float i){
+ float tempFuel = heat;
+ heat = tempFuel+i;
+ if (heat != tempFuel){
+ return true;
+ }
+ return false;
}
- // Ticking and NBT Handling
- /*
- * Called each tick as long the item is on a player inventory. Uses by maps
- * to check if is on a player hand and update it's contents.
- *
- * public int fuelRemaining = 0; public int maximumFuel = 0; public String
- * fuelType = ""; public float heat = 0; public float maxHeat = 5000;
+
+ //Ticking and NBT Handling
+ /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
+ * update it's contents.
*
+ * public int fuelRemaining = 0;
+ public int maximumFuel = 0;
+ public String fuelType = "";
+ public float heat = 0;
+ public float maxHeat = 5000;
+ *
*/
@Override
- public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) {
+ public void onCreated(ItemStack itemStack, World world, EntityPlayer player) {
itemStack.stackTagCompound = new NBTTagCompound();
- itemStack.stackTagCompound.setInteger("fuelRemaining", this.getFuelRemaining(itemStack));
- itemStack.stackTagCompound.setInteger("maximumFuel", this.maximumFuel);
- itemStack.stackTagCompound.setFloat("heat", this.getHeat(itemStack));
- itemStack.stackTagCompound.setFloat("maxHeat", this.getMaxHeat());
- itemStack.stackTagCompound.setString("fuelType", this.getType(itemStack));
- this.updateVars(itemStack);
+ itemStack.stackTagCompound.setInteger("fuelRemaining", getFuelRemaining(itemStack));
+ itemStack.stackTagCompound.setInteger("maximumFuel", maximumFuel);
+ itemStack.stackTagCompound.setFloat("heat", getHeat(itemStack));
+ itemStack.stackTagCompound.setFloat("maxHeat", getMaxHeat());
+ itemStack.stackTagCompound.setString("fuelType", getType(itemStack));
+ updateVars(itemStack);
}
@Override
- public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4,
- final boolean par5) {
+ public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) {
itemStack.stackTagCompound = new NBTTagCompound();
- itemStack.stackTagCompound.setInteger("fuelRemaining", this.getFuelRemaining(itemStack));
- itemStack.stackTagCompound.setInteger("maximumFuel", this.maximumFuel);
- itemStack.stackTagCompound.setFloat("heat", this.getHeat(itemStack));
- itemStack.stackTagCompound.setFloat("maxHeat", this.getMaxHeat());
- itemStack.stackTagCompound.setString("fuelType", this.getType(itemStack));
- this.updateVars(itemStack);
- }
-
- public boolean setFuelRemainingExplicitly(final int i) {
- final int tempFuel = this.fuelRemaining;
- this.fuelRemaining = i;
- if (i != tempFuel) {
- return true;
- }
- return false;
- }
-
- private void updateVars(final ItemStack stack) {
- if (stack.stackTagCompound != null) {
- this.heat = stack.stackTagCompound.getFloat("heat");
- this.fuelRemaining = stack.stackTagCompound.getInteger("fuelRemaining");
- }
+ itemStack.stackTagCompound.setInteger("fuelRemaining", getFuelRemaining(itemStack));
+ itemStack.stackTagCompound.setInteger("maximumFuel", maximumFuel);
+ itemStack.stackTagCompound.setFloat("heat", getHeat(itemStack));
+ itemStack.stackTagCompound.setFloat("maxHeat", getMaxHeat());
+ itemStack.stackTagCompound.setString("fuelType", getType(itemStack));
+ updateVars(itemStack);
}
+
+
}
diff --git a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java
index a90ca5db35..9b852cb1ea 100644
--- a/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java
+++ b/src/Java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java
@@ -1,8 +1,8 @@
package gtPlusPlus.core.item.general.fuelrods;
-public class FuelRod_Thorium extends FuelRod_Base {
+public class FuelRod_Thorium extends FuelRod_Base{
- public FuelRod_Thorium(final String unlocalizedName, final String type, final int fuelLeft, final int maxFuel) {
+ public FuelRod_Thorium(String unlocalizedName, String type, int fuelLeft, int maxFuel) {
super(unlocalizedName, type, fuelLeft, maxFuel);
this.setMaxDamage(maxFuel);
this.maximumFuel = maxFuel;
diff --git a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java
index bf6f98aed6..7fbfca0ac8 100644
--- a/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java
+++ b/src/Java/gtPlusPlus/core/item/init/ItemsFoods.java
@@ -11,45 +11,33 @@ import net.minecraft.potion.PotionEffect;
public class ItemsFoods {
- public static void load() {
- ItemsFoods.run();
+ public static void load(){
+ run();
}
-
- private static void run() {
-
- // 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",
- 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",
- ItemUtils.getItemStack(CORE.MODID + ":itemHotIngotRaisinBread", 1));
-
- // Raisin Bread
- ModItems.itemFoodRaisinToast = new BaseItemFood("itemFoodRaisinToast", "Raisin Toast", 1, 0.5f, false)
- .setAlwaysEdible();
- 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",
- ItemUtils.getItemStack(CORE.MODID + ":itemHotFoodRaisinToast", 1));
-
- // Raisin Bread
- ModItems.itemFoodCurriedSausages = new BaseItemFood("itemFoodCurriedSausages", "Curried Sausages", 5, 2f,
- false);
- 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",
- ItemUtils.getItemStack(CORE.MODID + ":itemHotFoodCurriedSausages", 1));
-
+
+ private static void run(){
+
+ //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", 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", ItemUtils.getItemStack(CORE.MODID+":itemHotIngotRaisinBread", 1));
+
+ //Raisin Bread
+ ModItems.itemFoodRaisinToast = new BaseItemFood("itemFoodRaisinToast", "Raisin Toast", 1, 0.5f, false).setAlwaysEdible();
+ 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", ItemUtils.getItemStack(CORE.MODID+":itemHotFoodRaisinToast", 1));
+
+ //Raisin Bread
+ ModItems.itemFoodCurriedSausages = new BaseItemFood("itemFoodCurriedSausages", "Curried Sausages", 5, 2f, false);
+ 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", ItemUtils.getItemStack(CORE.MODID+":itemHotFoodCurriedSausages", 1));
+
}
-
+
}
diff --git a/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java b/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java
index 09487e1546..0f89f2a0ff 100644
--- a/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java
+++ b/src/Java/gtPlusPlus/core/item/materials/MaterialHandler.java
@@ -4,5 +4,7 @@ public class MaterialHandler {
@SuppressWarnings("unused")
private String Staballoy;
-
+
+
+
}
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java b/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java
index 7e00895b32..108ac4b83d 100644
--- a/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java
+++ b/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java
@@ -1,54 +1,64 @@
package gtPlusPlus.core.item.tool.misc;
-import java.util.List;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.item.base.BaseItemWithDamageValue;
import gtPlusPlus.core.lib.CORE;
+
+import java.util.List;
+
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
-public class SandstoneHammer extends BaseItemWithDamageValue {
+public class SandstoneHammer extends BaseItemWithDamageValue{
- public SandstoneHammer(final String unlocalizedName) {
+ /* (non-Javadoc)
+ * @see net.minecraft.item.Item#getColorFromItemStack(net.minecraft.item.ItemStack, int)
+ */
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ //Figure Out Damage
+
+
+ return super.getColorFromItemStack(stack, HEX_OxFFFFFF);
+ }
+
+ public SandstoneHammer(String unlocalizedName) {
super(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName);
this.setMaxStackSize(1);
this.setMaxDamage(2500);
}
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add(EnumChatFormatting.GRAY + "Allows you to craft sand from cobble, or sandstone from sand.");
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ list.add(EnumChatFormatting.GRAY+"Allows you to craft sand from cobble, or sandstone from sand.");
super.addInformation(stack, aPlayer, list, bool);
- }
+ }
@Override
- public boolean doesContainerItemLeaveCraftingGrid(final ItemStack itemStack) {
+ public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack)
+ {
return false;
}
- /*
- * (non-Javadoc)
- *
- * @see net.minecraft.item.Item#getColorFromItemStack(net.minecraft.item.
- * ItemStack, int)
- */
@Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- // Figure Out Damage
-
- return super.getColorFromItemStack(stack, HEX_OxFFFFFF);
+ public boolean getShareTag()
+ {
+ return true;
}
@Override
- public ItemStack getContainerItem(final ItemStack itemStack) {
+ public boolean hasContainerItem(ItemStack itemStack)
+ {
+ return true;
+ }
+ @Override
+ public ItemStack getContainerItem(ItemStack itemStack)
+ {
itemStack.setItemDamage(itemStack.getItemDamage() + 8);
return itemStack;
@@ -56,23 +66,14 @@ public class SandstoneHammer extends BaseItemWithDamageValue {
@Override
@SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
+ public EnumRarity getRarity(ItemStack par1ItemStack){
return EnumRarity.uncommon;
}
@Override
- public boolean getShareTag() {
- return true;
- }
-
- @Override
- public boolean hasContainerItem(final ItemStack itemStack) {
- return true;
- }
-
- @Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
+ public boolean hasEffect(ItemStack par1ItemStack){
return false;
}
+
}
diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java
index b9736136bb..99ee699dcf 100644
--- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java
+++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java
@@ -1,8 +1,5 @@
package gtPlusPlus.core.item.tool.staballoy;
-import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
@@ -16,190 +13,167 @@ import net.minecraft.init.Blocks;
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 MultiPickaxeBase extends StaballoyPickaxe {
+public class MultiPickaxeBase extends StaballoyPickaxe{
- protected Boolean FACING_HORIZONTAL = true;
+ /* (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 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 MultiPickaxeBase(final String unlocalizedName, final ToolMaterial material, final int materialDurability,
- final int colour) {
+ 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 MultiPickaxeBase(String unlocalizedName, ToolMaterial material, int materialDurability, int colour) {
super(Utils.sanitizeString(unlocalizedName), material);
this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName));
this.setTextureName(CORE.MODID + ":" + "itemPickaxe");
- this.FACING_HORIZONTAL = true;
+ this.FACING_HORIZONTAL=true;
this.setMaxStackSize(1);
this.setMaxDamage(materialDurability);
this.colour = colour;
- this.materialName = material.name();
+ this.materialName = material.name();
this.setCreativeTab(AddToCreativeTab.tabTools);
- try {
- this.isValid = this.addRecipe();
- }
- catch (final Throwable e) {
- }
- if (colour != 0 && this.isValid) {
- GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName));
+ try {isValid = addRecipe();} catch (Throwable e){}
+ if (colour != 0 && isValid){
+ GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName));
}
}
- private boolean addRecipe() {
- final String plateDense = "plateDense" + this.materialName;
- final String rodLong = "stickLong" + this.materialName;
- final String toolHammer = "craftingToolHardHammer";
- final String toolWrench = "craftingToolWrench";
- final String toolFile = "craftingToolFile";
- final String toolScrewDriver = "craftingToolScrewdriver";
+ /*
+ *
+ *
+ *
+ * Methods
+ *
+ *
+ *
+ */
+
+ 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)) {
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){
return false;
}
- if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)) {
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){
return false;
}
- RecipeUtils.recipeBuilder(plateDense, plateDense, plateDense, toolFile, rodLong, toolHammer, toolWrench,
- rodLong, toolScrewDriver, ItemUtils.getSimpleStack(this));
+ RecipeUtils.recipeBuilder(
+ plateDense, plateDense, plateDense,
+ toolFile, rodLong, toolHammer,
+ toolWrench, rodLong, toolScrewDriver,
+ ItemUtils.getSimpleStack(this));
return true;
}
- /*
- *
- *
- *
- * Methods
- *
- *
- *
- */
-
- @SuppressWarnings("static-method")
- private float calculateDurabilityLoss(final World world, final int X, final int Y, final int Z) {
- float bDurabilityLoss = 0;
- Boolean correctTool = false;
- float bHardness = 0;
- if (!world.isRemote) {
- try {
- final Block removalist = world.getBlock(X, Y, Z);
- // Utils.LOG_WARNING(removalist.toString());
-
- bHardness = removalist.getBlockHardness(world, X, Y, Z) * 100;
- Utils.LOG_WARNING("Hardness: " + bHardness);
-
- bDurabilityLoss = 100;
- // Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss);
-
- correctTool = this.canPickaxeBlock(removalist, world);
- Utils.LOG_WARNING("" + correctTool);
-
- if (!correctTool) {
- return 0;
- }
-
- }
- catch (final NullPointerException e) {
-
- }
- }
- return bDurabilityLoss;
- }
-
- @Override
- public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer) {
- item.damageItem(damage, localPlayer);
- }
-
- @Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- if (this.colour == 0) {
- return MathUtils.generateSingularRandomHexValue();
- }
- return this.colour;
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.
- * ItemStack)
- */
- @Override
- public double getDurabilityForDisplay(final ItemStack stack) {
- if (super.getDurabilityForDisplay(stack) > 0) {
- return super.getDurabilityForDisplay(stack);
- }
- return 0;
+ public final String getMaterialName() {
+ return materialName;
}
@Override
- public String getItemStackDisplayName(final ItemStack iStack) {
+ public String getItemStackDisplayName(ItemStack iStack) {
String name;
- if (this.getUnlocalizedName().toLowerCase().contains("wood")) {
+ if (getUnlocalizedName().toLowerCase().contains("wood")){
name = "Wooden";
}
- else if (this.getUnlocalizedName().toLowerCase().contains("cobblestone")) {
+ else if (getUnlocalizedName().toLowerCase().contains("cobblestone")){
name = "Cobblestone";
}
- else if (this.getUnlocalizedName().toLowerCase().contains("iron")) {
+ else if (getUnlocalizedName().toLowerCase().contains("iron")){
name = "Iron";
}
- else if (this.getUnlocalizedName().toLowerCase().contains("gold")) {
+ else if (getUnlocalizedName().toLowerCase().contains("gold")){
name = "Gold";
}
- else if (this.getUnlocalizedName().toLowerCase().contains("diamond")) {
+ else if (getUnlocalizedName().toLowerCase().contains("diamond")){
name = "Diamond";
}
else {
- name = this.materialName;
+ name = materialName;
}
- return name + " Multipickaxe";
- }
-
- public final String getMaterialName() {
- return this.materialName;
+ return name+" Multipickaxe";
}
@Override
- @SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
- return EnumRarity.uncommon;
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ if (colour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return colour;
+
}
- @Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
- return false;
+ @SuppressWarnings("static-method")
+ private float calculateDurabilityLoss(World world, int X, int Y, int Z){
+ float bDurabilityLoss = 0;
+ Boolean correctTool = false;
+ float bHardness = 0;
+ if (!world.isRemote){
+ try {
+ Block removalist = world.getBlock(X, Y, Z);
+ //Utils.LOG_WARNING(removalist.toString());
+
+ bHardness = removalist.getBlockHardness(world, X, Y, Z)*100;
+ Utils.LOG_WARNING("Hardness: "+bHardness);
+
+ bDurabilityLoss = 100;
+ //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss);
+
+ correctTool = canPickaxeBlock(removalist, world);
+ Utils.LOG_WARNING(""+correctTool);
+
+ if (!correctTool){
+ return 0;
+ }
+
+ } catch (NullPointerException e){
+
+ }
+ }
+ return bDurabilityLoss;
}
- // Should clear up blocks quicker if I chain it.
+ //Should clear up blocks quicker if I chain it.
@Override
- public void removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z,
- final ItemStack heldItem) {
- this.localWorld = world;
+ public void removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){
+ localWorld = world;
try {
- final Block block = world.getBlock(X, Y, Z);
- final float dur = this.calculateDurabilityLoss(world, X, Y, Z);
+ Block block = world.getBlock(X, Y, Z);
+ float dur = calculateDurabilityLoss(world, X, Y, Z);
Utils.LOG_WARNING(block.toString());
String removalTool = "";
removalTool = block.getHarvestTool(1);
- if (removalTool.equals("pickaxe") || UtilsMining.getBlockType(block)) {
- if (this.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 (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) {
+ if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-dur)){
block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0);
world.setBlockToAir(X, Y, Z);
@@ -215,15 +189,29 @@ public class MultiPickaxeBase extends StaballoyPickaxe {
Utils.LOG_WARNING("Incorrect Tool for mining this block.");
}
}
- }
- catch (final NullPointerException e) {
+ } catch (NullPointerException e){
}
}
+ public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){
+ item.damageItem(damage, localPlayer);
+ }
+
+ public void setItemDamage(ItemStack item, int damage){
+ item.setItemDamage(damage-1);
+ }
+
+
@Override
- public void setItemDamage(final ItemStack item, final int damage) {
- item.setItemDamage(damage - 1);
+ @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/MultiSpadeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java
index 0c7eba48e8..0560893490 100644
--- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java
+++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java
@@ -1,8 +1,5 @@
package gtPlusPlus.core.item.tool.staballoy;
-import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
@@ -13,108 +10,105 @@ 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 {
+public class MultiSpadeBase extends StaballoySpade{
- protected Boolean FACING_HORIZONTAL = true;
+ /* (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 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(final String unlocalizedName, final ToolMaterial material, final int materialDurability,
- final int colour) {
+ 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.FACING_HORIZONTAL=true;
this.setMaxStackSize(1);
this.setMaxDamage(materialDurability);
this.colour = colour;
this.materialName = material.name();
this.setCreativeTab(AddToCreativeTab.tabTools);
- try {
- this.isValid = this.addRecipe();
- }
- catch (final Throwable e) {
- }
- if (colour != 0 && this.isValid) {
- GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName));
+ try {isValid = addRecipe();} catch (Throwable e){}
+ if (colour != 0 && isValid){
+ GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName));
}
}
-
- private boolean addRecipe() {
- final String plateDense = "plateDense" + this.materialName;
- final String rodLong = "stickLong" + this.materialName;
- final String toolHammer = "craftingToolHardHammer";
- final String toolWrench = "craftingToolWrench";
- final String toolFile = "craftingToolFile";
- final String toolScrewDriver = "craftingToolScrewdriver";
-
- if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)) {
+
+ 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)) {
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){
return false;
- }
-
- RecipeUtils.recipeBuilder(toolFile, plateDense, toolHammer, null, rodLong, null, toolWrench, rodLong,
- toolScrewDriver, ItemUtils.getSimpleStack(this));
-
+ }
+
+ RecipeUtils.recipeBuilder(
+ toolFile, plateDense, toolHammer,
+ null, rodLong, null,
+ toolWrench, rodLong, toolScrewDriver,
+ ItemUtils.getSimpleStack(this));
+
return true;
}
-
- @Override
- public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
- if (this.colour == 0) {
- return MathUtils.generateSingularRandomHexValue();
- }
- return this.colour;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.
- * ItemStack)
- */
- @Override
- public double getDurabilityForDisplay(final ItemStack stack) {
- if (super.getDurabilityForDisplay(stack) > 0) {
- return super.getDurabilityForDisplay(stack);
- }
- return 0;
+
+ public final String getMaterialName() {
+ return materialName;
}
-
+
@Override
- public String getItemStackDisplayName(final ItemStack iStack) {
+ public String getItemStackDisplayName(ItemStack iStack) {
String name;
- if (this.getUnlocalizedName().toLowerCase().contains("wood")) {
+ if (getUnlocalizedName().toLowerCase().contains("wood")){
name = "Wooden";
}
else {
- name = this.materialName;
+ name = materialName;
}
- return "Big " + name + " Spade";
+ return "Big "+name+" Spade";
}
- public final String getMaterialName() {
- return this.materialName;
- }
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ if (colour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return colour;
+ }
@Override
@SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
+ public EnumRarity getRarity(ItemStack par1ItemStack){
return EnumRarity.uncommon;
}
@Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
+ public boolean hasEffect(ItemStack par1ItemStack){
return false;
}
diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java
index 16852b5090..07c5800a1f 100644
--- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java
+++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java
@@ -1,366 +1,279 @@
package gtPlusPlus.core.item.tool.staballoy;
+import gtPlusPlus.core.lib.CORE;
+
import java.util.List;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gtPlusPlus.core.lib.CORE;
-import net.minecraft.block.*;
+import net.minecraft.block.Block;
+import net.minecraft.block.BlockAir;
+import net.minecraft.block.BlockCocoa;
+import net.minecraft.block.BlockDirt;
+import net.minecraft.block.BlockDoublePlant;
+import net.minecraft.block.BlockFlower;
+import net.minecraft.block.BlockGrass;
+import net.minecraft.block.BlockHugeMushroom;
+import net.minecraft.block.BlockLeavesBase;
+import net.minecraft.block.BlockLog;
+import net.minecraft.block.BlockMushroom;
+import net.minecraft.block.BlockSand;
+import net.minecraft.block.BlockSnow;
+import net.minecraft.block.BlockSnowBlock;
+import net.minecraft.block.BlockTallGrass;
+import net.minecraft.block.BlockVine;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.*;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemAxe;
+import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
-public class StaballoyAxe extends ItemAxe {
+public class StaballoyAxe extends ItemAxe{
public String mat;
- // EXPLODE TREE
- byte[] tre = new byte[32000];
-
- byte unchecked = 0;
- byte needcheck = 1;
- byte ignore = 2;
- byte harvest = 3;
- public StaballoyAxe(final String unlocalizedName, final ToolMaterial material) {
+ public StaballoyAxe(String unlocalizedName, ToolMaterial material) {
super(material);
this.setUnlocalizedName(unlocalizedName);
this.setTextureName(CORE.MODID + ":" + unlocalizedName);
}
-
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
+
+ // EXPLODE TREE
+ byte[] tre= new byte[32000];
+ byte unchecked=0;
+ byte needcheck=1;
+ byte ignore =2;
+ byte harvest =3;
+
+ private boolean setcheck(int x, int y, int z) {
+ if(x<0 || x>19 || z<0 || z>19 || y<0 || y>79) return false;
+ int o=x+z*20+y*400;
+ if (tre[o]==unchecked) tre[o]=needcheck;
+ return true;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add(EnumChatFormatting.GOLD + "Fells entire trees in a single swipe!..");
- list.add(EnumChatFormatting.GRAY + "Ask Alkalus for new trees to be supported.");
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ list.add(EnumChatFormatting.GOLD+"Fells entire trees in a single swipe!..");
+ list.add(EnumChatFormatting.GRAY+"Ask Alkalus for new trees to be supported.");
super.addInformation(stack, aPlayer, list, bool);
}
-
- private void breakMushroom(final World wld, final Block bit, final EntityPlayer plr, final boolean silk,
- final int x, final int y, final int z, final int met) {
- if (silk) {
- final ItemStack stk = null; // TODO
- /*
- * if (bit==Blocks.brown_mushroom_block) stk = new
- * ItemStack(LoonToolItems.brown_mushroom_block,1,met); else if
- * (bit==Blocks.red_mushroom_block) stk = new
- * ItemStack(LoonToolItems.red_mushroom_block,1,met); else stk = new
- * ItemStack(bit,1,met);
- */
- final EntityItem entityitem = new EntityItem(wld, x + 0.5, y + 0.5, z + 0.5, stk);
- entityitem.delayBeforeCanPickup = 10;
- wld.spawnEntityInWorld(entityitem);
- }
- else {
- bit.harvestBlock(wld, plr, x, y, z, met);
- }
- wld.setBlockToAir(x, y, z);
- }
-
- public boolean canIgnore(final Block bit) {
- if (bit instanceof BlockAir) {
- return true;
- }
- if (bit instanceof BlockGrass) {
- return true;
- }
- if (bit instanceof BlockSand) {
- return true;
- }
- if (bit instanceof BlockDirt) {
- return true;
- }
- if (bit instanceof BlockCocoa) {
- return true;
- }
- if (bit instanceof BlockVine) {
- return true;
- }
- if (bit instanceof BlockMushroom) {
- return true;
- }
- if (bit instanceof BlockSnow) {
- return true;
- }
- if (bit instanceof BlockSnowBlock) {
- return true;
- }
- if (bit instanceof BlockFlower) {
- return true;
- }
- if (bit instanceof BlockTallGrass) {
- return true;
- }
- if (bit instanceof BlockDoublePlant) {
- return true;
- }
-
- // LoonTools.log("Found uncuttable "+bit.getClass().getSimpleName());
+
+ public boolean canIgnore(Block bit){
+ if (bit instanceof BlockAir)return true;
+ if (bit instanceof BlockGrass)return true;
+ if (bit instanceof BlockSand)return true;
+ if (bit instanceof BlockDirt)return true;
+ if (bit instanceof BlockCocoa)return true;
+ if (bit instanceof BlockVine)return true;
+ if (bit instanceof BlockMushroom)return true;
+ if (bit instanceof BlockSnow)return true;
+ if (bit instanceof BlockSnowBlock)return true;
+ if (bit instanceof BlockFlower)return true;
+ if (bit instanceof BlockTallGrass)return true;
+ if (bit instanceof BlockDoublePlant)return true;
+
+ //LoonTools.log("Found uncuttable "+bit.getClass().getSimpleName());
return false;
}
-
- private int check(final World par1World, final int x, final int y, final int z, final int xo, final int yo,
- final int zo) {
- int f = 0;
- final int o = x + z * 20 + y * 400;
- if (this.tre[o] == this.needcheck) {
- this.tre[o] = this.ignore;
- final Block bit = par1World.getBlock(x + xo, y + yo, z + zo);
- if (bit instanceof BlockLog || bit instanceof BlockLeavesBase || bit instanceof BlockHugeMushroom
- || bit.getUnlocalizedName().toLowerCase().contains("log")
- || bit.getUnlocalizedName().toLowerCase().contains("wood")) {
- f = 1;
- this.tre[o] = this.harvest;
- // if (bit instanceof BlockLog){
- // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" ");
- // }
- for (int xb = -1; xb < 2; xb++) {
- for (int yb = -1; yb < 2; yb++) {
- for (int zb = -1; zb < 2; zb++) {
- if (!this.setcheck(x + xb, y + yb, z + zb)) {
- return 3;
- }
- }
- }
- }
- }
- else {
- if (!this.canIgnore(bit)) {
- return 2;
- }
+
+ private int check(World par1World, int x, int y, int z, int xo, int yo,int zo) {
+ int f=0;
+ int o=x+z*20+y*400;
+ if (tre[o]==needcheck){
+ tre[o]=ignore;
+ Block bit = par1World.getBlock(x+xo, y+yo, z+zo);
+ if ((bit instanceof BlockLog)||(bit instanceof BlockLeavesBase)||(bit instanceof BlockHugeMushroom) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){
+ f=1;
+ tre[o]=harvest;
+ //if (bit instanceof BlockLog){
+ // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" ");
+ //}
+ for(int xb=-1;xb<2;xb++)
+ for(int yb=-1;yb<2;yb++)
+ for(int zb=-1;zb<2;zb++)
+ if (!setcheck(x+xb,y+yb,z+zb))return 3;
+ }else{
+ if (!canIgnore(bit)) return 2;
}
}
return f;
}
-
- private int check2(final World par1World, final int x, final int y, final int z, final int xo, final int yo,
- final int zo) {
- int f = 0;
- final int o = x + z * 20 + y * 400;
- if (this.tre[o] == this.needcheck) {
- this.tre[o] = this.ignore;
- final Block bit = par1World.getBlock(x + xo, y + yo, z + zo);
- if (bit instanceof BlockLog) {
- f = 1;
- this.tre[o] = this.harvest;
- // if (bit instanceof BlockLog){
- // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" ");
- // }
- for (int xb = -1; xb < 2; xb++) {
- for (int yb = -1; yb < 2; yb++) {
- for (int zb = -1; zb < 2; zb++) {
- if (!this.setcheck(x + xb, y + yb, z + zb)) {
- return 3;
- }
- }
+
+ public int checkTree(World par1World,int xo,int yo,int zo){
+ boolean f;
+ for (f=true;f==true;){
+ f=false;
+ for (int y=0;y<80;y++)
+ for(int z=0;z<20;z++)
+ for(int x=0;x<20;x++){
+ int r=check(par1World,x,y,z,xo,yo,zo);
+ if (r==3) return 3;
+ if (r==2) return 2;
+ if (r==1) f=true;
}
- }
- }
- else if (bit instanceof BlockLeavesBase) {
- }
- else {
- if (!this.canIgnore(bit)) {
- return 2;
- }
+
+ for (int y=79;y>=0;y--)
+ for(int z=19;z>=0;z--)
+ for(int x=19;x>=0;x--){
+ int r=check(par1World,x,y,z,xo,yo,zo);
+ if (r==2) return 3;
+ if (r==2) return 2;
+ if (r==1) f=true;
+ }
+ }
+ return 1;
+ }
+
+ private int check2(World par1World, int x, int y, int z, int xo, int yo,int zo) {
+ int f=0;
+ int o=x+z*20+y*400;
+ if (tre[o]==needcheck){
+ tre[o]=ignore;
+ Block bit = par1World.getBlock(x+xo, y+yo, z+zo);
+ if (bit instanceof BlockLog){
+ f=1;
+ tre[o]=harvest;
+ //if (bit instanceof BlockLog){
+ // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" ");
+ //}
+ for(int xb=-1;xb<2;xb++)
+ for(int yb=-1;yb<2;yb++)
+ for(int zb=-1;zb<2;zb++)
+ if (!setcheck(x+xb,y+yb,z+zb))return 3;
+ }else if (bit instanceof BlockLeavesBase){
+ }else{
+ if (!canIgnore(bit)) return 2;
}
}
return f;
}
- public int checkTree(final World par1World, final int xo, final int yo, final int zo) {
+ public int checkTree2(World par1World,int xo,int yo,int zo){
boolean f;
- for (f = true; f == true;) {
- f = false;
- for (int y = 0; y < 80; y++) {
- for (int z = 0; z < 20; z++) {
- for (int x = 0; x < 20; x++) {
- final int r = this.check(par1World, x, y, z, xo, yo, zo);
- if (r == 3) {
- return 3;
- }
- if (r == 2) {
- return 2;
- }
- if (r == 1) {
- f = true;
- }
+ for (f=true;f==true;){
+ f=false;
+ for (int y=0;y<80;y++)
+ for(int z=0;z<20;z++)
+ for(int x=0;x<20;x++){
+ int r=check2(par1World,x,y,z,xo,yo,zo);
+ if (r==3) return 3;
+ if (r==2) return 2;
+ if (r==1) f=true;
}
- }
- }
-
- for (int y = 79; y >= 0; y--) {
- for (int z = 19; z >= 0; z--) {
- for (int x = 19; x >= 0; x--) {
- final int r = this.check(par1World, x, y, z, xo, yo, zo);
- if (r == 2) {
- return 3;
- }
- if (r == 2) {
- return 2;
- }
- if (r == 1) {
- f = true;
- }
+
+ for (int y=79;y>=0;y--)
+ for(int z=19;z>=0;z--)
+ for(int x=19;x>=0;x--){
+ int r=check2(par1World,x,y,z,xo,yo,zo);
+ if (r==2) return 3;
+ if (r==2) return 2;
+ if (r==1) f=true;
}
- }
- }
}
return 1;
}
-
- public int checkTree2(final World par1World, final int xo, final int yo, final int zo) {
- boolean f;
- for (f = true; f == true;) {
- f = false;
- for (int y = 0; y < 80; y++) {
- for (int z = 0; z < 20; z++) {
- for (int x = 0; x < 20; x++) {
- final int r = this.check2(par1World, x, y, z, xo, yo, zo);
- if (r == 3) {
- return 3;
- }
- if (r == 2) {
- return 2;
- }
- if (r == 1) {
- f = true;
+
+ public void exploadTree(World par1World,int xo,int yo,int zo, EntityPlayer plr){
+ for (int y=0;y<80;y++)
+ for(int z=0;z<20;z++)
+ for(int x=0;x<20;x++){
+ int o=x+z*20+y*400;
+ if (tre[o]==harvest){
+ Block bit = par1World.getBlock(x+xo, y+yo, z+zo);
+ int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo);
+
+ if ((bit instanceof BlockLog)||(bit instanceof BlockLeavesBase) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){
+ bit.harvestBlock(par1World, plr, x+xo, y+yo, z+zo,met);
+ par1World.setBlockToAir(x+xo, y+yo, z+zo);
}
}
}
- }
-
- for (int y = 79; y >= 0; y--) {
- for (int z = 19; z >= 0; z--) {
- for (int x = 19; x >= 0; x--) {
- final int r = this.check2(par1World, x, y, z, xo, yo, zo);
- if (r == 2) {
- return 3;
- }
- if (r == 2) {
- return 2;
- }
- if (r == 1) {
- f = true;
- }
- }
- }
- }
- }
- return 1;
}
- public void exploadMushroom(final World par1World, final int xo, final int yo, final int zo, final EntityPlayer plr,
- final boolean silk) {
- for (int y = 0; y < 80; y++) {
- for (int z = 0; z < 20; z++) {
- for (int x = 0; x < 20; x++) {
- final int o = x + z * 20 + y * 400;
- if (this.tre[o] == this.harvest) {
- final Block bit = par1World.getBlock(x + xo, y + yo, z + zo);
- final int met = par1World.getBlockMetadata(x + xo, y + yo, z + zo);
- if (bit instanceof BlockHugeMushroom) {
- this.breakMushroom(par1World, bit, plr, silk, x + xo, y + yo, z + zo, met);
- }
- else {
- bit.harvestBlock(par1World, plr, x + xo, y + yo, z + zo, met);
- par1World.setBlockToAir(x + xo, y + yo, z + zo);
- }
- }
- }
- }
+ private void breakMushroom(World wld, Block bit, EntityPlayer plr, boolean silk, int x, int y, int z, int met) {
+ if (silk){
+ ItemStack stk = null; //TODO
+ /*if (bit==Blocks.brown_mushroom_block) stk = new ItemStack(LoonToolItems.brown_mushroom_block,1,met);
+ else if (bit==Blocks.red_mushroom_block) stk = new ItemStack(LoonToolItems.red_mushroom_block,1,met);
+ else stk = new ItemStack(bit,1,met);*/
+ EntityItem entityitem = new EntityItem(wld, x+0.5, y+0.5, z+0.5, stk);
+ entityitem.delayBeforeCanPickup = 10;
+ wld.spawnEntityInWorld(entityitem);
+ }else{
+ bit.harvestBlock(wld, plr, x, y, z, met);
}
+ wld.setBlockToAir(x, y, z);
}
-
- public void exploadTree(final World par1World, final int xo, final int yo, final int zo, final EntityPlayer plr) {
- for (int y = 0; y < 80; y++) {
- for (int z = 0; z < 20; z++) {
- for (int x = 0; x < 20; x++) {
- final int o = x + z * 20 + y * 400;
- if (this.tre[o] == this.harvest) {
- final Block bit = par1World.getBlock(x + xo, y + yo, z + zo);
- final int met = par1World.getBlockMetadata(x + xo, y + yo, z + zo);
-
- if (bit instanceof BlockLog || bit instanceof BlockLeavesBase
- || bit.getUnlocalizedName().toLowerCase().contains("log")
- || bit.getUnlocalizedName().toLowerCase().contains("wood")) {
- bit.harvestBlock(par1World, plr, x + xo, y + yo, z + zo, met);
- par1World.setBlockToAir(x + xo, y + yo, z + zo);
+
+ public void exploadMushroom(World par1World,int xo,int yo,int zo, EntityPlayer plr, boolean silk){
+ for (int y=0;y<80;y++)
+ for(int z=0;z<20;z++)
+ for(int x=0;x<20;x++){
+ int o=x+z*20+y*400;
+ if (tre[o]==harvest){
+ Block bit = par1World.getBlock(x+xo, y+yo, z+zo);
+ int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo);
+ if (bit instanceof BlockHugeMushroom){
+ breakMushroom(par1World, bit, plr, silk, x+xo, y+yo, z+zo,met);
+ }else{
+ bit.harvestBlock(par1World, plr, x+xo, y+yo, z+zo,met);
+ par1World.setBlockToAir(x+xo, y+yo, z+zo);
}
}
}
- }
- }
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
- return EnumRarity.rare;
}
+
@Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
- return true;
- }
-
- @Override
- public boolean onBlockDestroyed(final ItemStack itm, final World wld, final Block blk, final int x, final int y,
- final int z, final EntityLivingBase plr) {
- if (!wld.isRemote) {
- final Block bit = wld.getBlock(x, y, z);
- final boolean silk = EnchantmentHelper.getSilkTouchModifier(plr);
- if (bit instanceof BlockHugeMushroom) {
- for (int n = 0; n < 32000; n++) {
- this.tre[n] = this.unchecked;
- }
- final int met = wld.getBlockMetadata(x, y, z);
- this.breakMushroom(wld, bit, (EntityPlayer) plr, silk, x, y, z, met);
- wld.setBlockToAir(x, y, z);
- this.tre[2210] = this.needcheck;
- if (this.checkTree(wld, x - 10, y - 4, z - 10) == 1) {
- this.exploadMushroom(wld, x - 10, y - 4, z - 10, (EntityPlayer) plr, silk);
+ public boolean onBlockDestroyed(ItemStack itm, World wld,Block blk, int x, int y,int z, EntityLivingBase plr) {
+ if (!wld.isRemote){
+ Block bit = wld.getBlock(x, y, z);
+ boolean silk=EnchantmentHelper.getSilkTouchModifier(plr);
+ if ((bit instanceof BlockHugeMushroom)){
+ for (int n=0;n<32000;n++) tre[n]=unchecked;
+ int met = wld.getBlockMetadata(x, y, z);
+ breakMushroom(wld, bit, (EntityPlayer) plr, silk, x, y, z,met);
+ wld.setBlockToAir(x,y,z);
+ tre[2210]=needcheck;
+ if (checkTree(wld,x-10,y-4,z-10)==1){
+ exploadMushroom(wld,x-10,y-4,z-10,(EntityPlayer) plr,silk);
}
}
-
- if (bit instanceof BlockLog || bit.getUnlocalizedName().toLowerCase().contains("log")
- || bit.getUnlocalizedName().toLowerCase().contains("wood")) {
- // LoonTools.log("cutting tree @ "+x+" "+y+" "+z+" ");
- for (int n = 0; n < 32000; n++) {
- this.tre[n] = this.unchecked;
- }
- final int met = wld.getBlockMetadata(x, y, z);
- bit.harvestBlock(wld, (EntityPlayer) plr, x, y, z, met);
- wld.setBlockToAir(x, y, z);
- this.tre[2210] = this.needcheck;
- if (this.checkTree(wld, x - 10, y - 4, z - 10) == 1) {
- this.exploadTree(wld, x - 10, y - 4, z - 10, (EntityPlayer) plr);
- }
- else {
- for (int n = 0; n < 32000; n++) {
- this.tre[n] = this.unchecked;
- }
- this.tre[2210] = this.needcheck;
- if (this.checkTree2(wld, x - 10, y - 4, z - 10) == 1) {
- this.exploadTree(wld, x - 10, y - 4, z - 10, (EntityPlayer) plr);
+
+ if (bit instanceof BlockLog || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){
+ //LoonTools.log("cutting tree @ "+x+" "+y+" "+z+" ");
+ for (int n=0;n<32000;n++) tre[n]=unchecked;
+ int met = wld.getBlockMetadata(x, y, z);
+ bit.harvestBlock(wld, (EntityPlayer) plr, x, y, z,met);
+ wld.setBlockToAir(x,y,z);
+ tre[2210]=needcheck;
+ if (checkTree(wld,x-10,y-4,z-10)==1){
+ exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr);
+ }else{
+ for (int n=0;n<32000;n++) tre[n]=unchecked;
+ tre[2210]=needcheck;
+ if (checkTree2(wld,x-10,y-4,z-10)==1){
+ exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr);
}
}
}
}
return super.onBlockDestroyed(itm, wld, blk, x, y, z, plr);
}
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(ItemStack par1ItemStack){
+ return EnumRarity.rare;
+ }
- private boolean setcheck(final int x, final int y, final int z) {
- if (x < 0 || x > 19 || z < 0 || z > 19 || y < 0 || y > 79) {
- return false;
- }
- final int o = x + z * 20 + y * 400;
- if (this.tre[o] == this.unchecked) {
- this.tre[o] = this.needcheck;
- }
+ @Override
+ public boolean hasEffect(ItemStack par1ItemStack){
return true;
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java
index 5096b94054..079e3cfc39 100644
--- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java
+++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java
@@ -1,362 +1,350 @@
package gtPlusPlus.core.item.tool.staballoy;
-import java.util.List;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
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.*;
-import net.minecraft.util.*;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemPickaxe;
+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 StaballoyPickaxe extends ItemPickaxe {
-
- protected Boolean FACING_HORIZONTAL = true;
+public class StaballoyPickaxe extends ItemPickaxe{
- protected String FACING = "north";
- protected EntityPlayer localPlayer;
- protected String lookingDirection;
- protected World localWorld;
- public ItemStack thisPickaxe = null;
- public StaballoyPickaxe(final String unlocalizedName, final ToolMaterial material) {
- super(material);
- this.setUnlocalizedName(unlocalizedName);
- this.setTextureName(CORE.MODID + ":" + unlocalizedName);
- this.FACING_HORIZONTAL = true;
- this.setMaxStackSize(1);
- this.setMaxDamage(3200);
+ /* (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
- *
- *
- *
+ *
+ *
+ *
+ * Methods
+ *
+ *
+ *
*/
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- this.thisPickaxe = stack;
- 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);
+ 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);
}
@SuppressWarnings("static-method")
- private float calculateDurabilityLoss(final World world, final int X, final int Y, final int Z) {
+ private float calculateDurabilityLoss(World world, int X, int Y, int Z){
float bDurabilityLoss = 0;
Boolean correctTool = false;
float bHardness = 0;
- if (!world.isRemote) {
+ if (!world.isRemote){
try {
- final Block removalist = world.getBlock(X, Y, Z);
- // Utils.LOG_WARNING(removalist.toString());
+ Block removalist = world.getBlock(X, Y, Z);
+ //Utils.LOG_WARNING(removalist.toString());
bHardness = removalist.getBlockHardness(world, X, Y, Z);
- Utils.LOG_WARNING("Hardness: " + bHardness);
+ Utils.LOG_WARNING("Hardness: "+bHardness);
- bDurabilityLoss = bDurabilityLoss + bHardness;
- // Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss);
+ bDurabilityLoss = (bDurabilityLoss + bHardness);
+ //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss);
- correctTool = this.canPickaxeBlock(removalist, world);
- Utils.LOG_WARNING("" + correctTool);
+ correctTool = canPickaxeBlock(removalist, world);
+ Utils.LOG_WARNING(""+correctTool);
- if (!correctTool) {
+ if (!correctTool){
return 0;
}
- }
- catch (final NullPointerException e) {
+ } catch (NullPointerException e){
}
}
return 100;
}
- public Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld) {
+ public Boolean canPickaxeBlock(Block currentBlock, World currentWorld){
String correctTool = "";
- if (!currentWorld.isRemote) {
+ if (!currentWorld.isRemote){
try {
correctTool = currentBlock.getHarvestTool(0);
- // Utils.LOG_WARNING(correctTool);
- if (UtilsMining.getBlockType(currentBlock) || correctTool.equals("pickaxe")) {
- return true;
- }
- }
- catch (final NullPointerException e) {
- return false;
- }
+ //Utils.LOG_WARNING(correctTool);
+ if (UtilsMining.getBlockType(currentBlock) || correctTool.equals("pickaxe")){
+ return true;}
+ } catch (NullPointerException e){
+ return false;}
}
return false;
}
- public boolean checkFacing(final World world) {
- this.localWorld = world;
- if (this.localPlayer != null) {
- final int direction = MathHelper.floor_double(this.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; }
- */
-
- final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world,
- this.localPlayer, false);
- if (movingobjectposition != null) {
- final int sideHit = movingobjectposition.sideHit;
- String playerStandingPosition = "";
- if (movingobjectposition != null) {
- // System.out.println("Side Hit:
- // "+movingobjectposition.sideHit);
- }
-
- if (sideHit == 0) {
- playerStandingPosition = "above";
- this.FACING_HORIZONTAL = false;
- }
- else if (sideHit == 1) {
- playerStandingPosition = "below";
- this.FACING_HORIZONTAL = false;
- }
- else if (sideHit == 2) {
- playerStandingPosition = "facingSouth";
- this.FACING_HORIZONTAL = true;
- }
- else if (sideHit == 3) {
- playerStandingPosition = "facingNorth";
- this.FACING_HORIZONTAL = true;
- }
- else if (sideHit == 4) {
- playerStandingPosition = "facingEast";
- this.FACING_HORIZONTAL = true;
- }
- else if (sideHit == 5) {
- playerStandingPosition = "facingWest";
- this.FACING_HORIZONTAL = true;
- }
- this.lookingDirection = playerStandingPosition;
-
- if (direction == 0) {
- this.FACING = "south";
- }
- else if (direction == 1) {
- this.FACING = "west";
- }
- else if (direction == 2) {
- this.FACING = "north";
- }
- else if (direction == 3) {
- this.FACING = "east";
- }
- }
-
- return true;
- }
- return false;
- }
-
- public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer) {
- item.damageItem(damage, localPlayer);
- }
-
- private void GetDestroyOrientation(final String FACING, final World world, final int X, final int Y, final int Z,
- final ItemStack heldItem) {
- this.localWorld = world;
+ 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 (!world.isRemote){
- if (FACING.equals("below") || FACING.equals("above")) {
+ if (FACING.equals("below") || FACING.equals("above")){
DURABILITY_LOSS = 0;
- for (int i = -1; i < 2; i++) {
- for (int j = -1; j < 2; j++) {
- final float dur = this.calculateDurabilityLoss(world, X + i, Y, Z + j);
- DURABILITY_LOSS = DURABILITY_LOSS + dur;
- Utils.LOG_WARNING("Added Loss: " + dur);
- this.removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem);
+ for(int i = -1; i < 2; i++) {
+ for(int j = -1; j < 2; j++) {
+ float dur = calculateDurabilityLoss(world, X + i, Y, Z + j);
+ DURABILITY_LOSS = (DURABILITY_LOSS + dur);
+ Utils.LOG_WARNING("Added Loss: "+dur);
+ removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem);
}
}
}
- else if (FACING.equals("facingEast") || FACING.equals("facingWest")) {
+ 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++) {
- final float dur = this.calculateDurabilityLoss(world, X, Y + i, Z + j);
- DURABILITY_LOSS = DURABILITY_LOSS + dur;
- Utils.LOG_WARNING("Added Loss: " + dur);
- this.removeBlockAndDropAsItem(world, X, Y + i, Z + j, heldItem);
+ for(int i = -1; i < 2; i++) {
+ for(int j = -1; j < 2; j++) {
+ float dur = calculateDurabilityLoss(world, X, Y + i, Z + j);
+ DURABILITY_LOSS = (DURABILITY_LOSS + dur);
+ Utils.LOG_WARNING("Added Loss: "+dur);
+ removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem);
}
}
}
- else if (FACING.equals("facingNorth") || FACING.equals("facingSouth")) {
+ 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++) {
- final float dur = this.calculateDurabilityLoss(world, X + j, Y + i, Z);
- DURABILITY_LOSS = DURABILITY_LOSS + dur;
- Utils.LOG_WARNING("Added Loss: " + dur);
- this.removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem);
+ for(int i = -1; i < 2; i++) {
+ for(int j = -1; j < 2; j++) {
+ float dur = calculateDurabilityLoss(world, X + j, Y + i, Z);
+ DURABILITY_LOSS = (DURABILITY_LOSS + dur);
+ Utils.LOG_WARNING("Added Loss: "+dur);
+ 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());
- final int itemdmg = heldItem.getItemDamage();
- final int maxdmg = heldItem.getMaxDamage();
- final int dodmg = (int) DURABILITY_LOSS;
- final int durNow = maxdmg - itemdmg;
- final 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
+ //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) <= (99) && itemdmg != 0){
+ //TODO break tool
Utils.LOG_INFO("Breaking Tool");
heldItem.stackSize = 0;
}
- // Do Damage
+ //Do Damage
else {
- // setItemDamage(heldItem, durLeft);
- Utils.LOG_INFO("" + (durNow - durLeft));
- this.damageItem(heldItem, durNow - durLeft - 1, this.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());
+
+
+ /*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;
}
}
-
- /*
- * (non-Javadoc)
- *
- * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.
- * ItemStack)
- */
- @Override
- public double getDurabilityForDisplay(final ItemStack stack) {
- if (super.getDurabilityForDisplay(stack) > 0) {
- return super.getDurabilityForDisplay(stack);
- }
- return 0;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
- return EnumRarity.rare;
- }
-
- @Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
- return true;
- }
-
- @Override
- public boolean onBlockDestroyed(final ItemStack stack, final World world, final Block block, final int X,
- final int Y, final int Z, final EntityLivingBase entity) {
- // super.onBlockDestroyed(stack, world, block, X, Y, Z, entity);
- this.localWorld = world;
- this.thisPickaxe = stack;
- // checkFacing(world);
- if (!world.isRemote) {
- this.GetDestroyOrientation(this.lookingDirection, world, X, Y, Z, stack);
- }
-
- return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity);
- }
-
- @Override
- public boolean onBlockStartBreak(final ItemStack itemstack, final int X, final int Y, final int Z,
- final EntityPlayer aPlayer) {
- this.thisPickaxe = itemstack;
- this.localPlayer = aPlayer;
- this.checkFacing(this.localPlayer.worldObj);
- return super.onBlockStartBreak(itemstack, X, Y, Z, aPlayer);
+
+ public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){
+ item.damageItem(damage, localPlayer);
}
-
- @Override
- public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer aPlayer) {
- this.localPlayer = aPlayer;
- this.localWorld = world;
- this.thisPickaxe = stack;
- return super.onItemRightClick(stack, world, aPlayer);
+
+ public void setItemDamage(ItemStack item, int damage){
+ item.setItemDamage(damage-1);
}
- // Should clear up blocks quicker if I chain it.
- public void removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z,
- final ItemStack heldItem) {
- this.localWorld = world;
+ //Should clear up blocks quicker if I chain it.
+ public void removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){
+ localWorld = world;
try {
- final Block block = world.getBlock(X, Y, Z);
- final float dur = this.calculateDurabilityLoss(world, X, Y, Z);
+ Block block = world.getBlock(X, Y, Z);
+ float dur = calculateDurabilityLoss(world, X, Y, Z);
Utils.LOG_WARNING(block.toString());
String removalTool = "";
removalTool = block.getHarvestTool(1);
-
- if (removalTool.equals("pickaxe") || UtilsMining.getBlockType(block)) {
- if (this.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);
-
+
+ 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);
+
}
-
+
}
}
else {
Utils.LOG_WARNING("Incorrect Tool for mining this block.");
}
}
+ } catch (NullPointerException e){
+
}
- catch (final NullPointerException e) {
+ }
+
+ 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.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
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(ItemStack par1ItemStack){
+ return EnumRarity.rare;
+ }
+
+ @Override
+ public boolean hasEffect(ItemStack par1ItemStack){
+ return true;
}
- public void setItemDamage(final ItemStack item, final int damage) {
- item.setItemDamage(damage - 1);
+
+ @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 StaballoyPickaxe(String unlocalizedName, ToolMaterial material) {
+ super(material);
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.FACING_HORIZONTAL=true;
+ this.setMaxStackSize(1);
+ this.setMaxDamage(3200);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java
index 210bdcf378..79eac5816b 100644
--- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java
+++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java
@@ -1,327 +1,316 @@
package gtPlusPlus.core.item.tool.staballoy;
-import java.util.List;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
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.*;
-import net.minecraft.util.*;
+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 {
-
- protected Boolean FACING_HORIZONTAL = true;
+public class StaballoySpade extends ItemSpade{
- protected String FACING = "north";
- protected EntityPlayer localPlayer;
- protected String lookingDirection;
- protected World localWorld;
- public ItemStack thisPickaxe = null;
- public StaballoySpade(final String unlocalizedName, final ToolMaterial material) {
- super(material);
- this.setUnlocalizedName(unlocalizedName);
- this.setTextureName(CORE.MODID + ":" + unlocalizedName);
- this.FACING_HORIZONTAL = true;
- this.setMaxStackSize(1);
- this.setMaxDamage(3200);
+ /* (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
- *
- *
- *
+ *
+ *
+ *
+ * Methods
+ *
+ *
+ *
*/
- @SuppressWarnings({
- "unchecked", "rawtypes"
- })
@Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- this.thisPickaxe = stack;
- list.add(EnumChatFormatting.GOLD + "Spades a 3x3 area in the direction you are facing.");
- super.addInformation(stack, aPlayer, list, bool);
+ public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer aPlayer) {
+ localPlayer = aPlayer;
+ localWorld = world;
+ thisPickaxe = stack;
+ return super.onItemRightClick(stack, world, aPlayer);
}
- public Boolean canPickaxeBlock(final Block currentBlock, final 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 (final NullPointerException e) {
- return false;
- }
- }
- return false;
- }
- public boolean checkFacing(final World world) {
- this.localWorld = world;
- if (this.localPlayer != null) {
- final int direction = MathHelper.floor_double(this.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; }
- */
-
- final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world,
- this.localPlayer, false);
- if (movingobjectposition != null) {
- final int sideHit = movingobjectposition.sideHit;
- String playerStandingPosition = "";
- if (movingobjectposition != null) {
- // System.out.println("Side Hit:
- // "+movingobjectposition.sideHit);
- }
+ @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);
+ }
- if (sideHit == 0) {
- playerStandingPosition = "above";
- this.FACING_HORIZONTAL = false;
- }
- else if (sideHit == 1) {
- playerStandingPosition = "below";
- this.FACING_HORIZONTAL = false;
- }
- else if (sideHit == 2) {
- playerStandingPosition = "facingSouth";
- this.FACING_HORIZONTAL = true;
- }
- else if (sideHit == 3) {
- playerStandingPosition = "facingNorth";
- this.FACING_HORIZONTAL = true;
- }
- else if (sideHit == 4) {
- playerStandingPosition = "facingEast";
- this.FACING_HORIZONTAL = true;
- }
- else if (sideHit == 5) {
- playerStandingPosition = "facingWest";
- this.FACING_HORIZONTAL = true;
- }
- this.lookingDirection = playerStandingPosition;
+ return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity);
+ }
- if (direction == 0) {
- this.FACING = "south";
- }
- else if (direction == 1) {
- this.FACING = "west";
- }
- else if (direction == 2) {
- this.FACING = "north";
- }
- else if (direction == 3) {
- this.FACING = "east";
- }
- }
+ public Boolean canPickaxeBlock(Block currentBlock, World currentWorld){
+ String correctTool = "";
+ if (!currentWorld.isRemote){
+ try {
+ correctTool = currentBlock.getHarvestTool(0);
+ //Utils.LOG_WARNING(correctTool);
- return true;
+ 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;
}
- public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer) {
- item.damageItem(damage, localPlayer);
- }
-
- private void GetDestroyOrientation(final String FACING, final World world, final int X, final int Y, final int Z,
- final ItemStack heldItem) {
- this.localWorld = world;
+ 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 (!world.isRemote){
- if (FACING.equals("below") || FACING.equals("above")) {
+ 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
- + this.removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem);
+ 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")) {
+ 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
- + this.removeBlockAndDropAsItem(world, X, Y + i, Z + j, heldItem);
+ 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")) {
+ 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
- + this.removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem);
+ 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());
- final int itemdmg = heldItem.getItemDamage();
- final int maxdmg = heldItem.getMaxDamage();
- final int dodmg = (int) DURABILITY_LOSS;
- final int durNow = maxdmg - itemdmg;
- final 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
+ //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
+ //Do Damage
else {
- // setItemDamage(heldItem, durLeft);
- Utils.LOG_INFO("" + (durNow - durLeft));
- this.damageItem(heldItem, durNow - durLeft - 1, this.localPlayer);
+ //setItemDamage(heldItem, durLeft);
+ Utils.LOG_INFO(""+(durNow-durLeft));
+ damageItem(heldItem, (durNow-durLeft)-1, localPlayer);
}
DURABILITY_LOSS = 0;
}
}
- /*
- * (non-Javadoc)
- *
- * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.
- * ItemStack)
- */
- @Override
- public double getDurabilityForDisplay(final ItemStack stack) {
- if (super.getDurabilityForDisplay(stack) > 0) {
- return super.getDurabilityForDisplay(stack);
- }
- return 0;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public EnumRarity getRarity(final ItemStack par1ItemStack) {
- return EnumRarity.rare;
- }
-
- @Override
- public boolean hasEffect(final ItemStack par1ItemStack) {
- return true;
- }
-
- @Override
- public boolean onBlockDestroyed(final ItemStack stack, final World world, final Block block, final int X,
- final int Y, final int Z, final EntityLivingBase entity) {
- // super.onBlockDestroyed(stack, world, block, X, Y, Z, entity);
- this.localWorld = world;
- this.thisPickaxe = stack;
- // checkFacing(world);
- if (!world.isRemote) {
- this.GetDestroyOrientation(this.lookingDirection, world, X, Y, Z, stack);
- }
-
- return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity);
- }
-
- @Override
- public boolean onBlockStartBreak(final ItemStack itemstack, final int X, final int Y, final int Z,
- final EntityPlayer aPlayer) {
- this.thisPickaxe = itemstack;
- this.localPlayer = aPlayer;
- this.checkFacing(this.localPlayer.worldObj);
- return super.onBlockStartBreak(itemstack, X, Y, Z, aPlayer);
+ public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){
+ item.damageItem(damage, localPlayer);
}
- @Override
- public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer aPlayer) {
- this.localPlayer = aPlayer;
- this.localWorld = world;
- this.thisPickaxe = stack;
- return super.onItemRightClick(stack, world, aPlayer);
+ public void setItemDamage(ItemStack item, int damage){
+ item.setItemDamage(damage-1);
}
- // Should clear up blocks quicker if I chain it.
- public int removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z,
- final ItemStack heldItem) {
- this.localWorld = world;
+ //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 {
- final Block block = world.getBlock(X, Y, Z);
+ 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 (this.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) {
-
- final int itemdmg = heldItem.getItemDamage();
- final int maxdmg = heldItem.getMaxDamage();
- final int dodmg = 100;
- final int durNow = maxdmg - itemdmg;
- final int durLeft = 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;
+ 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;
}
- Utils.LOG_INFO(
- "Incorrect Tool for mining this block. Wrong Block Water/lava/bedrock/blacklist");
- 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. Cannot Shovel this block type.");
+ 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. Blocks mining tool is now Shovel.");
+ Utils.LOG_INFO("Incorrect Tool for mining this block. Cannot Shovel this block type.");
return 0;
}
- Utils.LOG_INFO("Either the block was air or it declares an invalid mining tool.");
+ Utils.LOG_INFO("Incorrect Tool for mining this block. Blocks mining tool is now Shovel.");
return 0;
- }
- catch (final NullPointerException e) {
+ }
+ 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 void setItemDamage(final ItemStack item, final int damage) {
- item.setItemDamage(damage - 1);
+ 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);
}
}