aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/core/item
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/core/item')
-rw-r--r--src/main/java/gtPlusPlus/core/item/ModItems.java1238
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java582
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemBackpack.java92
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemBrain.java109
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemBurnable.java44
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemColourable.java98
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java566
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemDamageable.java201
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemGeneric.java28
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemLoot.java109
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemTCShard.java82
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemTickable.java341
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemWithCharge.java76
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java27
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/BasicSpawnEgg.java254
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/CoreItem.java237
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java11
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java70
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java83
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java145
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java44
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java126
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java162
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java58
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java58
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/foil/BaseItemFoil.java11
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java50
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java80
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/gears/BaseItemGear.java11
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/gears/BaseItemSmallGear.java11
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java21
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java110
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java101
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java61
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java71
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java100
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java41
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java156
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java94
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java114
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java104
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java161
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java115
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockSpawner.java39
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java174
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java57
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java12
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ore/BaseItemCentrifugedCrushedOre.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ore/BaseItemCrushedOre.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ore/BaseItemImpureDust.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java25
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedCrushedOre.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedDust.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java279
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java18
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java20
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlateHeavy.java47
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java95
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/rings/BaseItemRing.java12
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/rods/BaseItemRod.java12
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java18
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java11
-rw-r--r--src/main/java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java12
-rw-r--r--src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java190
-rw-r--r--src/main/java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java259
-rw-r--r--src/main/java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java197
-rw-r--r--src/main/java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java137
-rw-r--r--src/main/java/gtPlusPlus/core/item/bauble/HealthBoostBauble.java39
-rw-r--r--src/main/java/gtPlusPlus/core/item/bauble/ModularBauble.java408
-rw-r--r--src/main/java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java175
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java614
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/CoalTar.java378
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java1133
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/IonParticles.java165
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java820
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/NuclearChem.java116
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/OilChem.java45
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/RocketFuels.java1071
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java161
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java319
-rw-r--r--src/main/java/gtPlusPlus/core/item/chemistry/general/ItemNuclearChemBase.java152
-rw-r--r--src/main/java/gtPlusPlus/core/item/circuit/ItemAdvancedChip.java237
-rw-r--r--src/main/java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java114
-rw-r--r--src/main/java/gtPlusPlus/core/item/effects/RarityEffect.java42
-rw-r--r--src/main/java/gtPlusPlus/core/item/effects/RarityEpic.java29
-rw-r--r--src/main/java/gtPlusPlus/core/item/effects/RarityRare.java29
-rw-r--r--src/main/java/gtPlusPlus/core/item/effects/RarityUncommon.java23
-rw-r--r--src/main/java/gtPlusPlus/core/item/food/BaseItemMetaFood.java431
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/BaseItemGrindle.java84
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/BedLocator_Base.java107
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/BufferCore.java72
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemAirFilter.java141
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemAreaClear.java202
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java85
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java153
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java295
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemCloakingDevice.java259
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemControlCore.java128
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemCreativeTab.java59
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemEmpty.java21
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemGemShards.java78
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemGenericToken.java182
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemGiantEgg.java300
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemHalfCompleteCasings.java63
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemHealingDevice.java432
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemLavaFilter.java127
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java140
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java211
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/RF2EU_Battery.java315
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/books/ItemBaseBook.java130
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java246
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/chassis/ItemBoilerChassis.java86
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoil.java93
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoilWire.java93
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java223
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java13
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java84
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java285
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java30
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java30
-rw-r--r--src/main/java/gtPlusPlus/core/item/general/throwables/ItemThrowableBomb.java124
-rw-r--r--src/main/java/gtPlusPlus/core/item/init/ItemsFoods.java80
-rw-r--r--src/main/java/gtPlusPlus/core/item/init/ItemsMultiTools.java74
-rw-r--r--src/main/java/gtPlusPlus/core/item/materials/DustDecayable.java97
-rw-r--r--src/main/java/gtPlusPlus/core/item/materials/MaterialHandler.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/ConnectedBlockFinder.java142
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/DebugScanner.java104
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/FakeGregtechTool.java74
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/GregtechPump.java1302
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java80
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java11
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java59
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java328
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java243
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java11
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java13
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java311
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java126
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java345
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java462
-rw-r--r--src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java411
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/WearableLoader.java15
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/armour/ArmourLoader.java41
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmour.java11
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourBoots.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourChest.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourHelm.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourLegs.java10
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java117
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/armour/tinfoil/ArmourTinFoilHat.java183
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/base/BaseItemWearable.java65
-rw-r--r--src/main/java/gtPlusPlus/core/item/wearable/hazmat/ItemArmorHazmatEx.java31
152 files changed, 24095 insertions, 0 deletions
diff --git a/src/main/java/gtPlusPlus/core/item/ModItems.java b/src/main/java/gtPlusPlus/core/item/ModItems.java
new file mode 100644
index 0000000000..fca4c5d3c6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/ModItems.java
@@ -0,0 +1,1238 @@
+package gtPlusPlus.core.item;
+import static gtPlusPlus.core.creative.AddToCreativeTab.tabMachines;
+import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc;
+import static gtPlusPlus.core.lib.CORE.LOAD_ALL_CONTENT;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_OreDictUnificator;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.block.base.BasicBlock.BlockTypes;
+import gtPlusPlus.core.block.base.BlockBaseModular;
+import gtPlusPlus.core.common.compat.COMPAT_Baubles;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.*;
+import gtPlusPlus.core.item.base.BaseItemComponent.ComponentTypes;
+import gtPlusPlus.core.item.base.cell.BaseItemCell;
+import gtPlusPlus.core.item.base.dusts.BaseItemDust;
+import gtPlusPlus.core.item.base.foil.BaseItemFoil;
+import gtPlusPlus.core.item.base.foods.BaseItemFood;
+import gtPlusPlus.core.item.base.foods.BaseItemHotFood;
+import gtPlusPlus.core.item.base.gears.BaseItemSmallGear;
+import gtPlusPlus.core.item.base.ingots.BaseItemIngot;
+import gtPlusPlus.core.item.base.ingots.BaseItemIngot_OLD;
+import gtPlusPlus.core.item.base.misc.BaseItemMisc;
+import gtPlusPlus.core.item.base.misc.BaseItemMisc.MiscTypes;
+import gtPlusPlus.core.item.base.plates.BaseItemPlate;
+import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble;
+import gtPlusPlus.core.item.bauble.*;
+import gtPlusPlus.core.item.chemistry.*;
+import gtPlusPlus.core.item.crafting.ItemDummyResearch;
+import gtPlusPlus.core.item.effects.RarityUncommon;
+import gtPlusPlus.core.item.food.BaseItemMetaFood;
+import gtPlusPlus.core.item.general.*;
+import gtPlusPlus.core.item.general.books.ItemBaseBook;
+import gtPlusPlus.core.item.general.capture.ItemEntityCatcher;
+import gtPlusPlus.core.item.general.chassis.ItemBoilerChassis;
+import gtPlusPlus.core.item.general.chassis.ItemDehydratorCoil;
+import gtPlusPlus.core.item.general.chassis.ItemDehydratorCoilWire;
+import gtPlusPlus.core.item.general.spawn.ItemCustomSpawnEgg;
+import gtPlusPlus.core.item.general.throwables.ItemHydrofluoricAcidPotion;
+import gtPlusPlus.core.item.general.throwables.ItemSulfuricAcidPotion;
+import gtPlusPlus.core.item.general.throwables.ItemThrowableBomb;
+import gtPlusPlus.core.item.init.ItemsFoods;
+import gtPlusPlus.core.item.materials.DustDecayable;
+import gtPlusPlus.core.item.tool.misc.DebugScanner;
+import gtPlusPlus.core.item.tool.misc.GregtechPump;
+import gtPlusPlus.core.item.tool.misc.SandstoneHammer;
+import gtPlusPlus.core.item.tool.misc.box.AutoLunchBox;
+import gtPlusPlus.core.item.tool.misc.box.MagicToolBag;
+import gtPlusPlus.core.item.tool.misc.box.UniversalToolBox;
+import gtPlusPlus.core.item.tool.staballoy.*;
+import gtPlusPlus.core.item.wearable.WearableLoader;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.CORE.ConfigSwitches;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.*;
+import gtPlusPlus.core.material.nuclear.FLUORIDES;
+import gtPlusPlus.core.material.nuclear.NUCLIDE;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.data.StringUtils;
+import gtPlusPlus.core.util.debug.DEBUG_INIT;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.everglades.GTplusplus_Everglades;
+import gtPlusPlus.preloader.CORE_Preloader;
+import gtPlusPlus.xmod.cofh.HANDLER_COFH;
+import gtPlusPlus.xmod.eio.material.MaterialEIO;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
+import gtPlusPlus.xmod.gregtech.common.helpers.VolumetricFlaskHelper;
+import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems;
+import net.minecraft.item.*;
+import net.minecraft.item.Item.ToolMaterial;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.common.util.EnumHelper;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+public final class ModItems {
+
+ public static ToolMaterial STABALLOY = EnumHelper.addToolMaterial("Staballoy", 3, 2500, 7, 1.0F, 18);
+
+ public static Item ZZZ_Empty;
+ public static Item AAA_Broken;
+
+
+ public static Item itemAlkalusDisk;
+ public static Item itemDebugShapeSpawner;
+ public static ItemCustomSpawnEgg itemCustomSpawnEgg;
+
+ //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;
+ public static Item itemDustSoularium;
+ public static Item itemDustRedstoneAlloy;
+ public static Item itemDustElectricalSteel;
+ public static Item itemDustPulsatingIron;
+ public static Item itemDustEnergeticAlloy;
+ public static Item itemDustVibrantAlloy;
+ public static Item itemDustConductiveIron;
+ //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 itemHydrogenBlob;
+ 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 Item itemPersonalFireProofDevice;
+ public static Item itemSlowBuildingRing;
+
+ public static MultiPickaxeBase MP_GTMATERIAL;
+ public static MultiSpadeBase MS_GTMATERIAL;
+
+ 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 dustUranium232;
+ 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 dustLi2CO3CaOH2;
+ public static Item dustLi2BeF4;
+
+ public static Item dustTumbagaMix;
+
+ public static Item dustAer;
+ public static Item dustIgnis;
+ public static Item dustTerra;
+ public static Item dustAqua;
+
+ public static Item cellHydrogenChlorideMix;
+
+ public static BaseEuItem metaItem2;
+
+ public static Item shardAer;
+ public static Item shardIgnis;
+ public static Item shardTerra;
+ public static Item shardAqua;
+
+ //Tc Compat for energy crystal recipes
+ public static Item shardDull;
+
+ //Lighter
+ public static Item itemBasicFireMaker;
+
+ //Zirconium
+ public static Item itemZirconiumChlorideCinterPellet;
+ public static Item dustZrCl4;
+ public static Item dustCookedZrCl4;
+ public static Item dustZrF4;
+
+ public static Item dustNaBF4NaF;
+ public static Item dustLiFBeF2ZrF4UF4;
+ public static Item dustLiFBeF2ZrF4U235;
+ public static Item dustLiFBeF2ThF4UF4;
+
+ public static Item dustCalciumSulfate;
+
+ public static Item dustFertUN18;
+ public static Item dustFertUN32;
+
+ //public static Fluid fluidFLiBeSalt;
+ //public static Fluid fluidFLiBeSaltBurnt;
+
+ public static Fluid fluidLftrCore1;
+ public static Fluid fluidLftrCore2;
+ public static Fluid fluidLftrCore3;
+ public static Fluid fluidLftrCore4;
+ public static Fluid fluidLftrBlanket1;
+ public static Fluid fluidLftrBlanket2;
+ public static Fluid fluidLftrBlanket3;
+ public static Fluid fluidNuclearWaste;
+
+
+ //Possibly missing base items that GT may be missing.
+
+ public static Item itemSmallWroughtIronGear;
+ public static Item itemPlateRawMeat;
+ public static Item itemPlateClay;
+ public static Item itemPlateLithium;
+ public static Item itemPlateEuropium;
+ public static Item itemPlateVanadium;
+ public static Item itemDoublePlateClay;
+ public static Item itemDoublePlateEuropium;
+ public static Item itemFoilUranium235;
+ public static Item itemDustIndium;
+ public static BlockBaseModular blockRawMeat;
+
+ public static Item itemBoilerChassis;
+ public static Item itemDehydratorCoilWire;
+ public static Item itemDehydratorCoil;
+
+ public static Item itemLavaFilter;
+ public static Item itemAirFilter;
+
+ public static Item itemCoalCoke;
+ public static Item itemCactusCharcoal;
+ public static Item itemSugarCharcoal;
+ public static Item itemCactusCoke;
+ public static Item itemSugarCoke;
+
+ public static Item itemCircuitLFTR;
+ public static Item itemBasicTurbine;
+
+ public static Item itemDebugAreaClear;
+
+ public static Item itemGemShards;
+ public static Item itemHalfCompleteCasings;
+
+ public static Item itemSulfuricPotion;
+ public static Item itemHydrofluoricPotion;
+
+ public static Item itemModularBauble;
+ public static Item itemCustomBook;
+
+ public static Item itemGrindleTablet;
+ public static Item itemRope;
+ public static Item itemFiber;
+ public static Item itemDragonJar;
+
+ //Unstable Elements & Related Content
+ public static Item dustNeptunium238;
+ public static Item dustDecayedRadium226;
+ public static Item dustRadium226;
+ public static Item dustProtactinium233;
+
+ public static ItemGiantEgg itemBigEgg;
+
+ public static GregtechPump toolGregtechPump;
+
+ public static ItemGenericToken itemGenericToken;
+
+ public static Item itemControlCore;
+
+ public static ItemStack itemHotTitaniumIngot;
+
+ public static Fluid fluidZrF4;
+
+ public static Item boxTools;
+ public static Item boxFood;
+ public static Item boxMagic;
+
+ public static DustDecayable dustMolybdenum99;
+ public static DustDecayable dustTechnetium99;
+ public static DustDecayable dustTechnetium99M;
+
+ public static IonParticles itemIonParticleBase;
+ public static StandardBaseParticles itemStandarParticleBase;
+
+ public static BatteryPackBaseBauble itemChargePack_Low_1;
+ public static BatteryPackBaseBauble itemChargePack_Low_2;
+ public static BatteryPackBaseBauble itemChargePack_Low_3;
+ public static BatteryPackBaseBauble itemChargePack_Low_4;
+ public static BatteryPackBaseBauble itemChargePack_Low_5;
+ public static BatteryPackBaseBauble itemChargePack_High_1;
+ public static BatteryPackBaseBauble itemChargePack_High_2;
+ public static BatteryPackBaseBauble itemChargePack_High_3;
+ public static BatteryPackBaseBauble itemChargePack_High_4;
+
+ public static DebugScanner itemDebugScanner;
+
+ public static ItemDummyResearch itemDummyResearch;
+
+ public static CoreItem itemBombCasing;
+ public static CoreItem itemBombUnf;
+ public static CoreItem itemDetCable;
+ public static ItemThrowableBomb itemBomb;
+
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Zombie;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Skeleton;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Spider;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Creeper;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Enderman;
+
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Nether;
+ public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Infernal;
+
+ public static CoreItem itemExquisiteIndustrialDiamond;
+
+ public static BaseItemMetaFood itemMetaFood;
+
+ static {
+ Logger.INFO("Items!");
+ //Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon.
+ AAA_Broken = new BaseItemIngot_OLD("AAA_Broken", "Errors - Tell Alkalus", Utils.rgbtoHexValue(128, 128, 128), 0);
+ ZZZ_Empty = new ItemEmpty();
+ }
+
+ public static final void init(){
+
+ itemDebugScanner = new DebugScanner();
+
+ itemAlkalusDisk = new BaseItemDamageable("itemAlkalusDisk", AddToCreativeTab.tabMisc, 1, 0, "Unknown Use", EnumRarity.rare, EnumChatFormatting.AQUA, false, null);
+ itemBigEgg = new ItemGiantEgg();
+ itemGenericToken = new ItemGenericToken();
+ itemDummyResearch = new ItemDummyResearch();
+ itemCustomSpawnEgg = new ItemCustomSpawnEgg();
+
+ //Debug Loading
+ if (CORE_Preloader.DEBUG_MODE){
+ DEBUG_INIT.registerItems();
+ }
+
+ itemDebugAreaClear = new ItemAreaClear();
+
+ //Register meta item, because we need them for everything.
+ MetaGeneratedGregtechItems.INSTANCE.generateMetaItems();
+
+ //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.getItemStackFromFQRN(CORE.MODID+":itemStickyRubber", 1));
+
+ //Register Hydrogen Blobs first, so we can replace old helium blobs.
+ itemHydrogenBlob = new CoreItem("itemHydrogenBlob", "Mysterious Hydrogen Blob", tabMisc).setTextureName(CORE.MODID + ":itemHeliumBlob");
+ //Register Old Helium Blob, this will be replaced when held by a player.
+ itemHeliumBlob = new CoreItem("itemHeliumBlob", tabMisc, ItemUtils.getSimpleStack(itemHydrogenBlob)).setTextureName(CORE.MODID + ":itemHydrogenBlob");
+
+ //Register this neato device, for making some fires.
+ itemBasicFireMaker = new ItemBasicFirestarter();
+
+ //Register Rope
+ itemFiber = new CoreItem("itemFiber", "Plant Fiber", tabMisc);
+ itemRope = new CoreItem("itemRope", "Rope", tabMisc);
+
+ //Load Wearable Items
+ WearableLoader.run();
+
+ //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));
+
+
+ //Load Custom Box/bags
+ boxTools = new UniversalToolBox("Tool Box");
+ boxFood = new AutoLunchBox("Eatotron-9000");
+ boxMagic = new MagicToolBag("Mystic Bag");
+
+ itemBlueprintBase = new ItemBlueprint("itemBlueprint");
+
+ itemGemShards = new ItemGemShards("itemGemShards", "Gem Shards", AddToCreativeTab.tabMisc, 32, 0, "They glitter in the light", EnumRarity.rare, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(182, 114, 18)).setTextureName(CORE.MODID + ":itemHeliumBlob");
+ itemHalfCompleteCasings = new ItemHalfCompleteCasings("itemHalfCompleteCasings", AddToCreativeTab.tabMisc, 32, 0, "This isn't quite finished yet.", EnumRarity.common, EnumChatFormatting.GRAY, false, Utils.rgbtoHexValue(255, 255, 255)).setTextureName("gregtech" + ":" + "gt.metaitem.01/" + "761");
+ itemSulfuricPotion = new ItemSulfuricAcidPotion("itemSulfuricPotion", "Throwable Vial of Sulfuric Acid", "Burn your foes alive!").setTextureName(CORE.MODID + ":itemSulfuricAcidPotion");
+ itemHydrofluoricPotion = new ItemHydrofluoricAcidPotion("itemHydrofluoricPotion", "Throwable Vial of Hydrofluoric Acid", "They won't see this coming, nor anything after!").setTextureName(CORE.MODID + ":itemPotion");
+ //Start meta Item Generation
+ ItemsFoods.load();
+
+
+ try{
+
+ /**
+ * Try generate dusts for missing rare earth materials if they don't exist
+ */
+
+ if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGadolinium", 1))){
+ ItemUtils.generateSpecialUseDusts("Gadolinium", "Gadolinium", Materials.Gadolinium.mElement.name(), Utils.rgbtoHexValue(226, 172, 9));
+ }
+ if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustYtterbium", 1))){
+ ItemUtils.generateSpecialUseDusts("Ytterbium", "Ytterbium", Materials.Ytterbium.mElement.name(), Utils.rgbtoHexValue(Materials.Yttrium.mRGBa[0]-60, Materials.Yttrium.mRGBa[1]-60, Materials.Yttrium.mRGBa[2]-60));
+ }
+ if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustSamarium", 1))){
+ ItemUtils.generateSpecialUseDusts("Samarium", "Samarium", Materials.Samarium.mElement.name(), Utils.rgbtoHexValue(161, 168, 114));
+ }
+ if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustLanthanum", 1))){
+ ItemUtils.generateSpecialUseDusts("Lanthanum", "Lanthanum", Materials.Lanthanum.mElement.name(), Utils.rgbtoHexValue(106, 127, 163));
+ }
+ if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGermanium", 1))){
+ ItemUtils.generateSpecialUseDusts("Germanium", "Germanium", "Ge", ELEMENT.getInstance().GERMANIUM.getRgbAsHex());
+ }
+
+
+ //Elements generate first so they can be used in compounds.
+ //Missing Elements
+ MaterialGenerator.generate(ELEMENT.getInstance().SELENIUM); //LFTR byproduct
+ MaterialGenerator.generate(ELEMENT.getInstance().BROMINE);
+ MaterialGenerator.generate(ELEMENT.getInstance().KRYPTON); //LFTR byproduct
+ MaterialGenerator.generate(ELEMENT.getInstance().STRONTIUM);
+ MaterialGenerator.generate(ELEMENT.getInstance().ZIRCONIUM);
+ MaterialGenerator.generate(ELEMENT.getInstance().RUTHENIUM);
+ MaterialGenerator.generate(ELEMENT.getInstance().IODINE); //LFTR byproduct
+ MaterialGenerator.generate(ELEMENT.getInstance().HAFNIUM);
+ MaterialGenerator.generate(ELEMENT.getInstance().DYSPROSIUM);
+ MaterialGenerator.generate(ELEMENT.getInstance().ERBIUM);
+ MaterialGenerator.generate(ELEMENT.getInstance().PRASEODYMIUM);
+ MaterialGenerator.generate(ELEMENT.getInstance().TELLURIUM); //LFTR byproduct
+ MaterialGenerator.generate(ELEMENT.getInstance().RHODIUM);
+ MaterialGenerator.generate(ELEMENT.getInstance().RHENIUM);
+ MaterialGenerator.generate(ELEMENT.getInstance().THALLIUM);
+
+ //RADIOACTIVE ELEMENTS
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().TECHNETIUM, false); //LFTR byproduct
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().POLONIUM, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().ASTATINE, false);
+ //MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().RADON, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().FRANCIUM, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().RADIUM, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PROMETHIUM, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().ACTINIUM, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PROTACTINIUM, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().NEPTUNIUM, false); //LFTR byproduct
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().CURIUM, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().BERKELIUM, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().CALIFORNIUM, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().EINSTEINIUM, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().FERMIUM, false);
+
+
+ //Nuclear Isotopes
+
+ //Lithium-7 is used as a part of the molten lithium fluoride in molten salt reactors: liquid-fluoride nuclear reactors.
+ //The large neutron-absorption cross-section of lithium-6 (about 940 barns[5]) as compared with the very small
+ //neutron cross-section of lithium-7 (about 45 millibarns) makes high separation of lithium-7 from natural lithium a
+ //strong requirement for the possible use in lithium fluoride reactors.
+ MaterialGenerator.generate(ELEMENT.getInstance().LITHIUM7, false);
+ //Thorium-232 is the most stable isotope of Thorium, purified for nuclear fuel use in this case.
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().THORIUM232);
+ //Production of 233U (through the neutron irradiation of 232Th) invariably produces small amounts of 232U as an impurity
+ //because of parasitic (n,2n) reactions on uranium-233 itself, or on protactinium-233, or on thorium-232:
+ MaterialGenerator.generate(ELEMENT.getInstance().URANIUM232);
+ //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);
+ //Plutonium-238 is a very powerful alpha emitter. This makes the plutonium-238 isotope suitable for usage in radioisotope thermoelectric generators (RTGs)
+ //and radioisotope heater units - one gram of plutonium-238 generates approximately 0.5 W of thermal power.
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PLUTONIUM238, false);
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustPlutonium239", 1) == null || Utils.getGregtechVersionAsInt() < 50931) {
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().PLUTONIUM239, false);
+ }
+
+ //RTG Fuel Materials
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().STRONTIUM90, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().POLONIUM210, false);
+ MaterialGenerator.generateNuclearMaterial(ELEMENT.getInstance().AMERICIUM241, false);
+
+ if (!CORE.GTNH) {
+ MaterialGenerator.generateOreMaterialWithAllExcessComponents(ELEMENT.getInstance().TRINIUM);
+ }
+
+ //Custom Materials that will have standalone refinery processes
+ MaterialGenerator.generate(ELEMENT.STANDALONE.ADVANCED_NITINOL, false);
+ MaterialGenerator.generate(ELEMENT.STANDALONE.ASTRAL_TITANIUM);
+ MaterialGenerator.generate(ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN);
+ MaterialGenerator.generate(ELEMENT.STANDALONE.HYPOGEN);
+ MaterialGenerator.generate(ELEMENT.STANDALONE.CHRONOMATIC_GLASS);
+
+ //Custom Materials that are from Runescape
+ MaterialGenerator.generate(ELEMENT.STANDALONE.BLACK_METAL);
+ MaterialGenerator.generate(ELEMENT.STANDALONE.WHITE_METAL);
+ MaterialGenerator.generateOreMaterialWithAllExcessComponents(ELEMENT.STANDALONE.GRANITE);
+ MaterialGenerator.generateOreMaterialWithAllExcessComponents(ELEMENT.STANDALONE.RUNITE);
+ MaterialGenerator.generate(ELEMENT.STANDALONE.DRAGON_METAL, false);
+
+ MISC_MATERIALS.run();
+
+
+ //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);
+ MaterialGenerator.generate(ALLOY.TUNGSTEN_TITANIUM_CARBIDE);
+
+ //LFTR Fuel components
+ //MaterialGenerator.generate(MISC_MATERIALS.HYDROXIDE); //LFTR fuel component
+ //MaterialGenerator.generate(MISC_MATERIALS.AMMONIA); //LFTR fuel component
+ //MaterialGenerator.generate(MISC_MATERIALS.AMMONIUM); //LFTR fuel component
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.AMMONIUM_BIFLUORIDE); //LFTR fuel component
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.BERYLLIUM_HYDROXIDE); //LFTR fuel component
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.AMMONIUM_TETRAFLUOROBERYLLATE); //LFTR fuel component
+
+ //Generate Fluorides
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.BERYLLIUM_FLUORIDE);
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.LITHIUM_FLUORIDE);
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.THORIUM_TETRAFLUORIDE);
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.THORIUM_HEXAFLUORIDE);
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.URANIUM_TETRAFLUORIDE, false);
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.URANIUM_HEXAFLUORIDE, false);
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.ZIRCONIUM_TETRAFLUORIDE);
+ //LFTR Fluoride outputs
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.NEPTUNIUM_HEXAFLUORIDE);
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.TECHNETIUM_HEXAFLUORIDE);
+ MaterialGenerator.generateNuclearDusts(FLUORIDES.SELENIUM_HEXAFLUORIDE);
+
+ //Generate Reactor Fuel Salts
+ MaterialGenerator.generateNuclearDusts(NUCLIDE.LiFBeF2ZrF4U235);
+ MaterialGenerator.generateNuclearDusts(NUCLIDE.LiFBeF2ZrF4UF4);
+ MaterialGenerator.generateNuclearDusts(NUCLIDE.LiFBeF2ThF4UF4);
+ //MaterialGenerator.generateNuclearMaterial(NUCLIDE.Li2BeF4, false);
+
+ //Generate some Alloys
+
+ //Misc Alloys
+ MaterialGenerator.generate(ALLOY.ENERGYCRYSTAL);
+ MaterialGenerator.generate(ALLOY.BLOODSTEEL);
+
+ MaterialGenerator.generate(ALLOY.ZERON_100);
+ //Tumbaga was the name given by Spaniards to a non-specific alloy of gold and copper
+ MaterialGenerator.generate(ALLOY.TUMBAGA);
+ //Potin is traditionally an alloy of bronze, tin and lead, with varying quantities of each possible
+ MaterialGenerator.generate(ALLOY.POTIN);
+
+ //Staballoy & Tantalloy
+ MaterialGenerator.generate(ALLOY.STABALLOY);
+ MaterialGenerator.generate(ALLOY.TANTALLOY_60);
+ MaterialGenerator.generate(ALLOY.TANTALLOY_61);
+
+ //Inconel
+ MaterialGenerator.generate(ALLOY.INCONEL_625);
+ MaterialGenerator.generate(ALLOY.INCONEL_690);
+ MaterialGenerator.generate(ALLOY.INCONEL_792);
+
+
+ //Steels
+ MaterialGenerator.generateDusts(ALLOY.EGLIN_STEEL_BASE);
+ MaterialGenerator.generate(ALLOY.EGLIN_STEEL);
+ MaterialGenerator.generate(ALLOY.MARAGING250);
+ MaterialGenerator.generate(ALLOY.MARAGING300);
+ MaterialGenerator.generate(ALLOY.MARAGING350);
+ MaterialGenerator.generate(ALLOY.AQUATIC_STEEL);
+
+ MaterialGenerator.generate(ALLOY.NITINOL_60,true,false);
+
+ //Composite Alloys
+ MaterialGenerator.generate(ALLOY.STELLITE);
+ MaterialGenerator.generate(ALLOY.TALONITE);
+
+ //Hastelloy
+ MaterialGenerator.generate(ALLOY.HASTELLOY_W);
+ MaterialGenerator.generate(ALLOY.HASTELLOY_X);
+ MaterialGenerator.generate(ALLOY.HASTELLOY_C276);
+ MaterialGenerator.generate(ALLOY.HASTELLOY_N);
+
+ //Incoloy
+ MaterialGenerator.generate(ALLOY.INCOLOY_020);
+ MaterialGenerator.generate(ALLOY.INCOLOY_DS);
+ MaterialGenerator.generate(ALLOY.INCOLOY_MA956);
+
+ //Leagrisium
+ MaterialGenerator.generate(ALLOY.LEAGRISIUM);
+
+ //Super Conductor
+ MaterialGenerator.generate(ALLOY.HG1223, false, false);
+
+ //Generate Fictional Materials
+ if (!CORE.GTNH) {
+ MaterialGenerator.generate(ELEMENT.getInstance().TRINIUM, false);
+ MaterialGenerator.generate(ELEMENT.getInstance().TRINIUM_REFINED, false);
+ }
+ MaterialGenerator.generate(ALLOY.TRINIUM_TITANIUM);
+ MaterialGenerator.generate(ALLOY.TRINIUM_NAQUADAH, false);
+ MaterialGenerator.generate(ALLOY.TRINIUM_NAQUADAH_CARBON);
+ MaterialGenerator.generate(ALLOY.TRINIUM_REINFORCED_STEEL);
+
+ //Top Tier Alloys
+ MaterialGenerator.generate(ALLOY.HELICOPTER);
+ MaterialGenerator.generate(ALLOY.LAFIUM);
+ MaterialGenerator.generate(ALLOY.CINOBITE);
+ MaterialGenerator.generate(ALLOY.PIKYONIUM);
+ MaterialGenerator.generate(ALLOY.ABYSSAL);
+ MaterialGenerator.generate(ALLOY.LAURENIUM);
+ MaterialGenerator.generate(ALLOY.BOTMIUM);
+ MaterialGenerator.generate(ALLOY.HS188A);
+
+
+ MaterialGenerator.generate(ALLOY.TITANSTEEL);
+ MaterialGenerator.generate(ALLOY.ARCANITE);
+ MaterialGenerator.generate(ALLOY.OCTIRON);
+
+ MaterialGenerator.generate(ALLOY.BABBIT_ALLOY, false);
+ MaterialGenerator.generate(ALLOY.BLACK_TITANIUM, false);
+
+ // High Level Bioplastic
+ MaterialGenerator.generate(ELEMENT.STANDALONE.RHUGNOR, false, false);
+
+
+
+
+
+
+
+
+ //Must be the final Alloy to Generate
+ MaterialGenerator.generate(ALLOY.QUANTUM);
+
+ //Ores
+ MaterialGenerator.generateOreMaterial(FLUORIDES.FLUORITE);
+ MaterialGenerator.generateOreMaterial(ALLOY.KOBOLDITE);
+ GTplusplus_Everglades.GenerateOreMaterials();
+
+
+ } catch (final Throwable r){
+ Logger.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);
+ }
+
+ //TC Style Shards, for use in making energy crystal mix.
+ //A dull shard, able to be infused with an element.
+ shardDull = new BaseItemTCShard("Drained", Utils.rgbtoHexValue(75, 75, 75), "Can be infused to create a magical shard.", "Obtained from Mining Stone/SandStone, Chopping Logs or Shovelling Dirt.");
+
+ //Generates four elemental shards when TC is not installed.
+ if (!LoadedMods.Thaumcraft){
+ shardAer = new BaseItemTCShard("Aer", Utils.rgbtoHexValue(225, 225, 5));
+ shardIgnis = new BaseItemTCShard("Ignis", Utils.rgbtoHexValue(255, 5, 5));
+ shardTerra = new BaseItemTCShard("Terra", Utils.rgbtoHexValue(5, 255, 5));
+ shardAqua = new BaseItemTCShard("Aqua", Utils.rgbtoHexValue(5, 5, 255));
+ }
+ else {
+ shardAer = ItemUtils.getItemStackWithMeta(LoadedMods.Thaumcraft, "Thaumcraft:ItemShard", "Air Shard", 0, 1).getItem();
+ shardIgnis = ItemUtils.getItemStackWithMeta(LoadedMods.Thaumcraft, "Thaumcraft:ItemShard", "Fire Shard", 1, 1).getItem();
+ shardAqua = ItemUtils.getItemStackWithMeta(LoadedMods.Thaumcraft, "Thaumcraft:ItemShard", "Warer Shard", 2, 1).getItem();
+ shardTerra = ItemUtils.getItemStackWithMeta(LoadedMods.Thaumcraft, "Thaumcraft:ItemShard", "Earth Shard", 3, 1).getItem();
+ }
+ //Generates a set of four special dusts to be used in my recipes.
+ dustAer = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().AER, true)[0];
+ dustIgnis = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().IGNIS, true)[0];
+ dustTerra = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().TERRA, true)[0];
+ dustAqua = ItemUtils.generateSpecialUseDusts(ELEMENT.getInstance().AQUA, true)[0];
+
+ ItemUtils.generateSpecialUseDusts(MISC_MATERIALS.WOODS_GLASS, false);
+ cellHydrogenChlorideMix = new BaseItemCell("hydrogenchloridemix", "Hydrogen Chloride Mix", MISC_MATERIALS.HYDROGEN_CHLORIDE.getRGB());
+
+ //Nuclear Fuel Dusts
+ dustLithiumCarbonate = ItemUtils.generateSpecialUseDusts("LithiumCarbonate", "Lithium Carbonate", "Li2CO3", Utils.rgbtoHexValue(240, 240, 240))[0]; //https://en.wikipedia.org/wiki/Lithium_carbonate
+ dustLithiumPeroxide = ItemUtils.generateSpecialUseDusts("LithiumPeroxide", "Lithium Peroxide", "Li2O2", Utils.rgbtoHexValue(250, 250, 250))[0]; //https://en.wikipedia.org/wiki/Lithium_peroxide
+ dustLithiumHydroxide = ItemUtils.generateSpecialUseDusts("LithiumHydroxide", "Lithium Hydroxide", "LiOH", Utils.rgbtoHexValue(250, 250, 250))[0]; //https://en.wikipedia.org/wiki/Lithium_hydroxide
+
+ if (!ItemUtils.checkForInvalidItems(ItemUtils.getItemStackOfAmountFromOreDict("dustQuicklime", 1)) && !LoadedMods.IHL){
+ dustQuicklime = ItemUtils.generateSpecialUseDusts("Quicklime", "Quicklime", "CaO", Utils.rgbtoHexValue(255, 255, 175))[0]; //https://en.wikipedia.org/wiki/Calcium_oxide
+ }
+ dustCalciumHydroxide = ItemUtils.generateSpecialUseDusts("CalciumHydroxide", "Hydrated Lime", "Ca(OH)2", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_hydroxide
+ dustCalciumCarbonate = ItemUtils.generateSpecialUseDusts("CalciumCarbonate", "Calcium Carbonate", "CaCO3", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_carbonate
+ if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGypsum", 1) == null) || (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustCalciumSulfate", 1) == null)){
+ dustCalciumSulfate = ItemUtils.generateSpecialUseDusts("Gypsum", "Calcium Sulfate (Gypsum)", "CaSO4", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_sulfate
+ GT_OreDictUnificator.registerOre("dustCalciumSulfate", ItemUtils.getSimpleStack(dustCalciumSulfate));
+ }
+ else {
+ GT_OreDictUnificator.registerOre("dustCalciumSulfate", ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustGypsum", 1));
+ }
+ dustLi2CO3CaOH2 = ItemUtils.generateSpecialUseDusts("Li2CO3CaOH2", "Li2CO3 + Ca(OH)2 Compound", "Li2CO3CaOH2", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/Calcium_carbonate
+ MaterialUtils.generateSpecialDustAndAssignToAMaterial(FLUORIDES.SODIUM_FLUORIDE, false);
+ //FLiBe Fuel Compounds
+ dustLi2BeF4 = ItemUtils.generateSpecialUseDusts("Li2BeF4", "Lithium Tetrafluoroberyllate Fuel Compound", "Li2BeF4", Utils.rgbtoHexValue(255, 255, 255))[0]; //https://en.wikipedia.org/wiki/FLiBe
+ Material.registerComponentForMaterial(NUCLIDE.Li2BeF4, OrePrefixes.dust, ItemUtils.getSimpleStack(dustLi2BeF4));
+ //fluidFLiBeSalt = ("Li2BeF4", "Li2BeF4", 7430, new short[]{255, 255, 255, 100}, 0);
+ //fluidFLiBeSalt = FluidUtils.addGTFluidNoPrefix("Li2BeF4", "Lithium Tetrafluoroberyllate", new short[]{255, 255, 255, 100}, 0, 743, null, CI.emptyCells(1), 1000, true);
+ //fluidFLiBeSaltBurnt = FluidUtils.addGTFluidNoPrefix("Li2BeF2UF4", "Li2BeF2UF4", new short[]{50, 255, 50, 100}, 0, 743, null, CI.emptyCells(1), 1000, true);
+
+ // LFTR Core Fluid Processing
+ //fluidLftrCore1 = FluidUtils.addGTFluidNoPrefix("LiBeF2UF4FP", "LiBeF2UF4FP", new short[]{110, 255, 110, 100}, 0, 800, null, CI.emptyCells(1), 1000, true);
+ //fluidLftrCore2 = FluidUtils.addGTFluidNoPrefix("UF6F2FP", "UF6F2FP", new short[]{150, 255, 150, 100}, 0, 800, null, CI.emptyCells(1), 1000, true);
+ //fluidLftrCore3 = FluidUtils.addGTFluidNoPrefix("LiFBeF2", "LiFBeF2", new short[]{100, 255, 50, 100}, 0, 800, null, CI.emptyCells(1), 1000, true);
+ //fluidLftrCore4 = FluidUtils.addGTFluidNoPrefix("LiFBeF2UF4", "LiFBeF2UF4", new short[]{50, 255, 100, 100}, 0, 800, null, CI.emptyCells(1), 1000, true);
+ // LFTR Blanket Fluid Processing
+ //fluidLftrBlanket1 = FluidUtils.addGTFluidNoPrefix("LiFThF4", "LiFThF4", new short[]{50, 150, 255, 50}, 0, 500, null, CI.emptyCells(1), 1000, true);
+ //fluidLftrBlanket2 = FluidUtils.addGTFluidNoPrefix("LiFBeF2ThF4", "LiFBeF2ThF4", new short[]{100, 150, 100, 100}, 0, 500, null, CI.emptyCells(1), 1000, true);
+ //fluidLftrBlanket3 = FluidUtils.addGTFluidNoPrefix("UF6F2", "UF6F2", new short[]{10, 150, 10, 100}, 0, 500, null, CI.emptyCells(1), 1000, true);
+ fluidNuclearWaste = FluidUtils.addGTFluidNoPrefix("nuclear.waste", "Nuclear Waste", new short[]{10, 250, 10, 100}, 0, 1000, null, CI.emptyCells(1), 1000, true);
+
+
+ //LFTR Control Circuit
+ itemCircuitLFTR = new CoreItem("itemCircuitLFTR", ""+EnumChatFormatting.GREEN+"Control Circuit", AddToCreativeTab.tabMisc, 1, 0, new String[] {"Keeps Multiblocks Stable"}, EnumRarity.epic, EnumChatFormatting.DARK_GREEN, false, null);
+
+ if (CORE.ConfigSwitches.enableMachine_Pollution) {
+ itemBasicTurbine = new ItemBasicScrubberTurbine();
+ }
+
+ //Zirconium
+ //Cinter Pellet.
+ itemZirconiumChlorideCinterPellet = new CoreItem("itemZirconiumPellet", "Zirconium Pellet ["+StringUtils.subscript("ZrCl4")+"]", tabMisc).setTextureName(CORE.MODID + ":itemShard");
+ GT_OreDictUnificator.registerOre("pelletZirconium", new ItemStack(itemZirconiumChlorideCinterPellet));
+ //Zirconium Chloride
+ dustZrCl4 = ItemUtils.generateSpecialUseDusts("ZrCl4", "ZrCl4", "ZrCl4", Utils.rgbtoHexValue(180, 180, 180))[0]; //http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/39/036/39036750.pdf
+ dustCookedZrCl4 = ItemUtils.generateSpecialUseDusts("CookedZrCl4", "Cooked ZrCl4", "ZrCl4", Utils.rgbtoHexValue(180, 180, 180))[0]; //http://www.iaea.org/inis/collection/NCLCollectionStore/_Public/39/036/39036750.pdf
+
+ //Zirconium Tetrafluoride
+ /*GT_OreDictUnificator.registerOre("cellZrF4", ItemUtils.getItemStackOfAmountFromOreDict("cellZirconiumTetrafluoride", 1));
+ GT_OreDictUnificator.registerOre("dustZrF4", ItemUtils.getItemStackOfAmountFromOreDict("dustZirconiumTetrafluoride", 1));*/
+ //GT_OreDictUnificator.registerOre("cellZrF4", ItemUtils.getItemStackOfAmountFromOreDict("cellZirconiumTetrafluoride", 1));
+ //GT_OreDictUnificator.registerOre("dustZrF4", ItemUtils.getItemStackOfAmountFromOreDict("dustZirconiumTetrafluoride", 1));
+ fluidZrF4 = FluidUtils.generateFluidNoPrefix("ZirconiumTetrafluoride", "Zirconium Tetrafluoride", 500, new short[]{170, 170, 140, 100}); //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride
+ FLUORIDES.ZIRCONIUM_TETRAFLUORIDE.setFluid(fluidZrF4);
+
+ //Coolant Salt
+ //NaBF4 - NaF - 621C
+ //dustNaBF4NaF = ItemUtils.generateSpecialUseDusts("NaBF4NaF", "NaBF4NaF", Utils.rgbtoHexValue(45, 45, 90))[0]; //https://en.wikipedia.org/wiki/Zirconium_tetrafluoride
+
+
+ //Load Tree Farmer
+ if (CORE.ConfigSwitches.enableMultiblock_TreeFarmer){ //https://en.wikipedia.org/wiki/UAN
+ dustFertUN18 = ItemUtils.generateSpecialUseDusts("UN18Fertiliser", "UN-18 Fertiliser", Utils.rgbtoHexValue(60, 155, 60))[0];
+ dustFertUN32 = ItemUtils.generateSpecialUseDusts("UN32Fertiliser", "UN-32 Fertiliser", Utils.rgbtoHexValue(55, 190, 55))[0];
+
+ ItemStack temp1 = null;
+ ItemStack temp2 = null;
+
+ if (LoadedMods.IndustrialCraft2){
+ temp1 = ItemUtils.getCorrectStacktype("IC2:itemFertilizer", 1);
+ }
+ if (LoadedMods.Forestry){
+ temp2 = ItemUtils.getCorrectStacktype("Forestry:fertilizerCompound", 1);
+ }
+ if (temp1 != null){
+ FluidUtils.generateFluidNonMolten("Fertiliser", "Fertiliser", 32, new short[]{45, 170, 45, 100}, temp1, temp2, true);
+ }
+ FluidUtils.generateFluidNonMolten("UN32Fertiliser", "UN-32 Fertiliser", 24, new short[]{55, 190, 55, 100}, null, null, true);
+ FluidUtils.generateFluidNonMolten("UN18Fertiliser", "UN-18 Fertiliser", 22, new short[]{60, 155, 60, 100}, null, null, true);
+
+ /*GT_Values.RA.addMixerRecipe(
+ arg0, //Item In
+ arg1,
+ arg2,
+ arg3,
+ arg4, //Fluid in
+ arg5, //Fluid Out
+ arg6, //Item out
+ arg7, //Eu
+ arg8); //Time
+ */
+
+ }
+
+ //Juice
+ FluidUtils.generateFluidNonMolten("RaisinJuice", "Raisin Juice", 2, new short[]{51, 0, 51, 100}, ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foodRaisins", 1), ItemUtils.getItemStackOfAmountFromOreDictNoBroken("fruitRaisins", 1), 50, true);
+
+
+ //Test items
+ 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);
+
+ toolGregtechPump = new GregtechPump();
+ toolGregtechPump.registerPumpType(0, "Simple Hand Pump", 0, 0);
+ toolGregtechPump.registerPumpType(1, "Advanced Hand Pump", 32000, 1);
+ toolGregtechPump.registerPumpType(2, "Super Hand Pump", 128000, 2);
+ toolGregtechPump.registerPumpType(3, "Ultimate Hand Pump", 512000, 3);
+
+ //Create Multi-tools
+ //ItemsMultiTools.load();
+
+ //Xp Fluids - Dev
+ if (!FluidRegistry.isFluidRegistered("mobessence")){
+ FluidUtils.generateFluidNoPrefix("mobessence", "mobessence", 0, new short[]{125, 175, 125, 100});
+ }
+ if (!FluidRegistry.isFluidRegistered("xpjuice")){
+ FluidUtils.generateFluidNoPrefix("xpjuice", "xpjuice", 0, new short[]{50, 150, 50, 100});
+ }
+
+ //Just an unusual plate needed for some black magic.
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateClay", 1) == null){
+ itemPlateClay = new BaseItemPlate(NONMATERIAL.CLAY);
+ }
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDoubleClay", 1) == null){
+ itemDoublePlateClay = new BaseItemPlateDouble(NONMATERIAL.CLAY);
+ }
+
+ //Need this for Mutagenic Frames
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("foilUranium235", 1) == null){
+ itemFoilUranium235 = new BaseItemFoil(ELEMENT.getInstance().URANIUM235);
+ }
+
+ //A small gear needed for wizardry.
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("gearGtSmallWroughtIron", 1) == null){
+ itemSmallWroughtIronGear = new BaseItemSmallGear(NONMATERIAL.WROUGHT_IRON);
+ }
+ //Krypton Processing
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHotTitanium", 1) == null){
+ itemHotTitaniumIngot = ItemUtils.getSimpleStack(new BaseItemIngot(ELEMENT.getInstance().TITANIUM, ComponentTypes.HOTINGOT));
+ }
+ else {
+ itemHotTitaniumIngot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHotTitanium", 1);
+ }
+
+ //Need this for Laurenium
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("dustIndium", 1) == null){
+ itemDustIndium = new BaseItemDust(ELEMENT.getInstance().INDIUM);
+ }
+
+ //Industrial Diamonds
+ itemExquisiteIndustrialDiamond = new CoreItem("IndustrialDiamondExquisite", "High Quality Industrial Diamond", tabMisc);
+ ItemStack tempStack = itemExquisiteIndustrialDiamond.getStack();
+ ItemUtils.addItemToOreDictionary(tempStack, "gemDiamond");
+ ItemUtils.addItemToOreDictionary(tempStack, "craftingIndustrialDiamond");
+ ItemUtils.addItemToOreDictionary(tempStack, "gemExquisiteDiamond");
+ ItemUtils.addItemToOreDictionary(tempStack, "craftingExquisiteIndustrialDiamond");
+
+ //Custom GT++ Crafting Components
+
+ //Springs
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SPRING, ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SPRING, ELEMENT.STANDALONE.WHITE_METAL);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SPRING, ALLOY.NITINOL_60);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SPRING, ALLOY.AQUATIC_STEEL);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SPRING, ALLOY.EGLIN_STEEL);
+
+ //Small Springs
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SMALLSPRING, ALLOY.MARAGING250);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SMALLSPRING, ALLOY.NICHROME);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SMALLSPRING, ALLOY.STABALLOY);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SMALLSPRING, ALLOY.STEEL_BLACK);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.SMALLSPRING, ALLOY.BLACK_TITANIUM);
+
+ //Fine Wire
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ELEMENT.STANDALONE.WHITE_METAL);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ELEMENT.getInstance().PALLADIUM);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ELEMENT.getInstance().ZIRCONIUM);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ALLOY.LEAGRISIUM);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ALLOY.BABBIT_ALLOY);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ALLOY.KOBOLDITE);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ALLOY.HG1223);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.FINEWIRE, ALLOY.QUANTUM);
+
+ //Dense Plates
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.POTIN);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.AQUATIC_STEEL);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.BRONZE);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.OSMIRIDIUM);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.QUANTUM);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.STEEL_BLACK);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.STAINLESS_STEEL);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.EGLIN_STEEL);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.MARAGING300);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ALLOY.TALONITE);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.HYPOGEN);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.RHUGNOR);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.ADVANCED_NITINOL);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.ASTRAL_TITANIUM);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.WHITE_METAL);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.BLACK_METAL);
+ MaterialUtils.generateComponentAndAssignToAMaterial(ComponentTypes.PLATEHEAVY, ELEMENT.STANDALONE.GRANITE);
+
+
+
+
+ //Special Sillyness
+ if (true) {
+
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateSodium", 1) == null){
+ new BaseItemPlate(ELEMENT.getInstance().SODIUM);
+ }
+
+ Material meatRaw = NONMATERIAL.MEAT;
+ // A plate of Meat.
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateMeatRaw", 1) == null){
+ itemPlateRawMeat = new BaseItemPlate(meatRaw);
+ ItemUtils.registerFuel(ItemUtils.getSimpleStack(itemPlateRawMeat), 100);
+ }
+ // A Block of Meat.
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("blockMeatRaw", 1) == null){
+ blockRawMeat = new BlockBaseModular(meatRaw, BlockTypes.STANDARD);
+ ItemUtils.registerFuel(ItemUtils.getSimpleStack(blockRawMeat), 900);
+ }
+ }
+
+
+ // A plate of Vanadium.
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateVanadium", 1) == null){
+ itemPlateVanadium = new BaseItemPlate(ELEMENT.getInstance().VANADIUM);
+ }
+
+ //A plate of Lithium.
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateLithium", 1) == null){
+ itemPlateLithium = new BaseItemPlate(ELEMENT.getInstance().LITHIUM);
+ }
+
+ //A plate of Europium.
+ if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateEuropium", 1) == null) && CORE.ConfigSwitches.enableCustom_Pipes){
+ itemPlateEuropium = new BaseItemPlate(ELEMENT.getInstance().EUROPIUM);
+ }
+ if ((ItemUtils.getItemStackOfAmountFromOreDictNoBroken("plateDoubleEuropium", 1) == null) && CORE.ConfigSwitches.enableCustom_Pipes){
+ itemDoublePlateEuropium = new BaseItemPlateDouble(ELEMENT.getInstance().EUROPIUM);
+ }
+
+ //Tumbaga Mix (For Simple Crafting)
+ dustTumbagaMix = ItemUtils.generateSpecialUseDusts("MixTumbaga", "Tumbaga Mix", "Au2Cu", Utils.rgbtoHexValue(255, 150, 80))[0];
+
+ /*
+ * Decayable Materials
+ */
+
+ dustNeptunium238 = new DustDecayable("dustNeptunium238", Utils.rgbtoHexValue(175, 240, 75), 50640, new String[] {""+StringUtils.superscript("238Np"), "Result: Plutonium 238 ("+StringUtils.superscript("238Pu")+")"}, ELEMENT.getInstance().PLUTONIUM238.getDust(1).getItem(), 5);
+ dustDecayedRadium226 = ItemUtils.generateSpecialUseDusts("DecayedRadium226", "Decayed Radium-226", "Contains Radon ("+StringUtils.superscript("222Rn")+")", ELEMENT.getInstance().RADIUM.getRgbAsHex())[0];
+ dustRadium226 = new DustDecayable("dustRadium226", ELEMENT.getInstance().RADIUM.getRgbAsHex(), 90000, new String[] {""+StringUtils.superscript("226Ra"), "Result: Radon ("+StringUtils.superscript("222Rn")+")"}, ItemUtils.getSimpleStack(dustDecayedRadium226).getItem(), 5);
+ dustProtactinium233 = new DustDecayable("dustProtactinium233", ELEMENT.getInstance().PROTACTINIUM.getRgbAsHex(), 32000, new String[] {""+StringUtils.superscript("233Pa"), "Result: Uranium 233("+StringUtils.superscript("233U")+")"}, ELEMENT.getInstance().URANIUM233.getDust(1).getItem(), 6);
+ dustTechnetium99 = new DustDecayable("dustTechnetium99", ELEMENT.getInstance().TECHNETIUM.getRgbAsHex(), 164500, new String[] {""+StringUtils.superscript("99Mo"), "Result: Ruthenium 99("+StringUtils.superscript("99Ru")+")"}, ELEMENT.getInstance().RUTHENIUM.getDust(1).getItem(), 4);
+ dustTechnetium99M = new DustDecayable("dustTechnetium99M", ELEMENT.getInstance().TECHNETIUM.getRgbAsHex(), 8570, new String[] {""+StringUtils.superscript("99ᵐTc"), "Result: Technicium 99 ("+StringUtils.superscript("99Tc")+")"}, dustTechnetium99, 4);
+ dustMolybdenum99 = new DustDecayable("dustMolybdenum99", ELEMENT.getInstance().MOLYBDENUM.getRgbAsHex(), 16450, new String[] {""+StringUtils.superscript("99Mo"), "Result: Technicium 99ᵐ ("+StringUtils.superscript("99ᵐTc")+")"}, dustTechnetium99M, 4);
+
+ itemIonParticleBase = new IonParticles();
+ itemStandarParticleBase = new StandardBaseParticles();
+
+ if (Meta_GT_Proxy.sDoesVolumetricFlaskExist) {
+ Item a8kFlask = VolumetricFlaskHelper.generateNewFlask("Volumetric_Flask_8k", "Large Volumetric Flask", 8000);
+ Item a64kFlask = VolumetricFlaskHelper.generateNewFlask("Volumetric_Flask_32k", "Gigantic Volumetric Flask", 32000);
+ GregtechItemList.VOLUMETRIC_FLASK_8k.set(a8kFlask);
+ GregtechItemList.VOLUMETRIC_FLASK_32k.set(a64kFlask);
+ }
+
+ itemBoilerChassis = new ItemBoilerChassis();
+ itemDehydratorCoilWire = new ItemDehydratorCoilWire();
+ itemDehydratorCoil = new ItemDehydratorCoil();
+
+ itemAirFilter = new ItemAirFilter();
+ itemLavaFilter = new ItemLavaFilter();
+
+ itemGrindleTablet = new BaseItemGrindle();
+ itemDragonJar = new ItemEntityCatcher();
+
+ itemControlCore = new ItemControlCore();
+
+ //Chemistry
+ new CoalTar();
+ new RocketFuels();
+
+ //Nuclear Processing
+ new NuclearChem();
+
+ //Farm Animal Fun
+ new AgriculturalChem();
+
+ //General Chemistry
+ new GenericChem();
+
+ // Milled Ore Processing
+ new MilledOreProcessing();
+
+ //Bombs
+ itemBombCasing = new CoreItem("itemBombCasing", "Bomb Casing", tabMisc);
+ itemBombCasing.setTextureName(CORE.MODID + ":bomb_casing");
+ itemBombUnf = new CoreItem("itemBombUnf", "Bomb (unf)", tabMisc);
+ itemBombUnf.setTextureName(CORE.MODID + ":bomb_casing");
+ itemDetCable = new CoreItem("itemDetCable", "Det. Cable", tabMisc);
+ itemDetCable.setTextureName("string");
+ itemBomb = new ItemThrowableBomb();
+
+ //Only used for debugging.
+ /*if (CORE.DEVENV) {
+ new ConnectedBlockFinder();
+ }*/
+
+ //Misc Items
+ @SuppressWarnings("unused")
+ Item tI;
+ tI = new BaseItemMisc("Chilly", new short[]{0,64,196}, 32, MiscTypes.POTION, new String[]{"It's Blue"});
+ tI = new BaseItemMisc("4000DC's", new short[]{180,100,30}, 1, MiscTypes.BIGKEY, new String[]{"It opens things."});
+ tI = new BaseItemMisc("Dull", new short[]{64,64,64}, 64, MiscTypes.GEM, null);
+ tI = new BaseItemMisc("Forest", new short[]{130,164,96}, 64, MiscTypes.MUSHROOM, new String[]{"You Found this on the ground.", "Definitely not sure if it's worth eating."});
+
+ //Baubles
+ if (LoadedMods.Baubles){
+ tI = new HealthBoostBauble();
+ itemModularBauble = new ModularBauble();
+ }
+
+ //EnderIO Resources
+ if ((LoadedMods.EnderIO || LOAD_ALL_CONTENT)){
+ Logger.INFO("EnderIO Found - Loading Resources.");
+ //Enderio Dusts
+ itemDustSoularium = ItemUtils.generateSpecialUseDusts("Soularium", "Soularium", MaterialEIO.SOULARIUM.vChemicalFormula, MaterialEIO.SOULARIUM.getRgbAsHex())[0];
+ itemDustRedstoneAlloy = ItemUtils.generateSpecialUseDusts("RedstoneAlloy", "Redstone Alloy", MaterialEIO.REDSTONE_ALLOY.vChemicalFormula, MaterialEIO.REDSTONE_ALLOY.getRgbAsHex())[0];
+ itemDustElectricalSteel = ItemUtils.generateSpecialUseDusts("ElectricalSteel", "Electrical Steel", MaterialEIO.ELECTRICAL_STEEL.vChemicalFormula, MaterialEIO.ELECTRICAL_STEEL.getRgbAsHex())[0];
+ itemDustPulsatingIron = ItemUtils.generateSpecialUseDusts("PulsatingIron", "Pulsating Iron", MaterialEIO.PULSATING_IRON.vChemicalFormula, MaterialEIO.PULSATING_IRON.getRgbAsHex())[0];
+ itemDustEnergeticAlloy = ItemUtils.generateSpecialUseDusts("EnergeticAlloy", "Energetic Alloy", MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula, MaterialEIO.ENERGETIC_ALLOY.getRgbAsHex())[0];
+ itemDustVibrantAlloy = ItemUtils.generateSpecialUseDusts("VibrantAlloy", "Vibrant Alloy", MaterialEIO.VIBRANT_ALLOY.vChemicalFormula, MaterialEIO.VIBRANT_ALLOY.getRgbAsHex())[0];
+ itemDustConductiveIron = ItemUtils.generateSpecialUseDusts("ConductiveIron", "Conductive Iron", MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula, MaterialEIO.CONDUCTIVE_IRON.getRgbAsHex())[0];
+
+ //EnderIO Plates
+ itemPlateSoularium = ItemUtils.generateSpecialUsePlate("Soularium", "Soularium", MaterialEIO.SOULARIUM.vChemicalFormula, MaterialEIO.SOULARIUM.getRgbAsHex(), 0);
+ itemPlateRedstoneAlloy = ItemUtils.generateSpecialUsePlate("RedstoneAlloy", "Redstone Alloy", MaterialEIO.REDSTONE_ALLOY.vChemicalFormula, MaterialEIO.REDSTONE_ALLOY.getRgbAsHex(), 0);
+ itemPlateElectricalSteel = ItemUtils.generateSpecialUsePlate("ElectricalSteel", "Electrical Steel", MaterialEIO.ELECTRICAL_STEEL.vChemicalFormula, MaterialEIO.ELECTRICAL_STEEL.getRgbAsHex(), 0);
+ itemPlatePulsatingIron = ItemUtils.generateSpecialUsePlate("PhasedIron", "Phased Iron", MaterialEIO.PULSATING_IRON.vChemicalFormula, MaterialEIO.PULSATING_IRON.getRgbAsHex(), 0);
+ itemPlateEnergeticAlloy = ItemUtils.generateSpecialUsePlate("EnergeticAlloy", "Energetic Alloy", MaterialEIO.ENERGETIC_ALLOY.vChemicalFormula, MaterialEIO.ENERGETIC_ALLOY.getRgbAsHex(), 0);
+ itemPlateVibrantAlloy = ItemUtils.generateSpecialUsePlate("VibrantAlloy", "Vibrant Alloy", MaterialEIO.VIBRANT_ALLOY.vChemicalFormula, MaterialEIO.VIBRANT_ALLOY.getRgbAsHex(), 0);
+ itemPlateConductiveIron = ItemUtils.generateSpecialUsePlate("ConductiveIron", "Conductive Iron", MaterialEIO.CONDUCTIVE_IRON.vChemicalFormula, MaterialEIO.CONDUCTIVE_IRON.getRgbAsHex(), 0);
+
+ //Register dumb naming conventions - Who chose fucking phased Iron/Gold?
+ GT_OreDictUnificator.registerOre("dustPhasedGold", ItemUtils.getSimpleStack(itemDustVibrantAlloy));
+ GT_OreDictUnificator.registerOre("platePhasedGold", ItemUtils.getSimpleStack(itemPlateVibrantAlloy));
+ GT_OreDictUnificator.registerOre("dustPhasedIron", ItemUtils.getSimpleStack(itemDustPulsatingIron));
+ GT_OreDictUnificator.registerOre("platePhasedIron", ItemUtils.getSimpleStack(itemPlatePulsatingIron));
+ GT_OreDictUnificator.registerOre("blockVibrantAlloy", ItemUtils.getItemStackOfAmountFromOreDict("blockPhasedGold", 1));
+
+ CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getPlate(1), MaterialEIO.REDSTONE_ALLOY.getFluidStack(144), 16, 4*9);
+ CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getIngot(1), MaterialEIO.REDSTONE_ALLOY.getFluidStack(144), 16, 4*9);
+ CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getNugget(1), MaterialEIO.REDSTONE_ALLOY.getFluidStack(16), 16, 4);
+ CORE.RA.addFluidExtractionRecipe(MaterialEIO.REDSTONE_ALLOY.getBlock(1), MaterialEIO.REDSTONE_ALLOY.getFluidStack(1294), 16, 4*9*9);
+
+ }
+ else {
+ /*Logger.WARNING("EnderIO not Found - Generating our own Resources.");
+ MaterialGenerator.generate(MaterialEIO.CONDUCTIVE_IRON);
+ MaterialGenerator.generate(MaterialEIO.PULSATING_IRON);
+ MaterialGenerator.generate(MaterialEIO.REDSTONE_ALLOY);
+ MaterialGenerator.generate(MaterialEIO.SOULARIUM);
+ MaterialGenerator.generate(MaterialEIO.ELECTRICAL_STEEL);
+ MaterialGenerator.generate(MaterialEIO.ENERGETIC_ALLOY);
+ MaterialGenerator.generate(MaterialEIO.VIBRANT_ALLOY); */
+ }
+
+ //Big Reactors
+ if (LoadedMods.Big_Reactors|| LOAD_ALL_CONTENT){
+ Logger.INFO("BigReactors Found - Loading Resources.");
+ //Item Init
+ itemPlateBlutonium = ItemUtils.generateSpecialUsePlate("Blutonium", "Blutonium", new short[]{0, 0, 255}, 0);
+ itemPlateCyanite = ItemUtils.generateSpecialUsePlate("Cyanite", "Cyanite", new short[]{0, 191, 255}, 0);
+ itemPlateLudicrite = ItemUtils.generateSpecialUsePlate("Ludicrite", "Ludicrite", new short[]{167, 5, 179}, 0);
+ }
+ else {
+ Logger.WARNING("BigReactors not Found - Skipping Resources.");
+ }
+
+ //Thaumcraft
+ if ((LoadedMods.Thaumcraft|| LOAD_ALL_CONTENT) && !CORE.GTNH){
+ Logger.INFO("Thaumcraft Found - Loading Resources.");
+ //Item Init
+ try {
+ ItemUtils.getItemForOreDict("Thaumcraft:ItemResource", "ingotVoidMetal", "Void Metal Ingot", 16);
+ itemPlateVoidMetal = ItemUtils.generateSpecialUsePlate("Void", "Void", new short[]{82, 17, 82}, 0);
+ GT_OreDictUnificator.registerOre("plateVoidMetal", new ItemStack(ModItems.itemPlateVoidMetal));
+ } catch (final NullPointerException e){}
+
+ }
+ else {
+ Logger.WARNING("Thaumcraft not Found - Skipping Resources.");
+ }
+
+ //Pneumaticraft
+ if (LoadedMods.PneumaticCraft|| LOAD_ALL_CONTENT){
+ Logger.INFO("PneumaticCraft Found - Loading Resources.");
+ //Item Init
+ itemPlateCompressedIron = ItemUtils.generateSpecialUsePlate("CompressedIron", "Compressed Iron", new short[]{128, 128, 128}, 0);
+ }
+ else {
+ Logger.WARNING("PneumaticCraft not Found - Skipping Resources.");
+ }
+
+ //Simply Jetpacks
+ if (LoadedMods.Simply_Jetpacks|| LOAD_ALL_CONTENT){
+ Logger.INFO("SimplyJetpacks Found - Loading Resources.");
+ //Item Init
+ itemPlateEnrichedSoularium = new RarityUncommon().setUnlocalizedName("itemPlateEnrichedSoularium").setCreativeTab(AddToCreativeTab.tabMisc).setTextureName(CORE.MODID + ":itemPlateSoularium");
+ //Registry
+ GameRegistry.registerItem(itemPlateEnrichedSoularium, "itemPlateEnrichedSoularium");
+ }
+ else {
+ Logger.WARNING("SimplyJetpacks not Found - Skipping Resources.");
+ }
+
+ //rfTools
+ if (LoadedMods.RFTools|| LOAD_ALL_CONTENT){
+ Logger.INFO("rfTools Found - Loading Resources.");
+ //Item Init
+ itemPlateDimensionShard = ItemUtils.generateSpecialUsePlate("DimensionShard", "Dimensional Shard", new short[]{170, 230, 230}, 0);
+ }
+ else {
+ Logger.WARNING("rfTools not Found - Skipping Resources.");
+ }
+
+ //IC2 Exp
+ if (LoadedMods.IndustrialCraft2|| LOAD_ALL_CONTENT){
+ Logger.INFO("IndustrialCraft2 Found - Loading Resources.");
+
+ //Baubles Mod Test
+ try {
+ final Class<?> baublesTest = ReflectionUtils.getClass("baubles.api.IBauble");
+ if (baublesTest != null){
+ COMPAT_Baubles.run();
+ }
+ else {
+ Logger.INFO("Baubles Not Found - Skipping Resources.");
+ }
+ } catch(final Throwable T){
+ Logger.INFO("Baubles Not Found - Skipping Resources.");
+ }
+ }
+ else {
+ Logger.WARNING("IndustrialCraft2 not Found - Skipping Resources.");
+ }
+
+
+ //Special Item Handling Case
+ if (ConfigSwitches.enableAlternativeBatteryAlloy) {
+ //ModItems.itemIngotBatteryAlloy = new BaseItemIngot("itemIngotBatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 0); TODO
+ ModItems.itemPlateBatteryAlloy = ItemUtils.generateSpecialUsePlate("BatteryAlloy", "Battery Alloy", new short[]{35, 228, 141}, 0);
+
+ }
+
+
+ //UtilsItems.generateSpawnEgg("ic2", "boatcarbon", Utils.generateSingularRandomHexValue(), Utils.generateSingularRandomHexValue());
+
+ HANDLER_COFH.initItems();
+
+ /*
+ * Misc Items
+ */
+
+ //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
+ itemSandstoneHammer = new SandstoneHammer("itemSandstoneHammer").setCreativeTab(AddToCreativeTab.tabTools);
+ GameRegistry.registerItem(itemSandstoneHammer, itemSandstoneHammer.getUnlocalizedName());
+
+ //Buffer Cores!
+ Item itemBufferCore;
+ for(int i=1; i<=10; i++){
+ //Utils.LOG_INFO(""+i);
+ itemBufferCore = new BufferCore("itemBufferCore", i).setCreativeTab(AddToCreativeTab.tabMachines);
+ GameRegistry.registerItem(itemBufferCore, itemBufferCore.getUnlocalizedName());
+ //System.out.println("Buffer Core registration count is: "+i);
+ }
+
+ 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");
+
+ itemCustomBook = new ItemBaseBook();
+ registerCustomTokens();
+ }
+
+ public static void registerCustomTokens() {
+ itemGenericToken.register(0, "BitCoin", 16, "Can be used on the dark web");
+ itemGenericToken.register(1, "Hand Pump Trade Token I", 1, "Craft into a Tier I Hand pump");
+ itemGenericToken.register(2, "Hand Pump Trade Token II", 1, "Craft into a Tier II Hand pump");
+ itemGenericToken.register(3, "Hand Pump Trade Token III", 1, "Craft into a Tier III Hand pump");
+ itemGenericToken.register(4, "Hand Pump Trade Token IV", 1, "Craft into a Tier IV Hand pump");
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java
new file mode 100644
index 0000000000..b4988136c0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseEuItem.java
@@ -0,0 +1,582 @@
+package gtPlusPlus.core.item.base;
+
+import static gregtech.api.enums.GT_Values.*;
+
+import java.util.*;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.SubTag;
+import gregtech.api.enums.TC_Aspects.TC_AspectStack;
+import gregtech.api.interfaces.IItemBehaviour;
+import gregtech.api.interfaces.IItemContainer;
+import gregtech.api.objects.ItemData;
+import gregtech.api.util.*;
+
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import ic2.api.item.*;
+
+public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricItemManager {
+
+ /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */
+ private final HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>> mItemBehaviors = new HashMap<>();
+ 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<>();
+ private final ArrayList<Pair<Integer, EnumChatFormatting>> descColour = new ArrayList<>();
+ private final ArrayList<Pair<Integer, String>> itemName = new ArrayList<>();
+ private final ArrayList<Pair<Integer, String>> itemDescription = new ArrayList<>();
+ private final ArrayList<Pair<Integer, Boolean>> hasEffect = new ArrayList<>();
+
+ public final HashMap<Short, Long[]> mElectricStats = new HashMap<>();
+ public final HashMap<Short, Short> mBurnValues = new HashMap<>();
+
+ 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);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+
+ 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<>(id, regRarity));
+ this.itemName.add(new Pair<>(id, localizedName));
+ this.itemDescription.add(new Pair<>(id, description));
+ this.descColour.add(new Pair<>(id, colour));
+ this.hasEffect.add(new Pair<>(id, Effect));
+ }
+
+ @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();
+ }
+ return EnumRarity.common;
+ }
+
+ @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;
+ }
+
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public 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: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : 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);
+ }
+ }
+ }
+
+
+ @Override
+ public final Item getChargedItem(final ItemStack itemStack) {
+ return this;
+ }
+
+ @Override
+ public final Item getEmptyItem(final ItemStack itemStack) {
+ return this;
+ }
+
+ @Override
+ public final double getMaxCharge(final ItemStack aStack) {
+ final Long[] tStats = this.getElectricStats(aStack);
+ if (tStats == null) {
+ return 0;
+ }
+ return Math.abs(tStats[0]);
+ }
+
+ @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]);
+ }
+
+ @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 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;
+ }
+
+ @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)) {
+ return 0;
+ }
+ if (aBatteryAlike && !this.canProvideEnergy(aStack)) {
+ return 0;
+ }
+ if (tStats[3] > 0) {
+ 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);
+ }
+ return tChargeBefore - tNewCharge;
+ }
+
+ @Override
+ public final double getCharge(final ItemStack aStack) {
+ return this.getRealCharge(aStack);
+ }
+
+ @Override
+ public final boolean canUse(final ItemStack aStack, final double aAmount) {
+ return this.getRealCharge(aStack) >= aAmount;
+ }
+
+ @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;
+ }
+
+ @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)));
+ }
+
+ @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 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");
+ }
+
+ 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;
+ }
+
+ public short getChargedMetaData(final ItemStack aStack) {
+ return (short) aStack.getItemDamage();
+ }
+
+ public short getEmptyMetaData(final ItemStack aStack) {
+ return (short) aStack.getItemDamage();
+ }
+
+
+ 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
+ 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 IElectricItemManager getManager(final ItemStack aStack) {
+ return this;
+ } // We are our own Manager
+
+ /**
+ * Sets the Furnace Burn Value for the Item.
+ *
+ * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765]
+ * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU)
+ * @return the Item itself for convenience in constructing.
+ */
+ public final BaseEuItem setBurnValue(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;
+ }
+
+ /**
+ * @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;
+ }
+
+
+ @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) || (D1 && this.mEnabledItems.get(i))) {
+ final Long[] tStats = this.mElectricStats.get((short) (this.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);
+ aList.add(tStack);
+ }
+ if ((tStats == null) || (tStats[3] != -2)) {
+ final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i);
+ this.isItemStackUsable(tStack);
+ aList.add(tStack);
+ }
+ }
+ }
+ }
+
+ @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));
+ }
+ this.mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":" + (this.getUnlocalizedName() + "/" + i));
+ }
+ }
+ }
+
+
+ @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;
+ }
+
+ /**
+ * Sets the unlocalized name of this item to the string passed as the parameter"
+ */
+ @Override
+ public Item setUnlocalizedName(final String p_77655_1_){
+ this.unlocalizedName = p_77655_1_;
+ super.setUnlocalizedName(p_77655_1_);
+ return this;
+ }
+
+ /**
+ * Returns the unlocalized name of this item.
+ */
+ @Override
+ public String getUnlocalizedName()
+ {
+ return this.unlocalizedName;
+ }
+
+ public final Long[] getElectricStats(final ItemStack aStack) {
+ return this.mElectricStats.get((short) aStack.getItemDamage());
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) {
+ return false;
+ }
+
+ @Override
+ public boolean getIsRepairable(final ItemStack aStack, final 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(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<>(1);
+ this.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(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<>();
+ // 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 String getItemStackDisplayName(final ItemStack par1ItemStack) {
+ int keyValue = (par1ItemStack.getItemDamage() - this.mOffset);
+ if (keyValue < 0 || keyValue > 3) {
+ keyValue = 0;
+ }
+ return this.itemName.get(keyValue).getValue();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemBackpack.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemBackpack.java
new file mode 100644
index 0000000000..246620344a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemBackpack.java
@@ -0,0 +1,92 @@
+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 net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+import gregtech.api.util.GT_OreDictUnificator;
+
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.handler.GuiHandler;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+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);
+ }
+
+ // Without this method, your inventory will NOT work!!!
+ @Override
+ public int getMaxItemUseDuration(final 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)
+ {
+ // 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 :)
+ else {
+ // 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(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");
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(final IIconRegister iconRegister)
+ {
+ this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + "itemBackpack");
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemBrain.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemBrain.java
new file mode 100644
index 0000000000..73ed4afb42
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemBrain.java
@@ -0,0 +1,109 @@
+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;
+
+/*
+ *
+ *
+ Key Point: You can access the NBT compound data from the Item class (in those methods that pass an ItemStack), but the NBT compound can only be set on an ItemStack.
+
+ The steps to add NBT data to an ItemStack:
+ Create or otherwise get an ItemStack of the desired item
+ Create an NBTTagCompound and fill it with the appropriate data
+ Call ItemStack#setTagCompound() method to set it.
+
+ *
+ */
+
+public class BaseItemBrain extends Item{
+ // This is an array of all the types I am going to be adding.
+ String[] brainTypes = { "dead", "preserved", "fresh", "tasty" };
+
+ // This method allows us to have different language translation keys for
+ // each item we add.
+ @Override
+ public String getUnlocalizedName(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");
+ }
+ }
+ // This will be used if the item is obtained without nbt data on it.
+ return "item.nullBrain";
+ }
+
+
+ // This is a fun method which allows us to run some code when our item is
+ // shown in a creative tab. I am going to use it to add all the brain
+ // types.
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(final Item item, final CreativeTabs tab, final List itemList)
+ {
+ // This creates a loop with a counter. It will go through once for
+ // every listing in brainTypes, and gives us a number associated
+ // with each listing.
+ for (int pos = 0; pos < this.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.
+ // We need to give it some.
+ brainStack.setTagCompound(new NBTTagCompound());
+ // Now we set the type of the item, brainType is the key, and
+ // brainTypes[pos] is grabbing a
+ // entry from the brainTypes array.
+ brainStack.getTagCompound().setString("brainType",
+ this.brainTypes[pos]);
+ // And this adds it to the itemList, which is a list of all items
+ // in the creative tab.
+ itemList.add(brainStack);
+ }
+ }
+
+ // This code will allow us to tell the items apart in game. You can change
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ // texture based on nbt data, but I won't be covering that.
+ @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
+ {
+ tooltip.add(StatCollector.translateToLocal(
+ "tooltip.yourmod.nullbrain.desc"));
+ }
+ }
+}
+
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemBurnable.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemBurnable.java
new file mode 100644
index 0000000000..a5db714822
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemBurnable.java
@@ -0,0 +1,44 @@
+package gtPlusPlus.core.item.base;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class BaseItemBurnable extends CoreItem {
+
+ protected final int meta;
+
+ public BaseItemBurnable(String unlocalizedName, String displayName, CreativeTabs creativeTab,
+ int stackSize, int maxDmg, String description, String oredictName, int burnTime, int meta) {
+ super(unlocalizedName, creativeTab, stackSize, maxDmg, description);
+ this.itemName = displayName;
+ this.meta = meta;
+ if (oredictName != null && !oredictName.equals("")){
+ registerOrdictionary(oredictName);
+ }
+ registerFuel(burnTime);
+
+ }
+
+ public void registerFuel(int burn){
+ CORE.burnables.add(new Pair<Integer, ItemStack>(burn, ItemUtils.getSimpleStack(this, 1)));
+ }
+
+ public final void registerOrdictionary(String name){
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), name);
+ }
+
+ @Override
+ public int getDamage(ItemStack stack) {
+ return this.meta;
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemColourable.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemColourable.java
new file mode 100644
index 0000000000..ca7041617d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemColourable.java
@@ -0,0 +1,98 @@
+package gtPlusPlus.core.item.base;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+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.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import gtPlusPlus.core.lib.CORE;
+
+public class BaseItemColourable extends Item
+{
+
+ private final EnumRarity rarity;
+ private final EnumChatFormatting descColour;
+ private final String itemDescription;
+ protected String itemName;
+ private final boolean hasEffect;
+ public final int componentColour;
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ return this.componentColour;
+ }
+
+ //5
+ /*
+ * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect
+ */
+ public BaseItemColourable(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, int rgb)
+ {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(creativeTab);
+ this.setMaxStackSize(stackSize);
+ this.setMaxDamage(maxDmg);
+ this.setHasSubtypes(true);
+ this.rarity = regRarity;
+ this.itemDescription = description;
+ this.descColour = colour;
+ this.hasEffect = Effect;
+ this.componentColour = rgb;
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ //6
+ /*
+ * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect
+ */
+ public BaseItemColourable(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, int rgb)
+ {
+ this.setUnlocalizedName(unlocalizedName);
+ this.itemName = displayName;
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(creativeTab);
+ this.setMaxStackSize(stackSize);
+ this.setMaxDamage(maxDmg);
+ this.rarity = regRarity;
+ this.itemDescription = description;
+ this.descColour = colour;
+ this.hasEffect = Effect;
+ this.componentColour = rgb;
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @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);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return this.rarity;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return this.hasEffect;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ if ((this.itemName == null) || this.itemName.equals("")) {
+ return super.getItemStackDisplayName(tItem);
+ }
+ return this.itemName;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java
new file mode 100644
index 0000000000..9ad8ea3feb
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java
@@ -0,0 +1,566 @@
+package gtPlusPlus.core.item.base;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.TextureSet;
+import gregtech.api.util.GT_OreDictUnificator;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.material.state.MaterialState;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.data.StringUtils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+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.util.IIcon;
+import net.minecraft.world.World;
+
+public class BaseItemComponent extends Item{
+
+ private final static Class<TextureSet> mTextureSetPreload;
+
+ static {
+ mTextureSetPreload = TextureSet.class;
+ }
+
+ public final Material componentMaterial;
+ public final String materialName;
+ public final String unlocalName;
+ public final ComponentTypes componentType;
+ public final int componentColour;
+ public Object extraData;
+
+ protected IIcon base;
+ protected IIcon overlay;
+
+ public BaseItemComponent(final Material material, final ComponentTypes componentType) {
+ this.componentMaterial = material;
+ this.unlocalName = "item"+componentType.COMPONENT_NAME+material.getUnlocalizedName();
+ this.materialName = material.getLocalizedName();
+ this.componentType = componentType;
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(this.unlocalName);
+ this.setMaxStackSize(64);
+ //this.setTextureName(this.getCorrectTextures());
+ this.componentColour = material.getRgbAsHex();
+ GameRegistry.registerItem(this, this.unlocalName);
+
+ //if (componentType != ComponentTypes.DUST)
+
+ GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this));
+ if (LoadedMods.Thaumcraft) {
+ //ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), TC_Aspect_Wrapper.generate(TC_Aspects.METALLUM.mAspect), 1);
+ if (componentMaterial.isRadioactive) {
+ //ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), TC_Aspect_Wrapper.generate(TC_Aspects.RADIO.mAspect), componentMaterial.vRadiationLevel);
+ }
+ }
+ registerComponent();
+ }
+
+ //For Cell Generation
+ public BaseItemComponent(final String unlocalName, final String localName, final short[] RGBA) {
+
+ // Handles .'s from fluid internal names.
+ String aFormattedNameForFluids;
+ if (unlocalName.contains(".")) {
+ aFormattedNameForFluids = StringUtils.splitAndUppercase(unlocalName, ".");
+ }
+ else {
+ aFormattedNameForFluids = unlocalName;
+ }
+ Material aTempMaterial = Material.mMaterialCache.get(localName.toLowerCase());
+ Logger.INFO("Attempted to get "+localName+" cell material from cache. Valid? "+(aTempMaterial != null));
+ this.componentMaterial = aTempMaterial;
+ this.unlocalName = "itemCell"+aFormattedNameForFluids;
+ this.materialName = localName;
+ this.componentType = ComponentTypes.CELL;
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(aFormattedNameForFluids);
+ this.setMaxStackSize(64);
+ this.componentColour = MathUtils.getRgbAsHex(RGBA);
+ this.extraData = RGBA;
+
+ this.setTextureName(CORE.MODID + ":" + "item"+ComponentTypes.CELL.COMPONENT_NAME);
+ GameRegistry.registerItem(this, aFormattedNameForFluids);
+ GT_OreDictUnificator.registerOre(ComponentTypes.CELL.getOreDictName()+Utils.sanitizeStringKeepBrackets(localName), ItemUtils.getSimpleStack(this));
+ registerComponent();
+ }
+
+ public boolean registerComponent() {
+ if (this.componentMaterial == null) {
+ return false;
+ }
+ //Register Component
+ Map<String, ItemStack> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName());
+ if (aMap == null) {
+ aMap = new HashMap<String, ItemStack>();
+ }
+ String aKey = componentType.getGtOrePrefix().name();
+ ItemStack x = aMap.get(aKey);
+ if (x == null) {
+ aMap.put(aKey, ItemUtils.getSimpleStack(this));
+ Logger.MATERIALS("Registering a material component. Item: ["+componentMaterial.getUnlocalizedName()+"] Map: ["+aKey+"]");
+ Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap);
+ return true;
+ }
+ else {
+ //Bad
+ Logger.MATERIALS("Tried to double register a material component. ");
+ return false;
+ }
+ }
+
+ public String getCorrectTextures(){
+ if (!CORE.ConfigSwitches.useGregtechTextures){
+ return CORE.MODID + ":" + "item"+this.componentType.COMPONENT_NAME;
+ }
+ String metType = "9j4852jyo3rjmh3owlhw9oe";
+ if (this.componentMaterial != null) {
+ TextureSet u = this.componentMaterial.getTextureSet();
+ if (u != null) {
+ metType = u.mSetName;
+ }
+ }
+ metType = (metType.equals("9j4852jyo3rjmh3owlhw9oe") ? "METALLIC" : metType);
+ return "gregtech" + ":" + "materialicons/"+metType+"/" + this.componentType.getOreDictName();
+
+
+
+ //return "gregtech" + ":" + "materialicons/"+metType+"/" + this.componentType.COMPONENT_NAME.toLowerCase();
+ }
+
+ /*@Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+
+ if (this.componentType == ComponentTypes.SMALLGEAR){
+ return "Small " + this.materialName+" Gear";
+ }
+
+ if (this.componentMaterial != null) {
+ return (this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME);
+ }
+ return this.materialName+" Cell";
+ }*/
+
+ public final String getMaterialName() {
+ return this.materialName;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+
+ try {
+
+
+ if (this.componentMaterial == null){
+ if (this.materialName != null){
+ //list.add(Utils.sanitizeStringKeepBrackets(materialName));
+ }
+ }
+
+ if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("") && (this.componentMaterial != null)){
+
+
+ if (this.componentMaterial != null){
+ if (!this.componentMaterial.vChemicalFormula.contains("?")) {
+ list.add(Utils.sanitizeStringKeepBrackets(this.componentMaterial.vChemicalFormula));
+ }
+ else if (this.componentMaterial.vChemicalFormula.contains("?")) {
+ String temp = componentMaterial.vChemicalFormula;
+ temp = temp.replace(" ", "");
+ temp = temp.replace("-", "");
+ temp = temp.replace("_", "");
+ temp = temp.replace("!", "");
+ temp = temp.replace("@", "");
+ temp = temp.replace("#", "");
+ temp = temp.replace(" ", "");
+ list.add(temp);
+ }
+
+ if (this.componentMaterial.isRadioactive){
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }
+
+ if (this.componentType == ComponentTypes.INGOT || this.componentType == ComponentTypes.HOTINGOT){
+ if ((this.materialName != null) && (this.materialName != "") && !this.materialName.equals("") && this.unlocalName.toLowerCase().contains("hot")){
+ list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot! "+EnumChatFormatting.GRAY+" Avoid direct handling..");
+ }
+ }
+ }
+ else {
+ String aChemicalFormula = Material.sChemicalFormula.get(materialName.toLowerCase());
+ if (aChemicalFormula != null && aChemicalFormula.length() > 0) {
+ list.add(Utils.sanitizeStringKeepBrackets(aChemicalFormula));
+ }
+ }
+
+ //Hidden Tooltip
+ if (KeyboardUtils.isCtrlKeyDown()) {
+ if (this.componentMaterial != null) {
+ String type = this.componentMaterial.getTextureSet().mSetName;
+ String output = type.substring(0, 1).toUpperCase() + type.substring(1);
+ list.add(EnumChatFormatting.GRAY+"Material Type: "+output+".");
+ list.add(EnumChatFormatting.GRAY+"Material State: "+this.componentMaterial.getState().name()+".");
+ list.add(EnumChatFormatting.GRAY+"Radioactivity Level: "+this.componentMaterial.vRadiationLevel+".");
+ }
+ }
+ else {
+ list.add(EnumChatFormatting.DARK_GRAY+"Hold Ctrl to show additional info.");
+ }
+
+ }
+ }
+ catch (Throwable t) {}
+
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) {
+ if (this.componentMaterial != null){
+ if (entityHolding instanceof EntityPlayer){
+ if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){
+ EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.componentMaterial.vRadiationLevel, world, entityHolding);
+ }
+ }
+ }
+
+ if (extraData != null) {
+ if (componentMaterial != null && componentMaterial.getRGBA()[3] > 1) {
+ if (((Map<Integer, Short[]>) extraData).get(9999) == null) {
+ ((Map<Integer, Short[]>) extraData).put(9999, new Short[] {0});
+ }
+ Short aCurrentFrame = ((Map<Integer, Short[]>) extraData).get(9999)[0];
+ short fC = (short) (aCurrentFrame >= Short.MAX_VALUE ? 0 : aCurrentFrame+1);
+ ((Map<Integer, Short[]>) extraData).put((int) 9999, new Short[] {(short) (fC), 0});
+ ((Map<Integer, Short[]>) extraData).put((int) 9998, new Short[] {aCurrentFrame, 0});
+
+ }
+ }
+ }
+
+
+ /**
+ *
+ * Handle Custom Rendering
+ *
+ */
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ return (CORE.ConfigSwitches.useGregtechTextures ? true : false);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int renderPass) {
+
+
+ if (this.componentType == ComponentTypes.CELL || this.componentType == ComponentTypes.PLASMACELL) {
+ if (renderPass == 0 && !CORE.ConfigSwitches.useGregtechTextures){
+ return Utils.rgbtoHexValue(255, 255, 255);
+ }
+ if (renderPass == 1 && CORE.ConfigSwitches.useGregtechTextures){
+ return Utils.rgbtoHexValue(255, 255, 255);
+ }
+ }
+ if (this.componentType == ComponentTypes.PLATEHEAVY) {
+
+ }
+
+
+
+ try {
+ if (this.componentMaterial == null) {
+ if (extraData != null) {
+ if (short.class.isInstance(extraData)){
+ short[] abc = (short[]) extraData;
+ return Utils.rgbtoHexValue(abc[0], abc[1], abc[2]);
+ }
+ }
+ return this.componentColour;
+ }
+
+ if (this.componentMaterial.getRGBA()[3] <= 1) {
+ return this.componentColour;
+ }
+ else {
+
+ //Mild Glow Effect
+ if (this.componentMaterial.getRGBA()[3] == 2) {
+ if (extraData == null) {
+ extraData = new HashMap<Integer, Short[]>();
+ ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE, new Short[] {0});
+ ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE-1, new Short[] {0});
+ short[] er = this.componentMaterial.getRGBA();
+ short value = 1;
+ Short[] ht = new Short[] {er[0], er[1], er[2]};
+ for (int y = 0; y < 40; y++) {
+ if (y < 20) {
+ value = 1;
+ }
+ else {
+ value = -1;
+ }
+ short r = (short) (ht[0] + value);
+ short g = (short) (ht[1] + value);
+ short b = (short) (ht[2] + value);
+ Short[] qq = new Short[] {(short) Math.min(255, r), (short) Math.min(255, g), (short) Math.min(255, b)};
+ ht = qq;
+ ((Map<Integer, Short[]>) extraData).put(y, qq);
+ }
+ }
+ if (extraData != null) {
+
+ Short aCurrentFrame = ((Map<Integer, Short[]>) extraData).get((int) Short.MAX_VALUE)[0];
+ Short aSize = 40;
+ short nextFrame = (short) ((aCurrentFrame < aSize) ? (aCurrentFrame+1) : 0);
+ Short[] aCurrentFrameRGB = ((Map<Integer, Short[]>) extraData).get(aCurrentFrame < aSize ? (int) aCurrentFrame : 0);
+ ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE, new Short[] {nextFrame});
+ return Utils.rgbtoHexValue(aCurrentFrameRGB[0], aCurrentFrameRGB[1], aCurrentFrameRGB[2]);
+
+
+ /*Short aCurrentFrame = ((Map<Integer, Short[]>) extraData).get((int) Short.MAX_VALUE)[0];
+ Short[] aCurrentFrameRGB = ((Map<Integer, Short[]>) extraData).get((int) aCurrentFrame);
+ short nextFrame = aCurrentFrame < 40 ? aCurrentFrame++ : 0;
+ ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE, new Short[] {nextFrame});
+ return Utils.rgbtoHexValue(aCurrentFrameRGB[0], aCurrentFrameRGB[1], aCurrentFrameRGB[2]);*/
+ }
+ }
+
+ //Rainbow Hue Cycle
+ else if (this.componentMaterial.getRGBA()[3] == 3) {
+ if (extraData == null) {
+ extraData = new HashMap<Integer, Short[]>();
+ ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE, new Short[] {0});
+ ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE-1, new Short[] {0});
+ int aSlot = 0;
+
+ //Let's say you're starting with green:
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 0});
+ //Slowly start adding in some red to get to yellow:
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 255, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 255, 0});
+ //Then, take out the green to get to red:
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 204, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 204, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 204, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 153, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 153, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 153, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 102, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 102, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 102, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 51, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 51, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 51, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 0});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 0});
+ //Now, add blue to get to purple:
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 51});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 51});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 51});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 102});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 102});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 102});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 153});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 153});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 153});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 204});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 204});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 204});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {255, 0, 255});
+ //Then, remove red to get to blue:
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {204, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {153, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] {102, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 51, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 0, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 0, 255});
+ //Add the green back in to get to cyan:
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 51, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 51, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 51, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 102, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 102, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 102, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 153, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 153, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 153, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 204, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 204, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 204, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 255});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 255});
+ //And finally remove the blue to get back to green:
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 204});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 204});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 204});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 153});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 153});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 153});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 102});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 102});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 102});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 51});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 51});
+ ((Map<Integer, Short[]>) extraData).put(aSlot++, new Short[] { 0, 255, 51});
+ ((Map<Integer, Short[]>) extraData).put((int) Byte.MAX_VALUE, new Short[] {(short) (((Map<Integer, Short[]>) extraData).size()-1)});
+
+
+ }
+ if (extraData != null) {
+ Short aCurrentFrame = ((Map<Integer, Short[]>) extraData).get((int) Short.MAX_VALUE)[0];
+ Short aSize = (short) (((Map<Integer, Short[]>) extraData).size() - 3);
+ short nextFrame = (short) ((aCurrentFrame < aSize) ? (aCurrentFrame+1) : 0);
+ Short[] aCurrentFrameRGB = ((Map<Integer, Short[]>) extraData).get(aCurrentFrame < aSize ? (int) aCurrentFrame : 0);
+ ((Map<Integer, Short[]>) extraData).put((int) Short.MAX_VALUE, new Short[] {nextFrame});
+ return Utils.rgbtoHexValue(aCurrentFrameRGB[0], aCurrentFrameRGB[1], aCurrentFrameRGB[2]);
+ }
+ }
+ }
+
+
+ }
+ catch (Throwable t) {
+
+ }
+ return this.componentColour;
+
+
+
+
+
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ if (CORE.ConfigSwitches.useGregtechTextures) {
+ if(pass == 0) {
+ return this.base;
+ }
+ return this.overlay;
+ }
+ return this.base;
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister i) {
+
+ if (CORE.ConfigSwitches.useGregtechTextures){
+ this.base = i.registerIcon(getCorrectTextures());
+ this.overlay = i.registerIcon(getCorrectTextures() + "_OVERLAY");
+ }
+ else {
+ this.base = i.registerIcon(getCorrectTextures());
+ //this.overlay = i.registerIcon(getCorrectTextures() + "_OVERLAY");
+ }
+ }
+
+
+
+
+ public static enum ComponentTypes {
+ DUST("Dust", " Dust", "dust", OrePrefixes.dust),
+ DUSTSMALL("DustSmall", " Dust", "dustSmall", OrePrefixes.dustSmall),
+ DUSTTINY("DustTiny", " Dust", "dustTiny", OrePrefixes.dustTiny),
+ INGOT("Ingot", " Ingot", "ingot", OrePrefixes.ingot),
+ HOTINGOT("HotIngot", " Hot Ingot", "ingotHot", OrePrefixes.ingotHot),
+ PLATE("Plate", " Plate", "plate", OrePrefixes.plate),
+ PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble", OrePrefixes.plateDouble),
+ ROD("Rod", " Rod", "stick", OrePrefixes.stick),
+ RODLONG("RodLong", " Long Rod", "stickLong", OrePrefixes.stickLong),
+ GEAR("Gear", " Gear", "gearGt", OrePrefixes.gearGt),
+ SMALLGEAR("SmallGear", " Gear", "gearGtSmall", OrePrefixes.gearGtSmall), //TODO
+ SCREW("Screw", " Screw", "screw", OrePrefixes.screw),
+ BOLT("Bolt", " Bolt", "bolt", OrePrefixes.bolt),
+ ROTOR("Rotor", " Rotor", "rotor", OrePrefixes.rotor),
+ RING("Ring", " Ring", "ring", OrePrefixes.ring),
+ FOIL("Foil", " Foil", "foil", OrePrefixes.foil),
+ PLASMACELL("CellPlasma", " Plasma Cell", "cellPlasma", OrePrefixes.cellPlasma),
+ CELL("Cell", " Cell", "cell", OrePrefixes.cell),
+ NUGGET("Nugget", " Nugget", "nugget", OrePrefixes.nugget),
+ PLATEHEAVY("HeavyPlate", "Heavy@Plate", "plateHeavy", OrePrefixes.plateDense),
+ SPRING("Spring", " Spring", "spring", OrePrefixes.spring),
+ SMALLSPRING("SmallSpring", "Small@Spring", "springSmall", OrePrefixes.springSmall),
+ FINEWIRE("FineWire", "Fine@Wire", "wireFine", OrePrefixes.wireFine),;
+
+ private String COMPONENT_NAME;
+ private String DISPLAY_NAME;
+ private String OREDICT_NAME;
+ private OrePrefixes a_GT_EQUAL;
+ private ComponentTypes (final String LocalName, final String DisplayName, final String OreDictName, final OrePrefixes aPrefix){
+ this.COMPONENT_NAME = LocalName;
+ this.DISPLAY_NAME = DisplayName;
+ this.OREDICT_NAME = OreDictName;
+ this.a_GT_EQUAL = aPrefix;
+ }
+
+ public String getComponent(){
+ return this.COMPONENT_NAME;
+ }
+
+ public String getName(){
+ return this.DISPLAY_NAME;
+ }
+
+ public String getOreDictName(){
+ return this.OREDICT_NAME;
+ }
+
+ public OrePrefixes getGtOrePrefix() {
+ return this.a_GT_EQUAL;
+ }
+
+ }
+
+}
+
+
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemDamageable.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemDamageable.java
new file mode 100644
index 0000000000..4209ec0a59
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemDamageable.java
@@ -0,0 +1,201 @@
+package gtPlusPlus.core.item.base;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+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.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+
+public class BaseItemDamageable extends Item {
+
+ private final EnumRarity rarity;
+ private final String itemDescription;
+ protected String itemName;
+ private final boolean hasEffect;
+
+ public BaseItemDamageable(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, final ItemStack OverrideItem)
+ {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(creativeTab);
+ this.setMaxStackSize(1);
+ this.setMaxDamage(251);
+ this.setNoRepair();
+ this.rarity = regRarity;
+ this.itemDescription = description;
+ this.hasEffect = Effect;
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ public String getItemDescription(){
+ return this.itemDescription;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ int dmg = (int) getItemDamage(stack);
+ if (dmg <= 3){
+ list.add(EnumChatFormatting.GRAY+this.itemDescription);
+ }
+ if (dmg > 3 && dmg <= 25){
+ list.add(EnumChatFormatting.GRAY+"You have discovered that smashing this against valuable stones has some function..");
+ }
+ else if (dmg > 0){
+ int maxDamage = 250;
+ list.add(EnumChatFormatting.GRAY+""+(maxDamage-getItemDamage(stack))+"/"+maxDamage+" gems remaining.");
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ int dmg = (int) getItemDamage(par1ItemStack);
+ if (dmg > 200){
+ return EnumRarity.epic;
+ }
+ return this.rarity;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ int dmg = (int) getItemDamage(par1ItemStack);
+ if (dmg > 200){
+ return true;
+ }
+ return this.hasEffect;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ if ((this.itemName == null) || this.itemName.equals("")) {
+ return super.getItemStackDisplayName(tItem);
+ }
+ return this.itemName;
+ }
+
+ private static boolean createNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Value", 0);
+ tagMain.setTag("Damage", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static final long getItemDamage(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("Damage");
+ if (aNBT != null) {
+ return aNBT.getLong("Value");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return 0L;
+ }
+
+ public static final boolean setItemDamage(final ItemStack aStack, final long aDamage) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("Damage");
+ if (aNBT != null) {
+ aNBT.setLong("Value", aDamage);
+ return true;
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return false;
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ if (stack.getTagCompound() == null){
+ createNBT(stack);
+ }
+ double currentDamage = getItemDamage(stack);
+ double durabilitypercent = currentDamage / 100;
+ double inverse = (100-durabilitypercent);
+ return durabilitypercent;
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ int dmg = (int) getItemDamage(stack);
+ if (dmg <= 20){
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
+ public static ItemStack damageItem(ItemStack item){
+ if (item != null){
+ long currentUse = BaseItemDamageable.getItemDamage(item);
+ if (currentUse >= 0 && currentUse <= 250){
+ BaseItemDamageable.setItemDamage(item, currentUse+1);
+ return item;
+ }
+ else {
+ return item;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public boolean doesContainerItemLeaveCraftingGrid(ItemStack stack) {
+ Logger.INFO("Does Leave Table? "+stack.getDisplayName());
+ return true;
+ }
+
+ @Override
+ public boolean getShareTag() {
+ return true;
+ }
+
+ @Override
+ public boolean hasContainerItem() {
+ return true;
+ }
+
+ @Override
+ public boolean hasContainerItem(ItemStack stack) {
+ Logger.INFO("hasContainerItem? "+stack.getDisplayName());
+ return true;
+ }
+
+ @Override
+ public ItemStack getContainerItem(ItemStack itemStack) {
+ ItemStack stack = itemStack.copy();
+ //stack.setItemDamage(stack.getItemDamage() + 1);
+ damageItem(stack);
+ stack.stackSize = 1;
+ return stack;
+ }
+
+ @Override
+ public int getDamage(ItemStack stack) {
+ return (int) getItemDamage(stack);
+ }
+
+}
+
+
+
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemGeneric.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemGeneric.java
new file mode 100644
index 0000000000..970d5ec0c8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemGeneric.java
@@ -0,0 +1,28 @@
+package gtPlusPlus.core.item.base;
+
+import java.util.List;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.core.lib.CORE;
+
+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);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemLoot.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemLoot.java
new file mode 100644
index 0000000000..3d9ff9fa48
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemLoot.java
@@ -0,0 +1,109 @@
+package gtPlusPlus.core.item.base;
+
+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;
+
+import gregtech.api.enums.Materials;
+
+import gtPlusPlus.api.enums.Quality;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class BaseItemLoot extends Item{
+
+ private final String materialName;
+ private final String unlocalName;
+ private final LootTypes lootTypes;
+ private Quality lootQuality;
+ private final Materials lootMaterial;
+
+ public BaseItemLoot(final LootTypes lootType, final 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.setMaxStackSize(1);
+ this.setTextureName(CORE.MODID + ":" + "item"+lootType.LOOT_TYPE);
+ }
+
+ public ItemStack generateLootStack(){
+ this.lootQuality = Quality.getRandomQuality();
+ return ItemUtils.getSimpleStack(this, 1);
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return (this.materialName+this.lootTypes.DISPLAY_SUFFIX);
+ }
+
+ public final String getMaterialName() {
+ return this.materialName;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add(this.lootQuality.getQuality());
+
+ /*if (componentMaterial.isRadioactive){
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }*/
+
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ final short[] temp = this.lootMaterial.mRGBa;
+ return Utils.rgbtoHexValue(temp[0], temp[1], temp[2]);
+ }
+
+ @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 this.LOOT_TYPE;
+ }
+ public String getName(){
+ return this.DISPLAY_SUFFIX;
+ }
+ public String getOreDictName(){
+ return this.OREDICT_NAME;
+ }
+ }
+
+}
+
+
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemTCShard.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemTCShard.java
new file mode 100644
index 0000000000..4f0db3e2ec
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemTCShard.java
@@ -0,0 +1,82 @@
+package gtPlusPlus.core.item.base;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+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 gregtech.api.util.GT_OreDictUnificator;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class BaseItemTCShard extends Item{
+
+ public final String unlocalName;
+ public final String displayName;
+ public final String descriptionString;
+ public final String descriptionString2;
+ public final int itemColour;
+
+ public BaseItemTCShard(final String DisplayName, final int colour) {
+ this(DisplayName, colour, "");
+ }
+
+ public BaseItemTCShard(final String DisplayName, final int colour, final String Description) {
+ this(DisplayName, colour, "", Description);
+ }
+
+ public BaseItemTCShard(final String DisplayName, final int colour, final String Description, final String Description2) {
+ this.unlocalName = "item"+Utils.sanitizeString(DisplayName);
+ this.displayName = DisplayName;
+ this.itemColour = colour;
+ this.descriptionString = Description;
+ this.descriptionString2 = Description2;
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(this.unlocalName);
+ this.setMaxStackSize(64);
+ this.setTextureName(CORE.MODID + ":" + "itemShard");
+ GameRegistry.registerItem(this, this.unlocalName);
+ GT_OreDictUnificator.registerOre("shard"+DisplayName, ItemUtils.getSimpleStack(this));
+ GT_OreDictUnificator.registerOre("gemInfused"+DisplayName, ItemUtils.getSimpleStack(this));
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return (this.displayName+" Shard");
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ if ((this.descriptionString != "") || !this.descriptionString.equals("")){
+ list.add(EnumChatFormatting.GRAY+this.descriptionString);
+ }
+ if ((this.descriptionString2 != "") || !this.descriptionString2.equals("")){
+ list.add(EnumChatFormatting.GRAY+this.descriptionString2);
+ }
+ }
+
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ return this.itemColour;
+ }
+
+ @Override
+ public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) {
+
+ }
+
+
+}
+
+
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemTickable.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemTickable.java
new file mode 100644
index 0000000000..eb066024e0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemTickable.java
@@ -0,0 +1,341 @@
+package gtPlusPlus.core.item.base;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+
+public class BaseItemTickable extends CoreItem {
+
+ public final String[] descriptionString;
+ public final int itemColour;
+ public final int maxTicks;
+ public final boolean twoRenderPasses;
+ public final boolean ticksInContainers;
+
+ public IIcon[] mIcon = new IIcon[2];
+
+ public BaseItemTickable(boolean twoPass, final String unlocalName, final int colour, final int maxTicks) {
+ this(false, twoPass, unlocalName, colour, maxTicks, new String[] {});
+ }
+
+ public BaseItemTickable(boolean containerTick, boolean twoPass, final String unlocalName, final int colour, final int maxTicks) {
+ this(containerTick, twoPass, unlocalName, colour, maxTicks, new String[] {});
+ }
+
+ public BaseItemTickable(boolean containerTick, boolean twoPass, final String unlocalName, final int colour, final int maxTicks, final String[] Description) {
+ super(unlocalName, AddToCreativeTab.tabMisc, 1, 999999999, Description, EnumRarity.epic, EnumChatFormatting.DARK_RED, true, null);
+ this.itemColour = colour;
+ this.descriptionString = Description;
+ this.maxTicks = maxTicks;
+ this.twoRenderPasses = twoPass;
+ this.ticksInContainers = containerTick;
+ this.maxStackSize = 1;
+ //setGregtechItemList();
+ }
+
+ @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 == null || iStack == null) {
+ return;
+ }
+ if (world.isRemote) {
+ return;
+ }
+
+
+ boolean active = isTicking(world, iStack);
+ if (active) {
+ tickItemTag(world, iStack);
+ }
+
+ }
+
+ /*private final boolean setGregtechItemList() {
+ ItemList.Component_LavaFilter.set(this);
+ return ItemList.Component_LavaFilter.get(1) != null ? true : false;
+ }*/
+
+ /**
+ *
+ * Handle Custom Rendering
+ *
+ */
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ return this.twoRenderPasses;
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int renderPass) {
+ if (renderPass == 1 && this.twoRenderPasses){
+ return Utils.rgbtoHexValue(255, 255, 255);
+ }
+ return this.itemColour;
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ if (this.twoRenderPasses) {
+ if(pass == 0) {
+ return this.mIcon[0];
+ }
+ return this.mIcon[1];
+ }
+ return this.mIcon[0];
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister i) {
+
+ if (this.twoRenderPasses){
+ this.mIcon[0] = i.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName());
+ this.mIcon[1] = i.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "_OVERLAY");
+ }
+ else {
+ this.mIcon[0] = i.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName());
+ //this.overlay = i.registerIcon(getCorrectTextures() + "_OVERLAY");
+ }
+ }
+
+ protected int getMaxTicks(ItemStack aStack) {
+ return maxTicks;
+ }
+
+ protected boolean createNBT(World world, ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Tick", 0);
+ tagNBT.setLong("maxTick", getMaxTicks(rStack));
+ tagNBT.setBoolean("isActive", true);
+
+ //Try set world time
+ if (world != null) {
+ //tagNBT.setLong("CreationDate", world.getTotalWorldTime());
+ }
+
+ tagMain.setTag("TickableItem", tagNBT);
+ rStack.setTagCompound(tagMain);
+ Logger.INFO("Created Tickable NBT data.");
+ return true;
+ }
+
+ public final long getTicks(World world, final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("TickableItem");
+ if (aNBT != null) {
+ return aNBT.getLong("Tick");
+ }
+ }
+ else {
+ createNBT(world, aStack);
+ }
+ return 0L;
+ }
+
+ public final boolean setTicks(World world, final ItemStack aStack, final long aDamage) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("TickableItem");
+ if (aNBT != null) {
+ aNBT.setLong("Tick", aDamage);
+ return true;
+ }
+ }
+ else {
+ createNBT(world, aStack);
+ }
+ return false;
+ }
+
+ public final boolean isTicking(World world, final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("TickableItem");
+ if (aNBT != null) {
+ return aNBT.getBoolean("isActive");
+ }
+ }
+ else {
+ return createNBT(world, aStack);
+ }
+ return true;
+ }
+
+ public final boolean setTicking(World world, final ItemStack aStack, final boolean active) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("TickableItem");
+ if (aNBT != null) {
+ aNBT.setBoolean("isActive", active);
+ return true;
+ }
+ }
+ else {
+ createNBT(world, aStack);
+ }
+ return false;
+ }
+
+ public final boolean getTicksInContainer(World world, final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("TickableItem");
+ if (aNBT != null) {
+ return aNBT.getBoolean("ticksInContainer");
+ }
+ }
+ else {
+ createNBT(world, aStack);
+ }
+ return false;
+ }
+
+ public final boolean setTicksInContainer(World world, final ItemStack aStack, final boolean active) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("TickableItem");
+ if (aNBT != null) {
+ aNBT.setBoolean("ticksInContainer", active);
+ return true;
+ }
+ }
+ else {
+ createNBT(world, aStack);
+ }
+ return false;
+ }
+
+ public final long getDifferenceInWorldTimeToCreationTime(World world, final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("TickableItem");
+ if (aNBT != null) {
+ return (world.getTotalWorldTime() - aNBT.getLong("CreationDate"));
+ }
+ }
+ else {
+ createNBT(world, aStack);
+ }
+ return 0L;
+ }
+
+ public final boolean setItemStackCreationTime(final ItemStack aStack, World world) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("TickableItem");
+ if (aNBT != null) {
+ aNBT.setLong("CreationDate", world.getTotalWorldTime());
+ return true;
+ }
+ }
+ else {
+ createNBT(world, aStack);
+ }
+ return false;
+ }
+
+ public final boolean tickItemTag(World world, ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ if (aNBT.hasKey("TickableItem")) {
+ aNBT = aNBT.getCompoundTag("TickableItem");
+ //Done Ticking
+ if (getMaxTicks(aStack)-getTicks(world, aStack) <= 0) {
+ setTicking(world, aStack, false);
+ return false;
+ }
+ if (isTicking(world, aStack)) {
+ if (aNBT != null) {
+ aNBT.setLong("Tick", getTicks(world, aStack)+1);
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return false;
+ }
+ }
+ }
+ return createNBT(world, aStack);
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ if (stack.getTagCompound() == null){
+ //createNBT(null, stack);
+ return 0;
+ }
+ double currentDamage = getTicks(null, stack);
+ double durabilitypercent = currentDamage / getMaxTicks(stack);
+ return durabilitypercent;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, @SuppressWarnings("rawtypes") List list, boolean bool) {
+ World world = player.getEntityWorld();
+ if (this.descriptionString.length > 0) {
+ list.add(EnumChatFormatting.GRAY+this.descriptionString[0]);
+ }
+ long maxTicks = getMaxTicks(stack);
+ long ticks = 0;
+ if (stack.hasTagCompound()) {
+ ticks = getTicks(world, stack);
+ }
+ EnumChatFormatting durability = EnumChatFormatting.GRAY;
+ if (maxTicks-ticks > (maxTicks*0.8)){
+ durability = EnumChatFormatting.GRAY;
+ }
+ else if (maxTicks-ticks > (maxTicks*0.6)){
+ durability = EnumChatFormatting.GREEN;
+ }
+ else if (maxTicks-ticks > (maxTicks*0.4)){
+ durability = EnumChatFormatting.YELLOW;
+ }
+ else if (maxTicks-ticks > (maxTicks*0.2)){
+ durability = EnumChatFormatting.GOLD;
+ }
+ else if (maxTicks-ticks > 0){
+ durability = EnumChatFormatting.RED;
+ }
+ list.add(durability+""+((maxTicks-ticks)/20)+EnumChatFormatting.GRAY+" seconds until decay");
+
+ if (this.descriptionString.length > 1) {
+ for (int h=1;h<this.descriptionString.length;h++) {
+ list.add(EnumChatFormatting.GRAY+this.descriptionString[h]);
+ }
+ }
+
+ //super.addInformation(stack, player, list, bool);
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+
+}
+
+
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemWithCharge.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemWithCharge.java
new file mode 100644
index 0000000000..d81112e0c6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemWithCharge.java
@@ -0,0 +1,76 @@
+package gtPlusPlus.core.item.base;
+
+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.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+
+public class BaseItemWithCharge extends Item{
+
+ public int int_Charge = 0;
+ public int int_Max_Charge = 0;
+
+ public BaseItemWithCharge(final String unlocalizedName, final int constructor_Charge, final int constructor_Max_Charge) {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ this.int_Charge = constructor_Charge;
+ this.int_Max_Charge = constructor_Max_Charge;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @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;
+ 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);
+ }
+ }
+
+ //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) {
+
+ }
+
+ @Override
+ public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) {
+
+ }
+
+ @Override
+ public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) {
+ itemStack.stackTagCompound = new NBTTagCompound();
+ return super.onItemRightClick(itemStack, world, par3Entity);
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java b/src/main/java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java
new file mode 100644
index 0000000000..14597ae876
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java
@@ -0,0 +1,27 @@
+package gtPlusPlus.core.item.base;
+
+import java.util.List;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.core.lib.CORE;
+
+public class BaseItemWithDamageValue extends Item{
+ public BaseItemWithDamageValue(final String unlocalizedName) {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setMaxDamage(100);
+ }
+ @Override
+ public void setDamage(final ItemStack stack, final int damage) {
+ super.setDamage(stack, damage);
+ }
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/base/BasicSpawnEgg.java b/src/main/java/gtPlusPlus/core/item/base/BasicSpawnEgg.java
new file mode 100644
index 0000000000..57d42d721e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/BasicSpawnEgg.java
@@ -0,0 +1,254 @@
+package gtPlusPlus.core.item.base;
+
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+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.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemMonsterPlacer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+
+
+
+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
+ Logger.WARNING("Spawn egg constructor for "+this.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(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);
+ 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;
+ }
+
+ final Entity entity = this.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;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * 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
+ {
+ 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
+ Logger.WARNING("Entity not found "+this.entityToSpawnName);
+ }
+ }
+
+ return this.entityToSpawn;
+ }
+
+
+ /**
+ * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
+ */
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(final Item parItem, final CreativeTabs parTab, final List parList){
+ parList.add(new ItemStack(parItem, 1, 0));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(final ItemStack par1ItemStack, final int parColorType){
+ return (parColorType == 0) ? this.colorBase : this.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(final ItemStack par1ItemStack){
+ return "Spawn "+this.entityToSpawnName;
+ }
+
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(final IIconRegister par1IconRegister){
+ super.registerIcons(par1IconRegister);
+ this.theIcon = par1IconRegister.registerIcon(this.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(final int parDamageVal, final int parRenderPass){
+ return parRenderPass > 0 ? this.theIcon : super.getIconFromDamageForRenderPass(parDamageVal, parRenderPass);
+ }
+
+ public void setColors(final int parColorBase, final int parColorSpots){
+ this.colorBase = parColorBase;
+ this.colorSpots = parColorSpots;
+ }
+
+ public int getColorBase(){
+ return this.colorBase;
+ }
+
+ public int getColorSpots(){
+ return this.colorSpots;
+ }
+
+ public final void setEntityToSpawnName(final String parEntityToSpawnName){
+ this.entityToSpawnName = parEntityToSpawnName;
+ this.entityToSpawnNameFull = this.entityMODID+"."+this.entityToSpawnName;
+ }
+
+}
+
diff --git a/src/main/java/gtPlusPlus/core/item/base/CoreItem.java b/src/main/java/gtPlusPlus/core/item/base/CoreItem.java
new file mode 100644
index 0000000000..7ce96b2a88
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/CoreItem.java
@@ -0,0 +1,237 @@
+package gtPlusPlus.core.item.base;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class CoreItem extends Item
+{
+
+ private final EnumRarity rarity;
+ private final EnumChatFormatting descColour;
+ private final String[] itemDescription;
+ protected String itemName;
+ private final boolean hasEffect;
+
+ //Replace Item - What does this item turn into when held.
+ private final ItemStack turnsInto;
+
+ //0
+ /*
+ * Name, Tab - 64 Stack, 0 Dmg
+ */
+ public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab)
+ {
+ this(unlocalizedName, creativeTab, 64, 0); //Calls 3
+ }
+
+ //0
+ /*
+ * Name, Tab - 64 Stack, 0 Dmg
+ */
+ public CoreItem(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab)
+ {
+ this(unlocalizedName, creativeTab, 64, 0); //Calls 3
+ this.itemName = displayName;
+ }
+
+ //0.1
+ /*
+ * Name, Tab - 64 Stack, 0 Dmg
+ */
+ public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final ItemStack OverrideItem)
+ {
+ this(unlocalizedName, creativeTab, 64, 0, new String[] {"This item will be replaced by another when held by a player, it is old and should not be used in recipes."}, EnumRarity.uncommon, EnumChatFormatting.UNDERLINE, false, OverrideItem); //Calls 5
+ }
+ //0.1
+ /*
+ * Name, Tab - 64 Stack, 0 Dmg
+ */
+ public CoreItem(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab, final ItemStack OverrideItem)
+ {
+ this(unlocalizedName, creativeTab, 64, 0, new String[] {"This item will be replaced by another when held by a player, it is old and should not be used in recipes."}, EnumRarity.uncommon, EnumChatFormatting.UNDERLINE, false, OverrideItem); //Calls 5
+ this.itemName = displayName;
+ }
+
+ //1
+ /*
+ * Name, Tab, Stack - 0 Dmg
+ */
+ public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize)
+ {
+ this(unlocalizedName, creativeTab, stackSize, 0); //Calls 3
+ }
+ //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
+ }
+ //3
+ /*
+ * Name, Tab, Stack, Dmg - Description
+ */
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, String string) {
+ this(unlocalizedName, creativeTab, stackSize, new String[] {string});
+ }
+ public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg)
+ {
+ this(unlocalizedName, creativeTab, stackSize, maxDmg, new String[] {}); //Calls 4
+ }
+ //4 //Not Rare + basic tooltip
+ /*
+ * Name, Tab, Stack, Dmg, Description
+ */
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String string) {
+ this(unlocalizedName, creativeTab, stackSize, maxDmg, new String[] {string});
+ }
+ 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, null); //Calls 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, null); //Calls 5
+ }
+
+ //4.75
+ /*
+ * Name, Tab, Stack, Dmg, Description, Rarity - Gray text
+ */
+ public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String string, EnumRarity uncommon) {
+ this(unlocalizedName, creativeTab, stackSize, maxDmg, new String[] {string}, uncommon);
+ }
+ 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, null); //Calls 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, final ItemStack OverrideItem)
+ {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(creativeTab);
+ this.setMaxStackSize(stackSize);
+ this.setMaxDamage(maxDmg);
+ this.rarity = regRarity;
+ this.itemDescription = description;
+ this.descColour = colour;
+ this.hasEffect = Effect;
+ this.turnsInto = OverrideItem;
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ //6
+ /*
+ * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect
+ */
+ public CoreItem(final String unlocalizedName, final String displayName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, final String[] description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect, final ItemStack OverrideItem)
+ {
+ this.setUnlocalizedName(unlocalizedName);
+ this.itemName = displayName;
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setCreativeTab(creativeTab);
+ this.setMaxStackSize(stackSize);
+ this.setMaxDamage(maxDmg);
+ this.rarity = regRarity;
+ this.itemDescription = description;
+ this.descColour = colour;
+ this.hasEffect = Effect;
+ this.turnsInto = OverrideItem;
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ if (this.itemDescription.length > 0) {
+ for (int u=0;u<this.itemDescription.length;u++) {
+ list.add(this.descColour+this.itemDescription[u]);
+ }
+ }
+ //list.add(this.descColour+this.itemDescription);
+ //super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return this.rarity;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return this.hasEffect;
+ }
+
+ @Override
+ public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) {
+ if (this.turnsInto != null){
+ if (entityHolding instanceof EntityPlayer){
+
+ Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+this.turnsInto.getDisplayName()+".");
+ final ItemStack tempTransform = this.turnsInto;
+ if (iStack.stackSize == 64){
+ tempTransform.stackSize=64;
+ ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
+ for (int l=0;l<64;l++){
+ ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
+ }
+
+ }
+ else {
+ tempTransform.stackSize=1;
+ ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
+ ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+
+ public ItemStack getStack() {
+ return ItemUtils.getSimpleStack(this);
+ }
+
+/* @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ if ((this.itemName == null) || this.itemName.equals("")) {
+ return super.getItemStackDisplayName(tItem);
+ }
+ return this.itemName;
+ }*/
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java b/src/main/java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
new file mode 100644
index 0000000000..0420809253
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.base.bolts;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemBolt extends BaseItemComponent{
+
+ public BaseItemBolt(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.BOLT);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
new file mode 100644
index 0000000000..ad47adcf64
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
@@ -0,0 +1,70 @@
+package gtPlusPlus.core.item.base.cell;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import ic2.core.Ic2Items;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidContainerRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class BaseItemCell extends BaseItemComponent{
+
+ ComponentTypes Cell = ComponentTypes.CELL;
+
+ public BaseItemCell(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.CELL);
+ this.fluidColour = (short[]) material.getRGBA();
+ //FluidContainerRegistry.registerFluidContainer(material.getFluid(1000), ItemUtils.getSimpleStack(this), Ic2Items.cell.copy());
+ }
+
+ public BaseItemCell(final String unlocalName, final String localName, final short[] RGBa) {
+ super(unlocalName, localName, RGBa);
+ this.fluidColour = RGBa;
+ FluidStack aFluid = FluidUtils.getFluidStack(unlocalName.toLowerCase(), 1000);
+ if (aFluid != null) {
+ FluidContainerRegistry.registerFluidContainer(aFluid, ItemUtils.getSimpleStack(this), Ic2Items.cell.copy());
+ }
+ }
+
+ public BaseItemCell(final String unlocalName, final String localName, final short[] RGBa, final Fluid cellFluid) {
+ super(unlocalName, localName, RGBa);
+ this.fluidColour = RGBa;
+ FluidContainerRegistry.registerFluidContainer(FluidUtils.getFluidStack(cellFluid, 1000), ItemUtils.getSimpleStack(this), Ic2Items.cell.copy());
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister i) {
+
+ if (CORE.ConfigSwitches.useGregtechTextures){
+ this.base = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "cell");
+ this.overlay = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "cell_OVERLAY");
+ }
+ else {
+ this.base = i.registerIcon(CORE.MODID + ":" + "item"+this.Cell.getComponent());
+ this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+this.Cell.getComponent()+"_Overlay");
+ }
+ //this.overlay = cellMaterial.getFluid(1000).getFluid().get
+ }
+
+ private final short[] fluidColour;
+ boolean upwards = true;
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int renderPass) {
+ if (renderPass == 0 && !CORE.ConfigSwitches.useGregtechTextures){
+ return Utils.rgbtoHexValue(230, 230, 230);
+ }
+ if (renderPass == 1 && CORE.ConfigSwitches.useGregtechTextures){
+ return Utils.rgbtoHexValue(230, 230, 230);
+ }
+ return this.componentColour;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java
new file mode 100644
index 0000000000..23d1d022fa
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/cell/BaseItemPlasmaCell.java
@@ -0,0 +1,83 @@
+package gtPlusPlus.core.item.base.cell;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.Utils;
+
+public class BaseItemPlasmaCell extends BaseItemComponent{
+
+ private IIcon base;
+ private IIcon overlay;
+ ComponentTypes PlasmaCell = ComponentTypes.PLASMACELL;
+ private int tickCounter = 0;
+ private final int tickCounterMax = 200;
+ private final short[] fluidColour;
+
+ public BaseItemPlasmaCell(final Material material) {
+ super(material, ComponentTypes.PLASMACELL);
+ this.fluidColour = (short[]) material.getRGBA();
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ return true;
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister i) {
+ this.base = i.registerIcon(CORE.MODID + ":" + "item"+this.PlasmaCell.getComponent());
+ this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+this.PlasmaCell.getComponent()+"_Overlay");
+ //this.overlay = cellMaterial.getFluid(1000).getFluid().get
+ }
+
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int renderPass) {
+ if (renderPass == 0){
+ return Utils.rgbtoHexValue(230, 230, 230);
+ }
+ return this.componentColour;
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ if(pass == 0) {
+ return this.base;
+ }
+ return this.overlay;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack cell) {
+ return this.materialName+" Plasma Cell";
+ }
+
+ @Override
+ public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) {
+ if (this.componentMaterial != null){
+ if (!world.isRemote){
+ if(this.tickCounter < this.tickCounterMax ){
+ this.tickCounter++;
+ }
+ else if(this.tickCounter >= this.tickCounterMax){
+ entityHolding.attackEntityFrom(DamageSource.onFire, 2);
+ this.tickCounter = 0;
+ }
+ }
+ }
+ super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
new file mode 100644
index 0000000000..9022f864cb
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
@@ -0,0 +1,145 @@
+package gtPlusPlus.core.item.base.dusts;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemDust extends BaseItemComponent {
+
+ private BaseItemComponent[] mSizedDusts = new BaseItemComponent[2];
+
+ public BaseItemDust(Material aMat) {
+ this(aMat, true);
+ }
+
+ public BaseItemDust(Material aMat, boolean generateSmallDusts) {
+ super(aMat, ComponentTypes.DUST);
+ if (generateSmallDusts) {
+ mSizedDusts[0] = new BaseItemComponent(aMat, ComponentTypes.DUSTSMALL);
+ mSizedDusts[1] = new BaseItemComponent(aMat, ComponentTypes.DUSTTINY);
+ }
+ }
+
+ public BaseItemDust(DustState aState, Material aMat) {
+ super(aMat, ComponentTypes.DUST);
+ if (aState.generatesSmallDust()) {
+ mSizedDusts[0] = new BaseItemComponent(aMat, ComponentTypes.DUSTSMALL);
+ }
+ if (aState.generatesTinyDust()) {
+ mSizedDusts[1] = new BaseItemComponent(aMat, ComponentTypes.DUSTTINY);
+ }
+ }
+
+ private BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, boolean addRecipes) {
+ super(matInfo, ComponentTypes.DUST);
+ }
+
+ public static class DustState {
+ static final int NORMAL = (1);
+ static final int SMALL = (10);
+ static final int TINY = (100);
+ final int MIXTURE;
+ final boolean[] doesThings = new boolean[3];
+
+ public DustState (boolean genDust, boolean genSmallDust, boolean genDustTiny){
+ int aTotal = 0;
+ if (genDust) {
+ aTotal += NORMAL;
+ doesThings[0] = true;
+ }
+ else {
+ doesThings[0] = false;
+ }
+ if (genSmallDust) {
+ aTotal += SMALL;
+ doesThings[1] = true;
+ }
+ else {
+ doesThings[1] = false;
+ }
+ if (genDustTiny) {
+ aTotal += TINY;
+ doesThings[2] = true;
+ }
+ else {
+ doesThings[2] = false;
+ }
+ MIXTURE = aTotal;
+ }
+
+ public boolean generatesDust() {
+ return doesThings[0];
+ }
+ public boolean generatesSmallDust() {
+ return doesThings[1];
+ }
+ public boolean generatesTinyDust() {
+ return doesThings[2];
+ }
+
+ private DustState(int amount) {
+
+ if (amount == 1) {
+ doesThings[0] = true;
+ doesThings[1] = false;
+ doesThings[2] = false;
+
+ }
+ else if (amount == 10) {
+ doesThings[0] = false;
+ doesThings[1] = true;
+ doesThings[2] = false;
+ }
+ else if (amount == 100) {
+ doesThings[0] = false;
+ doesThings[1] = false;
+ doesThings[2] = true;
+
+ }
+ else if (amount == 11) {
+ doesThings[0] = true;
+ doesThings[1] = true;
+ doesThings[2] = false;
+
+ }
+ else if (amount == 101) {
+ doesThings[0] = true;
+ doesThings[1] = false;
+ doesThings[2] = true;
+
+ }
+ else if (amount == 110) {
+ doesThings[0] = false;
+ doesThings[1] = true;
+ doesThings[2] = true;
+
+ }
+ else if (amount == 111) {
+ doesThings[0] = true;
+ doesThings[1] = true;
+ doesThings[2] = true;
+ }
+ else {
+ doesThings[0] = false;
+ doesThings[1] = false;
+ doesThings[2] = false;
+ }
+ MIXTURE = amount;
+ }
+
+ public DustState get(int a) {
+ if (a == 1) {
+ return new DustState(NORMAL);
+ }
+ else if (a == 10) {
+ return new DustState(SMALL);
+ }
+ else if (a == 100) {
+ return new DustState(TINY);
+ }
+ else {
+ return new DustState(MIXTURE);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java
new file mode 100644
index 0000000000..8ee871e9c4
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java
@@ -0,0 +1,44 @@
+package gtPlusPlus.core.item.base.dusts;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.core.lib.CORE;
+
+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) {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setMaxStackSize(64);
+ if (pileSize.equalsIgnoreCase("dust")){
+ this.setTextureName(CORE.MODID + ":" + "dust");
+ }
+ else{
+ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);
+ }
+ this.setMaxStackSize(64);
+ this.colour = colour;
+ this.materialName = materialName;
+ this.setUnlocalizedName(unlocalizedName);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public abstract void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool);
+
+ public abstract String getMaterialName();
+
+ @Override
+ public abstract int getColorFromItemStack(ItemStack stack, int hex);
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java
new file mode 100644
index 0000000000..0757177e58
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustEx.java
@@ -0,0 +1,126 @@
+package gtPlusPlus.core.item.base.dusts;
+
+import java.util.*;
+
+import org.apache.commons.lang3.StringUtils;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+import gregtech.api.enums.TextureSet;
+import gregtech.api.util.GT_OreDictUnificator;
+
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class BaseItemDustEx extends BaseItemComponent{
+
+ public static Map<String, String> mCachedPileLinkages = new HashMap<String, String>();
+
+ protected IIcon[] baseAr = new IIcon[3];
+ protected IIcon[] overlayAr = new IIcon[3];
+ public final static ComponentTypes[] componentTypeAr = new ComponentTypes[] {ComponentTypes.DUST, ComponentTypes.DUSTSMALL, ComponentTypes.DUSTTINY};
+
+ public BaseItemDustEx(final Material material) {
+ super(material, componentTypeAr[0]);
+ //OreDict this beauty
+ GT_OreDictUnificator.registerOre(componentTypeAr[0].getOreDictName()+material.getUnlocalizedName(), ItemUtils.simpleMetaStack(this, 0, 1));
+ GT_OreDictUnificator.registerOre(componentTypeAr[1].getOreDictName()+material.getUnlocalizedName(), ItemUtils.simpleMetaStack(this, 0, 1));
+ GT_OreDictUnificator.registerOre(componentTypeAr[2].getOreDictName()+material.getUnlocalizedName(), ItemUtils.simpleMetaStack(this, 0, 1));
+ bakeRegistry();
+ }
+
+ private void bakeRegistry() {
+ String unlocalName = getUnlocalizedName();
+ if (unlocalName.contains("item.")) {
+ unlocalName = StringUtils.remove(unlocalName, "item.");
+ }
+ if (unlocalName.contains("itemDust")) {
+ unlocalName = StringUtils.remove(unlocalName, "itemDust");
+ }
+ mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDust"+unlocalName);
+ mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDustSmall"+unlocalName);
+ mCachedPileLinkages.put(this.getUnlocalizedName(), "itemDustTiny"+unlocalName);
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 3; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(int meta, int pass) {
+ if (CORE.ConfigSwitches.useGregtechTextures) {
+ if (meta == 0) {
+ if (pass == 0) {
+ return this.baseAr[0];
+ }
+ else {
+ return this.overlayAr[0];
+ }
+ }
+ else if (meta == 1) {
+ if (pass == 0) {
+ return this.baseAr[1];
+ }
+ else {
+ return this.overlayAr[1];
+ }
+ }
+ else {
+ if (pass == 0) {
+ return this.baseAr[2];
+ }
+ else {
+ return this.overlayAr[2];
+ }
+ }
+ }
+ else {
+ return this.baseAr[meta];
+ }
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister i) {
+ if (CORE.ConfigSwitches.useGregtechTextures){
+ this.baseAr[0] = i.registerIcon(getCorrectTextures());
+ this.overlayAr[0] = i.registerIcon(getCorrectTextures() + "_OVERLAY");
+ this.baseAr[1] = i.registerIcon(getCorrectTextures()+"Small");
+ this.overlayAr[1] = i.registerIcon(getCorrectTextures() + "Small_OVERLAY");
+ this.baseAr[2] = i.registerIcon(getCorrectTextures()+"Tiny");
+ this.overlayAr[2] = i.registerIcon(getCorrectTextures() + "Tiny_OVERLAY");
+ }
+ else {
+ this.baseAr[0] = i.registerIcon(getCorrectTextures());
+ this.baseAr[1] = i.registerIcon(getCorrectTextures()+"Small");
+ this.baseAr[2] = i.registerIcon(getCorrectTextures()+"Tiny");
+ }
+ }
+
+ @Override
+ public String getCorrectTextures(){
+ if (!CORE.ConfigSwitches.useGregtechTextures){
+ return CORE.MODID + ":" + "item"+this.componentType.getComponent();
+ }
+ String metType = "9j4852jyo3rjmh3owlhw9oe";
+ if (this.componentMaterial != null) {
+ TextureSet u = this.componentMaterial.getTextureSet();
+ if (u != null) {
+ metType = u.mSetName;
+ }
+ }
+ metType = (metType.equals("9j4852jyo3rjmh3owlhw9oe") ? "METALLIC" : metType);
+ return "gregtech" + ":" + "materialicons/"+metType+"/" + this.componentType.getOreDictName();
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
new file mode 100644
index 0000000000..e4fa06c58e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
@@ -0,0 +1,162 @@
+package gtPlusPlus.core.item.base.dusts;
+
+import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_OreDictUnificator;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.data.StringUtils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class BaseItemDustUnique extends Item{
+
+ protected final int colour;
+ protected final int sRadiation;
+ protected final String materialName;
+ protected final String name;
+ protected final String chemicalNotation;
+
+ public BaseItemDustUnique(final String unlocalizedName, final String materialName, final int colour, final String pileSize) {
+ this(unlocalizedName, materialName, "NullFormula", colour, pileSize);
+ }
+
+ public BaseItemDustUnique(final String unlocalizedName, final String materialName, final String mChemicalFormula, final int colour, final String pileSize) {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setMaxStackSize(64);
+ this.setTextureName(this.getCorrectTexture(pileSize));
+ this.setCreativeTab(tabMisc);
+ this.colour = colour;
+ this.materialName = materialName;
+ if (mChemicalFormula == null || mChemicalFormula.equals("") || mChemicalFormula.equals("NullFormula")){
+ this.chemicalNotation = StringUtils.subscript(materialName);
+ }
+ else {
+ this.chemicalNotation = StringUtils.subscript(mChemicalFormula);
+ }
+ this.sRadiation = ItemUtils.getRadioactivityLevel(materialName);
+ GameRegistry.registerItem(this, unlocalizedName);
+
+ 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";
+ }
+ else {
+ this.name = this.materialName+ " Dust";
+ }
+
+ String temp = "";
+ Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName());
+ if (this.getUnlocalizedName().contains("item.")){
+ temp = this.getUnlocalizedName().replace("item.", "");
+ Logger.WARNING("Generating OreDict Name: "+temp);
+ }
+ else {
+ temp = this.getUnlocalizedName();
+ }
+ if (temp.contains("DustTiny")){
+ temp = temp.replace("itemD", "d");
+ Logger.WARNING("Generating OreDict Name: "+temp);
+ }
+ else if (temp.contains("DustSmall")){
+ temp = temp.replace("itemD", "d");
+ Logger.WARNING("Generating OreDict Name: "+temp);
+ }
+ else {
+ temp = temp.replace("itemD", "d");
+ Logger.WARNING("Generating OreDict Name: "+temp);
+ }
+ if ((temp != null) && !temp.equals("")){
+ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
+ }
+ registerComponent();
+ }
+
+ public boolean registerComponent() {
+ if (this.materialName == null) {
+ return false;
+ }
+ String aName = materialName;
+ //Register Component
+ Map<String, ItemStack> aMap = Material.mComponentMap.get(aName);
+ if (aMap == null) {
+ aMap = new HashMap<String, ItemStack>();
+ }
+ String aKey = OrePrefixes.dust.name();
+ ItemStack x = aMap.get(aKey);
+ if (x == null) {
+ aMap.put(aKey, ItemUtils.getSimpleStack(this));
+ Logger.MATERIALS("Registering a material component. Item: ["+aName+"] Map: ["+aKey+"]");
+ Material.mComponentMap.put(aName, aMap);
+ return true;
+ }
+ else {
+ //Bad
+ Logger.MATERIALS("Tried to double register a material component. ");
+ return false;
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack iStack) {
+ return this.name;
+ }
+
+ private String getCorrectTexture(final String pileSize){
+ if (!CORE.ConfigSwitches.useGregtechTextures){
+ if ((pileSize.equals("dust")) || (pileSize.equals("Dust"))){
+ this.setTextureName(CORE.MODID + ":" + "dust");}
+ else{
+ this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);
+ }
+ }
+ if (pileSize.toLowerCase().contains("small")){
+ return "gregtech" + ":" + "materialicons/SHINY/dustSmall";
+ }
+ else if (pileSize.toLowerCase().contains("tiny")){
+ return "gregtech" + ":" + "materialicons/SHINY/dustTiny";
+ }
+ return "gregtech" + ":" + "materialicons/SHINY/dust";
+ }
+
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @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);
+ }
+ if (this.chemicalNotation.length() > 0 && !chemicalNotation.equals("") && !chemicalNotation.equals("NullFormula")){
+ list.add(this.chemicalNotation);
+ }
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ public final String getMaterialName() {
+ return StringUtils.subscript(this.materialName);
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ if (this.colour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return this.colour;
+
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java b/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java
new file mode 100644
index 0000000000..c6aff85da1
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java
@@ -0,0 +1,58 @@
+package gtPlusPlus.core.item.base.dusts.decimal;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemCentidust extends Item{
+
+ final Material dustMaterial;
+ final String materialName;
+ final String unlocalName;
+
+ public BaseItemCentidust(final Material material) {
+ this.dustMaterial = material;
+ this.unlocalName = "itemCentidust"+material.getUnlocalizedName();
+ this.materialName = material.getLocalizedName();
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(this.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
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+
+ return (this.materialName+ " Centidust");
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @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 final String getMaterialName() {
+ return this.materialName;
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ return this.dustMaterial.getRgbAsHex();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java b/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java
new file mode 100644
index 0000000000..2d1b4a8d27
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java
@@ -0,0 +1,58 @@
+package gtPlusPlus.core.item.base.dusts.decimal;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemDecidust extends Item{
+
+ final Material dustMaterial;
+ final String materialName;
+ final String unlocalName;
+
+ public BaseItemDecidust(final Material material) {
+ this.dustMaterial = material;
+ this.unlocalName = "itemDecidust"+material.getUnlocalizedName();
+ this.materialName = material.getLocalizedName();
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(this.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
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+
+ return (this.materialName+ " Decidust");
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @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 final String getMaterialName() {
+ return this.materialName;
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ return this.dustMaterial.getRgbAsHex();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/foil/BaseItemFoil.java b/src/main/java/gtPlusPlus/core/item/base/foil/BaseItemFoil.java
new file mode 100644
index 0000000000..3e2816bf52
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/foil/BaseItemFoil.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.base.foil;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemFoil extends BaseItemComponent{
+
+ public BaseItemFoil(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.FOIL);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java b/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java
new file mode 100644
index 0000000000..54aa90c03f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemFood.java
@@ -0,0 +1,50 @@
+package gtPlusPlus.core.item.base.foods;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+
+public class BaseItemFood extends ItemFood {
+
+ private final 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) {
+ super(healAmount, saturationModifier, wolvesFavorite);
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName.replace("Hot", ""));
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.effects = effects;
+ this.localName = localizedName;
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @Override
+ protected void onFoodEaten(final ItemStack stack, final World world, final EntityPlayer player) {
+ super.onFoodEaten(stack, world, player);
+
+ 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()
+ )
+ );
+ }
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+
+ return ("A Serving of "+this.localName);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java b/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java
new file mode 100644
index 0000000000..528b9593e6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java
@@ -0,0 +1,80 @@
+package gtPlusPlus.core.item.base.foods;
+
+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.DamageSource;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class BaseItemHotFood extends BaseItemFood{
+
+ 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);
+ this.unlocalName = unlocalizedName;
+ this.cooldownTime = timeToCoolInSeconds * 20;
+ this.materialName = foodName;
+ this.output = cooledFood;
+ this.setMaxStackSize(1);
+ }
+
+ @Override
+ public ItemStack onEaten(final ItemStack iStack, final World world, final EntityPlayer player) {
+ return super.onEaten(iStack, world, player);
+ }
+
+ @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){
+ Logger.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);
+ }
+
+
+ }
+ super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @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 final String getMaterialName() {
+ return this.materialName;
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ return Utils.rgbtoHexValue(230, 96, 96);
+
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/gears/BaseItemGear.java b/src/main/java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
new file mode 100644
index 0000000000..b72ea5db15
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.base.gears;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemGear extends BaseItemComponent{
+
+ public BaseItemGear(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.GEAR);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/gears/BaseItemSmallGear.java b/src/main/java/gtPlusPlus/core/item/base/gears/BaseItemSmallGear.java
new file mode 100644
index 0000000000..5435c692c6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/gears/BaseItemSmallGear.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.base.gears;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemSmallGear extends BaseItemComponent{
+
+ public BaseItemSmallGear(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.SMALLGEAR);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java b/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java
new file mode 100644
index 0000000000..ea96e2914c
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java
@@ -0,0 +1,21 @@
+package gtPlusPlus.core.item.base.ingots;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemIngot extends BaseItemComponent{
+
+ protected final String materialName;
+ protected final String unlocalName;
+
+ public BaseItemIngot(final Material material) {
+ this(material, ComponentTypes.INGOT);
+ }
+
+ public BaseItemIngot(final Material material, final ComponentTypes type) {
+ super(material, type);
+ this.materialName = material.getLocalizedName();
+ this.unlocalName = material.getUnlocalizedName();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java b/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java
new file mode 100644
index 0000000000..c19fecd924
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java
@@ -0,0 +1,110 @@
+package gtPlusPlus.core.item.base.ingots;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class BaseItemIngotHot extends BaseItemIngot{
+
+ private final ItemStack outputIngot;
+ private int tickCounter = 0;
+ private final int tickCounterMax = 200;
+ private final int mTier;
+
+ private IIcon base;
+ private IIcon overlay;
+
+ public BaseItemIngotHot(final Material material) {
+ super(material, ComponentTypes.HOTINGOT);
+ this.setTextureName(CORE.MODID + ":" + "itemIngotHot");
+ this.outputIngot = material.getIngot(1);
+ this.mTier = material.vTier;
+ this.generateRecipe();
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return super.getItemStackDisplayName(p_77653_1_);
+ //return ("Hot "+this.materialName+ " Ingot");
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ return Utils.rgbtoHexValue(225, 225, 225);
+ }
+
+ private void generateRecipe(){
+ Logger.WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+this.materialName+".");
+ CORE.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), this.outputIngot.copy(), (int) Math.max(this.componentMaterial.getMass() * 3L, 1L), this.componentMaterial.vVoltageMultiplier);
+ }
+
+ @Override
+ public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) {
+ if (this.componentMaterial != null){
+ if (entityHolding != null && entityHolding instanceof EntityPlayer){
+ if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){
+ EntityUtils.applyHeatDamageToEntity(1, world, entityHolding);
+ }
+ }
+ }
+ super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ if (CORE.ConfigSwitches.useGregtechTextures){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister i) {
+
+ if (CORE.ConfigSwitches.useGregtechTextures){
+ this.base = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "ingotHot");
+ this.overlay = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "ingotHot_OVERLAY");
+ }
+ else {
+ this.base = i.registerIcon(CORE.MODID + ":" + "item"+BaseItemComponent.ComponentTypes.HOTINGOT.getComponent());
+ //this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+BaseItemComponent.ComponentTypes.HOTINGOT.getComponent()+"_Overlay");
+ }
+ //this.overlay = cellMaterial.getFluid(1000).getFluid().get
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ if(pass == 0 && CORE.ConfigSwitches.useGregtechTextures) {
+ return this.base;
+ }
+ else if(pass == 1 && CORE.ConfigSwitches.useGregtechTextures) {
+ return this.overlay;
+ }
+ else {
+ return this.overlay;
+ }
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java b/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java
new file mode 100644
index 0000000000..6ad323333f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/ingots/BaseItemIngot_OLD.java
@@ -0,0 +1,101 @@
+package gtPlusPlus.core.item.base.ingots;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class BaseItemIngot_OLD extends Item{
+
+ protected int colour;
+ protected String materialName;
+ protected String unlocalName;
+
+ public BaseItemIngot_OLD(final String unlocalizedName, final String materialName, final int colour, final int sRadioactivity) {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.unlocalName = unlocalizedName;
+ this.setMaxStackSize(64);
+ this.setTextureName(CORE.MODID + ":" + "itemIngot");
+ this.colour = colour;
+ this.materialName = materialName;
+ this.sRadiation = sRadioactivity;
+ GameRegistry.registerItem(this, unlocalizedName);
+ String temp = "";
+ if (this.unlocalName.contains("itemIngot")){
+ temp = this.unlocalName.replace("itemI", "i");
+ }
+ else if (this.unlocalName.contains("itemHotIngot")){
+ temp = this.unlocalName.replace("itemHotIngot", "ingotHot");
+ }
+ if ((temp != null) && !temp.equals("")){
+ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
+ }
+ //this.generateCompressorRecipe();
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+
+ return (this.materialName+ " Ingot");
+ }
+
+ public final String getMaterialName() {
+ return this.materialName;
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ if (this.colour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return this.colour;
+
+ }
+
+ private void generateCompressorRecipe(){
+ if (this.unlocalName.contains("itemIngot")){
+ final ItemStack tempStack = ItemUtils.getSimpleStack(this, 9);
+ ItemStack tempOutput = null;
+ String temp = this.getUnlocalizedName().replace("item.itemIngot", "block");
+ Logger.WARNING("Unlocalized name for OreDict nameGen: "+this.getUnlocalizedName());
+ if (this.getUnlocalizedName().contains("item.")){
+ temp = this.getUnlocalizedName().replace("item.", "");
+ Logger.WARNING("Generating OreDict Name: "+temp);
+ }
+ temp = temp.replace("itemIngot", "block");
+ Logger.WARNING("Generating OreDict Name: "+temp);
+ if ((temp != null) && !temp.equals("")){
+ tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1);
+ if (tempOutput != null){
+ GT_ModHandler.addCompressionRecipe(tempStack, tempOutput);
+ }
+
+ }
+ }
+ else if (this.unlocalName.contains("itemHotIngot")){
+ return;
+ }
+
+
+ }
+
+
+ protected final int sRadiation;
+ @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(iStack.stackSize, this.sRadiation, world, entityHolding);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java
new file mode 100644
index 0000000000..96b5425437
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/FluidItemBlock.java
@@ -0,0 +1,61 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+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;
+
+import gtPlusPlus.core.fluids.BlockFluidBase;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class FluidItemBlock extends ItemBlock{
+
+ protected final int blockColour;
+ final BlockFluidBase baseBlock;
+ String name;
+
+ public FluidItemBlock(final Block block) {
+ super(block);
+ this.baseBlock = (BlockFluidBase) block;
+ this.blockColour = this.baseBlock.getRenderColor(1);
+ 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));
+ }
+
+ public int getRenderColor(final int aMeta) {
+ return this.blockColour;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack iStack) {
+ /*if (this.thisFluid != null){
+ this.name = "Molten "+this.thisFluid.getLocalizedName();
+ return this.name;
+ }*/
+ this.name = "Molten "+this.baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", "");
+ return this.name;
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ if (this.blockColour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return this.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);
+ }*/
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
new file mode 100644
index 0000000000..14344c1817
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
@@ -0,0 +1,71 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+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;
+
+import gtPlusPlus.api.interfaces.ITileTooltip;
+
+public class ItemBlockBasicTile extends ItemBlock {
+
+ private final int mID;
+
+ public ItemBlockBasicTile(final Block block) {
+ super(block);
+ this.mID = ((ITileTooltip) block).getTooltipID();
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ if (this.mID == 0) { // Fish trap
+ list.add("This trap catches fish faster if surrounded by more water blocks");
+ list.add("Can also be placed beside upto 4 other fish traps");
+ list.add("Requires at least two faces touching water");
+ list.add("1/1000 chance to produce triple loot.");
+ }
+ else if (this.mID == 1) { // Modularity
+ list.add("Used to construct modular armour & bauble upgrades..");
+ }
+ else if (this.mID == 2) { // Trade
+ list.add("Allows for SMP trade-o-mat type trading.");
+ }
+ else if (this.mID == 3) { // Project
+ list.add("Scan any crafting recipe in this to mass fabricate them in the Autocrafter..");
+ }
+ else if (this.mID == 4) { // Circuit Table
+ list.add("Easy Circuit Configuration");
+ list.add("Change default setting with a Screwdriver");
+ list.add("Default is used to select slot for auto-insertion");
+ }
+ else if (this.mID == 5) { // Decayables Chest
+ list.add("Chest which holds radioactive materials");
+ list.add("Items which decay will tick while inside");
+ list.add("Place with right click");
+ }
+ else if (this.mID == 6) { // Butterfly Killer
+ list.add("Kills Forestry Butterflies, Bats and other pests");
+ list.add("Use either Formaldehyde or Hydrogen cyanide");
+ list.add("Be weary of your neighbours");
+ }
+ else if (this.mID == 7) { // Egg Box
+ list.add("A box for holding big eggs");
+ }
+ else if (this.mID == 8){ // Volumetric Flask Setter
+ list.add("Easy Flask Configuration");
+ list.add("Configure default input slot with a screwdriver");
+ }
+ else if (this.mID == 9){
+
+ }
+
+ else {
+ list.add("Bad Tooltip ID - " + mID);
+ }
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java
new file mode 100644
index 0000000000..2aba494d6e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockDoor.java
@@ -0,0 +1,100 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+public class ItemBlockDoor extends ItemBlock {
+ @SideOnly(Side.CLIENT)
+ private IIcon field_150938_b;
+
+ public ItemBlockDoor(Block p_i45328_1_) {
+ super(p_i45328_1_);
+ }
+
+ /**
+ * 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 (par7 != 1) {
+ return false;
+ } else {
+ ++par5;
+ Block block;
+
+ block = field_150939_a;
+
+ if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)
+ && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack)) {
+ if (!block.canPlaceBlockAt(par3World, par4, par5, par6)) {
+ return false;
+ } else {
+ int i1 = MathHelper.floor_double(
+ (double) ((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
+ byte b0 = 0;
+ byte b1 = 0;
+
+ if (i1 == 0) {
+ b1 = 1;
+ }
+
+ if (i1 == 1) {
+ b0 = -1;
+ }
+
+ if (i1 == 2) {
+ b1 = -1;
+ }
+
+ if (i1 == 3) {
+ b0 = 1;
+ }
+
+ int i2 = (par3World.getBlock(par4 - b0, par5, par6 - b1).isNormalCube() ? 1 : 0)
+ + (par3World.getBlock(par4 - b0, par5 + 1, par6 - b1).isNormalCube() ? 1 : 0);
+ int j1 = (par3World.getBlock(par4 + b0, par5, par6 + b1).isNormalCube() ? 1 : 0)
+ + (par3World.getBlock(par4 + b0, par5 + 1, par6 + b1).isNormalCube() ? 1 : 0);
+ boolean flag = par3World.getBlock(par4 - b0, par5, par6 - b1) == block
+ || par3World.getBlock(par4 - b0, par5 + 1, par6 - b1) == block;
+ boolean flag1 = par3World.getBlock(par4 + b0, par5, par6 + b1) == block
+ || par3World.getBlock(par4 + b0, par5 + 1, par6 + b1) == block;
+ boolean flag2 = false;
+
+ if (flag && !flag1) {
+ flag2 = true;
+ } else if (j1 > i2) {
+ flag2 = true;
+ }
+
+ par3World.setBlock(par4, par5, par6, block, i1, 2);
+ par3World.setBlock(par4, par5 + 1, par6, block, 8 | (flag2 ? 1 : 0), 2);
+ par3World.notifyBlocksOfNeighborChange(par4, par5, par6, block);
+ par3World.notifyBlocksOfNeighborChange(par4, par5 + 1, par6, block);
+
+ --par1ItemStack.stackSize;
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+ }
+
+ @Override
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ p_77624_3_.add("This is a block, you can place it by right clicking");
+ super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java
new file mode 100644
index 0000000000..ac6740f268
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java
@@ -0,0 +1,41 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+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;
+import net.minecraft.util.EnumChatFormatting;
+
+import gtPlusPlus.core.block.general.BlockTankXpConverter;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+
+public class ItemBlockEntityBase extends ItemBlock {
+
+ public ItemBlockEntityBase(final Block block) {
+ super(block);
+ this.setMaxDamage(0);
+ //this.setHasSubtypes(true);
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack p_82790_1_, final int p_82790_2_) {
+ return super.getColorFromItemStack(p_82790_1_, p_82790_2_);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ if (Block.getBlockFromItem(stack.getItem()) instanceof BlockTankXpConverter){
+ /*list.add(EnumChatFormatting.GRAY+"Can convert Liquid Xp to Mob Essence and back.");
+ list.add(EnumChatFormatting.GRAY+"Right click with a Screwdriver to change mode.");
+ list.add(EnumChatFormatting.GRAY+"Shift+Right click to view tank information.");*/
+ list.add(EnumChatFormatting.GRAY+"Currently disabled, Use a GT Brewery instead. (New Recipes Added!)");
+ }
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
new file mode 100644
index 0000000000..396689ef63
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
@@ -0,0 +1,156 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.block.base.BlockBaseModular;
+import gtPlusPlus.core.block.base.BlockBaseOre;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.material.MaterialStack;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+
+public class ItemBlockGtBlock extends ItemBlock {
+
+ protected final int blockColour;
+ private int sRadiation;
+
+ private Material mMaterial;
+
+ private final Block thisBlock;
+ private boolean isOre = false;
+ private boolean isModular = false;
+
+ public ItemBlockGtBlock(final Block block) {
+ super(block);
+ this.thisBlock = block;
+ if (block instanceof BlockBaseOre) {
+ this.isOre = true;
+ } else if (block instanceof BlockBaseModular) {
+ this.isModular = true;
+ }
+ final BlockBaseModular baseBlock = (BlockBaseModular) block;
+ if (isModular) {
+ this.blockColour = baseBlock.getRenderColor(0);
+ } else if (isOre) {
+ this.blockColour = block.getBlockColor();
+ } else {
+ this.blockColour = block.getBlockColor();
+ }
+
+ if (block instanceof BlockBaseModular){
+ BlockBaseModular g = (BlockBaseModular) block;
+ this.mMaterial = g.getMaterialEx();
+ }
+ else {
+ this.mMaterial = null;
+ }
+
+ // GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block",
+ // "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block",
+ // "").replace("-", "").replace("_", "").replace(" ", ""),
+ // ItemUtils.getSimpleStack(this));
+ }
+
+ public int getRenderColor(final int aMeta) {
+ return this.blockColour;
+ }
+
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+
+ if (this.mMaterial != null) {
+ list.add(this.mMaterial.vChemicalFormula);
+ } else {
+
+ try {
+ BlockBaseModular g = (BlockBaseModular) thisBlock;
+ this.mMaterial = g.getMaterialEx();
+ }
+ catch (Throwable t) {
+
+ }
+
+
+ //list.add("Material is Null.");
+ }
+
+ if (this.isOre) {
+ if (KeyboardUtils.isCtrlKeyDown()) {
+ Block b = Block.getBlockFromItem(stack.getItem());
+ if (b != null) {
+
+ String aTool = b.getHarvestTool(stack.getItemDamage());
+ int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage());
+
+ if (this.mMaterial != null) {
+ list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5));
+ list.add("Contains: ");
+ if (mMaterial.getComposites().isEmpty()) {
+ list.add("- " + mMaterial.getLocalizedName());
+ } else {
+ for (MaterialStack m : mMaterial.getComposites()) {
+ list.add("- " + m.getStackMaterial().getLocalizedName() + " x" + m.getPartsPerOneHundred());
+ }
+ }
+ }
+ }
+ } else {
+ list.add(EnumChatFormatting.DARK_GRAY + "Hold Ctrl to show additional info.");
+ }
+ }
+ else {
+ Block b = Block.getBlockFromItem(stack.getItem());
+ if (b != null) {
+ String aTool = b.getHarvestTool(stack.getItemDamage());
+ int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage());
+ list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5));
+ }
+ }
+
+ if (this.mMaterial != null) {
+ if (this.mMaterial.vRadiationLevel > 0) {
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }
+ }
+
+ 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_) {
+
+ if (!isModular && !isOre) {
+ mMaterial = null;
+ } else {
+ if (this.mMaterial == null) {
+ Block b = Block.getBlockFromItem(iStack.getItem());
+ if (isOre) {
+ mMaterial = ((BlockBaseOre) b).getMaterialEx();
+ } else {
+ mMaterial = ((BlockBaseModular) b).getMaterialEx();
+ }
+ if (mMaterial != null) {
+ this.sRadiation = mMaterial.vRadiationLevel;
+ } else {
+ this.sRadiation = 0;
+ }
+ }
+ if (this.sRadiation > 0) {
+ EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding);
+ }
+ }
+
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java
new file mode 100644
index 0000000000..0dd125bf7b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java
@@ -0,0 +1,94 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import java.util.List;
+
+import gtPlusPlus.core.block.base.BlockBaseModular;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.material.MaterialStack;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+
+public class ItemBlockGtFrameBox extends ItemBlock{
+
+ protected int blockColour;
+ private Material mMaterial;
+ private int sRadiation;
+
+ public ItemBlockGtFrameBox(final Block block) {
+ super(block);
+ final BlockBaseModular baseBlock = (BlockBaseModular) block;
+ this.blockColour = baseBlock.getRenderColor(1);
+
+
+
+ if (block instanceof BlockBaseModular){
+ BlockBaseModular g = (BlockBaseModular) block;
+ this.mMaterial = g.getMaterialEx();
+ sRadiation = mMaterial.vRadiationLevel;
+ }
+ else {
+ this.mMaterial = null;
+ sRadiation = 0;
+ }
+
+ //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;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ if (this.mMaterial != null) {
+ list.add(this.mMaterial.vChemicalFormula);
+ if (this.mMaterial.vRadiationLevel > 0) {
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }
+ } else {
+ list.add("Material is Null.");
+ }
+ if (KeyboardUtils.isCtrlKeyDown()) {
+ Block b = Block.getBlockFromItem(stack.getItem());
+ if (b != null) {
+ String aTool = b.getHarvestTool(stack.getItemDamage());
+ int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage());
+ list.add("Mining Level: " + Math.min(Math.max(aMiningLevel1, 0), 5));
+ if (this.mMaterial != null) {
+ list.add("Contains: ");
+ if (mMaterial.getComposites().isEmpty()) {
+ list.add("- " + mMaterial.getLocalizedName());
+ } else {
+ for (MaterialStack m : mMaterial.getComposites()) {
+ list.add("- " + m.getStackMaterial().getLocalizedName() + " x" + m.getPartsPerOneHundred());
+ }
+ }
+ }
+ }
+ } else {
+ list.add(EnumChatFormatting.DARK_GRAY + "Hold Ctrl to show additional info.");
+ }
+ 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_) {
+
+ if (this.sRadiation > 0) {
+ EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.sRadiation, world, entityHolding);
+ }
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java
new file mode 100644
index 0000000000..b26ac67225
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockMeta.java
@@ -0,0 +1,114 @@
+package gtPlusPlus.core.item.base.itemblock;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.api.interfaces.ITileTooltip;
+import gtPlusPlus.api.objects.data.AutoMap;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlockWithMetadata;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class ItemBlockMeta extends ItemBlockWithMetadata
+{
+ private final Block mBlock;
+ private HashMap<Integer, AutoMap<String>> aTooltips = new LinkedHashMap<Integer, AutoMap<String>>();
+
+ public ItemBlockMeta(final Block aBlock)
+ {
+ super(aBlock, aBlock);
+ this.mBlock = aBlock;
+ this.setMaxDamage(0);
+ this.setHasSubtypes(true);
+ if (aBlock instanceof ITileTooltip) {
+ ITileTooltip aTooltip = (ITileTooltip) aBlock;
+ //aTooltips.put(aTooltip.getTooltipID(), aTooltip.getTooltipMap());
+ }
+ }
+
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ Block aThis = Block.getBlockFromItem(stack.getItem());
+ if (aThis != null) {
+ if (!aTooltips.isEmpty()) {
+ AutoMap<String> h = aTooltips.get(stack.getItemDamage());
+ if (h != null && !h.isEmpty()) {
+ for (String s : h) {
+ list.add(s);
+ }
+ }
+ }
+ }
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ /**
+ * Gets an icon index based on an item's damage value
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(final int p_77617_1_)
+ {
+ return this.mBlock.getIcon(2, p_77617_1_);
+ }
+
+ /**
+ * Returns the metadata of the block which this Item (ItemBlock) can place
+ */
+ @Override
+ public int getMetadata(final int p_77647_1_)
+ {
+ return p_77647_1_;
+ }
+
+ @Override
+ public String getUnlocalizedName(final ItemStack stack) {
+ return this.getUnlocalizedName() + "." + stack.getItemDamage();
+ }
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
+ return false;
+ }
+
+ @Override
+ public int getDisplayDamage(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public int getItemEnchantability(ItemStack stack) {
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java
new file mode 100644
index 0000000000..99367c5ef5
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockNBT.java
@@ -0,0 +1,104 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.api.interfaces.ITileTooltip;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.tileentities.base.TileEntityBase;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+
+public class ItemBlockNBT extends ItemBlock {
+
+
+ protected final int mID;
+
+ public ItemBlockNBT(final Block block) {
+ super(block);
+ this.mID = ((ITileTooltip) block).getTooltipID();
+ }
+
+
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+
+ //if ()
+
+
+
+ if (this.mID == 0){ //blockDarkWorldPortalFrame
+ list.add("Assembled in the same shape as the Nether Portal.");
+ }
+ }
+
+
+
+ @Override
+ public void onCreated(ItemStack item, World world, EntityPlayer player) {
+ addNBT(player, item);
+ super.onCreated(item, world, player);
+ }
+
+ @Override
+ public void onUpdate(ItemStack item, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) {
+ if (entity instanceof EntityPlayerMP) {
+ EntityPlayerMP mPlayer = (EntityPlayerMP) entity;
+
+ NBTTagCompound rNBT = item.getTagCompound();
+ rNBT = ((rNBT == null) ? new NBTTagCompound() : rNBT);
+ if (!rNBT.hasKey("mOwner")){
+ addNBT(mPlayer, item);
+ }
+ }
+ super.onUpdate(item, world, entity, p_77663_4_, p_77663_5_);
+ }
+
+ private void addNBT(EntityPlayer player, ItemStack item) {
+ NBTTagCompound rNBT = item.getTagCompound();
+ rNBT = ((rNBT == null) ? new NBTTagCompound() : rNBT);
+ if (player != null) {
+ boolean mOP = PlayerUtils.isPlayerOP(player);
+ rNBT.setString("mOwner", player.getDisplayName());
+ rNBT.setString("mUUID", ""+player.getUniqueID());
+ rNBT.setBoolean("mOP", mOP);
+ }
+ else if (player == null) {
+ rNBT.setString("mOwner", "fakeplayer");
+ rNBT.setString("mUUID", "00000000");
+ rNBT.setBoolean("mOP", false);
+ }
+ GT_Utility.ItemNBT.setNBT(item, rNBT);
+ }
+
+ @Override
+ public boolean placeBlockAt(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int side,
+ float hitX, float hitY, float hitZ, int aMeta) {
+ if (!(aWorld.setBlock(aX, aY, aZ, this.field_150939_a, 0, 3))) {
+ return false;
+ }
+ if (aWorld.getBlock(aX, aY, aZ) == this.field_150939_a) {
+ this.field_150939_a.onBlockPlacedBy(aWorld, aX, aY, aZ, aPlayer, aStack);
+ this.field_150939_a.onPostBlockPlaced(aWorld, aX, aY, aZ, aMeta);
+ }
+ TileEntityBase tTileEntity = (TileEntityBase) aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity != null && aPlayer != null) {
+ if (tTileEntity.isServerSide()){
+ Logger.INFO("Setting Tile Entity information");
+ NBTTagCompound aNBT = GT_Utility.ItemNBT.getNBT(aStack);
+ tTileEntity.setOwnerInformation(aNBT.getString("mOwner"), aNBT.getString("mUUID"), aNBT.getBoolean("mOP"));
+ }
+ }
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java
new file mode 100644
index 0000000000..e4079521d4
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockOre.java
@@ -0,0 +1,161 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.block.base.BlockBaseOre;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.material.MaterialStack;
+import gtPlusPlus.core.material.nuclear.FLUORIDES;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import gtPlusPlus.everglades.gen.gt.WorldGen_GT_Ore_Layer;
+
+public class ItemBlockOre extends ItemBlock{
+
+ private final BlockBaseOre mThisOre;
+ private final Material mThisMaterial;
+ private final int mThisRadiation;
+ private final int mThisColour;
+
+ public ItemBlockOre(final Block block) {
+ super(block);
+ if (block instanceof BlockBaseOre){
+ this.mThisOre = (BlockBaseOre) block;
+ this.mThisMaterial = this.mThisOre.getMaterialEx();
+ this.mThisRadiation = this.mThisMaterial.vRadiationLevel;
+ this.mThisColour = this.mThisMaterial.getRgbAsHex();
+ }
+ else {
+ this.mThisOre = null;
+ this.mThisMaterial = null;
+ this.mThisRadiation = 0;
+ this.mThisColour = Utils.rgbtoHexValue(255, 255, 255);
+ }
+ }
+
+ public int getRenderColor(final int aMeta) {
+ return this.mThisColour;
+ }
+
+ private static Map<String, AutoMap<String>> mMapOreBlockItemToDimName = new LinkedHashMap<String, AutoMap<String>>();
+ private static boolean mInitOres_Everglades = false;
+ private AutoMap<String> mDimsForThisOre = new AutoMap<String>();
+
+
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+
+ if (!mInitOres_Everglades) {
+ for (WorldGen_GT_Ore_Layer f : gtPlusPlus.everglades.gen.gt.WorldGen_Ores.validOreveins.values()) {
+ Material[] m2 = new Material[] {f.mPrimary, f.mSecondary, f.mBetween, f.mSporadic};
+ for (Material m1 : m2) {
+ AutoMap<String> aMap = mMapOreBlockItemToDimName.get(m1.getUnlocalizedName().toLowerCase());
+ if (aMap == null) {
+ aMap = new AutoMap<String>();
+ }
+ String aDimName = "Everglades";
+ if (!aMap.containsValue(aDimName)) {
+ aMap.put(aDimName);
+ }
+ mMapOreBlockItemToDimName.put(m1.getUnlocalizedName().toLowerCase(), aMap);
+ }
+ }
+ mInitOres_Everglades = true;
+ }
+
+
+ if (this.mThisMaterial != null){
+ list.add(this.mThisMaterial.vChemicalFormula);
+ }
+
+ //Radioactive?
+ if (this.mThisRadiation > 0){
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }
+
+ /**
+ * Tooltip Handler for Ores
+ */
+ if (this.mThisMaterial == FLUORIDES.FLUORITE){
+ list.add("Mined from Sandstone with a 1/"+(CORE.ConfigSwitches.chanceToDropFluoriteOre*20)+" chance, or Limestone with a 1/"+(CORE.ConfigSwitches.chanceToDropFluoriteOre)+" chance.");
+ }
+
+ if (this.mThisMaterial != null) {
+ list.add("Ore contains: ");
+ if (mThisMaterial.getComposites().isEmpty()) {
+ list.add("- "+mThisMaterial.getLocalizedName());
+ }
+ else {
+ for (MaterialStack m : mThisMaterial.getComposites()) {
+ list.add("- "+m.getStackMaterial().getLocalizedName()+" x"+m.getPartsPerOneHundred());
+ }
+ }
+ }
+
+ if (KeyboardUtils.isCtrlKeyDown()) {
+
+ Block b = Block.getBlockFromItem(stack.getItem());
+ if (b != null) {
+ String aTool = b.getHarvestTool(stack.getItemDamage());
+ int aMiningLevel1 = b.getHarvestLevel(stack.getItemDamage());
+ if (aMiningLevel1 != 0) {
+ list.add("Mining Level: "+Math.min(Math.max(aMiningLevel1, 0), 5));
+ }
+ }
+
+ if (mDimsForThisOre.isEmpty()) {
+ AutoMap<String> A = mMapOreBlockItemToDimName.get(this.mThisMaterial.getUnlocalizedName().toLowerCase());
+ if (A != null) {
+ mDimsForThisOre = A;
+ }
+ }
+
+ list.add("Found: ");
+ if (!mDimsForThisOre.isEmpty()) {
+ for (String m : mDimsForThisOre) {
+ list.add("- "+m);
+ }
+ }
+ else {
+ list.add("- Unknown");
+ }
+
+ }
+ else {
+ list.add(EnumChatFormatting.DARK_GRAY+"Hold Ctrl to show additional info.");
+ }
+
+
+
+
+
+
+ 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_) {
+ if (this.mThisMaterial != null){
+ if (this.mThisRadiation > 0){
+ if (entityHolding instanceof EntityPlayer){
+ if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){
+ EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.mThisMaterial.vRadiationLevel, world, entityHolding);
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java
new file mode 100644
index 0000000000..7a4222ed0f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockRoundRobinator.java
@@ -0,0 +1,115 @@
+package gtPlusPlus.core.item.base.itemblock;
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlockWithMetadata;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class ItemBlockRoundRobinator extends ItemBlockWithMetadata
+{
+ private final Block mBlock;
+
+ public ItemBlockRoundRobinator(final Block aBlock){
+ super(aBlock, aBlock);
+ this.mBlock = aBlock;
+ }
+
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add("Attempts to output items evenly on all four horizontal planes");
+ if (stack.getItemDamage() == 0) {
+ list.add("1 Item per enabled side every 400 ticks");
+ }
+ else if (stack.getItemDamage() == 1) {
+ list.add("1 Item per enabled side every 100 ticks");
+ }
+ else if (stack.getItemDamage() == 2) {
+ list.add("1 Item per enabled side every 20 ticks");
+ }
+ else if (stack.getItemDamage() == 3) {
+ list.add("1 Item per enabled side every 10 ticks");
+ }
+ else if (stack.getItemDamage() == 4) {
+ list.add("1 Item per enabled side every tick");
+ }
+ list.add("Top and bottom do not pull, so you must push items in");
+ list.add("Sides can also be disabled with a screwdriver");
+ list.add("Shift+RMB with empty hand to view inventory contents");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ /**
+ * Gets an icon index based on an item's damage value
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(final int p_77617_1_)
+ {
+ return this.mBlock.getIcon(0, p_77617_1_);
+ }
+
+ /**
+ * Returns the metadata of the block which this Item (ItemBlock) can place
+ */
+ @Override
+ public int getMetadata(final int p_77647_1_)
+ {
+ return p_77647_1_;
+ }
+
+ @Override
+ public String getUnlocalizedName(final ItemStack stack) {
+ return this.getUnlocalizedName() + "." + stack.getItemDamage();
+ }
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
+ return false;
+ }
+
+ @Override
+ public int getDisplayDamage(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public int getItemEnchantability(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public boolean getHasSubtypes() {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockSpawner.java b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockSpawner.java
new file mode 100644
index 0000000000..53c9cdb193
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/itemblock/ItemBlockSpawner.java
@@ -0,0 +1,39 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.EntityRegistry;
+import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
+import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+public class ItemBlockSpawner extends ItemBlockMeta{
+
+ private final Block mBlock;
+
+ public ItemBlockSpawner(Block aBlock) {
+ super(aBlock);
+ mBlock = aBlock;
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aBool) {
+ if (mBlock != null) {
+ int x = this.getMetadata(aStack.getItemDamage());
+ if (x >= 0) {
+ try {
+ EntityRegistration x1 = EntityRegistry.instance().lookupModSpawn(TileEntityGenericSpawner.mSpawners.get(x), false);
+ if (x1 != null) {
+ aList.add(EnumChatFormatting.RED+x1.getEntityName());
+ }
+ }
+ catch (Throwable t) {}
+ }
+ }
+ super.addInformation(aStack, aPlayer, aList, aBool);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java b/src/main/java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java
new file mode 100644
index 0000000000..25070ad817
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/misc/BaseItemMisc.java
@@ -0,0 +1,174 @@
+package gtPlusPlus.core.item.base.misc;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.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.util.IIcon;
+import net.minecraft.world.World;
+
+import gregtech.api.util.GT_OreDictUnificator;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class BaseItemMisc extends Item{
+
+ public final String displayName;
+ public final String unlocalName;
+ public final MiscTypes miscType;
+ public final Object componentColour;
+ public final String[] description;
+
+ public BaseItemMisc(
+ final String displayName,
+ final short[] RGB,
+ final int maxStackSize,
+ final MiscTypes miscType,
+ String[] description) {
+
+ //Set-up the Misc Generic Item
+ this.displayName = displayName;
+ String unlocalName = Utils.sanitizeString(displayName);
+ this.unlocalName = "item"+miscType.TYPE+unlocalName;
+ this.miscType = miscType;
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(this.unlocalName);
+ this.setMaxStackSize(maxStackSize);
+ //this.setTextureName(this.getCorrectTextures());
+ if (RGB != null){
+ this.componentColour = Utils.rgbtoHexValue(RGB[0], RGB[1], RGB[2]);
+ }
+ else {
+ this.componentColour = null;
+ }
+ this.description = description;
+ GameRegistry.registerItem(this, this.unlocalName);
+ GT_OreDictUnificator.registerOre(miscType.getOreDictPrefix()+unlocalName, ItemUtils.getSimpleStack(this));
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return this.displayName+miscType.DISPLAY_NAME_SUFFIX;
+ }
+
+ private String getCorrectTextures(){
+ return CORE.MODID + ":" + "item"+this.miscType.TYPE;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses() {
+ return this.miscType == MiscTypes.DROP;
+ }
+
+ @Override
+ public int getRenderPasses(int meta) {
+ return (this.miscType == MiscTypes.DROP) ? 2 : 1;
+ }
+
+ @SideOnly(Side.CLIENT)
+ private IIcon secondIcon;
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister par1IconRegister) {
+ if (this.miscType == MiscTypes.DROP && LoadedMods.Forestry){
+ this.itemIcon = par1IconRegister.registerIcon("forestry:honeyDrop.0");
+ this.secondIcon = par1IconRegister.registerIcon("forestry:honeyDrop.1");
+ }
+ else {
+ this.itemIcon = par1IconRegister.registerIcon(getCorrectTextures());
+ }
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack stack, int pass) {
+ return (pass == 0) ? itemIcon : secondIcon;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ if (this.description != null){ //Incase I don't add one
+ if (this.description.length > 0){ //Incase I somehow add a blank one
+ for (int x=0;x<this.description.length;x++){
+ list.add(EnumChatFormatting.GRAY+description[x]);
+ }
+ }
+ }
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ //Returns default colour if a custom one is not set.
+ if (this.componentColour == null){
+ return 16777215;
+ }
+ else {
+ return (int) this.componentColour;
+ }
+
+
+ }
+
+ @Override
+ public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) {
+ //Nothing Fancy here yet.
+ }
+
+
+
+
+
+
+
+
+ public static enum MiscTypes {
+ POTION("Potion", " Potion", "potion"),
+ KEY("Key", " Key", "key"),
+ BIGKEY("KeyBig", " Big Key", "bosskey"),
+ BOTTLE("Bottle", " Bottle", "bottle"),
+ GEM("Gem", " Gemstone", "gem"),
+ DROP("Droplet", " Droplet", "droplet"),
+ MUSHROOM("Mushroom", " Mushroom", "mushroom");
+
+ private String TYPE;
+ private String DISPLAY_NAME_SUFFIX;
+ private String OREDICT_PREFIX;
+
+ private MiscTypes (final String LocalName, final String DisplayNameSuffix, final String OreDictPrefix){
+ this.TYPE = LocalName;
+ this.DISPLAY_NAME_SUFFIX = DisplayNameSuffix;
+ this.OREDICT_PREFIX = OreDictPrefix;
+ }
+
+ public String getType(){
+ return this.TYPE;
+ }
+
+ public String getName(){
+ return this.DISPLAY_NAME_SUFFIX;
+ }
+
+ public String getOreDictPrefix(){
+ return this.OREDICT_PREFIX;
+ }
+
+ }
+
+}
+
+
diff --git a/src/main/java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java b/src/main/java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java
new file mode 100644
index 0000000000..b7bbc84757
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java
@@ -0,0 +1,57 @@
+package gtPlusPlus.core.item.base.misc;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+public abstract class BaseItemParticle extends CoreItem {
+
+ protected static final Map<Integer, Integer> aColourMap = new LinkedHashMap<Integer, Integer> ();
+ private final int aMaxCount;
+
+ public BaseItemParticle(String aType, int aCount, EnumRarity aRarity) {
+ super("particle"+aType, aType, AddToCreativeTab.tabOther, 64, 0, new String[] {}, aRarity, EnumChatFormatting.DARK_AQUA, false, null);
+ this.setTextureName(CORE.MODID + ":" + "science/Atom");
+ aMaxCount = aCount;
+ this.setHasSubtypes(true);
+
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ return aColourMap.get(stack.getItemDamage());
+ }
+
+ public int getColorFromParentClass(ItemStack stack, int aaa) {
+ return super.getColorFromItemStack(stack, aaa);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < aMaxCount; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+
+ @Override
+ public final String getItemStackDisplayName(final ItemStack tItem) {
+ String aReturnValue = super.getItemStackDisplayName(tItem);
+ String[] a2 = getAffixes();
+ aReturnValue = (a2[0] + aReturnValue + a2[1]);
+ return aReturnValue;
+ }
+
+ public abstract String[] getAffixes();
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java b/src/main/java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java
new file mode 100644
index 0000000000..1644856bf8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java
@@ -0,0 +1,12 @@
+package gtPlusPlus.core.item.base.nugget;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemNugget extends BaseItemComponent{
+
+ public BaseItemNugget(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.NUGGET);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemCentrifugedCrushedOre.java b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemCentrifugedCrushedOre.java
new file mode 100644
index 0000000000..73a13f568d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemCentrifugedCrushedOre.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.core.item.base.ore;
+
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemCentrifugedCrushedOre extends BaseOreComponent{
+
+ public BaseItemCentrifugedCrushedOre(final Material material) {
+ super(material, BaseOreComponent.ComponentTypes.CRUSHEDCENTRIFUGED);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemCrushedOre.java b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemCrushedOre.java
new file mode 100644
index 0000000000..f2ca40334f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemCrushedOre.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.core.item.base.ore;
+
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemCrushedOre extends BaseOreComponent{
+
+ public BaseItemCrushedOre(final Material material) {
+ super(material, BaseOreComponent.ComponentTypes.CRUSHED);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemImpureDust.java b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemImpureDust.java
new file mode 100644
index 0000000000..45dc4f4402
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemImpureDust.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.core.item.base.ore;
+
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemImpureDust extends BaseOreComponent{
+
+ public BaseItemImpureDust(final Material material) {
+ super(material, BaseOreComponent.ComponentTypes.DUSTIMPURE);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java
new file mode 100644
index 0000000000..4edf4ae75d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemMilledOre.java
@@ -0,0 +1,25 @@
+package gtPlusPlus.core.item.base.ore;
+
+import gregtech.api.enums.Materials;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import net.minecraft.item.Item;
+
+public class BaseItemMilledOre extends BaseOreComponent{
+
+ public BaseItemMilledOre(final Material material, int aMaterialEU) {
+ super(material, BaseOreComponent.ComponentTypes.MILLED);
+ CORE.RA.addMillingRecipe(material, aMaterialEU);
+ }
+
+ public static Item generate(Materials aMat, int aMaterialEU) {
+ return generate(MaterialUtils.generateMaterialFromGtENUM(aMat), aMaterialEU);
+ }
+
+ public static Item generate(Material aMat, int aMaterialEU) {
+ return new BaseItemMilledOre(aMat, aMaterialEU);
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedCrushedOre.java b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedCrushedOre.java
new file mode 100644
index 0000000000..3f2a1c23e6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedCrushedOre.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.core.item.base.ore;
+
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemPurifiedCrushedOre extends BaseOreComponent{
+
+ public BaseItemPurifiedCrushedOre(final Material material) {
+ super(material, BaseOreComponent.ComponentTypes.CRUSHEDPURIFIED);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedDust.java b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedDust.java
new file mode 100644
index 0000000000..0c9816fb56
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/ore/BaseItemPurifiedDust.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.core.item.base.ore;
+
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemPurifiedDust extends BaseOreComponent{
+
+ public BaseItemPurifiedDust(final Material material) {
+ super(material, BaseOreComponent.ComponentTypes.DUSTPURE);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java b/src/main/java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
new file mode 100644
index 0000000000..2cb23b3f97
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/ore/BaseOreComponent.java
@@ -0,0 +1,279 @@
+package gtPlusPlus.core.item.base.ore;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_OreDictUnificator;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.enums.CustomOrePrefix;
+import net.minecraft.client.renderer.texture.IIconRegister;
+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.IIcon;
+import net.minecraft.world.World;
+
+public class BaseOreComponent extends Item{
+
+ @SideOnly(Side.CLIENT)
+ private IIcon base;
+ @SideOnly(Side.CLIENT)
+ private IIcon overlay;
+
+ public final Material componentMaterial;
+ public final String materialName;
+ public final String unlocalName;
+ public final ComponentTypes componentType;
+ public final int componentColour;
+ public Object extraData;
+
+ public BaseOreComponent(final Material material, final ComponentTypes componentType) {
+ this.componentMaterial = material;
+ this.unlocalName = componentType.COMPONENT_NAME+material.getUnlocalizedName();
+ this.materialName = material.getLocalizedName();
+ this.componentType = componentType;
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(this.unlocalName);
+ this.setMaxStackSize(64);
+ this.componentColour = material.getRgbAsHex();
+ GameRegistry.registerItem(this, this.unlocalName);
+ registerComponent();
+ GT_OreDictUnificator.registerOre(componentType.getComponent()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this));
+ if (LoadedMods.Thaumcraft) {
+ //ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), TC_Aspect_Wrapper.generate(TC_Aspects.METALLUM.mAspect), 1);
+ if (componentMaterial.isRadioactive) {
+ //ThaumcraftUtils.addAspectToItem(ItemUtils.getSimpleStack(this), TC_Aspect_Wrapper.generate(TC_Aspects.RADIO.mAspect), componentMaterial.vRadiationLevel);
+ }
+ }
+
+ }
+
+ public boolean registerComponent() {
+ Logger.MATERIALS("Attempting to register "+this.getUnlocalizedName()+".");
+ if (this.componentMaterial == null) {
+ Logger.MATERIALS("Tried to register "+this.getUnlocalizedName()+" but the material was null.");
+ return false;
+ }
+ //Register Component
+ Map<String, ItemStack> aMap = Material.mComponentMap.get(componentMaterial.getUnlocalizedName());
+ if (aMap == null) {
+ aMap = new HashMap<String, ItemStack>();
+ }
+ String aKey = "Invalid";
+ if (componentType == ComponentTypes.CRUSHED) {
+ aKey = OrePrefixes.crushed.name();
+ }
+ else if (componentType == ComponentTypes.CRUSHEDCENTRIFUGED) {
+ aKey = OrePrefixes.crushedCentrifuged.name();
+ }
+ else if (componentType == ComponentTypes.CRUSHEDPURIFIED) {
+ aKey = OrePrefixes.crushedPurified.name();
+ }
+ else if (componentType == ComponentTypes.DUST) {
+ aKey = OrePrefixes.dust.name();
+ }
+ else if (componentType == ComponentTypes.DUSTIMPURE) {
+ aKey = OrePrefixes.dustImpure.name();
+ }
+ else if (componentType == ComponentTypes.DUSTPURE) {
+ aKey = OrePrefixes.dustPure.name();
+ }
+ else if (componentType == ComponentTypes.MILLED) {
+ aKey = CustomOrePrefix.milled.get().name();
+ }
+
+ ItemStack x = aMap.get(aKey);
+ if (x == null) {
+ aMap.put(aKey, ItemUtils.getSimpleStack(this));
+ Logger.MATERIALS("Registering a material component. Item: ["+componentMaterial.getUnlocalizedName()+"] Map: ["+aKey+"]");
+ Material.mComponentMap.put(componentMaterial.getUnlocalizedName(), aMap);
+ return true;
+ }
+ else {
+ //Bad
+ Logger.MATERIALS("Tried to double register a material component. ");
+ return false;
+ }
+ }
+
+ /*@Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return (this.componentType.getPrefix()+this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME);
+ }*/
+
+ public final String getMaterialName() {
+ return this.materialName;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public final void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ if (this.materialName != null && !this.materialName.equals("")){
+ if (this.componentMaterial != null){
+ if (!this.componentMaterial.vChemicalFormula.contains("?")) {
+ list.add(Utils.sanitizeStringKeepBrackets(this.componentMaterial.vChemicalFormula));
+ }
+ else if (this.componentMaterial.vChemicalFormula.contains("?")) {
+ String temp = componentMaterial.vChemicalFormula;
+ temp = temp.replace(" ", "");
+ temp = temp.replace("-", "");
+ temp = temp.replace("_", "");
+ temp = temp.replace("!", "");
+ temp = temp.replace("@", "");
+ temp = temp.replace("#", "");
+ temp = temp.replace(" ", "");
+ list.add(temp);
+ }
+ if (this.componentMaterial.isRadioactive){
+ list.add(CORE.GT_Tooltip_Radioactive+" | Level: "+this.componentMaterial.vRadiationLevel);
+ }
+ }
+ else {
+ String aChemicalFormula = Material.sChemicalFormula.get(materialName.toLowerCase());
+ if (aChemicalFormula != null && aChemicalFormula.length() > 0) {
+ list.add(Utils.sanitizeStringKeepBrackets(aChemicalFormula));
+ }
+ }
+ }
+ 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_) {
+ if (this.componentMaterial != null){
+ if (entityHolding instanceof EntityPlayer){
+ if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){
+ EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.componentMaterial.vRadiationLevel, world, entityHolding);
+ }
+ }
+ }
+ }
+
+
+
+ /**
+ * Rendering Related
+ * @author Alkalus
+ *
+ */
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ if (this.componentType.hasOverlay()){
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(final IIconRegister par1IconRegister){
+ if (this.componentType == ComponentTypes.MILLED) {
+ this.base = par1IconRegister.registerIcon(CORE.MODID + ":" + "processing/MilledOre/milled");
+ if (this.componentType.hasOverlay()){
+ this.overlay = par1IconRegister.registerIcon(CORE.MODID + ":" + "processing/MilledOre/milled_OVERLAY");
+ }
+ }
+ else if (CORE.ConfigSwitches.useGregtechTextures){
+ //Logger.MATERIALS(this.componentType.getPrefix()+this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME+" is using `"+"gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME+"' as the layer 0 texture path.");
+ this.base = par1IconRegister.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME);
+ if (this.componentType.hasOverlay()){
+ //Logger.MATERIALS(this.componentType.getPrefix()+this.componentMaterial.getLocalizedName()+this.componentType.DISPLAY_NAME+" is using `"+"gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME+"_OVERLAY"+"' as the layer 1 texture path.");
+ this.overlay = par1IconRegister.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + this.componentType.COMPONENT_NAME+"_OVERLAY");
+ }
+ }
+ else {
+ this.base = par1IconRegister.registerIcon(CORE.MODID + ":" + "item"+this.componentType.getComponent());
+ if (this.componentType.hasOverlay()){
+ this.overlay = par1IconRegister.registerIcon(CORE.MODID + ":" + "item"+this.componentType.getComponent()+"_Overlay");
+ }
+ }
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int renderPass) {
+ if (this.componentType == ComponentTypes.MILLED) {
+ if (renderPass == 1){
+ return Utils.rgbtoHexValue(230, 230, 230);
+ }
+ return this.componentColour;
+ }
+ else {
+ if (renderPass == 0 && !CORE.ConfigSwitches.useGregtechTextures){
+ return this.componentColour;
+ }
+ if (renderPass == 1 && CORE.ConfigSwitches.useGregtechTextures){
+ return Utils.rgbtoHexValue(230, 230, 230);
+ }
+ return this.componentColour;
+ }
+ }
+
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ if(pass == 0) {
+ return this.base;
+ }
+ return this.overlay;
+ }
+
+
+
+
+ public static enum ComponentTypes {
+ DUST("dust", "", " Dust", true),
+ DUSTIMPURE("dustImpure", "Impure ", " Dust", true),
+ DUSTPURE("dustPure", "Purified ", " Dust", true),
+ CRUSHED("crushed", "Crushed ", " Ore", true),
+ CRUSHEDCENTRIFUGED("crushedCentrifuged", "Centrifuged Crushed "," Ore", true),
+ CRUSHEDPURIFIED("crushedPurified", "Purified Crushed ", " Ore", true),
+ MILLED("milled", "Milled ", " Ore", true);
+
+ private String COMPONENT_NAME;
+ private String PREFIX;
+ private String DISPLAY_NAME;
+ private boolean HAS_OVERLAY;
+ private ComponentTypes (final String LocalName, final String prefix, final String DisplayName, final boolean overlay){
+ this.COMPONENT_NAME = LocalName;
+ this.PREFIX = prefix;
+ this.DISPLAY_NAME = DisplayName;
+ this.HAS_OVERLAY = overlay;
+ // dust + Dirty, Impure, Pure, Refined
+ // crushed + centrifuged, purified
+ }
+
+ public String getComponent(){
+ return this.COMPONENT_NAME;
+ }
+
+ public String getName(){
+ return this.DISPLAY_NAME;
+ }
+
+ public boolean hasOverlay(){
+ return this.HAS_OVERLAY;
+ }
+
+ public String getPrefix(){
+ return this.PREFIX;
+ }
+ }
+
+}
+
+
diff --git a/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java b/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java
new file mode 100644
index 0000000000..a810b22c70
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java
@@ -0,0 +1,18 @@
+package gtPlusPlus.core.item.base.plates;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.material.state.MaterialState;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+
+public class BaseItemPlate extends BaseItemComponent{
+
+ public BaseItemPlate(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.PLATE);
+ }
+
+ public BaseItemPlate(final String unlocalizedName, final String materialName, final MaterialState state, final short[] colour, final int tier, final int sRadioactivity) {
+ this(MaterialUtils.generateQuickMaterial(materialName, state, new short[]{colour[0], colour[1], colour[2], 0}, sRadioactivity));
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java b/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java
new file mode 100644
index 0000000000..31f86e8ffa
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java
@@ -0,0 +1,20 @@
+package gtPlusPlus.core.item.base.plates;
+
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemPlateDouble extends BaseItemComponent{
+
+ public BaseItemPlateDouble(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.PLATEDOUBLE);
+ this.setMaxStackSize(32);
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return ("Double "+this.materialName+ " Plate");
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlateHeavy.java b/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlateHeavy.java
new file mode 100644
index 0000000000..c9072b0d82
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlateHeavy.java
@@ -0,0 +1,47 @@
+package gtPlusPlus.core.item.base.plates;
+
+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;
+
+public class BaseItemPlateHeavy extends BaseItemComponent{
+
+ final static ComponentTypes HEAVY = ComponentTypes.PLATEHEAVY;
+
+ public BaseItemPlateHeavy(final Material material) {
+ super(material, HEAVY);
+ }
+
+ @Override
+ public String getCorrectTextures(){
+ return CORE.MODID + ":" + "itemHeavyPlate";
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ return true;
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister i) {
+ this.base = i.registerIcon(CORE.MODID + ":" + "itemHeavyPlate");
+ this.overlay = i.registerIcon(CORE.MODID + ":" + "itemHeavyPlate_Overlay");
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+
+ if (pass == 0) {
+ return this.base;
+ }
+ else {
+ return this.overlay;
+ }
+
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java b/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java
new file mode 100644
index 0000000000..ec3f449b0a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/plates/BaseItemPlate_OLD.java
@@ -0,0 +1,95 @@
+package gtPlusPlus.core.item.base.plates;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+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;
+
+import gregtech.api.util.GT_OreDictUnificator;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.data.StringUtils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class BaseItemPlate_OLD extends Item{
+
+ protected final int colour;
+ protected final int sRadiation;
+ protected final String materialName;
+ protected final String unlocalName;
+ protected final String chemicalNotation;
+
+ public BaseItemPlate_OLD(final String unlocalizedName, final String materialName, final int colour, final int sRadioactivity) {
+ this(unlocalizedName, materialName, "NullFormula", colour, sRadioactivity);
+ }
+
+ public BaseItemPlate_OLD(final String unlocalizedName, final String materialName, final String mChemicalFormula, final int colour, final int sRadioactivity) {
+ this.setUnlocalizedName("itemPlate"+unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.unlocalName = "itemPlate"+unlocalizedName;
+ this.setMaxStackSize(64);
+ this.setTextureName(CORE.MODID + ":" + "itemPlate");
+ this.setMaxStackSize(64);
+ this.colour = colour;
+ this.materialName = materialName;
+ if (mChemicalFormula.equals("") || mChemicalFormula.equals("NullFormula")){
+ this.chemicalNotation = StringUtils.subscript(materialName);
+ }
+ else {
+ this.chemicalNotation = StringUtils.subscript(mChemicalFormula);
+ }
+ this.sRadiation = sRadioactivity;
+ GameRegistry.registerItem(this, "itemPlate"+unlocalizedName);
+ String temp;
+ if (this.unlocalName.toLowerCase().contains("itemplate")){
+ temp = this.unlocalName.replace("itemP", "p");
+ if ((temp != null) && !temp.equals("")){
+ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
+ }
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+
+ return (this.materialName+ " plate");
+ }
+
+ public final String getMaterialName() {
+ return this.materialName;
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ if (this.colour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return this.colour;
+
+ }
+
+ @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(iStack.stackSize, this.sRadiation, world, entityHolding);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @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);
+ }
+ if (StringUtils.containsSuperOrSubScript(this.chemicalNotation)){
+ list.add(this.chemicalNotation);
+ }
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/rings/BaseItemRing.java b/src/main/java/gtPlusPlus/core/item/base/rings/BaseItemRing.java
new file mode 100644
index 0000000000..c83ae94af1
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/rings/BaseItemRing.java
@@ -0,0 +1,12 @@
+package gtPlusPlus.core.item.base.rings;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemRing extends BaseItemComponent{
+
+ public BaseItemRing(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.RING);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/main/java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
new file mode 100644
index 0000000000..f77f846d34
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
@@ -0,0 +1,12 @@
+package gtPlusPlus.core.item.base.rods;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemRod extends BaseItemComponent{
+
+ public BaseItemRod(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.ROD);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/main/java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
new file mode 100644
index 0000000000..215012817d
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
@@ -0,0 +1,18 @@
+package gtPlusPlus.core.item.base.rods;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+import net.minecraft.item.ItemStack;
+
+public class BaseItemRodLong extends BaseItemComponent{
+
+ public BaseItemRodLong(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.RODLONG);
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return ("Long "+this.materialName+ " Rod");
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java b/src/main/java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java
new file mode 100644
index 0000000000..6960e89e89
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.base.rotors;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemRotor extends BaseItemComponent{
+
+ public BaseItemRotor(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.ROTOR);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java b/src/main/java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java
new file mode 100644
index 0000000000..dbd817215a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java
@@ -0,0 +1,12 @@
+package gtPlusPlus.core.item.base.screws;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemScrew extends BaseItemComponent{
+
+ public BaseItemScrew(final Material material) {
+ super(material, BaseItemComponent.ComponentTypes.SCREW);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java
new file mode 100644
index 0000000000..fdd148b97b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/bauble/BaseBauble.java
@@ -0,0 +1,190 @@
+package gtPlusPlus.core.item.bauble;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
+
+import cpw.mods.fml.common.Optional;
+import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.ai.attributes.AttributeModifier;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+import net.minecraft.world.World;
+
+import baubles.api.BaubleType;
+import baubles.api.IBauble;
+import baubles.common.container.InventoryBaubles;
+import baubles.common.lib.PlayerHandler;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ModularArmourUtils.BT;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
+import net.minecraftforge.event.entity.living.LivingAttackEvent;
+
+@Optional.InterfaceList(value = { @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"),
+ @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles") })
+public class BaseBauble extends Item implements IBauble {
+
+ /**
+ * Implementation suggestions taken from Botania.
+ */
+
+ private BaubleType mThisBauble;
+ private final String mDisplayName;
+ private List<String> damageNegations = new ArrayList<String>();
+ Multimap<String, AttributeModifier> attributes = HashMultimap.create();
+
+ public BaseBauble(BaubleType type, String displayName) {
+ this.mThisBauble = type;
+ this.mDisplayName = displayName;
+ Utils.registerEvent(this);
+ this.setMaxStackSize(1);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(Utils.sanitizeString(displayName.toLowerCase()));
+ GameRegistry.registerItem(this, getUnlocalizedName());
+ }
+
+ public BaseBauble(BaubleType type, String unlocalName, int register) {
+ this.mThisBauble = type;
+ this.mDisplayName = "";
+ Utils.registerEvent(this);
+ this.setMaxStackSize(1);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ if (this.mDisplayName == null || this.mDisplayName.length() < 1) {
+ return super.getItemStackDisplayName(tItem).replaceAll(".name", "");
+ }
+ return this.mDisplayName;
+ }
+
+ @SubscribeEvent
+ public void onPlayerAttacked(LivingAttackEvent event) {
+ if (event.entityLiving instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) event.entityLiving;
+ if (getCorrectBauble(player) != null && damageNegations.contains(event.source.damageType))
+ event.setCanceled(true);
+ }
+ }
+
+ public boolean addDamageNegation(DamageSource damageSource) {
+ return addDamageNegation(damageSource, null);
+ }
+
+ public boolean addDamageNegation(DamageSource damageSource, ItemStack aStack) {
+ return damageNegations.add(damageSource.damageType);
+ }
+
+ public void clearDamageNegation() {
+ damageNegations.clear();
+ }
+
+ @Override
+ public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) {
+ return EntityPlayer.class.isInstance(arg1) ? true : false;
+ }
+
+ @Override
+ public boolean canUnequip(ItemStack arg0, EntityLivingBase arg1) {
+ return EntityPlayer.class.isInstance(arg1) ? true : false;
+ }
+
+ @Override
+ public BaubleType getBaubleType(ItemStack arg0) {
+ return mThisBauble;
+ }
+
+ public boolean SetBaubleType(BT arg0) {
+ return SetBaubleType(arg0.getType());
+ }
+
+ public boolean SetBaubleType(BaubleType arg0) {
+ BaubleType temp = this.mThisBauble;
+ this.mThisBauble = arg0;
+ if (this.mThisBauble != temp) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void onEquipped(ItemStack stack, EntityLivingBase entity) {
+ if (entity != null && EntityPlayer.class.isInstance(entity)) {
+ onEquippedOrLoadedIntoWorld(stack, entity);
+ setPlayerHashcode(stack, entity.hashCode());
+ }
+ }
+
+ @Override
+ public void onWornTick(ItemStack stack, EntityLivingBase player) {
+ if (getPlayerHashcode(stack) != player.hashCode()) {
+ onEquippedOrLoadedIntoWorld(stack, player);
+ setPlayerHashcode(stack, player.hashCode());
+ }
+ }
+
+ public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) {
+ attributes.clear();
+ fillModifiers(attributes, stack);
+ player.getAttributeMap().applyAttributeModifiers(attributes);
+ }
+
+ @Override
+ public void onUnequipped(ItemStack stack, EntityLivingBase player) {
+ attributes.clear();
+ fillModifiers(attributes, stack);
+ player.getAttributeMap().removeAttributeModifiers(attributes);
+ }
+
+ void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
+
+ }
+
+ public ItemStack getCorrectBauble(EntityPlayer player) {
+ InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
+ ItemStack stack1 = baubles.getStackInSlot(1);
+ ItemStack stack2 = baubles.getStackInSlot(2);
+ return isCorrectBauble(stack1) ? stack1 : isCorrectBauble(stack2) ? stack2 : null;
+ }
+
+ private boolean isCorrectBauble(ItemStack stack) {
+ return stack != null && (stack.getItem() == this);
+ }
+
+ @Override
+ public int getEntityLifespan(ItemStack itemStack, World world) {
+ return Integer.MAX_VALUE;
+ }
+
+ public static UUID getBaubleUUID(ItemStack stack) {
+ long most = NBTUtils.getLong(stack, "baubleUUIDMost");
+ if (most == 0) {
+ UUID uuid = UUID.randomUUID();
+ NBTUtils.setLong(stack, "baubleUUIDMost", uuid.getMostSignificantBits());
+ NBTUtils.setLong(stack, "baubleUUIDLeast", uuid.getLeastSignificantBits());
+ return getBaubleUUID(stack);
+ }
+
+ long least = NBTUtils.getLong(stack, "baubleUUIDLeast");
+ return new UUID(most, least);
+ }
+
+ public static int getPlayerHashcode(ItemStack stack) {
+ return NBTUtils.getInteger(stack, "mPlayerHashcode");
+ }
+
+ public static void setPlayerHashcode(ItemStack stack, int hash) {
+ NBTUtils.setInteger(stack, "mPlayerHashcode", hash);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java
new file mode 100644
index 0000000000..70de4603e7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java
@@ -0,0 +1,259 @@
+package gtPlusPlus.core.item.bauble;
+
+import java.util.List;
+
+import baubles.api.BaubleType;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.GT_Values;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+public class BatteryPackBaseBauble extends ElectricBaseBauble {
+
+
+ public BatteryPackBaseBauble(int tier) {
+ super(BaubleType.BELT, tier, GT_Values.V[tier] * 20 * 300, "GTPP.BattPack.0" + tier + ".name");
+ String aUnlocalName = "GTPP.BattPack.0" + tier + ".name";
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) {
+ GameRegistry.registerItem(this, aUnlocalName);
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
+ ItemStack itemStack = new ItemStack(this, 1);
+ ItemStack charged;
+ if (this.getEmptyItem(itemStack) == this) {
+ charged = new ItemStack(this, 1);
+ ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false);
+ itemList.add(charged);
+ }
+ if (this.getChargedItem(itemStack) == this) {
+ charged = new ItemStack(this, 1);
+ ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false);
+ itemList.add(charged);
+ }
+
+ }
+
+ @Override
+ public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_,
+ final boolean p_77663_5_) {
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public boolean canProvideEnergy(final ItemStack itemStack) {
+ double aItemCharge = ElectricItem.manager.getCharge(itemStack);
+ return aItemCharge > 0;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return (EnumChatFormatting.BLUE + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY);
+ }
+
+ @Override
+ public boolean showDurabilityBar(final ItemStack stack) {
+ return true;
+ }
+
+ public int secondsLeft(final ItemStack stack) {
+ double r = 0;
+ r = this.getCharge(stack) / (10000 * 20);
+ return (int) MathUtils.decimalRounding(r);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add("");
+ String aString1 = StatCollector.translateToLocal("GTPP.battpack.tooltip.1");
+ String aString2 = StatCollector.translateToLocal("GTPP.battpack.tooltip.2");
+ String aString3 = StatCollector.translateToLocal("GTPP.battpack.tooltip.3");
+ String aString4 = StatCollector.translateToLocal("GTPP.battpack.tooltip.4");
+
+ String aEU = StatCollector.translateToLocal("GTPP.info.eu");
+ String aEUT = aEU+"/t";
+
+ list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN + aString2+" " + (int) getTransferLimit(stack) + aEUT +" "+ aString3 + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN + aString4 + EnumChatFormatting.GRAY);
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public String getToolTip(final ItemStack stack) {
+ return ElectricItem.manager.getToolTip(stack);
+ }
+
+ @Override
+ public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override // TODO
+ public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) {
+
+ }
+
+ @Override // TODO
+ public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) {
+
+ }
+
+ @Override // TODO
+ public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayer) {
+ if (!aPlayer.worldObj.isRemote) {
+
+ try {
+
+ if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) {
+ // Try Iterate Armour Slots of Player
+ if (aPlayer instanceof EntityPlayer) {
+
+ // amour
+ for (final ItemStack aInvStack : ((EntityPlayer) aPlayer).inventory.armorInventory) {
+ if (aInvStack != null) {
+ if (aInvStack == aBaubleStack) {
+ continue;
+ }
+ if (ChargingHelper.isItemValid(aInvStack)) {
+ double aTransferRate = 0;
+ final IElectricItem electricItem = (IElectricItem) aInvStack.getItem();
+ if (electricItem != null) {
+ aTransferRate = electricItem.getTransferLimit(aInvStack);
+ double aItemCharge = ElectricItem.manager.getCharge(aInvStack);
+ if (aItemCharge >= 0 && aItemCharge != electricItem.getMaxCharge(aInvStack)) {
+ if (aItemCharge <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) {
+ if (ElectricItem.manager.getCharge(aBaubleStack) >= aTransferRate) {
+ if (ElectricItem.manager.getCharge(aInvStack) <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) {
+ double d = ElectricItem.manager.charge(aInvStack, aTransferRate * 16, mTier, false, true);
+ if (d > 0) {
+ d = ElectricItem.manager.charge(aInvStack, aTransferRate * 16, mTier, false, false);
+ ElectricItem.manager.discharge(aBaubleStack, d, mTier, false, true, false);
+ //Logger.INFO("Charging " + aInvStack.getDisplayName() + " | " + d + " | "+electricItem.getMaxCharge(aInvStack));
+ }
+ }
+ else {
+ //Logger.INFO("5");
+ }
+ }
+ else {
+ //Logger.INFO("4");
+ }
+ }
+ else {
+ //Logger.INFO("3");
+ }
+
+ }
+ else {
+ //Logger.INFO("1");
+ }
+ }
+
+ }
+ }
+ if (this.getCharge(aBaubleStack) > 0) {
+ continue;
+ } else {
+ break;
+ }
+ }
+
+ // Hotbar Slots
+ int aSlotCounter = 0;
+ for (final ItemStack aInvStack : ((EntityPlayer) aPlayer).inventory.mainInventory) {
+ if (aSlotCounter > (InventoryPlayer.getHotbarSize() - 1)) {
+ break;
+ }
+ aSlotCounter++;
+ if (aInvStack != null) {
+ if (aInvStack == aBaubleStack) {
+ continue;
+ }
+ if (ChargingHelper.isItemValid(aInvStack)) {
+ double aTransferRate = 0;
+ final IElectricItem electricItem = (IElectricItem) aInvStack.getItem();
+ if (electricItem != null) {
+ aTransferRate = electricItem.getTransferLimit(aInvStack);
+ double aItemCharge = ElectricItem.manager.getCharge(aInvStack);
+ if (aItemCharge >= 0 && aItemCharge != electricItem.getMaxCharge(aInvStack)) {
+ if (aItemCharge <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) {
+ if (ElectricItem.manager.getCharge(aBaubleStack) >= aTransferRate) {
+ if (ElectricItem.manager.getCharge(aInvStack) <= (electricItem.getMaxCharge(aInvStack) - aTransferRate)) {
+ double d = ElectricItem.manager.charge(aInvStack, aTransferRate, mTier, false, true);
+ if (d > 0) {
+ d = ElectricItem.manager.charge(aInvStack, aTransferRate, mTier, false, false);
+ ElectricItem.manager.discharge(aBaubleStack, d, mTier, false, true, false);
+ //Logger.INFO("Charging " + aInvStack.getDisplayName() + " | " + d + " | "+electricItem.getMaxCharge(aInvStack));
+ }
+ }
+ else {
+ //Logger.INFO("5");
+ }
+ }
+ else {
+ //Logger.INFO("4");
+ }
+ }
+ else {
+ //Logger.INFO("3");
+ }
+
+ }
+ else {
+ //Logger.INFO("1");
+ }
+ }
+ }
+ }
+ if (this.getCharge(aBaubleStack) > 0) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+
+ }
+ }
+
+
+
+
+ }
+
+ @Override
+ public String getTextureNameForBauble() {
+ return "chargepack/"+mTier;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java
new file mode 100644
index 0000000000..4316f13401
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java
@@ -0,0 +1,197 @@
+package gtPlusPlus.core.item.bauble;
+
+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 cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.GT_Values;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import ic2.api.item.IElectricItemManager;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+@Optional.InterfaceList(value = { @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"),
+@Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles") })
+public abstract class ElectricBaseBauble extends BaseBauble implements IElectricItem, IElectricItemManager, IBauble {
+
+ public final int mTier;
+ private final double maxValueEU;
+ private final BaubleType mType;
+
+ public ElectricBaseBauble(BaubleType aType, int aTier, double aMaxEU, String aUnlocalName) {
+ super(aType, aUnlocalName, 0);
+ mType = aType;
+ mTier = aTier;
+ maxValueEU = aMaxEU;
+ this.setUnlocalizedName(aUnlocalName);
+ this.setTextureName(CORE.MODID + ":" + getTextureNameForBauble());
+ this.setMaxDamage(27);
+ this.setMaxStackSize(1);
+ this.setNoRepair();
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) {
+ GameRegistry.registerItem(this, aUnlocalName);
+ }
+ }
+
+ public abstract String getTextureNameForBauble();
+
+ @SuppressWarnings("unchecked")
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
+ ItemStack itemStack = new ItemStack(this, 1);
+ ItemStack charged;
+ if (this.getEmptyItem(itemStack) == this) {
+ charged = new ItemStack(this, 1);
+ ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false);
+ itemList.add(charged);
+ }
+ if (this.getChargedItem(itemStack) == this) {
+ charged = new ItemStack(this, 1);
+ ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false);
+ itemList.add(charged);
+ }
+
+ }
+
+ @Override
+ public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_,
+ final boolean p_77663_5_) {
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public boolean canProvideEnergy(final ItemStack itemStack) {
+ double aItemCharge = ElectricItem.manager.getCharge(itemStack);
+ return aItemCharge > 0;
+ }
+
+ @Override
+ public final Item getChargedItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(27);
+ return x.getItem();
+ }
+
+ @Override
+ public final Item getEmptyItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(0);
+ return x.getItem();
+ }
+
+ @Override
+ public final double getMaxCharge(final ItemStack itemStack) {
+ return maxValueEU;
+ }
+
+ @Override
+ public final int getTier(final ItemStack itemStack) {
+ return mTier;
+ }
+
+ @Override
+ public final double getTransferLimit(final ItemStack itemStack) {
+ return GT_Values.V[mTier];
+ }
+
+ @Override
+ public final double getDurabilityForDisplay(final ItemStack stack) {
+ return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack));
+ }
+
+ @Override
+ public boolean showDurabilityBar(final ItemStack stack) {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add("");
+ String aEuInfo = StatCollector.translateToLocal("GTPP.info.euInfo");
+ String aTier = StatCollector.translateToLocal("GTPP.machines.tier");
+ String aInputLimit = StatCollector.translateToLocal("GTPP.info.inputLimit");
+ String aCurrentPower = StatCollector.translateToLocal("GTPP.info.currentPower");
+ String aEU = StatCollector.translateToLocal("GTPP.info.eu");
+ String aEUT = aEU+"/t";
+
+ list.add(EnumChatFormatting.GOLD + aEuInfo + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GRAY + aTier+": [" + EnumChatFormatting.YELLOW + this.getTier(stack)
+ + EnumChatFormatting.GRAY + "] "+aInputLimit+": [" + EnumChatFormatting.YELLOW
+ + this.getTransferLimit(stack) + EnumChatFormatting.GRAY + aEUT+"]");
+ list.add(EnumChatFormatting.GRAY + aCurrentPower +": [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack)
+ + EnumChatFormatting.GRAY + aEU +"] [" + EnumChatFormatting.YELLOW
+ + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY
+ + "%]");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public final 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);
+ }
+
+ @Override
+ public final 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);
+ }
+
+ @Override
+ public final double getCharge(final ItemStack stack) {
+ return ElectricItem.manager.getCharge(stack);
+ }
+
+ @Override
+ public final boolean canUse(final ItemStack stack, final double amount) {
+ return ElectricItem.manager.canUse(stack, amount);
+ }
+
+ @Override
+ public final boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) {
+ return ElectricItem.manager.use(stack, amount, entity);
+ }
+
+ @Override
+ public final void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) {
+ ElectricItem.manager.chargeFromArmor(stack, entity);
+ }
+
+ @Override
+ public String getToolTip(final ItemStack stack) {
+ //return ElectricItem.manager.getToolTip(stack);
+ return null;
+ }
+
+ @Override
+ public final BaubleType getBaubleType(final ItemStack arg0) {
+ return mType;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java
new file mode 100644
index 0000000000..6a8751b682
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/bauble/FireProtectionBauble.java
@@ -0,0 +1,137 @@
+package gtPlusPlus.core.item.bauble;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+import baubles.api.BaubleType;
+import cpw.mods.fml.common.registry.GameRegistry;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.preloader.DevHelper;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+public class FireProtectionBauble extends BaseBauble {
+
+ public static HashMap<UUID, Boolean> mDataMap = new HashMap<UUID, Boolean>();
+ public static HashSet<UUID> mPlayerMap = new HashSet<UUID>();
+
+ private static Field isImmuneToFire;
+
+ static {
+ isImmuneToFire = ReflectionUtils.getField(Entity.class, DevHelper.isObfuscatedEnvironment() ? "func_70045_F" : "isImmuneToFire");
+ }
+
+ public static boolean fireImmune(Entity aEntity) {
+ return aEntity.isImmuneToFire();
+ }
+
+ public static boolean setEntityImmuneToFire(Entity aEntity, boolean aImmune) {
+ try {
+ return ReflectionUtils.setField(aEntity, isImmuneToFire, aImmune);
+ }
+ catch (Throwable t) {}
+ return false;
+ }
+
+ public FireProtectionBauble() {
+ super(BaubleType.RING, "GTPP.bauble.fireprotection.0" + ".name", 0);
+ String aUnlocalName = "GTPP.bauble.fireprotection.0" + ".name";
+ this.setUnlocalizedName(aUnlocalName);
+ this.setTextureName(CORE.MODID + ":" + getTextureNameForBauble());
+ this.setMaxDamage(100);
+ this.setMaxStackSize(1);
+ this.setNoRepair();
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) {
+ GameRegistry.registerItem(this, aUnlocalName);
+ }
+ }
+
+ @Override
+ public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_,
+ final boolean p_77663_5_) {
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
+
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return (EnumChatFormatting.DARK_RED + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY);
+ }
+
+ @Override
+ public boolean showDurabilityBar(final ItemStack stack) {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public void onEquipped(final ItemStack arg0, final EntityLivingBase aPlayer) {
+ if (!aPlayer.worldObj.isRemote) {
+ if (aPlayer instanceof EntityPlayer) {
+ EntityPlayer bPlayer = (EntityPlayer) aPlayer;
+ mPlayerMap.add(bPlayer.getUniqueID());
+ }
+ }
+ }
+
+ @Override
+ public void onUnequipped(final ItemStack arg0, final EntityLivingBase aPlayer) {
+ if (!aPlayer.worldObj.isRemote) {
+ if (aPlayer instanceof EntityPlayer) {
+ EntityPlayer bPlayer = (EntityPlayer) aPlayer;
+ if (bPlayer.isPotionActive(Potion.fireResistance)) {
+ bPlayer.removePotionEffect(Potion.fireResistance.id);
+ }
+ mPlayerMap.remove(bPlayer.getUniqueID());
+ setEntityImmuneToFire(bPlayer, false);
+ }
+ }
+ }
+
+ @Override
+ public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayer) {
+ if (!aPlayer.worldObj.isRemote) {
+ if (aPlayer instanceof EntityPlayer) {
+ EntityPlayer bPlayer = (EntityPlayer) aPlayer;
+ if (!fireImmune(bPlayer)) {
+ setEntityImmuneToFire(bPlayer, true);
+ }
+ if (!bPlayer.isPotionActive(Potion.fireResistance)) {
+ bPlayer.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 100, 4));
+ }
+ }
+ }
+ }
+
+ public String getTextureNameForBauble() {
+ return "baubles/itemFireProtectGlovesBetter";
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/bauble/HealthBoostBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/HealthBoostBauble.java
new file mode 100644
index 0000000000..49ce7ad715
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/bauble/HealthBoostBauble.java
@@ -0,0 +1,39 @@
+package gtPlusPlus.core.item.bauble;
+
+import java.util.List;
+
+import com.google.common.collect.Multimap;
+
+import net.minecraft.entity.SharedMonsterAttributes;
+import net.minecraft.entity.ai.attributes.AttributeModifier;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.EnumChatFormatting;
+
+import baubles.api.BaubleType;
+import gtPlusPlus.core.lib.CORE;
+
+public class HealthBoostBauble extends BaseBauble{
+
+
+ public HealthBoostBauble() {
+ super(BaubleType.AMULET, "The Key to the City");
+ addDamageNegation(DamageSource.wither);
+ this.setTextureName(CORE.MODID + ":" + "itemKeyGold");
+ }
+
+ @Override
+ void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
+ attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(getBaubleUUID(stack), "Bauble modifier", 40, 0));
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ list.add(EnumChatFormatting.GRAY+"You feel like you're on top of the world.");
+ list.add(EnumChatFormatting.GRAY+"Wear it around your neck like an amulet.");
+ super.addInformation(stack, player, list, bool);
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/bauble/ModularBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/ModularBauble.java
new file mode 100644
index 0000000000..a8d216e1bc
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/bauble/ModularBauble.java
@@ -0,0 +1,408 @@
+package gtPlusPlus.core.item.bauble;
+
+import java.util.List;
+
+import org.lwjgl.input.Keyboard;
+
+import com.google.common.collect.Multimap;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.SharedMonsterAttributes;
+import net.minecraft.entity.ai.attributes.AttributeModifier;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+
+import baubles.api.BaubleType;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.util.minecraft.ModularArmourUtils;
+import gtPlusPlus.core.util.minecraft.ModularArmourUtils.BT;
+import gtPlusPlus.core.util.minecraft.ModularArmourUtils.Modifiers;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+
+public class ModularBauble extends BaseBauble {
+
+ @SideOnly(Side.CLIENT)
+ private IIcon mTextureAmulet;
+ @SideOnly(Side.CLIENT)
+ private IIcon mTextureRing;
+ @SideOnly(Side.CLIENT)
+ private IIcon mTextureBelt;
+ private IIcon iconArray[] = new IIcon[3];
+ @SideOnly(Side.CLIENT)
+ private IIcon mfallback;
+
+ public ModularBauble() {
+ super(BaubleType.AMULET, "Modular Bauble");
+ }
+
+ @Override
+ void fillModifiers(Multimap<String, AttributeModifier> attributes, ItemStack stack) {
+
+ // Get Stats
+ int mStatlevel = 0;
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0) {
+ if (mStatlevel > 0 && mStatlevel < 20) {
+ attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 1, 0));
+ } else if (mStatlevel > 20 && mStatlevel < 45) {
+ attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 2, 0));
+ } else if (mStatlevel >= 45 && mStatlevel < 75) {
+ attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 4, 0));
+ } else if (mStatlevel >= 75 && mStatlevel < 99) {
+ attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 8, 0));
+ } else if (mStatlevel >= 100) {
+ attributes.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "AD" + mStatlevel, 16, 0));
+ }
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0) {
+ if (mStatlevel > 0 && mStatlevel < 20) {
+ attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 1, 0));
+ } else if (mStatlevel > 20 && mStatlevel < 45) {
+ attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 2, 0));
+ } else if (mStatlevel > 45 && mStatlevel < 75) {
+ attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 3, 0));
+ } else if (mStatlevel > 75 && mStatlevel < 99) {
+ attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 6, 0));
+ } else if (mStatlevel >= 100) {
+ attributes.put(SharedMonsterAttributes.knockbackResistance.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "BD" + mStatlevel, 10, 0));
+ }
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0) {
+ if (mStatlevel > 0 && mStatlevel <= 100) {
+ int bonus = mStatlevel / 5;
+ attributes.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "HP" + mStatlevel, bonus * 2, 0));
+ }
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0) {
+ if (mStatlevel > 0 && mStatlevel < 20) {
+ attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 1, 0));
+ } else if (mStatlevel > 20 && mStatlevel < 45) {
+ attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 2, 0));
+ } else if (mStatlevel > 45 && mStatlevel < 75) {
+ attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 3, 0));
+ } else if (mStatlevel > 75 && mStatlevel < 99) {
+ attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 4, 0));
+ } else if (mStatlevel >= 100) {
+ attributes.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(),
+ new AttributeModifier(getBaubleUUID(stack), "SP" + mStatlevel, 5, 0));
+ }
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_MINING)) > 0) {
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0) {
+ }
+
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ // Bauble Type
+ if (ModularArmourUtils.getBaubleType(stack) == BaubleType.AMULET) {
+ list.add(EnumChatFormatting.GRAY + "Current Form: " + EnumChatFormatting.RED + "Amulet"
+ + EnumChatFormatting.GRAY + ".");
+ list.add(EnumChatFormatting.GRAY + "You can change this into a Ring or a Belt.");
+ } else if (ModularArmourUtils.getBaubleType(stack) == BaubleType.RING) {
+ list.add(EnumChatFormatting.GRAY + "Current Form: " + EnumChatFormatting.RED + "Ring"
+ + EnumChatFormatting.GRAY + ".");
+ list.add(EnumChatFormatting.GRAY + "You can change this into an Amulet or a Belt.");
+ } else if (ModularArmourUtils.getBaubleType(stack) == BaubleType.BELT) {
+ list.add(EnumChatFormatting.GRAY + "Current Form: " + EnumChatFormatting.RED + "Belt"
+ + EnumChatFormatting.GRAY + ".");
+ list.add(EnumChatFormatting.GRAY + "You can change this into a Ring or an Amulet.");
+ }
+
+ // Get Stats
+ int mStatlevel = 0;
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DAMAGE)) > 0) {
+ list.add(EnumChatFormatting.GRAY + "Damage Boost: " + EnumChatFormatting.DARK_RED + mStatlevel
+ + EnumChatFormatting.GRAY + "/100.");
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HP)) > 0) {
+ list.add(EnumChatFormatting.GRAY + "Health Boost: " + EnumChatFormatting.RED + mStatlevel
+ + EnumChatFormatting.GRAY + "/100. Bonus " + (mStatlevel / 5) + " hearts.");
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_SPEED)) > 0) {
+ list.add(EnumChatFormatting.GRAY + "Speed Boost: " + EnumChatFormatting.WHITE + mStatlevel
+ + EnumChatFormatting.GRAY + "/100.");
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_MINING)) > 0) {
+ list.add(EnumChatFormatting.GRAY + "Mining Boost: " + EnumChatFormatting.DARK_GRAY + mStatlevel
+ + EnumChatFormatting.GRAY + "/100.");
+ }
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_HOLY)) > 0) {
+ list.add(EnumChatFormatting.GRAY + "Holy Boost: " + EnumChatFormatting.GOLD + mStatlevel
+ + EnumChatFormatting.GRAY + "/100.");
+ }
+
+ // Defence Boost
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(stack, Modifiers.BOOST_DEF)) > 0) {
+ list.add(EnumChatFormatting.GRAY + "Defence Boost: " + EnumChatFormatting.BLUE + mStatlevel
+ + EnumChatFormatting.GRAY + "/100.");
+
+ if ((Keyboard.isKeyDown(42)) || (Keyboard.isKeyDown(54))) {
+
+ if (mStatlevel >= 1) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Cactus"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 10) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Falling Blocks"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 20) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Wall Suffocation"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 35) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Drowning"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 50) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Starvation"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 60) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Falling"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 75) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Lava"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 80) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Magic"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 95) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Wither"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 100) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Fire"
+ + EnumChatFormatting.GRAY + ".");
+ }
+ if (mStatlevel >= 100) {
+ list.add(EnumChatFormatting.GRAY + "Protected From: " + EnumChatFormatting.BLUE + "Void"
+ + EnumChatFormatting.GRAY + ".");
+ }
+
+ }
+ else {
+ list.add(EnumChatFormatting.GRAY + "<Press Shift to view protections>");
+ }
+ }
+
+ if (NBTUtils.getBotanicaSoulboundOwner(stack) != null) {
+ if (!NBTUtils.getBotanicaSoulboundOwner(stack).equals("")) {
+ list.add(EnumChatFormatting.GRAY + "Owner: " + EnumChatFormatting.GREEN
+ + NBTUtils.getBotanicaSoulboundOwner(stack) + EnumChatFormatting.GRAY + ".");
+ }
+ }
+ super.addInformation(stack, player, list, bool);
+ }
+
+ @Override
+ public boolean addDamageNegation(DamageSource damageSource, ItemStack aStack) {
+
+ this.clearDamageNegation();
+ int mStatlevel = 0;
+ if ((mStatlevel = ModularArmourUtils.getModifierLevel(aStack, Modifiers.BOOST_HOLY)) > 0) {
+ if (mStatlevel >= 1) {
+ addDamageNegation(DamageSource.cactus);
+ }
+ if (mStatlevel >= 10) {
+ addDamageNegation(DamageSource.fallingBlock);
+ }
+ if (mStatlevel >= 20) {
+ addDamageNegation(DamageSource.inWall);
+ }
+ if (mStatlevel >= 35) {
+ addDamageNegation(DamageSource.drown);
+ }
+ if (mStatlevel >= 50) {
+ addDamageNegation(DamageSource.starve);
+ }
+ if (mStatlevel >= 60) {
+ addDamageNegation(DamageSource.fall);
+ }
+ if (mStatlevel >= 75) {
+ addDamageNegation(DamageSource.lava);
+ }
+ if (mStatlevel >= 80) {
+ addDamageNegation(DamageSource.magic);
+ }
+ if (mStatlevel >= 95) {
+ addDamageNegation(DamageSource.wither);
+ }
+ if (mStatlevel >= 100) {
+ addDamageNegation(DamageSource.inFire);
+ }
+ if (mStatlevel >= 100) {
+ addDamageNegation(DamageSource.onFire);
+ }
+ if (mStatlevel >= 100) {
+ addDamageNegation(DamageSource.outOfWorld);
+ }
+ }
+ return super.addDamageNegation(damageSource, null);
+ }
+
+ @Override
+ public boolean canEquip(ItemStack arg0, EntityLivingBase arg1) {
+ if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_AMULET.getID()) {
+ this.SetBaubleType(BT.TYPE_AMULET);
+ } else if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_RING.getID()) {
+ this.SetBaubleType(BT.TYPE_RING);
+ } else if (ModularArmourUtils.getBaubleTypeID(arg0) == BT.TYPE_BELT.getID()) {
+ this.SetBaubleType(BT.TYPE_BELT);
+ } else {
+ this.SetBaubleType(BT.TYPE_RING);
+ }
+ if (PlayerUtils.isPlayerOP((EntityPlayer) arg1)) {
+ return true; // Let OPs wear other peoples shit.
+ }
+
+ String mOwner;
+ if (NBTUtils.getBotanicaSoulboundOwner(arg0) == null || NBTUtils.getBotanicaSoulboundOwner(arg0).equals("")) {
+ return true;
+ } else if ((mOwner = NBTUtils.getBotanicaSoulboundOwner(arg0)) != null) {
+ String mPlayerName = arg1.getCommandSenderName();
+ if (mOwner.toLowerCase().equals(mPlayerName.toLowerCase())) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public BaubleType getBaubleType(ItemStack arg0) {
+ return ModularArmourUtils.getBaubleType(arg0);
+ }
+
+ @Override
+ public void onEquipped(ItemStack stack, EntityLivingBase entity) {
+ if (entity instanceof EntityPlayer) {
+ if (NBTUtils.getBotanicaSoulboundOwner(stack) == null
+ || NBTUtils.getBotanicaSoulboundOwner(stack).equals("")) {
+ NBTUtils.setBotanicaSoulboundOwner(stack, entity.getCommandSenderName());
+ }
+ }
+ super.onEquipped(stack, entity);
+ }
+
+ /*@Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
+ if (usingItem == null) {
+ return mfallback;
+ }
+ try {
+ if (stack.getItemDamage() == 0) {
+ return mfallback = mTextureAmulet;
+ }
+ else if (stack.getItemDamage() == 1) {
+ return mfallback = mTextureRing;
+ }
+ else if (stack.getItemDamage() == 2) {
+ return mfallback = mTextureBelt;
+ } else {
+ return mfallback = mTextureRing;
+ }
+ } catch (Throwable t) {
+ return mfallback = mTextureRing;
+ }
+ }*/
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int meta) {
+ if (meta < this.iconArray.length && this.iconArray[meta] != null){
+ return this.iconArray[meta];
+ }
+ return this.mfallback;
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 3; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister register) {
+ this.mfallback = register.registerIcon("miscutils" + ":" + "itemAmulet");
+ // you cannot initialize iconArray when declared nor in the constructor,
+ // as it is client-side only, so do it here:
+ if (LoadedMods.Thaumcraft) {
+ iconArray[0] = register.registerIcon("thaumcraft" + ":" + "bauble_amulet");
+ iconArray[1] = register.registerIcon("thaumcraft" + ":" + "bauble_ring");
+ iconArray[2] = register.registerIcon("thaumcraft" + ":" + "bauble_belt");
+ } else {
+ iconArray[0] = register.registerIcon("miscutils" + ":" + "itemAmulet");
+ iconArray[1] = register.registerIcon("miscutils" + ":" + "itemRingWearable");
+ iconArray[2] = register.registerIcon("miscutils" + ":" + "itemBelt");
+ }
+
+ mTextureAmulet = iconArray[0];
+ mTextureRing = iconArray[1];
+ mTextureBelt = iconArray[2];
+
+ }
+
+ @Override
+ public void onWornTick(ItemStack stack, EntityLivingBase player) {
+ super.onWornTick(stack, player);
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public Item setFull3D() {
+ // TODO Auto-generated method stub
+ return super.setFull3D();
+ }
+
+ @Override
+ public boolean isFull3D() {
+ return true;
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java b/src/main/java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java
new file mode 100644
index 0000000000..aab302688b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java
@@ -0,0 +1,175 @@
+package gtPlusPlus.core.item.bauble;
+
+import java.util.List;
+
+import baubles.api.BaubleType;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.GT_Values;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.AABB;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import ic2.api.item.ElectricItem;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+public class MonsterKillerBaseBauble extends ElectricBaseBauble {
+
+ private final Class[] mTargets;
+
+ public MonsterKillerBaseBauble(Class[] aMonsterBaseClassArray, String aMonsterTypeName, int aPowerTier) {
+ super(BaubleType.AMULET, aPowerTier, GT_Values.V[aPowerTier] * 20 * 300,
+ "GTPP.MonsterKiller." + aMonsterTypeName + ".name");
+ mTargets = aMonsterBaseClassArray;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
+ ItemStack itemStack = new ItemStack(this, 1);
+ ItemStack charged;
+ if (this.getEmptyItem(itemStack) == this) {
+ charged = new ItemStack(this, 1);
+ ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false);
+ itemList.add(charged);
+ }
+ if (this.getChargedItem(itemStack) == this) {
+ charged = new ItemStack(this, 1);
+ ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false);
+ itemList.add(charged);
+ }
+
+ }
+
+ @Override
+ public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_,
+ final boolean p_77663_5_) {
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public boolean canProvideEnergy(final ItemStack itemStack) {
+ double aItemCharge = ElectricItem.manager.getCharge(itemStack);
+ return aItemCharge > 0;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return (EnumChatFormatting.WHITE + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY);
+ }
+
+ @Override
+ public boolean showDurabilityBar(final ItemStack stack) {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add("");
+ String aString1 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.1");
+ String aString2 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.2");
+ String aString3 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.3");
+ String aString4 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.4");
+ String aEU = StatCollector.translateToLocal("GTPP.info.eu");
+ String aEUT = aEU + "/t";
+
+ list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN + aString2 + " " + (int) getTransferLimit(stack) + aEUT + " " + aString3
+ + EnumChatFormatting.GRAY);
+ list.add("");
+ list.add("" + EnumChatFormatting.GREEN + aString4 + " " + EnumChatFormatting.GRAY);
+ for (Class cz : mTargets) {
+ list.add("- " + EnumChatFormatting.DARK_GREEN + cz.getSimpleName().replace("Entity", "") + EnumChatFormatting.GRAY);
+ }
+
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) {
+
+ }
+
+ @Override
+ public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) {
+
+ }
+
+ @Override // TODO
+ public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayerEntity) {
+ if (aPlayerEntity == null) {
+ return;
+ }
+ EntityPlayer aPlayer = (EntityPlayer) aPlayerEntity;
+ if (!aPlayer.worldObj.isRemote) {
+ if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) {
+ AABB aPlayerBox = new AABB(aPlayerEntity, 5, 5, 5);
+ if (this.mTargets != null && this.mTargets.length > 0) {
+ for (Class clazz : mTargets) {
+ AutoMap<?> aEnts = EntityUtils.getEntitiesWithinBoundingBox(clazz, aPlayerBox);
+ if (aEnts.isEmpty()) {
+ continue;
+ } else {
+ EntityLiving aClosest = null;
+ double aEntityDistance = Short.MIN_VALUE;
+ for (Object ent : aEnts) {
+ if (!EntityLiving.class.isInstance(ent)) {
+ continue;
+ } else {
+ double aCurEntDis = EntityUtils.getDistance(aPlayerEntity, (Entity) ent);
+ if (aEntityDistance == Short.MIN_VALUE || aCurEntDis < aEntityDistance) {
+ aEntityDistance = aCurEntDis;
+ aClosest = (EntityLiving) ent;
+ }
+ }
+ }
+ if (aClosest != null) {
+ float aEntHealth = aClosest.getHealth();
+ float aEntMaxHealth = aClosest.getMaxHealth();
+ double aEntHealthPerc = MathUtils.findPercentage(aEntHealth, aEntMaxHealth);
+ long aEuUsage = (long) (aEntHealthPerc * 50 * aEntMaxHealth);
+ if (this.discharge(aBaubleStack, aEuUsage, mTier, true, false, false) > 0) {
+ aClosest.setDead();
+ PlayerUtils.messagePlayer(aPlayer, "Removed 1x "+aClosest.getCommandSenderName());
+ break;
+ }
+ } else {
+ continue;
+ }
+ }
+ }
+ }
+ } else {
+ return;
+ }
+ }
+ }
+
+ @Override
+ public String getTextureNameForBauble() {
+ return "baubles/itemAmulet";
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java b/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java
new file mode 100644
index 0000000000..8e7a760195
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/AgriculturalChem.java
@@ -0,0 +1,614 @@
+package gtPlusPlus.core.item.chemistry;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Materials;
+import gtPlusPlus.api.helpers.MaterialHelper;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.ItemPackage;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.plugin.agrichem.BioRecipes;
+import gtPlusPlus.plugin.agrichem.item.algae.ItemAgrichemBase;
+import gtPlusPlus.plugin.agrichem.item.algae.ItemAlgaeBase;
+import gtPlusPlus.plugin.agrichem.item.algae.ItemBioChip;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.oredict.OreDictionary;
+
+public class AgriculturalChem extends ItemPackage {
+
+ private static boolean aBOP;
+ private static boolean aTiCon;
+
+ private static AutoMap<FluidStack> mBloodFluids = new AutoMap<FluidStack>();
+
+ /**
+ * Fluids
+ */
+
+ // Poop Juice
+ public static Fluid PoopJuice;
+ // Manure Slurry
+ public static Fluid ManureSlurry;
+ // Fertile Manure Slurry
+ public static Fluid FertileManureSlurry;
+ // Blood
+ public static Fluid CustomBlood;
+ // Red Mud
+ public static Fluid RedMud;
+ /**
+ * Items
+ */
+
+ // Manure Byproducts
+ public static Item dustManureByproducts;
+ // Organic Fertilizer
+ public static Item dustOrganicFertilizer;
+ // Dirt
+ public static Item dustDirt;
+
+ // Poop Juice
+ // vv - Centrifuge
+ // Manure Slurry && Manure Byproducts -> (Elements) Centrifuge to several tiny
+ // piles
+ // vv - Chem Reactor - Add Peat, Meat
+ // Organic Fertilizer
+ // vv - Dehydrate
+ // Fertilizer
+
+ // Poop Juice
+ // vv - Mixer - Add Blood, Bone, Meat (1000L Poo, 200L Blood, x2 Bone, x3 Meat)
+ // Fertile Manure Slurry
+ // vv - Chem Reactor - Add Peat x1.5
+ // Organic Fertilizer x3
+ // vv - Dehydrate
+ // Fertilizer
+
+
+
+ public static Item mAlgae;
+ public static Item mBioCircuit;
+ public static Item mAgrichemItem1;
+
+ /*
+ * 0 - Algae Biomass
+ * 1 - Green Algae Biomass
+ * 2 - Brown Algae Biomass
+ * 3 - Golden-Brown Algae Biomass
+ * 4 - Red Algae Biomass
+ * 5 - Cellulose Fiber
+ * 6 - Golden-Brown Cellulose Fiber
+ * 7 - Red Cellulose Fiber
+ * 8 - Compost
+ * 9 - Wood Pellet
+ * 10 - Wood Brick
+ * 11 - Cellulose Pulp
+ * 12 - Raw Bio Resin
+ * 13 - Catalyst Carrier
+ * 14 - Green Metal Catalyst
+ * 15 - Alginic Acid
+ * 16 - Alumina
+ * 17 - Aluminium Pellet
+ * 18 - Sodium Aluminate
+ * 19 - Sodium Hydroxide // Exists in Newer GT
+ * 20 - Sodium Carbonate
+ * 21 - Lithium Chloride
+ * 22 - Pellet Mold
+ * 23 - Clean Aluminium Mix
+ * 24 - Pinecone
+ */
+
+ public static ItemStack mAlgaeBiosmass;
+ public static ItemStack mGreenAlgaeBiosmass;
+ public static ItemStack mBrownAlgaeBiosmass;
+ public static ItemStack mGoldenBrownAlgaeBiosmass;
+ public static ItemStack mRedAlgaeBiosmass;
+ public static ItemStack mCelluloseFiber;
+ public static ItemStack mGoldenBrownCelluloseFiber;
+ public static ItemStack mRedCelluloseFiber;
+ public static ItemStack mCompost;
+ public static ItemStack mWoodPellet;
+ public static ItemStack mWoodBrick;
+ public static ItemStack mCellulosePulp;
+ public static ItemStack mRawBioResin;
+ public static ItemStack mCatalystCarrier;
+ public static ItemStack mGreenCatalyst;
+ public static ItemStack mAlginicAcid;
+ public static ItemStack mAlumina;
+ public static ItemStack mAluminiumPellet;
+ public static ItemStack mSodiumAluminate;
+ public static ItemStack mSodiumHydroxide;
+ public static ItemStack mSodiumCarbonate;
+ public static ItemStack mLithiumChloride;
+ public static ItemStack mPelletMold;
+ public static ItemStack mCleanAluminiumMix;
+ public static ItemStack mPinecone;
+ public static ItemStack mCrushedPine;
+
+
+ @Override
+ public void items() {
+ // Nitrogen, Ammonium Nitrate, Phosphates, Calcium, Copper, Carbon
+ dustManureByproducts = ItemUtils.generateSpecialUseDusts("ManureByproducts", "Manure Byproduct",
+ "(N2H4O3)N2P2Ca3CuC8", Utils.rgbtoHexValue(110, 75, 25))[0];
+
+ // Basically Guano
+ dustOrganicFertilizer = ItemUtils.generateSpecialUseDusts("OrganicFertilizer", "Organic Fertilizer",
+ "Ca5(PO4)3(OH)", Utils.rgbtoHexValue(240, 240, 240))[0];
+
+ // Dirt Dust :)
+ dustDirt = ItemUtils.generateSpecialUseDusts("Dirt", "Dried Earth", Utils.rgbtoHexValue(65, 50, 15))[0];
+
+ mAlgae = new ItemAlgaeBase();
+ mAgrichemItem1 = new ItemAgrichemBase();
+ mBioCircuit = new ItemBioChip();
+ GregtechItemList.Circuit_BioRecipeSelector.set(mBioCircuit);
+
+
+
+ mAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 0, 1);
+ mGreenAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 1, 1);
+ mBrownAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 2, 1);
+ mGoldenBrownAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 3, 1);
+ mRedAlgaeBiosmass = ItemUtils.simpleMetaStack(mAgrichemItem1, 4, 1);
+ mCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 5, 1);
+ mGoldenBrownCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 6, 1);
+ mRedCelluloseFiber = ItemUtils.simpleMetaStack(mAgrichemItem1, 7, 1);
+ mCompost = ItemUtils.simpleMetaStack(mAgrichemItem1, 8, 1);
+ mWoodPellet = ItemUtils.simpleMetaStack(mAgrichemItem1, 9, 1);
+ mWoodBrick = ItemUtils.simpleMetaStack(mAgrichemItem1, 10, 1);
+ mCellulosePulp = ItemUtils.simpleMetaStack(mAgrichemItem1, 11, 1);
+ mRawBioResin = ItemUtils.simpleMetaStack(mAgrichemItem1, 12, 1);
+ mCatalystCarrier = ItemUtils.simpleMetaStack(mAgrichemItem1, 13, 1);
+ mGreenCatalyst = ItemUtils.simpleMetaStack(mAgrichemItem1, 14, 1);
+ mAlginicAcid = ItemUtils.simpleMetaStack(mAgrichemItem1, 15, 1);
+ mAlumina = ItemUtils.simpleMetaStack(mAgrichemItem1, 16, 1);
+ mAluminiumPellet = ItemUtils.simpleMetaStack(mAgrichemItem1, 17, 1);
+ mSodiumAluminate = ItemUtils.simpleMetaStack(mAgrichemItem1, 18, 1);
+
+ /**
+ * If It exists, don't add a new one.
+ */
+ if (OreDictionary.doesOreNameExist("dustSodiumHydroxide_GT5U") || OreDictionary.doesOreNameExist("dustSodiumHydroxide")) {
+ List<ItemStack> aTest = OreDictionary.getOres("dustSodiumHydroxide", false);
+ ItemStack aTestStack;
+ if (aTest.isEmpty()) {
+ aTest = OreDictionary.getOres("dustSodiumHydroxide_GT5U", false);
+ if (aTest.isEmpty()) {
+ aTestStack = ItemUtils.simpleMetaStack(mAgrichemItem1, 19, 1);
+ }
+ else {
+ aTestStack = aTest.get(0);
+ }
+ }
+ else {
+ aTestStack = aTest.get(0);
+ }
+ mSodiumHydroxide = aTestStack;
+ }
+ else {
+ mSodiumHydroxide = ItemUtils.simpleMetaStack(mAgrichemItem1, 19, 1);
+ }
+ mSodiumCarbonate = ItemUtils.simpleMetaStack(mAgrichemItem1, 20, 1);
+ mLithiumChloride = ItemUtils.simpleMetaStack(mAgrichemItem1, 21, 1);
+ mPelletMold = ItemUtils.simpleMetaStack(mAgrichemItem1, 22, 1);
+ mCleanAluminiumMix = ItemUtils.simpleMetaStack(mAgrichemItem1, 23, 1);
+ mPinecone = ItemUtils.simpleMetaStack(mAgrichemItem1, 24, 1);
+ mCrushedPine = ItemUtils.simpleMetaStack(mAgrichemItem1, 25, 1);
+
+ ItemUtils.addItemToOreDictionary(mGreenAlgaeBiosmass, "biomassGreenAlgae");
+ ItemUtils.addItemToOreDictionary(mBrownAlgaeBiosmass, "biomassBrownAlgae");
+ ItemUtils.addItemToOreDictionary(mGoldenBrownAlgaeBiosmass, "biomassGoldenBrownAlgae");
+ ItemUtils.addItemToOreDictionary(mRedAlgaeBiosmass, "biomassRedAlgae");
+
+ ItemUtils.addItemToOreDictionary(mCelluloseFiber, "fiberCellulose");
+ ItemUtils.addItemToOreDictionary(mGoldenBrownCelluloseFiber, "fiberCellulose");
+ ItemUtils.addItemToOreDictionary(mGoldenBrownCelluloseFiber, "fiberGoldenBrownCellulose");
+ ItemUtils.addItemToOreDictionary(mRedCelluloseFiber, "fiberCellulose");
+ ItemUtils.addItemToOreDictionary(mRedCelluloseFiber, "fiberRedCellulose");
+
+ ItemUtils.addItemToOreDictionary(mWoodPellet, "pelletWood");
+ ItemUtils.addItemToOreDictionary(mWoodBrick, "brickWood");
+ ItemUtils.addItemToOreDictionary(mCellulosePulp, "pulpCellulose");
+
+ ItemUtils.addItemToOreDictionary(mCatalystCarrier, "catalystEmpty");
+ ItemUtils.addItemToOreDictionary(mGreenCatalyst, "catalystAluminiumSilver");
+ ItemUtils.addItemToOreDictionary(mAlginicAcid, "dustAlginicAcid");
+ ItemUtils.addItemToOreDictionary(mAlumina, "dustAlumina");
+ ItemUtils.addItemToOreDictionary(mAluminiumPellet, "pelletAluminium");
+
+ ItemUtils.addItemToOreDictionary(mSodiumAluminate, "dustSodiumAluminate");
+ ItemUtils.addItemToOreDictionary(mSodiumHydroxide, "dustSodiumHydroxide");
+ ItemUtils.addItemToOreDictionary(mSodiumCarbonate, "dustSodiumCarbonate");
+ ItemUtils.addItemToOreDictionary(mLithiumChloride, "dustLithiumChloride");
+ ItemUtils.addItemToOreDictionary(mPinecone, "pinecone");
+ ItemUtils.addItemToOreDictionary(mCrushedPine, "crushedPineMaterial");
+
+ //Handle GT NaOH dusts
+ List<ItemStack> NaOHSmall = OreDictionary.getOres("dustSmallSodiumHydroxide_GT5U", false);
+ if (!NaOHSmall.isEmpty()) {
+ ItemUtils.addItemToOreDictionary(NaOHSmall.get(0), "dustSmallSodiumHydroxide");
+ }
+ List<ItemStack> NaOHTiny = OreDictionary.getOres("dustTinySodiumHydroxide_GT5U", false);
+ if (!NaOHTiny.isEmpty()) {
+ ItemUtils.addItemToOreDictionary(NaOHTiny.get(0), "dustTinySodiumHydroxide");
+ }
+
+
+ }
+
+ @Override
+ public void blocks() {
+ // None yet
+ }
+
+ @Override
+ public void fluids() {
+ // Sewage
+ PoopJuice = FluidUtils.generateFluidNonMolten("raw.waste", "Raw Animal Waste", 32 + 175,
+ new short[] { 100, 70, 30, 100 }, null, null, 0, true);
+
+ // Sewage
+ ManureSlurry = FluidUtils.generateFluidNonMolten("manure.slurry", "Manure Slurry", 39 + 175,
+ new short[] { 75, 45, 15, 100 }, null, null, 0, true);
+
+ // Sewage
+ FertileManureSlurry = FluidUtils.generateFluidNonMolten("fertile.manure.slurry", "Fertile Manure Slurry",
+ 45 + 175, new short[] { 65, 50, 15, 100 }, null, null, 0, true);
+
+ RedMud = FluidUtils.generateFluidNoPrefix("mud.red.slurry", "Red Mud Slurry", 32 + 175, new short[] { 180, 35, 25, 100 }, true);
+
+ }
+
+
+
+ public AgriculturalChem() {
+ super();
+
+ aBOP = LoadedMods.BiomesOPlenty;
+ aTiCon = LoadedMods.TiCon;
+
+ Logger.INFO("Adding Agrochemical content");
+
+ FluidStack aBlood;
+ if (aBOP) {
+ aBlood = FluidUtils.getFluidStack("hell_blood", 100);
+ if (aBlood != null) {
+ Logger.INFO("Found Biome's o Plenty, enabled Blood support.");
+ CustomBlood = aBlood.getFluid();
+ mBloodFluids.put(aBlood);
+ }
+ }
+
+ if (aTiCon) {
+ aBlood = FluidUtils.getFluidStack("blood", 100);
+ if (aBlood != null) {
+ Logger.INFO("Found Tinker's Construct, enabled Blood support.");
+ CustomBlood = aBlood.getFluid();
+ mBloodFluids.put(FluidUtils.getFluidStack("blood", 100));
+ }
+ }
+
+ // Handle Blood Internally, Create if required.
+ if (mBloodFluids.isEmpty() || CustomBlood == null) {
+ Logger.INFO(
+ "Did not find any existing Blood fluids. Trying to wildcard search the fluid registry, then generate our own if that fails.");
+ FluidStack aTempBlood = FluidUtils.getWildcardFluidStack("blood", 100);
+ if (aTempBlood != null) {
+ CustomBlood = aTempBlood.getFluid();
+ } else {
+ aTempBlood = FluidUtils.getWildcardFluidStack("hell_blood", 100);
+ if (aTempBlood == null) {
+ CustomBlood = FluidUtils.generateFluidNoPrefix("blood", "Blood", 32 + 175,
+ new short[] { 175, 25, 25, 100 }, true);
+ } else {
+ CustomBlood = aTempBlood.getFluid();
+ }
+ }
+ Logger.INFO("Using " + CustomBlood.getName());
+ mBloodFluids.put(FluidUtils.getFluidStack(CustomBlood, 100));
+ }
+
+ }
+
+ private final static AutoMap<ItemStack> mMeats = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mFish = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mFruits = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mVege = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mNuts = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mSeeds = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mPeat = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mBones = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mBoneMeal = new AutoMap<ItemStack>();
+
+ private final static AutoMap<ItemStack> mList_Master_Meats = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mList_Master_FruitVege = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mList_Master_Seeds = new AutoMap<ItemStack>();
+ private final static AutoMap<ItemStack> mList_Master_Bones = new AutoMap<ItemStack>();
+
+ private static void processAllOreDict() {
+ processOreDict("listAllmeatraw", mMeats);
+ processOreDict("listAllfishraw", mFish);
+ processOreDict("listAllfruit", mFruits);
+ processOreDict("listAllVeggie", mVege);
+ processOreDict("listAllnut", mNuts);
+ processOreDict("listAllSeed", mSeeds);
+ processOreDict("brickPeat", mPeat);
+ processOreDict("bone", mBones);
+ processOreDict("dustBone", mBoneMeal);
+ // Just make a mega list, makes life easier.
+ if (!mMeats.isEmpty()) {
+ for (ItemStack g : mMeats) {
+ mList_Master_Meats.put(g);
+ }
+ }
+ if (!mFish.isEmpty()) {
+ for (ItemStack g : mFish) {
+ mList_Master_Meats.put(g);
+ }
+ }
+ if (!mFruits.isEmpty()) {
+ for (ItemStack g : mFruits) {
+ mList_Master_FruitVege.put(g);
+ }
+ }
+ if (!mVege.isEmpty()) {
+ for (ItemStack g : mVege) {
+ mList_Master_FruitVege.put(g);
+ }
+ }
+ if (!mNuts.isEmpty()) {
+ for (ItemStack g : mNuts) {
+ mList_Master_FruitVege.put(g);
+ }
+ }
+ if (!mSeeds.isEmpty()) {
+ for (ItemStack g : mSeeds) {
+ mList_Master_Seeds.put(g);
+ }
+ }
+ if (!mBoneMeal.isEmpty()) {
+ for (ItemStack g : mBoneMeal) {
+ mList_Master_Bones.put(g);
+ }
+ }
+ if (!mBones.isEmpty()) {
+ for (ItemStack g : mBones) {
+ mList_Master_Bones.put(g);
+ }
+ }
+ }
+
+ private static void processOreDict(String aOreName, AutoMap<ItemStack> aMap) {
+ ArrayList<ItemStack> aTemp = OreDictionary.getOres(aOreName);
+ if (!aTemp.isEmpty()) {
+ for (ItemStack stack : aTemp) {
+ aMap.put(stack);
+ }
+ }
+ }
+
+ private static void addBasicSlurryRecipes() {
+
+ ItemStack aManureByprod1 = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyManureByproducts", 1);
+ ItemStack aManureByprod2 = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1);
+ ItemStack aDirtDust = ItemUtils.getSimpleStack(dustDirt, 1);
+
+ // Poop Juice to Basic Slurry
+ GT_Values.RA.addCentrifugeRecipe(CI.getNumberedCircuit(10), null, FluidUtils.getFluidStack(PoopJuice, 1000), // In
+ // Fluid
+ FluidUtils.getFluidStack(ManureSlurry, 250), // Out Fluid
+ aDirtDust, aDirtDust, aManureByprod1, aManureByprod1, aManureByprod1, aManureByprod1,
+ new int[] { 2000, 2000, 500, 500, 250, 250 }, // Chances
+ 10 * 20, // Time
+ 30); // EU
+
+ // More Efficient way to get byproducts, less Slurry
+ GT_Values.RA.addCentrifugeRecipe(CI.getNumberedCircuit(20), null, FluidUtils.getFluidStack(PoopJuice, 1000), // In
+ // Fluid
+ FluidUtils.getFluidStack(ManureSlurry, 50), // Out Fluid
+ aDirtDust, aDirtDust, aManureByprod1, aManureByprod1, aManureByprod2, aManureByprod2,
+ new int[] { 4000, 3000, 1250, 1250, 675, 675 }, // Chances
+ 20 * 20, // Time
+ 60); // EU
+
+ }
+
+ private static void addAdvancedSlurryRecipes() {
+
+ ItemStack aCircuit = CI.getNumberedCircuit(10);
+ ItemStack aBone;
+ ItemStack aMeat;
+ ItemStack aEmptyCells = CI.emptyCells(2);
+ ItemStack aInputCells = ItemUtils.getItemStackOfAmountFromOreDict("cellRawAnimalWaste", 2);
+ FluidStack aOutput = FluidUtils.getFluidStack(FertileManureSlurry, 1000);
+
+ for (FluidStack aBloodStack : mBloodFluids) {
+ for (ItemStack aBoneStack : mList_Master_Bones) {
+ aBone = ItemUtils.getSimpleStack(aBoneStack, 2);
+ for (ItemStack aMeatStack : mList_Master_Meats) {
+ aMeat = ItemUtils.getSimpleStack(aMeatStack, 5);
+ // Poop Juice to Fertile Slurry
+ GT_Values.RA.addMixerRecipe(aCircuit, aBone, aMeat, aInputCells, aBloodStack, // Input Fluid
+ aOutput, // Output Fluid
+ aEmptyCells, // Output Item
+ 20 * 8, // Time?
+ 60 // Eu?
+ );
+ }
+ }
+ }
+ }
+
+ private static void addBasicOrganiseFertRecipes() {
+ FluidStack aInputFluid = FluidUtils.getFluidStack(ManureSlurry, 1000);
+ ItemStack aOutputDust = ItemUtils.getSimpleStack(dustOrganicFertilizer, 3);
+ ItemStack aPeat;
+ ItemStack aMeat;
+ for (ItemStack aPeatStack : mPeat) {
+ aPeat = ItemUtils.getSimpleStack(aPeatStack, 3);
+ for (ItemStack aMeatStack : mList_Master_Meats) {
+ aMeat = ItemUtils.getSimpleStack(aMeatStack, 5);
+ CORE.RA.addChemicalRecipe(aPeat, aMeat, aInputFluid, null, aOutputDust, 20 * 20, 120);
+ }
+
+ aPeat = ItemUtils.getSimpleStack(aPeatStack, 2);
+ for (ItemStack aMeatStack : mList_Master_FruitVege) {
+ aMeat = ItemUtils.getSimpleStack(aMeatStack, 9);
+ CORE.RA.addChemicalRecipe(aPeat, aMeat, aInputFluid, null, aOutputDust, 10 * 20, 120);
+ }
+ }
+ }
+
+ private static void addAdvancedOrganiseFertRecipes() {
+ FluidStack aInputFluid = FluidUtils.getFluidStack(FertileManureSlurry, 1000);
+ ItemStack aOutputDust = ItemUtils.getSimpleStack(dustOrganicFertilizer, 7);
+ ItemStack aPeat;
+ ItemStack aMeat;
+ for (ItemStack aPeatStack : mPeat) {
+ aPeat = ItemUtils.getSimpleStack(aPeatStack, 5);
+ for (ItemStack aMeatStack : mList_Master_Meats) {
+ aMeat = ItemUtils.getSimpleStack(aMeatStack, 7);
+ CORE.RA.addChemicalRecipe(aPeat, aMeat, aInputFluid, null, aOutputDust, 10 * 20, 140);
+ }
+ aPeat = ItemUtils.getSimpleStack(aPeatStack, 3);
+ for (ItemStack aMeatStack : mList_Master_FruitVege) {
+ aMeat = ItemUtils.getSimpleStack(aMeatStack, 12);
+ CORE.RA.addChemicalRecipe(aPeat, aMeat, aInputFluid, null, aOutputDust, 5 * 20, 140);
+ }
+ }
+ }
+
+ public static ItemStack aFertForestry;
+ public static ItemStack aFertIC2;
+
+
+ private static void addMiscRecipes() {
+
+ ItemStack aDustOrganicFert = ItemUtils.getSimpleStack(dustOrganicFertilizer, 1);
+ ItemStack aManureByprod = ItemUtils.getSimpleStack(dustManureByproducts, 1);
+
+ // Dehydrate Organise Fert to Normal Fert.
+
+ /**
+ * Forestry Support
+ */
+ if (LoadedMods.Forestry) {
+ Field aItemField = ReflectionUtils.getField(ReflectionUtils.getClass("forestry.plugins.PluginCore"), "items");
+ try {
+ Object aItemRegInstance = aItemField != null ? aItemField.get(aItemField) : null;
+ if (aItemRegInstance != null) {
+ Field aFertField = ReflectionUtils.getField(aItemRegInstance.getClass(), "fertilizerCompound");
+ Object aItemInstance = aFertField.get(aItemRegInstance);
+ if (aItemInstance instanceof Item) {
+ aFertForestry = ItemUtils.getSimpleStack((Item) aItemInstance);
+ Item aForestryFert = (Item) aItemInstance;
+ CORE.RA.addDehydratorRecipe(
+ new ItemStack[] { CI.getNumberedCircuit(11), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null,
+ null, new ItemStack[] { ItemUtils.getSimpleStack(aForestryFert, 3), aManureByprod, aManureByprod },
+ new int[] { 10000, 2000, 2000 }, 20 * 20, 240);
+ }
+ }
+ }
+ catch (IllegalArgumentException | IllegalAccessException e) {
+
+ }
+ }
+
+ /**
+ * IC2 Support
+ */
+ if (LoadedMods.IndustrialCraft2) {
+ aFertIC2 = ItemUtils.getItemStackFromFQRN("IC2:itemFertilizer", 1);
+ CORE.RA.addDehydratorRecipe(
+ new ItemStack[] { CI.getNumberedCircuit(12), ItemUtils.getSimpleStack(aDustOrganicFert, 4) }, null,
+ null, new ItemStack[] { ItemUtils.getItemStackFromFQRN("IC2:itemFertilizer", 3), aManureByprod,
+ aManureByprod },
+ new int[] { 10000, 2000, 2000 }, 20 * 20, 240);
+ }
+
+ // Dirt Production
+ CORE.RA.addCompressorRecipe(ItemUtils.getSimpleStack(dustDirt, 9), ItemUtils.getSimpleStack(Blocks.dirt),
+ 20 * 2, 8);
+
+ // Centrifuge Byproducts
+
+ // Ammonium Nitrate, Phosphates, Calcium, Copper, Carbon
+ GT_Values.RA.addCentrifugeRecipe(CI.getNumberedCircuit(20), ItemUtils.getSimpleStack(aManureByprod, 4),
+ FluidUtils.getFluidStack("sulfuricacid", 250), // In Fluid
+ FluidUtils.getFluidStack("sulfuricapatite", 50), // Out Fluid
+ MaterialHelper.getDustSmall(Materials.Phosphorus, 2), MaterialHelper.getDustSmall(Materials.Calcium, 2),
+ MaterialHelper.getDustTiny(Materials.Copper, 1), MaterialHelper.getDust(Materials.Carbon, 1), ItemUtils.getSimpleStack(dustDirt, 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAmmoniumNitrate", 1),
+ new int[] { 2500, 2500, 750, 1000, 5000, 250 }, // Chances
+ 20 * 20, // Time
+ 60); // EU
+
+ // Add Fuel Usages
+ CORE.RA.addSemifluidFuel(FluidUtils.getFluidStack(PoopJuice, 1000), 12);
+ CORE.RA.addSemifluidFuel(FluidUtils.getFluidStack(ManureSlurry, 1000), 24);
+ CORE.RA.addSemifluidFuel(FluidUtils.getFluidStack(FertileManureSlurry, 1000), 32);
+
+ // Red Slurry / Tailings Processing
+ GT_Values.RA.addCentrifugeRecipe(
+ CI.getNumberedBioCircuit(10),
+ GT_Values.NI,
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 1000),
+ FluidUtils.getWater(500),
+ ELEMENT.getInstance().IRON.getSmallDust(1),
+ ELEMENT.getInstance().COPPER.getSmallDust(1),
+ ELEMENT.getInstance().TIN.getSmallDust(1),
+ ELEMENT.getInstance().SULFUR.getSmallDust(1),
+ ELEMENT.getInstance().NICKEL.getTinyDust(1),
+ ELEMENT.getInstance().LEAD.getTinyDust(1),
+ new int[] { 3000, 3000, 2000, 2000, 1000, 1000 },
+ 30 * 20,
+ 30);
+
+ }
+
+ @Override
+ public String errorMessage() {
+ return "Failed to generate recipes for AgroChem.";
+ }
+
+ @Override
+ public boolean generateRecipes() {
+ if (mBloodFluids.isEmpty()) {
+ Logger.INFO("Could not find, nor create Blood fluid. Unable to add recipes.");
+ return false;
+ }
+
+ // Organise OreDict
+ processAllOreDict();
+
+ // Slurry Production
+ addBasicSlurryRecipes();
+ addAdvancedSlurryRecipes();
+
+ // Organic Fert. Production
+ addBasicOrganiseFertRecipes();
+ addAdvancedOrganiseFertRecipes();
+
+ addMiscRecipes();
+
+ BioRecipes.init();
+
+ return true;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/CoalTar.java b/src/main/java/gtPlusPlus/core/item/chemistry/CoalTar.java
new file mode 100644
index 0000000000..ca9053dacb
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/CoalTar.java
@@ -0,0 +1,378 @@
+package gtPlusPlus.core.item.chemistry;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.util.GT_OreDictUnificator;
+import gtPlusPlus.api.objects.minecraft.ItemPackage;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.reflect.AddGregtechRecipe;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public class CoalTar extends ItemPackage {
+
+ public static Fluid Coal_Gas;
+ public static Fluid Coal_Oil;
+ public static Fluid Ethylene;
+ public static Fluid Ethylbenzene;
+ public static Fluid Anthracene;
+ public static Fluid Toluene;
+ public static Fluid Coal_Tar;
+ public static Fluid Coal_Tar_Oil;
+ public static Fluid Sulfuric_Coal_Tar_Oil;
+ public static Fluid Naphthalene;
+ public static Fluid Phthalic_Acid;
+
+ private static void recipeEthylBenzineFuelsIntoHeavyFuel() {
+ CORE.RA.addChemicalRecipe(
+ ItemUtils.getItemStackOfAmountFromOreDict("cellFuel", 9),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEthylbenzene", 2),
+ null,
+ FluidUtils.getFluidStack("nitrofuel", 7500),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 11),
+ 100,
+ CORE.GTNH ? 1000 : 500);
+ CORE.RA.addChemicalRecipe(
+ ItemUtils.getItemStackOfAmountFromOreDict("cellBioDiesel", 9),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEthylbenzene", 2),
+ null,
+ FluidUtils.getFluidStack("nitrofuel", 3000),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 11),
+ 300,
+ CORE.GTNH ? 1000 : 500);
+ }
+
+ public static void recipeCreateEthylene(){
+
+ FluidStack bioEth1 = FluidUtils.getFluidStack("fluid.bioethanol", 2000);
+ FluidStack bioEth2 = FluidUtils.getFluidStack("bioethanol", 2000);
+
+ if (bioEth1 != null){
+ CORE.RA.addDehydratorRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(17),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1)
+ },
+ bioEth1,
+ FluidUtils.getWater(1000),
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEthylene", 1)
+ },
+ new int[] {10000},
+ 120 * 20,
+ 80);
+ }
+
+ if (bioEth2 != null){
+ CORE.RA.addDehydratorRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(18),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1)
+ },
+ bioEth2,
+ FluidUtils.getWater(1000),
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEthylene", 1)
+ },
+ new int[] {10000},
+ 120 * 20,
+ 80);
+ }
+ }
+
+ public static void recipeCreateBenzene(){
+ //Create Benzene - (Toluene + Hydrogen | 95% Benzene / 5% methane)
+ CORE.RA.addDehydratorRecipe(
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("cellToluene", 10),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 10)
+ },
+ null,
+ null,
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("cellMethane", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellBenzene", 19)
+ },
+ new int[]{10000, 10000},
+ 20*100,
+ 90);
+ }
+
+ public static void recipeCreateEthylbenzene(){
+ GT_Values.RA.addChemicalRecipe(
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEthylene", 2),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellBenzene", 2),
+ null,
+ FluidUtils.getFluidStack("fluid.ethylbenzene", 4000),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 4),
+ 300);
+ }
+
+
+ public static void recipeCoalToCoalTar(){
+ //Charcoal
+ AddGregtechRecipe.addCokeAndPyrolyseRecipes(
+ GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Charcoal, 32L),
+ 8,
+ GT_Values.NF,
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSmallDirt", 2),
+ FluidUtils.getFluidStack("fluid.coaltar", 800),
+ 15,
+ 120);
+ //Lignite
+ AddGregtechRecipe.addCokeAndPyrolyseRecipes(
+ GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Lignite, 16L),
+ 8,
+ GT_Values.NF,
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSmallDarkAsh", 2),
+ FluidUtils.getFluidStack("fluid.coaltar", 800),
+ 45,
+ 60);
+
+ //Coal
+ AddGregtechRecipe.addCokeAndPyrolyseRecipes(
+ GT_OreDictUnificator.get(OrePrefixes.gem, Materials.Coal, 12L),
+ 8,
+ GT_Values.NF,
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSmallDarkAsh", 2),
+ FluidUtils.getFluidStack("fluid.coaltar", 2200),
+ 30,
+ 120);
+
+ //Coke
+ AddGregtechRecipe.addCokeAndPyrolyseRecipes(
+ ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 8),
+ 8,
+ GT_Values.NF,
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSmallAsh", 3),
+ FluidUtils.getFluidStack("fluid.coaltar", 3400),
+ 15,
+ 240);
+
+ }
+
+ private static void recipeCoalTarToCoalTarOil() {
+ // v - Distill (60% Tar oil/15% Naphtha/20% Ethylbenzene/5% Anthracene)
+ //Create Coal Tar Oil
+ //FluidUtils.generateFluidNonMolten("CoalTarOil", "Coal Tar Oil", 240, new short[]{240, 240, 150, 100}, null, null);
+ GT_Values.RA.addDistilleryRecipe(
+ CI.getNumberedCircuit(1), //Circuit
+ FluidUtils.getFluidStack("fluid.coaltar", 1000), //aInput
+ FluidUtils.getFluidStack("fluid.coaltaroil", 600), //aOutput
+ 600, //aDuration
+ 64,//aEUt
+ false //Hidden?
+ );
+ GT_Values.RA.addDistilleryRecipe(
+ CI.getNumberedCircuit(2), //Circuit
+ FluidUtils.getFluidStack("fluid.coaltar", 1000), //aInput
+ FluidUtils.getFluidStack("liquid_naphtha", 150), //aOutput
+ 300, //aDuration
+ 30,//aEUt
+ false //Hidden?
+ );
+ GT_Values.RA.addDistilleryRecipe(
+ CI.getNumberedCircuit(3), //Circuit
+ FluidUtils.getFluidStack("fluid.coaltar", 1000), //aInput
+ FluidUtils.getFluidStack("fluid.ethylbenzene", 200), //aOutput
+ 450, //aDuration
+ 86,//aEUt
+ false //Hidden?
+ );
+ GT_Values.RA.addDistilleryRecipe(
+ CI.getNumberedCircuit(4), //Circuit
+ FluidUtils.getFluidStack("fluid.coaltar", 1000), //aInput
+ FluidUtils.getFluidStack("fluid.anthracene", 50), //aOutput
+ 900, //aDuration
+ 30,//aEUt
+ false //Hidden?
+ );
+ GT_Values.RA.addDistilleryRecipe(
+ CI.getNumberedCircuit(5), //Circuit
+ FluidUtils.getFluidStack("fluid.coaltar", 1500), //aInput
+ FluidUtils.getFluidStack("fluid.kerosene", 600), //aOutput
+ 300, //aDuration
+ 64,//aEUt
+ false //Hidden?
+ );
+
+ GT_Values.RA.addDistillationTowerRecipe(
+ FluidUtils.getFluidStack("fluid.coaltar", 1200),
+ new FluidStack[]{
+ FluidUtils.getFluidStack("fluid.coaltaroil", 500), //aOutput
+ FluidUtils.getFluidStack("liquid_naphtha", 100), //aOutput
+ FluidUtils.getFluidStack("fluid.ethylbenzene", 150), //aOutput
+ FluidUtils.getFluidStack("fluid.anthracene", 50), //aOutput
+ FluidUtils.getFluidStack("fluid.kerosene", 400), //aOutput
+ },
+ null,
+ 900,
+ 60);
+
+ }
+
+ private static void recipeCoalTarOilToSulfuricOilToNaphthalene() {
+ //SulfuricCoalTarOil
+ GT_Values.RA.addChemicalRecipe(
+ ItemUtils.getItemStackOfAmountFromOreDict("cellCoalTarOil", 8),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellSulfuricAcid", 8),
+ null,
+ null,
+ ItemUtils.getItemStackOfAmountFromOreDict("cellSulfuricCoalTarOil", 16),
+ 20*16);
+ GT_Values.RA.addDistilleryRecipe(
+ CI.getNumberedCircuit(6), //Circuit
+ FluidUtils.getFluidStack("fluid.sulfuriccoaltaroil", 1000), //aInput
+ FluidUtils.getFluidStack("fluid.naphthalene", 1000), //aOutput
+ 1200, //aDuration
+ 30,//aEUt
+ false //Hidden?
+ );
+
+ }
+
+ private static void recipeNaphthaleneToPhthalicAcid() {
+ //SulfuricCoalTarOil
+ GT_Values.RA.addChemicalRecipe(
+ ItemUtils.getItemStackOfAmountFromOreDict("cellNaphthalene", 2),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustLithium", 5),
+ null,
+ FluidUtils.getFluidStack("fluid.phthalicacid", 2500),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2),
+ 20*16);
+
+ }
+
+ private static void recipePhthalicAcidToPhthalicAnhydride() {
+ CORE.RA.addDehydratorRecipe(
+ new ItemStack[] {
+ CI.getNumberedBioCircuit(15)
+ },
+ FluidUtils.getFluidStack("fluid.phthalicacid", 144),
+ null,
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 1)
+ },
+ new int[] {10000},
+ 60 * 20,
+ 120);
+ }
+
+ @Override
+ public String errorMessage() {
+ return "Bad Coal Science!";
+ }
+
+ @Override
+ public boolean generateRecipes() {
+ recipeCreateEthylene();
+ recipeCreateBenzene();
+ recipeCreateEthylbenzene();
+
+ recipeCoalToCoalTar();
+ recipeCoalTarToCoalTarOil();
+ recipeCoalTarOilToSulfuricOilToNaphthalene();
+ recipeNaphthaleneToPhthalicAcid();
+ recipePhthalicAcidToPhthalicAnhydride();
+
+ recipeEthylBenzineFuelsIntoHeavyFuel();
+
+ recipePhthalicAcidConversion();
+
+ //Burn the coal gas!
+ GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalGas", 1), null, 96, 1);
+ CORE.RA.addSemifluidFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellSulfuricCoalTarOil", 1), 64);
+ CORE.RA.addSemifluidFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalTarOil", 1), 32);
+ CORE.RA.addSemifluidFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellCoalTar", 1), 16);
+
+ return true;
+ }
+
+ private void recipePhthalicAcidConversion() {
+ FluidStack aMyAcid = FluidUtils.getFluidStack(Phthalic_Acid, 500);
+ FluidStack aGtAcid = FluidUtils.getFluidStack("phtalicacid", 500);
+ if (aMyAcid != null && aGtAcid != null) {
+ CORE.RA.addDistilleryRecipe(CI.getNumberedBioCircuit(8), aMyAcid, aGtAcid, null, 50, 16, false);
+ CORE.RA.addDistilleryRecipe(CI.getNumberedBioCircuit(9), aGtAcid, aMyAcid, null, 50, 16, false);
+ }
+ }
+
+ @Override
+ public void items() {
+ //Phthalic_Acid = FluidUtils.generateFluidNonMolten("PhthalicAcid", "Phthalic Acid", 207, new short[]{210, 220, 210, 100}, null, null);
+ // v - Dehydrate at 180C+
+ //Create Phthalic Anhydride
+ ItemUtils.generateSpecialUseDusts("PhthalicAnhydride", "Phthalic Anhydride", "C6H4(CO)2O", Utils.rgbtoHexValue(175, 175, 175));
+
+ //Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O
+ ItemUtils.generateSpecialUseDusts("LithiumHydroperoxide", "Lithium Hydroperoxide", "HLiO2", Utils.rgbtoHexValue(125, 125, 125));
+ // v - Dehydrate
+ //Lithium Peroxide - 2 LiOOH → Li2O2 + H2O2 + 2 H2O
+ //Lithium_Peroxide = FluidUtils.generateFluidNonMolten("LithiumPeroxide", "Lithium Peroxide", 446, new short[]{135, 135, 135, 100}, null, null);
+ }
+
+ @Override
+ public void blocks() {
+
+ }
+
+ @Override
+ public void fluids() {
+
+ //Create Coal Gas
+ Coal_Gas = FluidUtils.generateFluidNonMolten("CoalGas", "Coal Gas", 500, new short[]{48, 48, 48, 100}, null, null);
+ //Ethanol
+ // v - Dehydrate cells to remove water
+
+
+ //Create Ethylene
+ if (!FluidUtils.doesFluidExist("ethylene")){
+ Ethylene = FluidUtils.generateFluidNonMolten("ethylene", "Ethylene", -103, new short[]{255, 255, 255, 100}, null, null);
+ }
+ else {
+ Ethylene = FluidUtils.getWildcardFluidStack("ethylene", 1).getFluid();
+ }
+
+ //Create Ethylbenzene - Ethylbenzene is produced in on a large scale by combining benzene and ethylene in an acid-catalyzed chemical reaction
+ //Use Chemical Reactor
+ Ethylbenzene = FluidUtils.generateFluidNonMolten("Ethylbenzene", "Ethylbenzene", 136, new short[]{255, 255, 255, 100}, null, null);
+ //Create Anthracene
+ Anthracene = FluidUtils.generateFluidNonMolten("Anthracene", "Anthracene", 340, new short[]{255, 255, 255, 100}, null, null);
+ //Toluene
+ if (!FluidUtils.doesFluidExist("liquid_toluene")){
+ Toluene = FluidUtils.generateFluidNonMolten("liquid_toluene", "Toluene", -95, new short[]{140, 70, 20, 100}, null, null);
+ }
+ else {
+ Toluene = FluidUtils.getWildcardFluidStack("liquid_toluene", 1).getFluid();
+ }
+
+ //Create Coal Tar
+ Coal_Tar = FluidUtils.generateFluidNonMolten("CoalTar", "Coal Tar", 450, new short[]{32, 32, 32, 100}, null, null);
+ // v - Distill (60% Tar oil/15% Naphtha/20% Ethylbenzene/5% Anthracene)
+ //Create Coal Tar Oil
+ Coal_Tar_Oil = FluidUtils.generateFluidNonMolten("CoalTarOil", "Coal Tar Oil", 240, new short[]{240, 240, 150, 100}, null, null);
+ // v - Wash With Sulfuric Acid
+ //Create Sulfuric Coal Tar Oil
+ Sulfuric_Coal_Tar_Oil = FluidUtils.generateFluidNonMolten("SulfuricCoalTarOil", "Sulfuric Coal Tar Oil", 240, new short[]{250, 170, 12, 100}, null, null);
+ // v - Distill (No loss, just time consuming)
+ //Create Naphthalene
+ Naphthalene = FluidUtils.generateFluidNonMolten("Naphthalene", "Naphthalene", 115, new short[]{210, 185, 135, 100}, null, null);
+ // v - Oxidize with mercury and nitric acid
+ //Create Phthalic Acid
+ Phthalic_Acid = FluidUtils.generateFluidNonMolten("PhthalicAcid", "Phthalic Acid", 207, new short[]{210, 220, 210, 100}, null, null);
+ // v - Dehydrate at 180C+
+ //Create Phthalic Anhydride
+ //ItemUtils.generateSpecialUseDusts("PhthalicAnhydride", "Phthalic Anhydride", "C6H4(CO)2O", Utils.rgbtoHexValue(175, 175, 175));
+
+
+
+
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java
new file mode 100644
index 0000000000..43bd669829
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/GenericChem.java
@@ -0,0 +1,1133 @@
+package gtPlusPlus.core.item.chemistry;
+
+import gregtech.api.enums.*;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.minecraft.ItemPackage;
+import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase;
+import gtPlusPlus.core.item.circuit.ItemAdvancedChip;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.*;
+import gtPlusPlus.core.material.state.MaterialState;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import gtPlusPlus.plugin.agrichem.BioRecipes;
+import gtPlusPlus.plugin.agrichem.block.AgrichemFluids;
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.*;
+
+public class GenericChem extends ItemPackage {
+
+ /**
+ * Switches
+ */
+
+ private static boolean usingGregtechNitricOxide = false;
+ private static boolean usingGregtechNitrogenDioxide = false;
+ private static boolean usingGregtechHydricSulfur = false;
+
+ /**
+ * Materials
+ */
+
+ //public static final Material BAKELITE = new Material("Bakelite", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{90, 140, 140}, 120, 240, 23, 24, true, null, 0);//Not a GT Inherited Material
+ //public static final Material NYLON = new Material("Nylon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{45, 45, 45}, 300, 600, 44, 48, true, null, 0);//Not a GT Inherited Material
+ //public static final Material CARBYNE = new Material("Carbyne", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{25, 25, 25}, 2500, 5000, 63, 52, true, null, 0);//Not a GT Inherited Material
+
+
+ //Refined PTFE
+ public static final Material TEFLON = new Material(
+ "Teflon",
+ MaterialState.SOLID,
+ TextureSet.SET_SHINY,
+ new short[] { 75, 45, 75 },
+ 330, 640,
+ -1, -1,
+ false,
+ null,
+ 0,
+ new MaterialStack[] {
+ new MaterialStack(NONMATERIAL.PTFE, 75),
+ new MaterialStack(NONMATERIAL.PLASTIC, 15),
+ new MaterialStack(ELEMENT.getInstance().CARBON, 5),
+ new MaterialStack(ELEMENT.getInstance().SODIUM, 5)
+ });
+
+ /**
+ * Fluids
+ */
+
+ public static Fluid Benzene;
+ public static Fluid NitroBenzene;
+ public static Fluid Aniline;
+ public static Fluid Polyurethane;
+ public static Fluid Phenol; //https://en.wikipedia.org/wiki/Phenol#Uses
+ public static Fluid Cyclohexane; //https://en.wikipedia.org/wiki/Cyclohexane
+ public static Fluid Cyclohexanone; //https://en.wikipedia.org/wiki/Cyclohexanone
+ public static Fluid Cadaverine; //https://en.wikipedia.org/wiki/Cadaverine
+ public static Fluid Putrescine; //https://en.wikipedia.org/wiki/Putrescine
+ public static Fluid BoricAcid;
+ public static Fluid HydrochloricAcid;
+
+
+ public static Fluid Ethylanthraquinone2;
+ public static Fluid Ethylanthrahydroquinone2;
+ public static Fluid Hydrogen_Peroxide;
+ public static Fluid Lithium_Peroxide;
+ public static Fluid Nitric_Oxide;
+ public static Fluid Nitrogen_Dioxide;
+ public static Fluid Carbon_Disulfide;
+ public static Fluid Hydrogen_Sulfide;
+
+ /**
+ * Items
+ */
+
+ // Phenol Byproducts
+ public Item PhenolicResins; //https://en.wikipedia.org/wiki/Phenol_formaldehyde_resin
+ public static ItemGenericChemBase mGenericChemItem1;
+ public static Item mAdvancedCircuit;
+
+ private ItemStack mCatalystCarrier;
+
+ public static ItemStack mRedCatalyst;
+ public static ItemStack mYellowCatalyst;
+ public static ItemStack mBlueCatalyst;
+ public static ItemStack mOrangeCatalyst;
+ public static ItemStack mPurpleCatalyst;
+ public static ItemStack mBrownCatalyst;
+ public static ItemStack mPinkCatalyst;
+ public static ItemStack mFormaldehydeCatalyst;
+
+ public static ItemStack mMillingBallAlumina;
+ public static ItemStack mMillingBallSoapstone;
+
+ public static ItemStack mSodiumEthoxide;
+ public static ItemStack mSodiumEthylXanthate;
+ public static ItemStack mPotassiumEthylXanthate;
+ public static ItemStack mPotassiumHydroxide;
+
+
+
+ @Override
+ public void items() {
+ PhenolicResins = ItemUtils.generateSpecialUseDusts("phenolicresins", "Phenolic Resin", "HOC6H4CH2OH", Utils.rgbtoHexValue(80, 40, 40))[0];
+ //MaterialGenerator.generate(BAKELITE, false);
+ //MaterialGenerator.generate(NYLON, false);
+ MaterialGenerator.generate(TEFLON, false);
+
+ mGenericChemItem1 = new ItemGenericChemBase();
+ mAdvancedCircuit = new ItemAdvancedChip();
+ GregtechItemList.Circuit_T3RecipeSelector.set(mAdvancedCircuit);
+
+ registerItemStacks();
+ registerOreDict();
+
+ GregtechItemList.Milling_Ball_Alumina.set(mMillingBallAlumina);
+ GregtechItemList.Milling_Ball_Soapstone.set(mMillingBallSoapstone);
+
+ }
+
+
+ public void registerItemStacks() {
+
+ mCatalystCarrier = ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 13, 1);
+
+ mRedCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 0, 1);
+ mYellowCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 1, 1);
+ mBlueCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 2, 1);
+ mOrangeCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 3, 1);
+ mPurpleCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 4, 1);
+ mBrownCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 5, 1);
+ mPinkCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 6, 1);
+ mMillingBallAlumina = ItemUtils.simpleMetaStack(mGenericChemItem1, 7, 1);
+ mMillingBallSoapstone = ItemUtils.simpleMetaStack(mGenericChemItem1, 8, 1);
+ mSodiumEthoxide = ItemUtils.simpleMetaStack(mGenericChemItem1, 9, 1);
+ mSodiumEthylXanthate = ItemUtils.simpleMetaStack(mGenericChemItem1, 10, 1);
+ mPotassiumEthylXanthate = ItemUtils.simpleMetaStack(mGenericChemItem1, 11, 1);
+ mPotassiumHydroxide = ItemUtils.simpleMetaStack(mGenericChemItem1, 12, 1);
+ mFormaldehydeCatalyst = ItemUtils.simpleMetaStack(mGenericChemItem1, 13, 1);
+
+ }
+
+ public void registerOreDict() {
+
+ ItemUtils.addItemToOreDictionary(mRedCatalyst, "catalystIronCopper");
+ ItemUtils.addItemToOreDictionary(mYellowCatalyst, "catalystTungstenNickel");
+ ItemUtils.addItemToOreDictionary(mBlueCatalyst, "catalystCobaltTitanium");
+ ItemUtils.addItemToOreDictionary(mOrangeCatalyst, "catalystVanadiumPalladium");
+ ItemUtils.addItemToOreDictionary(mPurpleCatalyst, "catalystIridiumRuthenium");
+ ItemUtils.addItemToOreDictionary(mBrownCatalyst, "catalystNickelAluminium");
+ ItemUtils.addItemToOreDictionary(mPinkCatalyst, "catalystPlatinumRhodium");
+ ItemUtils.addItemToOreDictionary(mMillingBallAlumina, "millingballAlumina");
+ ItemUtils.addItemToOreDictionary(mMillingBallSoapstone, "millingballSoapstone");
+ ItemUtils.addItemToOreDictionary(mSodiumEthoxide, "dustSodiumEthoxide");
+ ItemUtils.addItemToOreDictionary(mSodiumEthylXanthate, "dustSodiumEthylXanthate");
+ ItemUtils.addItemToOreDictionary(mPotassiumEthylXanthate, "dustPotassiumEthylXanthate");
+ ItemUtils.addItemToOreDictionary(mPotassiumHydroxide, "dustPotassiumHydroxide");
+ ItemUtils.addItemToOreDictionary(mFormaldehydeCatalyst, "catalystFormaldehyde");
+
+ }
+
+ @Override
+ public void blocks() {}
+
+ @Override
+ public void fluids() {
+
+ if (!FluidRegistry.isFluidRegistered("benzene")) {
+ Benzene = FluidUtils.generateFluidNoPrefix("benzene", "Benzene", 278, new short[] { 100, 70, 30, 100 }, true);
+ }
+ else {
+ Benzene = FluidRegistry.getFluid("benzene");
+ }
+
+ NitroBenzene = FluidUtils.generateFluidNoPrefix("nitrobenzene", "NitroBenzene", 278, new short[] { 70, 50, 40, 100 }, true);
+
+ Aniline = FluidUtils.generateFluidNoPrefix("aniline", "Aniline", 266, new short[] { 100, 100, 30, 100 }, true);
+
+ BoricAcid = FluidUtils.generateFluidNoPrefix("boricacid", "Boric Acid", 278, new short[] { 90, 30, 120, 100 }, true);
+
+ Polyurethane = FluidUtils.generateFluidNoPrefix("polyurethane", "Polyurethane", 350, new short[] { 100, 70, 100, 100 }, true);
+
+ if (!FluidRegistry.isFluidRegistered("phenol")) {
+ Phenol = FluidUtils.generateFluidNoPrefix("phenol", "Phenol", 313, new short[] { 100, 70, 30, 100 }, true);
+ }
+ else {
+ Phenol = FluidRegistry.getFluid("phenol");
+ }
+
+ // Use GT's if it exists, else make our own.
+ if (FluidRegistry.isFluidRegistered("hydrochloricacid_gt5u")) {
+ HydrochloricAcid = FluidRegistry.getFluid("hydrochloricacid_gt5u");
+ }
+ else {
+ HydrochloricAcid = FluidUtils.generateFluidNoPrefix("hydrochloricacid", "Hydrochloric Acid", 285, new short[] { 183, 200, 196, 100 }, true);
+ }
+
+ Cyclohexane = FluidUtils.generateFluidNoPrefix("cyclohexane", "Cyclohexane", 32 + 175, new short[] { 100, 70, 30, 100 }, true);
+ Cyclohexanone = FluidUtils.generateFluidNoPrefix("cyclohexanone", "Cyclohexanone", 32 + 175, new short[] { 100, 70, 30, 100 }, true);
+
+ Cadaverine = FluidUtils.generateFluidNoPrefix("cadaverine", "Cadaverine", 32 + 175, new short[] { 100, 70, 30, 100 }, true);
+ Putrescine = FluidUtils.generateFluidNoPrefix("putrescine", "Putrescine", 32 + 175, new short[] { 100, 70, 30, 100 }, true);
+
+ //Create 2-Ethylanthraquinone
+ //2-Ethylanthraquinone is prepared from the reaction of phthalic anhydride and ethylbenzene
+ Ethylanthraquinone2 = FluidUtils.generateFluidNonMolten("2Ethylanthraquinone", "2-Ethylanthraquinone", 415, new short[]{227, 255, 159, 100}, null, null);
+ //Create 2-Ethylanthrahydroquinone
+ //Palladium plate + Hydrogen(250) + 2-Ethylanthraquinone(500) = 600 Ethylanthrahydroquinone
+ Ethylanthrahydroquinone2 = FluidUtils.generateFluidNonMolten("2Ethylanthrahydroquinone", "2-Ethylanthrahydroquinone", 415, new short[]{207, 225, 129, 100}, null, null);
+ //Create Hydrogen Peroxide
+ //Compressed Air(1500) + Ethylanthrahydroquinone(500) + Anthracene(5) = 450 Ethylanthraquinone && 200 Peroxide
+ Hydrogen_Peroxide = FluidUtils.generateFluidNonMolten("HydrogenPeroxide", "Hydrogen Peroxide", 150, new short[]{210, 255, 255, 100}, null, null);
+
+ if (FluidRegistry.isFluidRegistered("nitricoxide")) {
+ Nitric_Oxide = FluidRegistry.getFluid("nitricoxide");
+ usingGregtechNitricOxide = true;
+ }
+ else {
+ Nitric_Oxide = FluidUtils.generateFluidNoPrefix("nitricoxide", "Nitric Oxide", 200, new short[] {125, 200, 240, 100});
+ }
+ if (FluidRegistry.isFluidRegistered("nitrogendioxide")) {
+ Nitrogen_Dioxide = FluidRegistry.getFluid("nitrogendioxide");
+ usingGregtechNitrogenDioxide = true;
+ }
+ else {
+ Nitrogen_Dioxide = FluidUtils.generateFluidNoPrefix("nitrogendioxide", "Nitrogen Dioxide", 200, new short[] {100, 175, 255, 100});
+ }
+
+
+
+ //Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O
+ //ItemUtils.generateSpecialUseDusts("LithiumHydroperoxide", "Lithium Hydroperoxide", "HLiO2", Utils.rgbtoHexValue(125, 125, 125));
+ // v - Dehydrate
+ //Lithium Peroxide - 2 LiOOH → Li2O2 + H2O2 + 2 H2O
+ Lithium_Peroxide = FluidUtils.generateFluidNonMolten("LithiumPeroxide", "Lithium Peroxide", 446, new short[]{135, 135, 135, 100}, null, null);
+
+ Carbon_Disulfide = FluidUtils.generateFluidNoPrefix("CarbonDisulfide", "Carbon Disulfide", 350, new short[]{175, 175, 175, 100});
+
+ if (FluidRegistry.isFluidRegistered("fluid.liquid_hydricsulfur") || MaterialUtils.doesMaterialExist("HydricSulfide")) {
+ usingGregtechHydricSulfur = true;
+ Fluid aFluid = null;
+ if (ItemUtils.doesItemListEntryExist("sHydricSulfur")) {
+ ItemStack aListItem = ItemUtils.getValueOfItemList("sHydricSulfur", 1, (ItemList) null);
+ if (aListItem != null) {
+ FluidStack aFluidStack = FluidContainerRegistry.getFluidForFilledItem(aListItem);
+ if (aFluidStack != null) {
+ aFluid = aFluidStack.getFluid();
+ }
+
+ }
+ }
+ if (aFluid == null) {
+ aFluid = FluidUtils.getWildcardFluidStack("liquid_hydricsulfur", 1000).getFluid();
+ }
+ Hydrogen_Sulfide = aFluid;
+ }
+ else {
+ Hydrogen_Sulfide = FluidUtils.generateFluidNoPrefix("HydrogenSulfide", "Hydrogen Sulfide", 446, new short[]{240, 130, 30, 100});
+ }
+
+ }
+
+ @Override
+ public String errorMessage() {
+ return "Failed to generate recipes for GenericChem.";
+ }
+
+ @Override
+ public boolean generateRecipes() {
+
+ recipeAdvancedChip();
+ recipeCatalystRed();
+ recipeCatalystYellow();
+ recipeCatalystBlue();
+ recipeCatalystOrange();
+ recipeCatalystPurple();
+ recipeCatalystBrown();
+ recipeCatalystPink();
+ recipeCatalystFormaldehyde();
+
+ recipeGrindingBallAlumina();
+ recipeGrindingBallSoapstone();
+
+ recipeNitroBenzene();
+ recipeAniline();
+ recipeCadaverineAndPutrescine();
+ recipeCyclohexane();
+ recipeCyclohexanone();
+
+ recipe2Ethylanthraquinone();
+ recipe2Ethylanthrahydroquinone();
+ recipeHydrogenPeroxide();
+ recipeLithiumHydroperoxide();
+ recipeLithiumPeroxide();
+ if (!usingGregtechNitricOxide) {
+ recipeNitricOxide();
+ }
+ if (!usingGregtechNitrogenDioxide) {
+ recipeNitrogenDioxide();
+ }
+ if (!usingGregtechHydricSulfur) {
+ recipeHydricSulfur();
+ }
+
+ // Add recipes if we are not using GT's fluid.
+ if (!FluidRegistry.isFluidRegistered("hydrochloricacid_gt5u")) {
+ recipeHydrochloricAcid();
+ }
+
+ recipeSodiumEthoxide();
+ recipeCarbonDisulfide();
+ recipeEthylXanthates();
+ recipePotassiumHydroxide();
+
+ registerFuels();
+
+ return true;
+ }
+
+
+ private void recipeSodiumEthoxide() {
+ //2 C2H5OH + 2 Na → 2 C2H5ONa + H2
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(16),
+ ELEMENT.getInstance().SODIUM.getDust(2)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(BioRecipes.mEthanol, 1000),
+ },
+ new ItemStack[] {
+ ItemUtils.getSimpleStack(mSodiumEthoxide, 2)
+
+ },
+ new FluidStack[] {
+ ELEMENT.getInstance().HYDROGEN.getFluidStack(2000)
+ },
+ 20 *20,
+ 120,
+ 2);
+ }
+
+
+ private void recipePotassiumHydroxide() {
+ //Ca(OH)2 + K2CO3 → CaCO3 + 2 KOH
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(18),
+ ELEMENT.getInstance().POTASSIUM.getDust(4),
+ ELEMENT.getInstance().CARBON.getDust(2),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 2),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("oxygen", 6000),
+ },
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumCarbonate", 2),
+ ItemUtils.getSimpleStack(mPotassiumHydroxide, 4)
+
+ },
+ new FluidStack[] {
+
+ },
+ 20 *30,
+ 120,
+ 2);
+
+ }
+
+
+ private void recipeEthylXanthates() {
+
+ //Potassium ethyl xanthate - CH3CH2OH + CS2 + KOH → CH3CH2OCS2K + H2O
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(17),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustCalciumHydroxide", 2),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(BioRecipes.mEthanol, 1000),
+ FluidUtils.getFluidStack(Carbon_Disulfide, 1000),
+ },
+ new ItemStack[] {
+ ItemUtils.getSimpleStack(mPotassiumEthylXanthate, 1)
+ },
+ new FluidStack[] {
+ FluidUtils.getWater(1000)
+ },
+ 20 *60,
+ 120,
+ 4);
+
+ //Sodium ethyl xanthate - CH3CH2ONa + CS2 → CH3CH2OCS2Na
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(17),
+ ItemUtils.getSimpleStack(mSodiumEthoxide, 1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Carbon_Disulfide, 1000),
+ },
+ new ItemStack[] {
+ ItemUtils.getSimpleStack(mSodiumEthylXanthate, 1)
+ },
+ new FluidStack[] {
+
+ },
+ 20 *60,
+ 120,
+ 4);
+
+ }
+
+
+ private void recipeHydricSulfur() {
+
+ ItemStack aCellHydricSulfide = ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenSulfide", 1);
+ GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().SULFUR.getDust(1), GT_Utility.getIntegratedCircuit(1), ELEMENT.getInstance().HYDROGEN.getFluidStack(2000), FluidUtils.getFluidStack(Hydrogen_Sulfide, 3000), GT_Values.NI, 60, 8);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ELEMENT.getInstance().SULFUR.getDust(1), CI.emptyCells(3), ELEMENT.getInstance().HYDROGEN.getFluidStack(2000), GT_Values.NF, ItemUtils.getSimpleStack(aCellHydricSulfide, 3), GT_Values.NI, 60, 8);
+
+ }
+
+
+ private void recipeCarbonDisulfide() {
+
+ CORE.RA.addBlastRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("fuelCoke", 8),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 16)
+ },
+ new FluidStack[] {
+
+ },
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("dustDarkAsh", 1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Carbon_Disulfide, 4000)
+ },
+ 20 *60 * 10,
+ 30,
+ 1500);
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(20),
+ ItemUtils.getSimpleStack(mBrownCatalyst, 0),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 4)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(CoalTar.Coal_Gas, 1000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Carbon_Disulfide, 2000),
+ FluidUtils.getFluidStack(Hydrogen_Sulfide, 4000)
+ },
+ 20 *60 * 5,
+ 30,
+ 2);
+
+
+ }
+
+
+ private static void registerFuels() {
+
+ // Burnables
+
+ // Gas Fuels
+ GT_Values.RA.addFuel(ItemUtils.getItemStackOfAmountFromOreDict("cellNitroBenzene", 1), null, 1250, 1);
+
+ }
+
+ private void recipeGrindingBallAlumina() {
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ CI.getNumberedCircuit(10),
+ ItemUtils.getSimpleStack(AgriculturalChem.mAlumina, 64)
+ },
+ FluidUtils.getFluidStack(GenericChem.Aniline, 4000),
+ ItemUtils.getSimpleStack(mMillingBallAlumina, 8),
+ 180 * 20,
+ 480);
+ }
+ private void recipeGrindingBallSoapstone() {
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ CI.getNumberedCircuit(10),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSoapstone", 32)
+ },
+ FluidUtils.getFluidStack(AgrichemFluids.mLiquidResin, 2500),
+ ItemUtils.getSimpleStack(mMillingBallSoapstone, 8),
+ 120 * 20,
+ 480);
+ }
+
+ private void recipeNitrogenDioxide() {
+ ItemStack aNitricOxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitricOxide", 1);
+ ItemStack aNitrogenDioxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenDioxide", 1);
+ GT_Values.RA.addChemicalRecipe( ItemUtils.getSimpleStack(aNitricOxideCell, 2), GT_Utility.getIntegratedCircuit(1), ELEMENT.getInstance().OXYGEN.getFluidStack(1000), FluidUtils.getFluidStack(Nitrogen_Dioxide, 3000), CI.emptyCells(2), 160);
+ GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(1), GT_Utility.getIntegratedCircuit(1), FluidUtils.getFluidStack(Nitric_Oxide, 2000), FluidUtils.getFluidStack(Nitrogen_Dioxide, 3000), CI.emptyCells(1), 160);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ItemUtils.getSimpleStack(aNitricOxideCell, 2), CI.emptyCells(1), ELEMENT.getInstance().OXYGEN.getFluidStack(1000), GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ELEMENT.getInstance().OXYGEN.getCell(1), CI.emptyCells(2), FluidUtils.getFluidStack(Nitric_Oxide, 2000), GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ItemUtils.getSimpleStack(aNitricOxideCell, 2), ELEMENT.getInstance().OXYGEN.getCell(1), GT_Values.NF, GT_Values.NF, ItemUtils.getSimpleStack(aNitrogenDioxideCell, 3), GT_Values.NI, 160, 30);
+ }
+
+
+ private void recipeNitricOxide() {
+ ItemStack aWaterCell = ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 1);
+ ItemStack aNitricOxideCell = ItemUtils.getItemStackOfAmountFromOreDict("cellNitricOxide", 1);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(MISC_MATERIALS.AMMONIA.getCell(8), CI.emptyCells(1), ELEMENT.getInstance().OXYGEN.getFluidStack(5000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), ItemUtils.getSimpleStack(aWaterCell, 9), GT_Values.NI, 160, 30);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(ELEMENT.getInstance().OXYGEN.getCell(5), CI.emptyCells(4), MISC_MATERIALS.AMMONIA.getFluidStack(8000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), ItemUtils.getSimpleStack(aWaterCell, 9), GT_Values.NI, 160, 30);
+ GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(11), ELEMENT.getInstance().OXYGEN.getFluidStack(5000), FluidUtils.getWater(9000), ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(4), 160);
+ GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(11), MISC_MATERIALS.AMMONIA.getFluidStack(8000), FluidUtils.getWater(9000), ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(1), 160);
+ GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(2), ELEMENT.getInstance().OXYGEN.getFluidStack(5000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), CI.emptyCells(8), 320);
+ GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(2), MISC_MATERIALS.AMMONIA.getFluidStack(8000), FluidUtils.getFluidStack(Nitric_Oxide, 4000), CI.emptyCells(5), 320);
+ GT_Values.RA.addChemicalRecipe( MISC_MATERIALS.AMMONIA.getCell(8), GT_Utility.getIntegratedCircuit(12), ELEMENT.getInstance().OXYGEN.getFluidStack(5000), GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(4), 160);
+ GT_Values.RA.addChemicalRecipe( ELEMENT.getInstance().OXYGEN.getCell(5), GT_Utility.getIntegratedCircuit(12), MISC_MATERIALS.AMMONIA.getFluidStack(8000), GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), CI.emptyCells(1), 160);
+ GT_Values.RA.addChemicalRecipeForBasicMachineOnly(MISC_MATERIALS.AMMONIA.getCell(8), ELEMENT.getInstance().OXYGEN.getCell(5), GT_Values.NF, GT_Values.NF, ItemUtils.getSimpleStack(aNitricOxideCell, 4), ItemUtils.getSimpleStack(aWaterCell, 9), 160, 30);
+ GT_Values.RA.addMultiblockChemicalRecipe(new ItemStack[]{GT_Utility.getIntegratedCircuit(1)}, new FluidStack[]{MISC_MATERIALS.AMMONIA.getFluidStack(8000), ELEMENT.getInstance().OXYGEN.getFluidStack(5000)}, new FluidStack[]{FluidUtils.getFluidStack(Nitric_Oxide, 4000), FluidUtils.getWater(9000)}, null, 160, 30);
+ }
+
+
+ private void recipeHydrochloricAcid() {
+
+ ItemStack aAcidCell = ItemUtils.getItemStackOfAmountFromOreDict("cellHydrochloricAcid", 1);
+
+ CORE.RA.addChemicalRecipe(
+ ELEMENT.getInstance().CHLORINE.getCell(1),
+ GT_Utility.getIntegratedCircuit(1),
+ ELEMENT.getInstance().HYDROGEN.getFluidStack(1000),
+ FluidUtils.getFluidStack(HydrochloricAcid, 2000),
+ CI.emptyCells(1),
+ 60,
+ 8);
+
+ CORE.RA.addChemicalRecipe(
+ ELEMENT.getInstance().HYDROGEN.getCell(1),
+ GT_Utility.getIntegratedCircuit(1),
+ ELEMENT.getInstance().CHLORINE.getFluidStack(1000),
+ FluidUtils.getFluidStack(HydrochloricAcid, 2000),
+ CI.emptyCells(1),
+ 60,
+ 8);
+
+ GT_Values.RA.addElectrolyzerRecipe(
+ CI.emptyCells(1),
+ GT_Utility.getIntegratedCircuit(1),
+ FluidUtils.getFluidStack(HydrochloricAcid, 2000),
+ ELEMENT.getInstance().CHLORINE.getFluidStack(1000),
+ ELEMENT.getInstance().HYDROGEN.getCell(1),
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ null,
+ 720,
+ 30);
+
+ GT_Values.RA.addElectrolyzerRecipe(
+ CI.emptyCells(1),
+ GT_Utility.getIntegratedCircuit(11),
+ FluidUtils.getFluidStack(HydrochloricAcid, 2000),
+ ELEMENT.getInstance().HYDROGEN.getFluidStack(1000),
+ ELEMENT.getInstance().CHLORINE.getCell(1),
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ null,
+ 720,
+ 30);
+
+ GT_Values.RA.addElectrolyzerRecipe(
+ ItemUtils.getSimpleStack(aAcidCell, 2),
+ GT_Values.NI,
+ GT_Values.NF,
+ GT_Values.NF,
+ ELEMENT.getInstance().HYDROGEN.getCell(1),
+ ELEMENT.getInstance().CHLORINE.getCell(1),
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ GT_Values.NI,
+ null,
+ 720,
+ 30);
+ }
+
+ private void recipeCyclohexane() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ getTierTwoChip(),
+ ItemUtils.getSimpleStack(mBrownCatalyst, 0)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Benzene, 2000),
+ FluidUtils.getFluidStack("hydrogen", 10000)
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Cyclohexane, 1000),
+ },
+ 20 * 120,
+ 120,
+ 2);
+
+ }
+
+ private void recipeCyclohexanone() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ getTierTwoChip(),
+ ItemUtils.getSimpleStack(mBlueCatalyst, 0)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Cyclohexane, 2000),
+ FluidUtils.getFluidStack("air", 10000)
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Cyclohexanone, 2000),
+ },
+ 20 * 120,
+ 120,
+ 2);
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ getTierTwoChip(),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Phenol, 2000),
+ FluidUtils.getFluidStack("oxygen", 5000)
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Cyclohexanone, 2000),
+ },
+ 20 * 120,
+ 120,
+ 2);
+
+
+
+
+ }
+
+ private void recipeCatalystRed() {
+ // Assembly Recipe
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ getTierOneChip(),
+ CI.getEmptyCatalyst(10),
+ ELEMENT.getInstance().IRON.getDust(2),
+ ELEMENT.getInstance().COPPER.getDust(2),
+ },
+ GT_Values.NF,
+ ItemUtils.getSimpleStack(mRedCatalyst, 10),
+ 20 * 20,
+ 30);
+
+ }
+
+ private void recipeCatalystYellow() {
+ // Assembly Recipe
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ getTierThreeChip(),
+ CI.getEmptyCatalyst(10),
+ ELEMENT.getInstance().TUNGSTEN.getDust(4),
+ ELEMENT.getInstance().NICKEL.getDust(4),
+ },
+ GT_Values.NF,
+ ItemUtils.getSimpleStack(mYellowCatalyst, 10),
+ 60 * 20,
+ 2000);
+
+ }
+
+ private void recipeCatalystBlue() {
+ // Assembly Recipe
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ getTierTwoChip(),
+ CI.getEmptyCatalyst(10),
+ ELEMENT.getInstance().COBALT.getDust(3),
+ ELEMENT.getInstance().TITANIUM.getDust(3),
+ },
+ GT_Values.NF,
+ ItemUtils.getSimpleStack(mBlueCatalyst, 10),
+ 40 * 20,
+ 500);
+
+ }
+
+ private void recipeCatalystOrange() {
+ // Assembly Recipe
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ getTierTwoChip(),
+ CI.getEmptyCatalyst(10),
+ ELEMENT.getInstance().VANADIUM.getDust(5),
+ ELEMENT.getInstance().PALLADIUM.getDust(5),
+ },
+ GT_Values.NF,
+ ItemUtils.getSimpleStack(mOrangeCatalyst, 10),
+ 40 * 20,
+ 500);
+
+ }
+
+ private void recipeCatalystPurple() {
+ // Assembly Recipe
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ getTierFourChip(),
+ CI.getEmptyCatalyst(10),
+ ELEMENT.getInstance().IRIDIUM.getDust(6),
+ ELEMENT.getInstance().RUTHENIUM.getDust(6),
+ },
+ GT_Values.NF,
+ ItemUtils.getSimpleStack(mPurpleCatalyst, 10),
+ 120 * 20,
+ 8000);
+
+ }
+
+ private void recipeCatalystBrown() {
+ // Assembly Recipe
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ getTierOneChip(),
+ CI.getEmptyCatalyst(10),
+ ELEMENT.getInstance().NICKEL.getDust(4),
+ ELEMENT.getInstance().ALUMINIUM.getDust(4),
+ },
+ GT_Values.NF,
+ ItemUtils.getSimpleStack(mBrownCatalyst, 10),
+ 15 * 20,
+ 30);
+
+ }
+
+ private void recipeCatalystPink() {
+ // Assembly Recipe
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ getTierThreeChip(),
+ CI.getEmptyCatalyst(10),
+ ELEMENT.getInstance().PLATINUM.getDust(4),
+ ELEMENT.getInstance().RHODIUM.getDust(4),
+ },
+ GT_Values.NF,
+ ItemUtils.getSimpleStack(mPinkCatalyst, 10),
+ 30 * 20,
+ 2000);
+
+ }
+
+ private void recipeCatalystFormaldehyde() {
+ // Assembly Recipe
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ getTierThreeChip(),
+ CI.getEmptyCatalyst(4),
+ ItemUtils.getSimpleStack(RocketFuels.Formaldehyde_Catalyst_Dust, 8)
+ },
+ GT_Values.NF,
+ ItemUtils.getSimpleStack(mFormaldehydeCatalyst, 4),
+ 30 * 20,
+ 240);
+
+ }
+
+ private void recipeCadaverineAndPutrescine() {
+
+ // Basic Recipe
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ getTierOneChip(),
+ ItemUtils.getSimpleStack(Items.rotten_flesh, 64)
+ },
+ new FluidStack[] {
+ FluidUtils.getHotWater(2000)
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Cadaverine, 250),
+ FluidUtils.getFluidStack(Putrescine, 250),
+ },
+ 20 * 120,
+ 120,
+ 1);
+
+ // Advanced Recipe
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ getTierTwoChip(),
+ ItemUtils.getSimpleStack(Items.rotten_flesh, 128),
+ ItemUtils.simpleMetaStack(AgriculturalChem.mAgrichemItem1, 8, 32)
+ },
+ new FluidStack[] {
+ FluidUtils.getHotWater(3000)
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Cadaverine, 750),
+ FluidUtils.getFluidStack(Putrescine, 750),
+ },
+ 20 * 120,
+ 240,
+ 2);
+
+ }
+
+ private void recipeAniline() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ getTierThreeChip(),
+ ItemUtils.getSimpleStack(mBlueCatalyst, 0)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(NitroBenzene, 2000),
+ FluidUtils.getFluidStack("hydrogen", 10000)
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Aniline, 2000),
+ },
+ 20 * 30,
+ 500,
+ 3);
+
+ }
+
+ private void recipeNitroBenzene() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ getTierThreeChip(),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Benzene, 5000),
+ FluidUtils.getFluidStack("sulfuricacid", 3000),
+ FluidUtils.getFluidStack("nitricacid", 3000),
+ FluidUtils.getDistilledWater(10000)
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dilutedsulfuricacid", 3000),
+ FluidUtils.getFluidStack(NitroBenzene, 5000),
+ },
+ 20 * 30,
+ 500,
+ 4);
+
+ }
+
+ private void recipe2Ethylanthraquinone() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(4),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 4),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(CoalTar.Ethylbenzene, 2000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Ethylanthraquinone2, 2000+(144*4)),
+ },
+ 20 * 15,
+ 120,
+ 2);
+
+ /*GT_Values.RA.addChemicalRecipe(
+ ItemUtils.getItemStackOfAmountFromOreDict("dustPhthalicAnhydride", 4),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEthylbenzene", 2),
+ null,
+ FluidUtils.getFluidStack("fluid.2ethylanthraquinone", 2000+(144*4)),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 2),
+ 20*16);*/
+
+ }
+
+ private void recipe2Ethylanthrahydroquinone() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(4),
+ ItemUtils.getSimpleStack(mOrangeCatalyst, 0),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Ethylanthraquinone2, 4000),
+ FluidUtils.getFluidStack("hydrogen", 2000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Ethylanthrahydroquinone2, 5000),
+ },
+ 20 * 40,
+ 120,
+ 2);
+
+ /*GT_Values.RA.addChemicalRecipe(
+ ItemUtils.getItemStackOfAmountFromOreDict("platePalladium", 0),
+ ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthraquinone", 1),
+ FluidUtils.getFluidStack("hydrogen", 500),
+ FluidUtils.getFluidStack("fluid.2ethylanthrahydroquinone", 1200),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 1),
+ 20*40);*/
+
+ }
+
+ private void recipeLithiumPeroxide() {
+ CORE.RA.addDehydratorRecipe(
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 2),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellEmpty", 3)
+ },
+ null,
+ null,
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumPeroxide", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellWater", 2)
+ },
+ new int[]{10000, 10000, 10000},
+ 20*100,
+ 120);
+ }
+
+ private void recipeLithiumHydroperoxide() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(4),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 7),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000),
+ },
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 14),
+ },
+ new FluidStack[] {
+
+ },
+ 20 * 30,
+ 240,
+ 1);
+
+
+
+ /*CORE.RA.addChemicalRecipe(
+ ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroxide", 7),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 1),
+ 20,
+ FluidUtils.getFluidStack("fluid.cellhydrogenperoxide", 50),
+ null,
+ ItemUtils.getItemStackOfAmountFromOreDict("dustLithiumHydroperoxide", 14),
+ CI.emptyCells(1),
+ 20*30,
+ 240); */
+ }
+
+ private void recipeHydrogenPeroxide() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(4),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("air", 15000),
+ FluidUtils.getFluidStack(Ethylanthrahydroquinone2, 5000),
+ FluidUtils.getFluidStack("fluid.anthracene", 50),
+ },
+ new ItemStack[] {
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Ethylanthraquinone2, 4000),
+ FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000),
+ },
+ 20 * 30,
+ 240,
+ 1);
+
+ /* CORE.RA.addChemicalRecipe(
+ GT_ModHandler.getAirCell(15),
+ ItemUtils.getItemStackOfAmountFromOreDict("cell2Ethylanthrahydroquinone", 5),
+ 20,
+ FluidUtils.getFluidStack("fluid.anthracene", 50),
+ FluidUtils.getFluidStack("fluid.2ethylanthrahydroquinone", 4450),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogenPeroxide", 2),
+ CI.emptyCells(18),
+ 20*30,
+ 240);*/
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private static final ItemStack getTierOneChip() {
+ return CI.getNumberedAdvancedCircuit(4);
+ }
+ private static final ItemStack getTierTwoChip() {
+ return CI.getNumberedAdvancedCircuit(8);
+ }
+ private static final ItemStack getTierThreeChip() {
+ return CI.getNumberedAdvancedCircuit(12);
+ }
+ private static final ItemStack getTierFourChip() {
+ return CI.getNumberedAdvancedCircuit(16);
+ }
+
+ private static void recipeAdvancedChip() {
+ GT_ModHandler.addShapelessCraftingRecipe(
+ GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 0L), 0, new Object[]{OrePrefixes.circuit.get(Materials.Advanced)});
+
+ long bits = 0;
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 1L, new Object[0]), bits,
+ new Object[]{"d ", " P ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 2L, new Object[0]), bits,
+ new Object[]{" d ", " P ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 3L, new Object[0]), bits,
+ new Object[]{" d", " P ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 4L, new Object[0]), bits,
+ new Object[]{" ", " Pd", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 5L, new Object[0]), bits,
+ new Object[]{" ", " P ", " d", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 6L, new Object[0]), bits,
+ new Object[]{" ", " P ", " d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 7L, new Object[0]), bits,
+ new Object[]{" ", " P ", "d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 8L, new Object[0]), bits,
+ new Object[]{" ", "dP ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 9L, new Object[0]), bits,
+ new Object[]{"P d", " ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 10L, new Object[0]), bits,
+ new Object[]{"P ", " d", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 11L, new Object[0]), bits,
+ new Object[]{"P ", " ", " d", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 12L, new Object[0]), bits,
+ new Object[]{"P ", " ", " d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 13L, new Object[0]), bits,
+ new Object[]{" P", " ", " d", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 14L, new Object[0]), bits,
+ new Object[]{" P", " ", " d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 15L, new Object[0]), bits,
+ new Object[]{" P", " ", "d ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 16L, new Object[0]), bits,
+ new Object[]{" P", "d ", " ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 17L, new Object[0]), bits,
+ new Object[]{" ", " ", "d P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 18L, new Object[0]), bits,
+ new Object[]{" ", "d ", " P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 19L, new Object[0]), bits,
+ new Object[]{"d ", " ", " P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 20L, new Object[0]), bits,
+ new Object[]{" d ", " ", " P", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 21L, new Object[0]), bits,
+ new Object[]{"d ", " ", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 22L, new Object[0]), bits,
+ new Object[]{" d ", " ", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 23L, new Object[0]), bits,
+ new Object[]{" d", " ", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ BioRecipes.addCraftingRecipe(GregtechItemList.Circuit_T3RecipeSelector.getWithDamage(1L, 24L, new Object[0]), bits,
+ new Object[]{" ", " d", "P ", 'P', GregtechItemList.Circuit_T3RecipeSelector.getWildcard(1L, new Object[0])});
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/IonParticles.java b/src/main/java/gtPlusPlus/core/item/chemistry/IonParticles.java
new file mode 100644
index 0000000000..e08a509436
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/IonParticles.java
@@ -0,0 +1,165 @@
+package gtPlusPlus.core.item.chemistry;
+
+import java.util.HashMap;
+import java.util.List;
+
+import gregtech.api.enums.Materials;
+import gtPlusPlus.core.item.base.misc.BaseItemParticle;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.util.Utils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+
+public class IonParticles extends BaseItemParticle {
+
+ public static HashMap<String, Integer> NameToMetaMap = new HashMap<String, Integer>();
+ public static HashMap<Integer, String> MetaToNameMap = new HashMap<Integer, String>();
+
+
+ public IonParticles() {
+ super("Ion", ELEMENT.NAMES.length, EnumRarity.rare);
+ }
+
+ public static IIcon[] overlays = new IIcon[ELEMENT.NAMES.length];
+ public static IIcon baseTexture;
+
+ static {
+ //Generate Ions
+ int key = 0;
+ for (String s : ELEMENT.NAMES) {
+ //Map names to Meta
+ NameToMetaMap.put(Utils.sanitizeString(s.toLowerCase()), key);
+ MetaToNameMap.put(key, Utils.sanitizeString(s.toLowerCase()));
+ Materials m = Materials.get(s);
+ int aColour = 0;
+ if (m == null) {
+ aColour = Utils.rgbtoHexValue(128, 128, 128);
+ }
+ else {
+ aColour = Utils.rgbtoHexValue(m.mRGBa[0], m.mRGBa[1], m.mRGBa[2]);
+ }
+ aColourMap.put(key++, aColour);
+ }
+
+ }
+
+ @Override
+ public String[] getAffixes() {
+ return new String[] {"", ""};
+ }
+
+ @Override
+ public String getUnlocalizedName() {
+ return "";
+ }
+
+ @Override
+ public String getUnlocalizedName(final ItemStack itemStack) {
+ return "item.particle.ion" + "." + ELEMENT.NAMES[itemStack.getItemDamage()];
+ }
+
+ private static boolean createNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Charge", 0);
+ tagMain.setTag("Ion", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static final long getChargeState(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("Ion");
+ if (aNBT != null) {
+ return aNBT.getLong("Charge");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return 0L;
+ }
+
+ public static final boolean setChargeState(final ItemStack aStack, final long aCharge) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("Ion");
+ if (aNBT != null) {
+ aNBT.setLong("Charge", aCharge);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ if (stack.getTagCompound() == null){
+ createNBT(stack);
+ }
+ double chargeState = getChargeState(stack);
+ return chargeState;
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ long aCharge = getChargeState(stack);
+ String aState = EnumChatFormatting.YELLOW+"Unknown"+EnumChatFormatting.GRAY;
+ //State not set
+ if (aCharge == 0) {
+ list.add(EnumChatFormatting.GRAY+"A "+MetaToNameMap.get(stack.getItemDamage())+" Ion with an "+aState+" charge state");
+ }
+ else {
+ if (aCharge > 0) {
+ aState = EnumChatFormatting.GREEN+"Positive"+EnumChatFormatting.GRAY;
+ }
+ else {
+ aState = EnumChatFormatting.RED+"Negative"+EnumChatFormatting.GRAY;
+ }
+
+ list.add(EnumChatFormatting.GRAY+"A "+MetaToNameMap.get(stack.getItemDamage())+" Ion with a "+aState+" charge state of "+aCharge+"");
+ }
+ super.addInformation(stack, player, list, bool);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ for (int i = 0; i < IonParticles.overlays.length; i++) {
+ IonParticles.overlays[i] = reg.registerIcon(CORE.MODID + ":" + "ion/"+i);
+ }
+ IonParticles.baseTexture = reg.registerIcon(CORE.MODID + ":" + "ion/IonBase");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return IonParticles.overlays[meta];
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses() {
+ return true;
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(int aMeta, int aPass) {
+ if (aPass == 0) {
+ return IonParticles.baseTexture;
+ }
+ else {
+ return IonParticles.overlays[aMeta];
+ }
+ }
+
+ @Override
+ public int getRenderPasses(int metadata) {
+ return 2;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java b/src/main/java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java
new file mode 100644
index 0000000000..8dd2cd1187
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/MilledOreProcessing.java
@@ -0,0 +1,820 @@
+package gtPlusPlus.core.item.chemistry;
+
+import java.util.HashMap;
+
+import gregtech.api.enums.Materials;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.api.objects.data.Quad;
+import gtPlusPlus.api.objects.minecraft.ItemPackage;
+import gtPlusPlus.core.item.base.ore.BaseItemMilledOre;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.material.NONMATERIAL;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.minecraft.*;
+import gtPlusPlus.xmod.bop.HANDLER_BiomesOPlenty;
+import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+public class MilledOreProcessing extends ItemPackage {
+
+ /**
+ * Fluids
+ */
+
+ public static Fluid SphaleriteFlotationFroth;
+ public static Fluid ChalcopyriteFlotationFroth;
+ public static Fluid NickelFlotationFroth;
+ public static Fluid PlatinumFlotationFroth;
+ public static Fluid PentlanditeFlotationFroth;
+
+ public static Fluid RedstoneFlotationFroth;
+ public static Fluid SpessartineFlotationFroth;
+ public static Fluid GrossularFlotationFroth;
+ public static Fluid AlmandineFlotationFroth;
+ public static Fluid PyropeFlotationFroth;
+ public static Fluid MonaziteFlotationFroth;
+
+ public static Fluid PineOil;
+
+
+ /**
+ * Items
+ */
+
+ // Zinc, Iron, Indium, Germanium
+ public static Item milledSphalerite;
+
+ // Copper, Iron, Cadmium, Indium
+ public static Item milledChalcopyrite;
+
+ // Nickel, Cobalt, Rhodium, Ruthenium
+ public static Item milledNickel;
+
+ // Platinum, Rhodium, Selenium, Tellurium
+ public static Item milledPlatinum;
+
+ // Iron, Nickel, Promethium, Hafnium
+ public static Item milledPentlandite;
+
+
+
+
+ // Redstone, Chrome, Firestone, Dysprosium
+ public static Item milledRedstone;
+
+ // Manganese, Aluminium, Osmium, Strontium
+ public static Item milledSpessartine;
+
+ // Calcium, Aluminium, Tungsten, Thallium
+ public static Item milledGrossular;
+
+ // Aluminium, Magnesium, Yttrium, Ytterbium
+ public static Item milledAlmandine;
+
+ // Magnesium, Manganese, Borax, Rhenium
+ public static Item milledPyrope;
+
+ // Erbium, Lanthanum, Praseodymium, Europium
+ public static Item milledMonazite;
+
+
+ @Override
+ public void items() {
+
+ milledSphalerite = BaseItemMilledOre.generate(Materials.Sphalerite, MaterialUtils.getVoltageForTier(6));
+ milledChalcopyrite = BaseItemMilledOre.generate(Materials.Chalcopyrite, MaterialUtils.getVoltageForTier(5));
+ milledNickel = BaseItemMilledOre.generate(Materials.Nickel, MaterialUtils.getVoltageForTier(5));
+ milledPlatinum = BaseItemMilledOre.generate(Materials.Platinum, MaterialUtils.getVoltageForTier(6));
+ milledPentlandite = BaseItemMilledOre.generate(Materials.Pentlandite, MaterialUtils.getVoltageForTier(6));
+
+ milledRedstone = BaseItemMilledOre.generate(Materials.Redstone, MaterialUtils.getVoltageForTier(5));
+ milledSpessartine = BaseItemMilledOre.generate(Materials.Spessartine, MaterialUtils.getVoltageForTier(6));
+ milledGrossular = BaseItemMilledOre.generate(Materials.Grossular, MaterialUtils.getVoltageForTier(6));
+ milledAlmandine = BaseItemMilledOre.generate(Materials.Almandine, MaterialUtils.getVoltageForTier(6));
+ milledPyrope = BaseItemMilledOre.generate(Materials.Pyrope, MaterialUtils.getVoltageForTier(4));
+ milledMonazite = BaseItemMilledOre.generate(Materials.Monazite, MaterialUtils.getVoltageForTier(7));
+
+ }
+
+ @Override
+ public void blocks() {
+ // None yet
+ }
+
+ @Override
+ public void fluids() {
+
+ short[] aZincFrothRGB = Materials.Sphalerite.mRGBa;
+ SphaleriteFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.zincflotation", "Sphalerite Froth", 32 + 175, new short[] { aZincFrothRGB[0], aZincFrothRGB[1], aZincFrothRGB[2], 100 }, true);
+ short[] aCopperFrothRGB = Materials.Chalcopyrite.mRGBa;
+ ChalcopyriteFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.copperflotation", "Chalcopyrite Froth", 32 + 175, new short[] { aCopperFrothRGB[0], aCopperFrothRGB[1], aCopperFrothRGB[2], 100 }, true);
+ short[] aNickelFrothRGB = Materials.Nickel.mRGBa;
+ NickelFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.nickelflotation", "Nickel Froth", 32 + 175, new short[] { aNickelFrothRGB[0], aNickelFrothRGB[1], aNickelFrothRGB[2], 100 }, true);
+ short[] aPlatinumFrothRGB = Materials.Platinum.mRGBa;
+ PlatinumFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.platinumflotation", "Platinum Froth", 32 + 175, new short[] { aPlatinumFrothRGB[0], aPlatinumFrothRGB[1], aPlatinumFrothRGB[2], 100 }, true);
+ short[] aPentlanditeFrothRGB = Materials.Pentlandite.mRGBa;
+ PentlanditeFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.pentlanditeflotation", "Pentlandite Froth", 32 + 175, new short[] { aPentlanditeFrothRGB[0], aPentlanditeFrothRGB[1], aPentlanditeFrothRGB[2], 100 }, true);
+
+ short[] aRedstoneFrothRGB = Materials.Redstone.mRGBa;
+ RedstoneFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.redstoneflotation", "Redstone Froth", 32 + 175, new short[] { aRedstoneFrothRGB[0], aRedstoneFrothRGB[1], aRedstoneFrothRGB[2], 100 }, true);
+ short[] aSpessartineFrothRGB = Materials.Spessartine.mRGBa;
+ SpessartineFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.spessartineflotation", "Spessartine Froth", 32 + 175, new short[] { aSpessartineFrothRGB[0], aSpessartineFrothRGB[1], aSpessartineFrothRGB[2], 100 }, true);
+ short[] aGrossularFrothRGB = Materials.Grossular.mRGBa;
+ GrossularFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.grossularflotation", "Grossular Froth", 32 + 175, new short[] { aGrossularFrothRGB[0], aGrossularFrothRGB[1], aGrossularFrothRGB[2], 100 }, true);
+ short[] aAlmandineFrothRGB = Materials.Almandine.mRGBa;
+ AlmandineFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.almandineflotation", "Almandine Froth", 32 + 175, new short[] { aAlmandineFrothRGB[0], aAlmandineFrothRGB[1], aAlmandineFrothRGB[2], 100 }, true);
+ short[] aPyropeFrothRGB = Materials.Pyrope.mRGBa;
+ PyropeFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.pyropeflotation", "Pyrope Froth", 32 + 175, new short[] { aPyropeFrothRGB[0], aPyropeFrothRGB[1], aPyropeFrothRGB[2], 100 }, true);
+ short[] aMonaziteFrothRGB = Materials.Monazite.mRGBa;
+ MonaziteFlotationFroth = FluidUtils.generateFluidNoPrefix("froth.Monaziteflotation", "Monazite Froth", 32 + 175, new short[] { aMonaziteFrothRGB[0], aMonaziteFrothRGB[1], aMonaziteFrothRGB[2], 100 }, true);
+
+
+ PineOil = FluidUtils.generateFluidNoPrefix("pineoil", "Pine Oil", 32 + 175, new short[] { 250, 200, 60, 100 }, true);
+
+ }
+
+
+
+ public MilledOreProcessing() {
+ super();
+ Logger.INFO("Adding Ore Milling content");
+ }
+
+ private static void addMiscRecipes() {
+
+ /*
+ * First 5
+ */
+
+ //milledSphalerite
+ registerOreDataForMilledType(
+ SphaleriteFlotationFroth,
+ ELEMENT.getInstance().ZINC, 180,
+ ELEMENT.getInstance().IRON, 120,
+ ELEMENT.getInstance().INDIUM, 40,
+ ELEMENT.getInstance().GERMANIUM, 15
+ );
+ //milledChalcopyrite
+ registerOreDataForMilledType(
+ ChalcopyriteFlotationFroth,
+ ELEMENT.getInstance().COPPER, 180,
+ ELEMENT.getInstance().IRON, 120,
+ ELEMENT.getInstance().CADMIUM, 50,
+ ELEMENT.getInstance().INDIUM, 10
+ );
+ //milledNickel
+ registerOreDataForMilledType(
+ NickelFlotationFroth,
+ ELEMENT.getInstance().NICKEL, 150,
+ ELEMENT.getInstance().COBALT, 120,
+ ELEMENT.getInstance().RHODIUM, 32,
+ ELEMENT.getInstance().RUTHENIUM, 16
+ );
+ //milledPlatinum
+ registerOreDataForMilledType(
+ PlatinumFlotationFroth,
+ ELEMENT.getInstance().PLATINUM, 120,
+ ELEMENT.getInstance().RHODIUM, 60,
+ ELEMENT.getInstance().SELENIUM, 40,
+ ELEMENT.getInstance().TELLURIUM, 10
+ );
+ //milledPentlandite
+ registerOreDataForMilledType(
+ PentlanditeFlotationFroth,
+ ELEMENT.getInstance().IRON, 150,
+ ELEMENT.getInstance().NICKEL, 100,
+ ELEMENT.getInstance().PROMETHIUM, 20,
+ ELEMENT.getInstance().HAFNIUM, 10
+ );
+
+ /*
+ * Second 5
+ */
+ //milledRedstone
+ registerOreDataForMilledType(
+ RedstoneFlotationFroth,
+ NONMATERIAL.REDSTONE, 300,
+ ELEMENT.getInstance().CHROMIUM, 60,
+ MaterialUtils.generateMaterialFromGtENUM(Materials.Firestone), 45,
+ ELEMENT.getInstance().DYSPROSIUM, 16
+ );
+ //milledSpessartine
+ registerOreDataForMilledType(
+ SpessartineFlotationFroth,
+ ELEMENT.getInstance().MANGANESE, 150,
+ ELEMENT.getInstance().ALUMINIUM, 90,
+ ELEMENT.getInstance().OSMIUM, 30,
+ ELEMENT.getInstance().STRONTIUM, 20
+ );
+ //milledGrossular
+ registerOreDataForMilledType(
+ GrossularFlotationFroth,
+ ELEMENT.getInstance().CALCIUM, 180,
+ ELEMENT.getInstance().ALUMINIUM, 110,
+ ELEMENT.getInstance().TUNGSTEN, 60,
+ ELEMENT.getInstance().THALLIUM, 15
+ );
+ //milledAlmandine
+ registerOreDataForMilledType(
+ AlmandineFlotationFroth,
+ ELEMENT.getInstance().ALUMINIUM, 150,
+ ELEMENT.getInstance().MAGNESIUM, 75,
+ ELEMENT.getInstance().YTTRIUM, 25,
+ ELEMENT.getInstance().YTTERBIUM, 15
+ );
+ //milledPyrope
+ registerOreDataForMilledType(
+ PyropeFlotationFroth,
+ ELEMENT.getInstance().MAGNESIUM, 110,
+ ELEMENT.getInstance().MANGANESE, 70,
+ MaterialUtils.generateMaterialFromGtENUM(Materials.Borax), 60,
+ ELEMENT.getInstance().RHENIUM, 20
+ );
+ //milledMonazite TODO
+ registerOreDataForMilledType(
+ MonaziteFlotationFroth,
+ ELEMENT.getInstance().ERBIUM, 64,
+ ELEMENT.getInstance().LANTHANUM, 32,
+ ELEMENT.getInstance().LUTETIUM, 16,
+ ELEMENT.getInstance().EUROPIUM, 8
+ );
+
+
+ }
+
+ @Override
+ public String errorMessage() {
+ return "Failed to generate recipes for OreMillingProc.";
+ }
+
+ @Override
+ public boolean generateRecipes() {
+ addMiscRecipes();
+ addPineOilExtraction();
+ addFlotationRecipes1();
+ addFlotationRecipes2();
+ addVacuumFurnaceRecipes();
+ return true;
+ }
+
+ private void addVacuumFurnaceRecipes() {
+ int aCircuitID = 1;
+
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(SphaleriteFlotationFroth, 4000)
+ },
+ getOutputsFromMap(SphaleriteFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(6),
+ 5500);
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(ChalcopyriteFlotationFroth, 4000)
+ },
+ getOutputsFromMap(ChalcopyriteFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(5),
+ 4500);
+
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(NickelFlotationFroth, 4000)
+ },
+ getOutputsFromMap(NickelFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(5),
+ 4500);
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PlatinumFlotationFroth, 4000)
+ },
+ getOutputsFromMap(PlatinumFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(6),
+ 5500);
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PentlanditeFlotationFroth, 4000)
+ },
+ getOutputsFromMap(PentlanditeFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(6),
+ 5500);
+
+
+
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(RedstoneFlotationFroth, 4000)
+ },
+ getOutputsFromMap(RedstoneFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(5),
+ 4500);
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(SpessartineFlotationFroth, 4000)
+ },
+ getOutputsFromMap(SpessartineFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(6),
+ 5500);
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(GrossularFlotationFroth, 4000)
+ },
+ getOutputsFromMap(GrossularFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(6),
+ 5500);
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AlmandineFlotationFroth, 4000)
+ },
+ getOutputsFromMap(AlmandineFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(6),
+ 5500);
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PyropeFlotationFroth, 4000)
+ },
+ getOutputsFromMap(PyropeFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(4),
+ 3500);
+ CORE.RA.addVacuumFurnaceRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(aCircuitID++)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(MonaziteFlotationFroth, 4000)
+ },
+ getOutputsFromMap(MonaziteFlotationFroth),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AgriculturalChem.RedMud, 2000),
+ FluidUtils.getWater(2000)
+ },
+ 20 * 120,
+ MaterialUtils.getVoltageForTier(7),
+ 7500);
+
+ }
+
+ private void addFlotationRecipes1() {
+
+ // Sphalerite
+ CORE.RA.addFlotationRecipe(
+ Materials.Sphalerite,
+ ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 14000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(SphaleriteFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(6)
+ );
+
+ // Chalcopyrite
+ CORE.RA.addFlotationRecipe(
+ Materials.Chalcopyrite,
+ ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 12000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(ChalcopyriteFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(5)
+ );
+
+ // Nickel
+ CORE.RA.addFlotationRecipe(
+ Materials.Nickel,
+ ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 25000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(NickelFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(5)
+ );
+
+ // Platinum
+ CORE.RA.addFlotationRecipe(
+ Materials.Platinum,
+ ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 35000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PlatinumFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(6)
+ );
+
+
+ // Pentlandite
+ CORE.RA.addFlotationRecipe(
+ Materials.Pentlandite,
+ ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 14000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PentlanditeFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(6)
+ );
+
+ }
+
+ private void addFlotationRecipes2() {
+
+ // Redstone
+ CORE.RA.addFlotationRecipe(
+ Materials.Redstone,
+ ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 13000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(RedstoneFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(5)
+ );
+
+ // Spessartine
+ CORE.RA.addFlotationRecipe(
+ Materials.Spessartine,
+ ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 35000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(SpessartineFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(6)
+ );
+
+ // Grossular
+ CORE.RA.addFlotationRecipe(
+ Materials.Grossular,
+ ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 28000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(GrossularFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(6)
+ );
+
+ // Almandine
+ CORE.RA.addFlotationRecipe(
+ Materials.Almandine,
+ ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 18000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(AlmandineFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(5)
+ );
+
+ // Pyrope
+ CORE.RA.addFlotationRecipe(
+ Materials.Pyrope,
+ ItemUtils.getSimpleStack(GenericChem.mSodiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 8000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PyropeFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(4)
+ );
+
+ // Monazite
+ CORE.RA.addFlotationRecipe(
+ Materials.Monazite,
+ ItemUtils.getSimpleStack(GenericChem.mPotassiumEthylXanthate, 1),
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 30000),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(MonaziteFlotationFroth, 1000)
+ },
+ 20 * 1200,
+ MaterialUtils.getVoltageForTier(6)
+ );
+
+ }
+
+ private void addPineOilExtraction() {
+ AutoMap<ItemStack> aLogs = new AutoMap<ItemStack>();
+ AutoMap<ItemStack> aLeaves = new AutoMap<ItemStack>();
+ AutoMap<ItemStack> aSaplings = new AutoMap<ItemStack>();
+ AutoMap<ItemStack> aPinecones = new AutoMap<ItemStack>();
+
+ ItemStack aCrushedPine = ItemUtils.getSimpleStack(AgriculturalChem.mCrushedPine, 1);
+
+ aLogs.add(ItemUtils.getSimpleStack(BOP_Block_Registrator.log_Pine));
+ aLeaves.add(ItemUtils.getSimpleStack(BOP_Block_Registrator.leaves_Pine));
+ aSaplings.add(ItemUtils.getSimpleStack(BOP_Block_Registrator.sapling_Pine));
+ aPinecones.add(ItemUtils.getSimpleStack(AgriculturalChem.mPinecone, 1));
+
+ if (LoadedMods.BiomesOPlenty) {
+ aLogs.add(HANDLER_BiomesOPlenty.getStack(HANDLER_BiomesOPlenty.logs4, 0, 1));
+ aLeaves.add(HANDLER_BiomesOPlenty.getStack(HANDLER_BiomesOPlenty.colorizedLeaves2, 1, 1));
+ aSaplings.add(HANDLER_BiomesOPlenty.getStack(HANDLER_BiomesOPlenty.colorizedSaplings, 5, 1));
+ aPinecones.add(ItemUtils.simpleMetaStack(HANDLER_BiomesOPlenty.mPineCone, 13, 1));
+ }
+ if (LoadedMods.Forestry) {
+ ItemStack aForestryLog = ItemUtils.getItemStackFromFQRN("Forestry:logs", 1);
+ if (aForestryLog != null) {
+ aForestryLog.setItemDamage(20); // Set to Pine
+ aLogs.add(aForestryLog);
+ }
+ ItemStack aForestryLeaves = ItemUtils.getItemStackFromFQRN("Forestry:leaves", 1);
+ if (aForestryLeaves != null) {
+ NBTUtils.setString(aForestryLeaves, "species", "forestry.treePine"); // Set to Pine
+ aLeaves.add(aForestryLeaves);
+ }
+ }
+
+ for (ItemStack aLog : aLogs) {
+ addRecipe(aLog, ItemUtils.getSimpleStack(aCrushedPine, 16), new int[] {10000, 7500, 5000, 2500}, 10, 120);
+ }
+ for (ItemStack aLeaf : aLeaves) {
+ addRecipe(aLeaf, ItemUtils.getSimpleStack(aCrushedPine, 2), new int[] {5000, 5000, 2500, 2500}, 10, 30);
+ }
+ for (ItemStack aSapling : aSaplings) {
+ addRecipe(aSapling, ItemUtils.getSimpleStack(aCrushedPine, 4), new int[] {7500, 7500, 2500, 2500}, 10, 60);
+ }
+ for (ItemStack aCone : aPinecones) {
+ addRecipe(aCone, ItemUtils.getSimpleStack(aCrushedPine, 1), new int[] {7500, 7500, 5000, 2500}, 10, 60);
+ }
+
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedAdvancedCircuit(16),
+ ItemUtils.getSimpleStack(aCrushedPine, 64)
+ },
+ new FluidStack[] {
+ FluidUtils.getSteam(5000),
+ },
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 500)
+ },
+ new int[] {
+ 2000, 2000, 2000, 2000
+ },
+ 20 * 60,
+ 120,
+ 3);
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedAdvancedCircuit(18),
+ ItemUtils.getSimpleStack(aCrushedPine, 64)
+ },
+ new FluidStack[] {
+ FluidUtils.getSuperHeatedSteam(5000),
+ },
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 5),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 5)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(PineOil, 1500)
+ },
+ new int[] {
+ 3000, 3000, 3000, 3000
+ },
+ 20 * 45,
+ 120,
+ 4);
+
+ }
+
+ public boolean addRecipe(ItemStack aInput, ItemStack aOutput1, int[] aChances, int aTime, int aEU) {
+ aOutput1 = GT_OreDictUnificator.get(true, aOutput1);
+ ItemStack aOutputs[] = new ItemStack[4];
+ for (int i=0;i<aChances.length;i++) {
+ aOutputs[i] = aOutput1;
+ }
+ aOutputs = cleanArray(aOutputs);
+ if ((GT_Utility.isStackInvalid(aInput)) || (GT_Utility.isStackInvalid(aOutput1) || (GT_Utility.getContainerItem(aInput, false) != null))) {
+ return false;
+ }
+
+ return CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedAdvancedCircuit(14),
+ aInput
+ },
+ new FluidStack[] {
+
+ },
+ aOutputs,
+ new FluidStack[] {
+
+ },
+ aChances,
+ aTime * 20,
+ aEU,
+ 3);
+ }
+
+ public static ItemStack[] cleanArray(ItemStack[] input) {
+ int aArraySize = input.length;
+ AutoMap<ItemStack> aCleanedItems = new AutoMap<ItemStack>();
+ for (ItemStack checkStack : input) {
+ if (ItemUtils.checkForInvalidItems(checkStack)) {
+ aCleanedItems.put(checkStack);
+ }
+ }
+ ItemStack[] aOutput = new ItemStack[aCleanedItems.size()];
+ for (int i=0;i<aArraySize;i++) {
+ ItemStack aMappedStack = aCleanedItems.get(i);
+ if (aMappedStack != null){
+ aOutput[i] = aMappedStack;
+ }
+ }
+ return aOutput;
+ }
+
+ private static final HashMap<String, Quad<Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>>> aMilledFluidMap = new HashMap<String, Quad<Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>>>();
+
+ public static void registerOreDataForMilledType(Fluid aMilledFluid, Materials aOutput1, int aPerc1, Materials aOutput2, int aPerc2, Materials aOutput3, int aPerc3, Materials aOutput4, int aPerc4) {
+ registerOreDataForMilledType(aMilledFluid, MaterialUtils.generateMaterialFromGtENUM(aOutput1), aPerc1, MaterialUtils.generateMaterialFromGtENUM(aOutput2), aPerc2, MaterialUtils.generateMaterialFromGtENUM(aOutput3), aPerc3, MaterialUtils.generateMaterialFromGtENUM(aOutput4), aPerc4);
+ }
+
+ public static void registerOreDataForMilledType(Fluid aMilledFluid, Material aOutput1, int aPerc1, Material aOutput2, int aPerc2, Material aOutput3, int aPerc3, Material aOutput4, int aPerc4) {
+
+ Pair<Material, Integer> aFluidOutput1 = new Pair<Material, Integer>(aOutput1, aPerc1);
+ Pair<Material, Integer> aFluidOutput2 = new Pair<Material, Integer>(aOutput2, aPerc2);
+ Pair<Material, Integer> aFluidOutput3 = new Pair<Material, Integer>(aOutput3, aPerc3);
+ Pair<Material, Integer> aFluidOutput4 = new Pair<Material, Integer>(aOutput4, aPerc4);
+ Quad<Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>> aDataQuad = new Quad<Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>>(aFluidOutput1, aFluidOutput2, aFluidOutput3, aFluidOutput4);
+ aMilledFluidMap.put(aMilledFluid.getUnlocalizedName(), aDataQuad);
+
+ }
+
+ private static ItemStack[] getOutputsFromMap(Fluid aFluid) {
+ String aKey = aFluid.getUnlocalizedName();
+ return getArrayFromQuad(aMilledFluidMap.get(aKey));
+ }
+
+ private static ItemStack[] getArrayFromQuad(Quad<Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>, Pair<Material, Integer>> aData) {
+ AutoMap<ItemStack> aOutputs = new AutoMap<ItemStack>();
+ for (Object aPair : aData.values()) {
+ if (aPair != null && Pair.class.isInstance(aPair)) {
+ Pair aObj = (Pair) aPair;
+ Material aMat = (Material) aObj.getKey();
+ int aCount = (int) aObj.getValue();
+ aOutputs.addAll(getItemStackFromPair(aMat, aCount));
+ }
+ }
+ ItemStack[] aRealOutputArray = new ItemStack[aOutputs.size()];
+ int aIndex = 0;
+ for (ItemStack aStack : aOutputs) {
+ aRealOutputArray[aIndex++] = aStack;
+ }
+ return aRealOutputArray;
+ }
+
+ private static AutoMap<ItemStack> getItemStackFromPair(Material aMat, Integer aCount) {
+ AutoMap<ItemStack> aOutputs = new AutoMap<ItemStack>();
+ if (aCount > 64) {
+ AutoMap<Integer> sizes = getStackSizes(aCount);
+ for (int aSplitSize : sizes) {
+ ItemStack aDustStack = aMat.getDust(aSplitSize);
+ aOutputs.put(aDustStack);
+ }
+ }
+ else {
+ ItemStack aDustStack = aMat.getDust(aCount);
+ aOutputs.put(aDustStack);
+ }
+ return aOutputs;
+ }
+
+ private static AutoMap<Integer> getStackSizes(int aBigSize){
+ AutoMap<Integer> aSizes = new AutoMap<Integer>();
+ if (aBigSize <= 64) {
+ aSizes.add(aBigSize);
+ }
+ else {
+ for (int i = aBigSize; i > 0; i -= 64) {
+ aSizes.add(i);
+ }
+ }
+ return aSizes;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/NuclearChem.java b/src/main/java/gtPlusPlus/core/item/chemistry/NuclearChem.java
new file mode 100644
index 0000000000..f112b0d2a5
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/NuclearChem.java
@@ -0,0 +1,116 @@
+package gtPlusPlus.core.item.chemistry;
+
+import gtPlusPlus.api.objects.minecraft.ItemPackage;
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.item.chemistry.general.ItemGenericChemBase;
+import gtPlusPlus.core.item.chemistry.general.ItemNuclearChemBase;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+
+public class NuclearChem extends ItemPackage {
+
+ public static Fluid Burnt_LiFBeF2ThF4UF4;
+ public static Fluid Burnt_LiFBeF2ZrF4UF4;
+ public static Fluid Burnt_LiFBeF2ZrF4U235;
+
+
+ public static Fluid Impure_LiFBeF2;
+
+ public static Fluid GeneticMutagen;
+ private static boolean generateMutagenRecipe = false;
+
+ public static ItemNuclearChemBase mNuclearChemItem1;
+
+ public static ItemStack mResidueUranium;
+ public static ItemStack mResiduePlutonium;
+ public static ItemStack mResidueFluorides;
+ public static ItemStack mResidueNobles;
+
+ @Override
+ public void items() {
+
+ mNuclearChemItem1 = new ItemNuclearChemBase();
+ registerItemStacks();
+ registerOreDict();
+ }
+
+
+ public void registerItemStacks() {
+
+ mResidueUranium = ItemUtils.simpleMetaStack(mNuclearChemItem1, 0, 1);
+ mResidueUranium = ItemUtils.simpleMetaStack(mNuclearChemItem1, 1, 1);
+ mResidueUranium = ItemUtils.simpleMetaStack(mNuclearChemItem1, 2, 1);
+ mResidueUranium = ItemUtils.simpleMetaStack(mNuclearChemItem1, 3, 1);
+
+ }
+
+ public void registerOreDict() {
+
+ ItemUtils.addItemToOreDictionary(mResidueUranium, "dustResidueUranium");
+ ItemUtils.addItemToOreDictionary(mResiduePlutonium, "dustResiduePlutonium");
+ ItemUtils.addItemToOreDictionary(mResidueFluorides, "dustResidueFluoride");
+ ItemUtils.addItemToOreDictionary(mResidueNobles, "dustResidueNoble");
+
+ }
+
+ @Override
+ public void blocks() {
+ }
+
+ @Override
+ public void fluids() {
+ //Create Used Nuclear Fuels
+ Burnt_LiFBeF2ThF4UF4 = FluidUtils.generateFluidNonMolten("BurntLiFBeF2ThF4UF4", "Burnt LiFBeF2ThF4UF4 Salt", 545, new short[]{48, 175, 48, 100}, null, null);
+ Burnt_LiFBeF2ZrF4UF4 = FluidUtils.generateFluidNonMolten("BurntLiFBeF2ZrF4UF4", "Burnt LiFBeF2ZrF4UF4 Salt", 520, new short[]{48, 168, 68, 100}, null, null);
+ Burnt_LiFBeF2ZrF4U235 = FluidUtils.generateFluidNonMolten("BurntLiFBeF2ZrF4U235", "Burnt LiFBeF2ZrF4U235 Salt", 533, new short[]{68, 185, 48, 100}, null, null);
+ Impure_LiFBeF2 = FluidUtils.generateFluidNonMolten("ImpureLiFBeF2", "Impure LiFBeF2 Salt", 533, new short[]{110, 75, 186, 100}, null, null);
+ if (FluidUtils.getFluidStack("fluid.Mutagen", 1) == null) {
+ GeneticMutagen = FluidUtils.generateFluidNonMolten("GeneticMutagen", "Genetic Mutagen", 12, new short[]{22, 148, 185, 100}, null, null);
+ generateMutagenRecipe = true;
+ }
+ else {
+ GeneticMutagen = FluidUtils.getFluidStack("fluid.Mutagen", 1).getFluid();
+ }
+ }
+
+ @Override
+ public String errorMessage() {
+ return "Bad Nuclear Chemistry Recipes.";
+ }
+
+ @Override
+ public boolean generateRecipes() {
+ if (generateMutagenRecipe) {
+ chemReator_CreateMutagen();
+ }
+ chemReactor_MutagenWithEggs();
+ return true;
+ }
+
+ private static void chemReator_CreateMutagen() {
+ CORE.RA.addChemicalRecipe(
+ CI.getNumberedCircuit(20),
+ ItemUtils.getSimpleStack(Items.nether_star, 2),
+ FluidUtils.getMobEssence(5000),
+ FluidUtils.getFluidStack(GeneticMutagen, 8000),
+ null,
+ 30*20,
+ 500);
+ }
+
+ private static void chemReactor_MutagenWithEggs() {
+ CORE.RA.addChemicalRecipe(
+ CI.getNumberedCircuit(20),
+ ItemUtils.getSimpleStack(Items.egg, 2),
+ FluidUtils.getFluidStack(GeneticMutagen, 500),
+ null,
+ ItemUtils.getSimpleStack(ModItems.itemBigEgg, 2),
+ 300*20,
+ 500);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/OilChem.java b/src/main/java/gtPlusPlus/core/item/chemistry/OilChem.java
new file mode 100644
index 0000000000..4406995d27
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/OilChem.java
@@ -0,0 +1,45 @@
+package gtPlusPlus.core.item.chemistry;
+
+import gtPlusPlus.api.objects.minecraft.ItemPackage;
+
+public class OilChem extends ItemPackage {
+
+ /**
+ * Fluids
+ */
+
+
+ /**
+ * Items
+ */
+
+
+
+ @Override
+ public void items() {
+
+ }
+
+ @Override
+ public void blocks() {
+ // None yet
+ }
+
+ @Override
+ public void fluids() {
+
+ }
+
+
+
+ @Override
+ public String errorMessage() {
+ return "Failed to generate recipes for OilChem.";
+ }
+
+ @Override
+ public boolean generateRecipes() {
+
+ return true;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/RocketFuels.java b/src/main/java/gtPlusPlus/core/item/chemistry/RocketFuels.java
new file mode 100644
index 0000000000..c9c5ca98f6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/RocketFuels.java
@@ -0,0 +1,1071 @@
+package gtPlusPlus.core.item.chemistry;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+
+import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
+import gregtech.api.util.GTPP_Recipe;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.minecraft.ItemPackage;
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.recipe.common.CI;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.MaterialUtils;
+import gtPlusPlus.xmod.gregtech.common.StaticFields59;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+
+public class RocketFuels extends ItemPackage {
+
+ public static HashSet<String> mValidRocketFuelNames = new HashSet<String>();
+ public static HashMap<Integer, Fluid> mValidRocketFuels = new HashMap<Integer, Fluid>();
+
+ public static Fluid Oil_Heavy;
+ public static Fluid Diesel;
+ public static Fluid Kerosene;
+ public static Fluid RP1;
+ public static Fluid Nitrogen_Tetroxide;
+ public static Fluid Hydrazine;
+ public static Fluid Monomethylhydrazine;
+ public static Fluid Unsymmetrical_Dimethylhydrazine;
+ public static Fluid Nitrous_Oxide;
+ public static Fluid Hydrated_Ammonium_Nitrate_Slurry;
+ public static Fluid Liquid_Oxygen;
+ public static Fluid Liquid_Hydrogen;
+ public static Fluid Formaldehyde;
+
+
+ //Rocket Fuel Mixes
+ public static Fluid Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide;
+ public static Fluid RP1_Plus_Liquid_Oxygen;
+ public static Fluid Dense_Hydrazine_Mix;
+ public static Fluid Monomethylhydrazine_Plus_Nitric_Acid;
+
+ public static Item Ammonium_Nitrate_Dust;
+ public static Item Formaldehyde_Catalyst_Dust;
+ public static ItemStack Formaldehyde_Catalyst_Stack;
+
+ public RocketFuels() {
+ super(true);
+ }
+
+ public static void createKerosene(){
+
+ FluidStack fuelA = FluidUtils.getFluidStack("diesel", 3000);
+ FluidStack fuelB = FluidUtils.getFluidStack("fuel", 3000);
+
+ if (fuelA != null){
+ //GT_Values.RA.addDistilleryRecipe(23, fuelA, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false);
+ GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(Kerosene, 1800), 200, 64, false);
+ }
+ if (fuelA == null && fuelB != null){
+ //GT_Values.RA.addDistilleryRecipe(23, fuelB, FluidUtils.getFluidStack(Kerosene, 50), 200, 64, false);
+ GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelB, FluidUtils.getFluidStack(Kerosene, 1800), 200, 64, false);
+ }
+ }
+
+ public static void createRP1(){
+ FluidStack fuelA = FluidUtils.getFluidStack(Kerosene, 1000);
+ if (fuelA != null){
+ GT_Values.RA.addDistilleryRecipe(CI.getNumberedCircuit(23), fuelA, FluidUtils.getFluidStack(RP1, 750), 20 * 40, 120, false);
+ }
+ }
+
+ public static void createNitrogenTetroxide(){
+ /*CORE.RA.addDehydratorRecipe(
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 4)
+ },
+ FluidUtils.getFluidStack("nitricacid", 2000),
+ FluidUtils.getFluidStack(Nitrogen_Tetroxide, 450),
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 1)
+ },
+ new int[]{100, 50},
+ 20*16,
+ 500);*/
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("dustCopper", 12),
+ ItemUtils.getSimpleStack(GenericChem.mOrangeCatalyst, 0),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("nitricacid", 4000)
+ },
+ new ItemStack[]{
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSmallAsh", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustSmallDarkAsh", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyAsh", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustTinyDarkAsh", 1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Nitrogen_Tetroxide, 3000),
+ },
+ new int[]{100, 100, 50, 50},
+ 20 * 30,
+ MaterialUtils.getVoltageForTier(3),
+ 3);
+
+
+ }
+
+ public static void createHydrazine(){
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(21)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("fluid.hydrogenperoxide", 2000),
+ FluidUtils.getFluidStack("ammonia", 2000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Hydrazine, 4000),
+
+ },
+ 20 * 30,
+ MaterialUtils.getVoltageForTier(2),
+ 1);
+
+ FluidStack aBartWorksHydrogenPeroxide = FluidUtils.getWildcardFluidStack("Hydrogen Peroxide", 2000);
+ if (aBartWorksHydrogenPeroxide != null) {
+ Logger.INFO("Found BW Hydrogen Peroxide, adding compat recipe.");
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(22)
+ },
+ new FluidStack[] {
+ aBartWorksHydrogenPeroxide,
+ FluidUtils.getFluidStack("ammonia", 2000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Hydrazine, 4000),
+
+ },
+ 20 * 30,
+ MaterialUtils.getVoltageForTier(2),
+ 1);
+ }
+
+ }
+
+
+ public static void createMonomethylhydrazine(){
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(21),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", 2)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("hydrogen", 2000),
+ FluidUtils.getFluidStack(Hydrazine, 2000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Monomethylhydrazine, 4000),
+
+ },
+ 20 * 48,
+ 240,
+ 2);
+
+ }
+
+ private static void createLOX() {
+ GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1), ItemUtils.getItemStackOfAmountFromOreDict("cellLiquidOxygen", 1), 20*16);
+ CORE.RA.addAdvancedFreezerRecipe(new ItemStack[] {}, new FluidStack[] {FluidUtils.getFluidStack("oxygen", 3000)}, new FluidStack[] {FluidUtils.getFluidStack(Liquid_Oxygen, 3000)}, new ItemStack[] {}, new int[] {}, 20*16, 240, 0);
+ }
+
+ private static void createLOH() {
+ GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 1), ItemUtils.getItemStackOfAmountFromOreDict("cellLiquidHydrogen", 1), 20*16);
+ CORE.RA.addAdvancedFreezerRecipe(new ItemStack[] {}, new FluidStack[] {FluidUtils.getFluidStack("hydrogen", 300)}, new FluidStack[] {FluidUtils.getFluidStack(Liquid_Hydrogen, 300)}, new ItemStack[] {}, new int[] {}, 20*4, 540, 0);
+ }
+
+ private static void createHydratedAmmoniumNitrateSlurry() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedAdvancedCircuit(21),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("ammonia", 4000),
+ FluidUtils.getFluidStack("nitricacid", 4000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Hydrated_Ammonium_Nitrate_Slurry, 8000),
+
+ },
+ 20 * 60,
+ 120,
+ 1);
+
+ }
+
+ private static void createAmmoniumNitrateDust() {
+ CORE.RA.addDehydratorRecipe(
+ new ItemStack[] {CI.getNumberedCircuit(8)},
+ FluidUtils.getFluidStack(Hydrated_Ammonium_Nitrate_Slurry, 8*144),
+ FluidUtils.getWater(2000),
+ new ItemStack[] {
+ ItemUtils.getSimpleStack(Ammonium_Nitrate_Dust, 8)
+ },
+ new int[] {10000},
+ 90 * 20,
+ 480);
+
+ }
+
+ private static void createFormaldehyde() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedAdvancedCircuit(21),
+ ItemUtils.getSimpleStack(GenericChem.mFormaldehydeCatalyst, 0),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("oxygen", 16000),
+ FluidUtils.getFluidStack("methanol", 32000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Formaldehyde, 8000),
+
+ },
+ 20 * 90,
+ 120,
+ 1);
+
+ }
+
+ private static void createFormaldehydeCatalyst() {
+ GT_Values.RA.addMixerRecipe(
+ ItemUtils.getItemStackOfAmountFromOreDict("dustIron", 16),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustVanadium", 1),
+ CI.getNumberedCircuit(18),
+ null,
+ null,
+ null,
+ ItemUtils.getSimpleStack(Formaldehyde_Catalyst_Dust, 4),
+ 160,
+ 30);
+
+ }
+
+ private static void createUnsymmetricalDimethylhydrazine() {
+
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedAdvancedCircuit(21),
+ ItemUtils.getSimpleStack(GenericChem.mFormaldehydeCatalyst, 0),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("fluid.hydrazine", 2000),
+ FluidUtils.getFluidStack(Formaldehyde, 2000),
+ FluidUtils.getFluidStack("hydrogen", 4000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000),
+ FluidUtils.getWater(2000)
+
+ },
+ 20 * 60,
+ 120,
+ 3);
+
+ }
+
+ private static void addRocketFuelsToMap() {
+ HashMap<Integer, GTPP_Recipe> mRocketFuels = new LinkedHashMap<Integer, GTPP_Recipe>();
+ mRocketFuels.put(0, new GTPP_Recipe(
+ true,
+ new ItemStack[] {},
+ new ItemStack[] {},
+ null,
+ new int[] {},
+ new FluidStack[] {FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 1000)},
+ new FluidStack[] {},
+ 0,
+ 0,
+ 512)); //Fuel Value
+
+ mRocketFuels.put(1, new GTPP_Recipe(
+ true,
+ new ItemStack[] {},
+ new ItemStack[] {},
+ null,
+ new int[] {},
+ new FluidStack[] {FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 1000)},
+ new FluidStack[] {},
+ 0,
+ 0,
+ 1024)); //Fuel Value
+
+ mRocketFuels.put(2, new GTPP_Recipe(
+ true,
+ new ItemStack[] {},
+ new ItemStack[] {},
+ null,
+ new int[] {},
+ new FluidStack[] {FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 1000)},
+ new FluidStack[] {},
+ 0,
+ 0,
+ 2048)); //Fuel Value
+
+ mRocketFuels.put(3, new GTPP_Recipe(
+ true,
+ new ItemStack[] {},
+ new ItemStack[] {},
+ null,
+ new int[] {},
+ new FluidStack[] {FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 1000)},
+ new FluidStack[] {},
+ 0,
+ 0,
+ 4196)); //Fuel Value
+
+
+ //Add in default Diesel for the Buggy
+ mValidRocketFuels.put(-1, Diesel);
+
+ mValidRocketFuelNames.add(FluidRegistry.getFluidName(Diesel));
+ for (int mID : mRocketFuels.keySet()) {
+ GTPP_Recipe aFuelRecipe = mRocketFuels.get(mID);
+ if (aFuelRecipe != null) {
+ mValidRocketFuelNames.add(FluidRegistry.getFluidName(aFuelRecipe.mFluidInputs[0].getFluid()));
+ mValidRocketFuels.put(mID, aFuelRecipe.mFluidInputs[0].getFluid());
+ GTPP_Recipe.GTPP_Recipe_Map.sRocketFuels.add(aFuelRecipe);
+ }
+ }
+
+ }
+
+
+ private static void createRocketFuels() {
+
+ // RP1_Plus_Liquid_Oxygen
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Liquid_Oxygen, 2000),
+ FluidUtils.getFluidStack(RP1, 500),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(RP1_Plus_Liquid_Oxygen, 1500),
+
+ },
+ 20 * 15,
+ 240,
+ 3);
+
+
+ // Dense_Hydrazine_Mix
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(2),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Hydrazine, 4000),
+ FluidUtils.getFluidStack("methanol", 6000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Dense_Hydrazine_Mix, 10000),
+
+ },
+ 20 * 30,
+ 240,
+ 4);
+
+
+ // Monomethylhydrazine_Plus_Nitric_Acid
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(3),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Monomethylhydrazine, 2000),
+ FluidUtils.getFluidStack("nitricacid", 1000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Monomethylhydrazine_Plus_Nitric_Acid, 2000),
+
+ },
+ 20 * 45,
+ 480,
+ 5);
+
+
+ // Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide
+ CORE.RA.addChemicalPlantRecipe(
+ new ItemStack[] {
+ CI.getNumberedCircuit(4),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine, 2000),
+ FluidUtils.getFluidStack(Nitrogen_Tetroxide, 2000),
+ },
+ new ItemStack[] {
+
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack(Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide, 5000),
+
+ },
+ 20 * 60,
+ 480,
+ 6);
+
+ }
+
+ @Override
+ public String errorMessage() {
+ return "Bad Rocket Fuel Science!";
+ }
+
+ @Override
+ public boolean generateRecipes() {
+ createKerosene();
+ createRP1();
+ createNitrogenTetroxide();
+ createHydrazine();
+ createMonomethylhydrazine();
+
+ if (!CORE.GTNH) {
+ createLOX();
+ }
+ createLOH();
+
+
+ createHydratedAmmoniumNitrateSlurry();
+ createAmmoniumNitrateDust();
+ createFormaldehyde();
+ createFormaldehydeCatalyst();
+ createUnsymmetricalDimethylhydrazine();
+
+ createRocketFuels();
+ addRocketFuelsToMap();
+
+ return true;
+ }
+
+ @Override
+ public void items() {
+ Formaldehyde_Catalyst_Dust = ItemUtils.generateSpecialUseDusts("FormaldehydeCatalyst", "Formaldehyde Catalyst", "Fe16V1", Utils.rgbtoHexValue(25, 5, 25))[0];
+ Formaldehyde_Catalyst_Stack = ItemUtils.getSimpleStack(Formaldehyde_Catalyst_Dust);
+ }
+
+ @Override
+ public void blocks() {
+ }
+
+ @Override
+ public void fluids() {
+
+ //Register default fluids
+ Diesel = MaterialUtils.getMaterial("Fuel", "Diesel").getFluid(1).getFluid();
+
+ // 5.08 Compat
+ if (!FluidUtils.doesFluidExist("liquid_heavy_oil")){
+ Oil_Heavy = FluidUtils.generateFluidNoPrefix("liquid_heavy_oil", "Heavy Oil", 200, new short[]{10, 10, 10, 100});
+ }
+ else {
+ Oil_Heavy = MaterialUtils.getMaterial("OilHeavy", "Oil").getFluid(1).getFluid();
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellOilHeavy", 1) == null){
+ new BaseItemComponent("OilHeavy", "Heavy Oil", new short[] {10, 10, 10});
+ }
+ }
+
+
+ //Create Kerosene
+ Kerosene = FluidUtils.generateFluidNonMolten("Kerosene", "Kerosene", 233, new short[]{150, 40, 150, 100}, null, null);
+ CoalTar.Coal_Oil = Kerosene;
+
+ //RP! Focket Fuel
+ RP1 = FluidUtils.generateFluidNonMolten("RP1Fuel", "RP-1", 500, new short[]{210, 50, 50, 100}, null, null);
+
+ //Create Nitrogen Tetroxide
+ Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("NitrogenTetroxide", "Nitrogen Tetroxide", 261, new short[]{170, 170, 0, 100}, null, null);
+
+ //Create Hydrazine
+ Hydrazine = FluidUtils.generateFluidNonMolten("Hydrazine", "Hydrazine", 2, new short[]{250, 250, 250, 100}, null, null);
+
+ //Create Monomethylhydrazine
+ Monomethylhydrazine = FluidUtils.generateFluidNonMolten("Monomethylhydrazine", "Monomethylhydrazine", 221, new short[]{125, 125, 125, 100}, null, null);
+
+ //Create Anthracene
+ Nitrous_Oxide = FluidUtils.generateFluidNonMolten("NitrousOxide", "Nitrous Oxide", 182, new short[]{255, 255, 255, 100}, null, null);
+
+ //Nos
+ if (!FluidUtils.doesFluidExist("NitrousOxide")){
+ Nitrous_Oxide = FluidUtils.generateFluidNoPrefix("NitrousOxide", "Nitrous Oxide", 182, new short[]{255, 255, 255, 100});
+ }
+ else {
+ Nitrous_Oxide = FluidUtils.getWildcardFluidStack("NitrousOxide", 1).getFluid();
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellNitrousOxide", 1) == null){
+ new BaseItemComponent("NitrousOxide", "Nitrous Oxide", new short[] {10, 10, 175});
+ }
+ }
+
+ //Unsymmetrical_Dimethylhydrazine
+ if (FluidUtils.getFluidStack("1,1dimethylhydrazine", 1) == null){
+ Unsymmetrical_Dimethylhydrazine = FluidUtils.generateFluidNonMolten("UnsymmetricalDimethylhydrazine", "Unsymmetrical Dimethylhydrazine", 216, new short[]{70, 210, 20, 100}, null, null);
+ }
+ else {
+ Unsymmetrical_Dimethylhydrazine = FluidUtils.getFluidStack("1,1dimethylhydrazine", 1000).getFluid();
+ }
+
+ //Create Hydrated_Ammonium_Nitrate_Slurry
+ Hydrated_Ammonium_Nitrate_Slurry = FluidUtils.generateFluidNonMolten("AmmoniumNitrateSlurry", "Hydrated Ammonium Nitrate Slurry", 450, new short[]{150, 75, 150, 100}, null, null);
+
+ //Lithium Hydroperoxide - LiOH + H2O2 → LiOOH + 2 H2O
+ Ammonium_Nitrate_Dust = ItemUtils.generateSpecialUseDusts("AmmoniumNitrate", "Ammonium Nitrate", "N2H4O3", Utils.rgbtoHexValue(150, 75, 150))[0];
+
+ //Create Liquid_Oxygen
+ if (FluidUtils.getFluidStack("LiquidOxygen", 1) == null && FluidUtils.getFluidStack("liquidoxygen", 1) == null){
+ Liquid_Oxygen = FluidUtils.generateFluidNonMolten("LiquidOxygen", "Liquid Oxygen", 54, new short[]{75, 75, 220, 100}, null, null);
+ }
+ else {
+ if (FluidUtils.getFluidStack("LiquidOxygen", 1) != null ) {
+ Liquid_Oxygen = FluidUtils.getFluidStack("LiquidOxygen", 1).getFluid();
+ }
+ else {
+ Liquid_Oxygen = FluidUtils.getFluidStack("liquidoxygen", 1).getFluid();
+ }
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellLiquidOxygen", 1) == null){
+ new BaseItemComponent("LiquidOxygen", "Liquid Oxygen", new short[] {10, 10, 175});
+ }
+ }
+
+ //Create Liquid_Hydrogen
+ if (FluidUtils.getFluidStack("LiquidHydrogen", 1) == null && FluidUtils.getFluidStack("liquidhydrogen", 1) == null){
+ Liquid_Hydrogen = FluidUtils.generateFluidNonMolten("LiquidHydrogen", "Liquid Hydrogen", 14, new short[]{75, 75, 220, 100}, null, null);
+ }
+ else {
+ if (FluidUtils.getFluidStack("LiquidHydrogen", 1) != null ) {
+ Liquid_Hydrogen = FluidUtils.getFluidStack("LiquidHydrogen", 1).getFluid();
+ }
+ else {
+ Liquid_Hydrogen = FluidUtils.getFluidStack("liquidhydrogen", 1).getFluid();
+ }
+ if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("cellLiquidHydrogen", 1) == null){
+ new BaseItemComponent("LiquidHydrogen", "Liquid Hydrogen", new short[] {10, 10, 175});
+ }
+ }
+
+ Formaldehyde = FluidUtils.generateFluidNonMolten("Formaldehyde", "Formaldehyde", 185, new short[]{150, 75, 150, 100}, null, null);
+
+ Unsymmetrical_Dimethylhydrazine_Plus_Nitrogen_Tetroxide = FluidUtils.generateFluidNonMolten("RocketFuelMixA", "H8N4C2O4 Rocket Fuel", 216, new short[]{50, 220, 50, 100}, null, null);
+ RP1_Plus_Liquid_Oxygen = FluidUtils.generateFluidNonMolten("RocketFuelMixB", "Rp-1 Rocket Fuel", 250, new short[]{250, 50, 50, 100}, null, null);
+ Monomethylhydrazine_Plus_Nitric_Acid = FluidUtils.generateFluidNonMolten("RocketFuelMixC", "CN3H7O3 Rocket Fuel", 221, new short[]{125, 75, 180, 100}, null, null);
+ Dense_Hydrazine_Mix = FluidUtils.generateFluidNonMolten("RocketFuelMixD", "Dense Hydrazine Fuel Mixture", 275, new short[]{175, 80, 120, 100}, null, null);
+
+ }
+
+ @Override
+ public boolean onLoadComplete(FMLLoadCompleteEvent event) {
+
+ Logger.INFO("Trying to remove GT recipes for '1,1dimethylhydrazine' && 'rocket_fuel' if they exist.");
+ /*if (FluidRegistry.isFluidRegistered("1,1dimethylhydrazine")) {
+
+ // Try Remove recipes for GT/EIO Rocket Fuel Cells
+ if (FluidRegistry.isFluidRegistered("rocket_fuel")) {
+
+ // Old Recipe
+ if (MaterialUtils.doesMaterialExist("NitrogenDioxide")) {
+ GT_Recipe aOldRecipe = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellNitrogenDioxide", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellHydrogen", 3),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("air", 500)
+ },
+ 388);
+ boolean aDidRemove = removeRecipe(aOldRecipe, GT_Recipe_Map.sChemicalRecipes);
+ Logger.INFO("Removed Old Recipe for Rocket Fuel: "+aDidRemove);
+ }
+
+ // Simple Recipes
+ if (MaterialUtils.doesMaterialExist("Ammonia") && MaterialUtils.doesMaterialExist("Methanol")) {
+
+ GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 3),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 4),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chlorine", 1000)
+ },
+ 480);
+ GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 1),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellMethanol", 4),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("ammonia", 3000)
+ },
+ 480);
+ GT_Recipe aSimpleRecipe3 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellAmmonia", 3),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChlorine", 1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("methanol", 4000)
+ },
+ 480);
+
+ boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove3 = removeRecipe(aSimpleRecipe3, GT_Recipe_Map.sChemicalRecipes);
+ Logger.INFO("Removed Simple Recipe 1 for Rocket Fuel: "+aDidRemove1);
+ Logger.INFO("Removed Simple Recipe 2 for Rocket Fuel: "+aDidRemove2);
+ Logger.INFO("Removed Simple Recipe 3 for Rocket Fuel: "+aDidRemove3);
+ }
+
+
+ // Complex Recipes I
+ if (MaterialUtils.doesMaterialExist("Dimethylhydrazine") && MaterialUtils.doesMaterialExist("DinitrogenTetroxide")) {
+
+ GT_Recipe aAdvRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dinitrogentetroxide", 1000)
+ },
+ 16);
+ GT_Recipe aAdvRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDinitrogenTetroxide", 1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylhydrazine", 1000)
+ },
+ 16);
+
+ GT_Recipe aAdvRecipe3 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 2),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("oxygen", 1000)
+ },
+ 16);
+ GT_Recipe aAdvRecipe4 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylhydrazine", 2000)
+ },
+ 16);
+
+ boolean aDidRemove1 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sMixerRecipes);
+ boolean aDidRemove2 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sMixerRecipes);
+ boolean aDidRemove3 = removeRecipe(aAdvRecipe3, GT_Recipe_Map.sMixerRecipes);
+ boolean aDidRemove4 = removeRecipe(aAdvRecipe4, GT_Recipe_Map.sMixerRecipes);
+ Logger.INFO("Removed Complex Recipe 1 for Rocket Fuel: "+aDidRemove1);
+ Logger.INFO("Removed Complex Recipe 2 for Rocket Fuel: "+aDidRemove2);
+ Logger.INFO("Removed Complex Recipe 3 for Rocket Fuel: "+aDidRemove3);
+ Logger.INFO("Removed Complex Recipe 4 for Rocket Fuel: "+aDidRemove4);
+ }
+ }
+
+
+ // Complex Recipes II
+ if (MaterialUtils.doesMaterialExist("Dimethylhydrazine")) {
+
+ GT_Recipe aAdvRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylhydrazine", 2),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("oxygen", 1000)
+ },
+ 16);
+ GT_Recipe aAdvRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellOxygen", 1),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylhydrazine", 2000)
+ },
+ 16);
+
+ boolean aDidRemove1 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sMixerRecipes);
+ boolean aDidRemove2 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sMixerRecipes);
+ Logger.INFO("Removed Complex Recipe 5 for Rocket Fuel: "+aDidRemove1);
+ Logger.INFO("Removed Complex Recipe 6 for Rocket Fuel: "+aDidRemove2);
+ }
+
+ if (MaterialUtils.doesMaterialExist("Chloramine") && MaterialUtils.doesMaterialExist("Dimethylamine")) {
+ GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2),
+ GT_Utility.getIntegratedCircuit(1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylamine", 5000)
+ },
+ 480);
+ GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5),
+ GT_Utility.getIntegratedCircuit(1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chloramine", 2000)
+ },
+ 16);
+
+
+
+ GT_Recipe aAdvRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2),
+ CI.emptyCells(4)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylamine", 5000)
+ },
+ 480);
+ GT_Recipe aAdvRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5),
+ CI.emptyCells(1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chloramine", 2000)
+ },
+ 16);
+ GT_Recipe aAdvRecipe3 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 2),
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 5),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chloramine", 2000)
+ },
+ 480);
+
+ boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove3 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove4 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove5 = removeRecipe(aAdvRecipe3, GT_Recipe_Map.sChemicalRecipes);
+ Logger.INFO("Removed Complex Recipe 1 for 1,1dimethylhydrazine: "+aDidRemove1);
+ Logger.INFO("Removed Complex Recipe 2 for 1,1dimethylhydrazine: "+aDidRemove2);
+ Logger.INFO("Removed Complex Recipe 3 for 1,1dimethylhydrazine: "+aDidRemove3);
+ Logger.INFO("Removed Complex Recipe 4 for 1,1dimethylhydrazine: "+aDidRemove4);
+ Logger.INFO("Removed Complex Recipe 5 for 1,1dimethylhydrazine: "+aDidRemove5);
+
+ }
+
+ if (MaterialUtils.doesMaterialExist("Chloramine") && MaterialUtils.doesMaterialExist("Dimethylamine")) {
+ GT_Recipe aSimpleRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 1),
+ GT_Utility.getIntegratedCircuit(1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylamine", 1000)
+ },
+ 480);
+ GT_Recipe aSimpleRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 1),
+ GT_Utility.getIntegratedCircuit(1)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chloramine", 1000)
+ },
+ 16);
+
+
+
+ GT_Recipe aAdvRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellChloramine", 1),
+ GT_Utility.getIntegratedCircuit(11)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("dimethylamine", 1000)
+ },
+ 480);
+ GT_Recipe aAdvRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ ItemUtils.getItemStackOfAmountFromOreDict("cellDimethylamine", 1),
+ GT_Utility.getIntegratedCircuit(11)
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("chloramine", 1000)
+ },
+ 16);
+
+ boolean aDidRemove1 = removeRecipe(aSimpleRecipe1, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove2 = removeRecipe(aSimpleRecipe2, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove3 = removeRecipe(aAdvRecipe1, GT_Recipe_Map.sChemicalRecipes);
+ boolean aDidRemove4 = removeRecipe(aAdvRecipe2, GT_Recipe_Map.sChemicalRecipes);
+ Logger.INFO("Removed Complex Recipe 5 for 1,1dimethylhydrazine: "+aDidRemove1);
+ Logger.INFO("Removed Complex Recipe 6 for 1,1dimethylhydrazine: "+aDidRemove2);
+ Logger.INFO("Removed Complex Recipe 7 for 1,1dimethylhydrazine: "+aDidRemove3);
+ Logger.INFO("Removed Complex Recipe 8 for 1,1dimethylhydrazine: "+aDidRemove4);
+
+ }
+
+ if (MaterialUtils.doesMaterialExist("HypochlorousAcid") && MaterialUtils.doesMaterialExist("Ammonia") && MaterialUtils.doesMaterialExist("Methanol")) {
+
+ GT_Recipe aAdvRecipe1 = getHalfBakedRecipe(
+ new ItemStack[] {
+ GT_Utility.getIntegratedCircuit(24),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("hypochlorousacid", 3000),
+ FluidUtils.getFluidStack("ammonia", 8000),
+ FluidUtils.getFluidStack("methanol", 12000)
+ },
+ 480);
+
+ GT_Recipe aAdvRecipe2 = getHalfBakedRecipe(
+ new ItemStack[] {
+ GT_Utility.getIntegratedCircuit(24),
+ },
+ new FluidStack[] {
+ FluidUtils.getFluidStack("hypochlorousacid", 1000),
+ FluidUtils.getFluidStack("ammonia", 1000),
+ FluidUtils.getFluidStack("methanol", 2000)
+ },
+ 480);
+
+ boolean aDidRemove1 = removeRecipe(aAdvRecipe1, StaticFields59.getLargeChemicalReactorRecipeMap());
+ boolean aDidRemove2 = removeRecipe(aAdvRecipe2, StaticFields59.getLargeChemicalReactorRecipeMap());
+ Logger.INFO("Removed Complex Recipe 9 for 1,1dimethylhydrazine: "+aDidRemove1);
+ Logger.INFO("Removed Complex Recipe 10 for 1,1dimethylhydrazine: "+aDidRemove2);
+
+
+ }
+ }*/
+
+ // Try Butcher recipes manually
+
+ //1,1Dimethylhydrazine
+ if (FluidRegistry.isFluidRegistered("1,1dimethylhydrazine")) {
+ Logger.INFO("Making sure all Chemical Reactor recipes for 1,1dimethylhydrazine have been removed.");
+ AutoMap<GT_Recipe> aToRemoveSingle = new AutoMap<GT_Recipe>();
+ ItemStack aUnsymCell = ItemUtils.getItemStackOfAmountFromOreDict("cell1,1Dimethylhydrazine", 1);
+ FluidStack aUnsymFluid = FluidUtils.getFluidStack("1,1dimethylhydrazine", 1);
+ recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sChemicalRecipes.mRecipeList) {
+ if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) {
+ if (aRecipeSingleBlock.mOutputs != null && aRecipeSingleBlock.mOutputs.length > 0) {
+ for (ItemStack aOutputItem : aRecipeSingleBlock.mOutputs) {
+ ItemStack aTemp = aOutputItem.copy();
+ aTemp.stackSize = 1;
+ if (GT_Utility.areStacksEqual(aTemp, aUnsymCell)) {
+ aToRemoveSingle.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) {
+ for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) {
+ if (GT_Utility.areFluidsEqual(aOutput, aUnsymFluid)) {
+ aToRemoveSingle.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ }
+ }
+ // Handle Multi Also
+ AutoMap<GT_Recipe> aToRemoveMulti = new AutoMap<GT_Recipe>();
+ recipe : for (GT_Recipe aRecipeSingleBlock : StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList) {
+ if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) {
+ if (aRecipeSingleBlock.mOutputs != null && aRecipeSingleBlock.mOutputs.length > 0) {
+ for (ItemStack aOutputItem : aRecipeSingleBlock.mOutputs) {
+ ItemStack aTemp = aOutputItem.copy();
+ aTemp.stackSize = 1;
+ if (GT_Utility.areStacksEqual(aTemp, aUnsymCell)) {
+ aToRemoveMulti.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) {
+ for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) {
+ if (GT_Utility.areFluidsEqual(aOutput, aUnsymFluid)) {
+ aToRemoveMulti.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ }
+ }
+ if (!aToRemoveSingle.isEmpty()) {
+ Logger.INFO("Found "+aToRemoveSingle.size()+" single block recipes, removing by force.");
+ for (GT_Recipe remove : aToRemoveSingle) {
+ GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(remove);
+ }
+ }
+ if (!aToRemoveMulti.isEmpty()) {
+ Logger.INFO("Found "+aToRemoveSingle.size()+" multiblock recipes, removing by force.");
+ for (GT_Recipe remove : aToRemoveMulti) {
+ StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(remove);
+ }
+ }
+ }
+
+
+ if (FluidRegistry.isFluidRegistered("rocket_fuel")) {
+ Logger.INFO("Making sure all Mixer recipes for rocket_fuel have been removed.");
+ AutoMap<GT_Recipe> aToRemoveSingle = new AutoMap<GT_Recipe>();
+ FluidStack aRocketFluid = FluidUtils.getFluidStack("rocket_fuel", 1);
+ recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sMixerRecipes.mRecipeList) {
+ if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) {
+ if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) {
+ for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) {
+ if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) {
+ aToRemoveSingle.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ }
+ }
+ if (!aToRemoveSingle.isEmpty()) {
+ Logger.INFO("Found "+aToRemoveSingle.size()+" recipes, removing by force.");
+ for (GT_Recipe remove : aToRemoveSingle) {
+ GT_Recipe_Map.sMixerRecipes.mRecipeList.remove(remove);
+ }
+ aToRemoveSingle.clear();
+ }
+
+ Logger.INFO("Making sure all Chemical Reactor recipes for rocket_fuel have been removed.");
+ recipe : for (GT_Recipe aRecipeSingleBlock : GT_Recipe_Map.sChemicalRecipes.mRecipeList) {
+ if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) {
+ if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) {
+ for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) {
+ if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) {
+ aToRemoveSingle.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ }
+ }
+ // Handle Multi Also
+ AutoMap<GT_Recipe> aToRemoveMulti = new AutoMap<GT_Recipe>();
+ recipe : for (GT_Recipe aRecipeSingleBlock : StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList) {
+ if (aRecipeSingleBlock != null && aRecipeSingleBlock.mEnabled) {
+ if (aRecipeSingleBlock.mFluidOutputs != null && aRecipeSingleBlock.mFluidOutputs.length > 0) {
+ for (FluidStack aOutput : aRecipeSingleBlock.mFluidOutputs) {
+ if (GT_Utility.areFluidsEqual(aOutput, aRocketFluid)) {
+ aToRemoveMulti.add(aRecipeSingleBlock);
+ continue recipe;
+ }
+ }
+ }
+ }
+ }
+ if (!aToRemoveSingle.isEmpty()) {
+ Logger.INFO("Found "+aToRemoveSingle.size()+" single block recipes, removing by force.");
+ for (GT_Recipe remove : aToRemoveSingle) {
+ GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(remove);
+ }
+ }
+ if (!aToRemoveMulti.isEmpty()) {
+ Logger.INFO("Found "+aToRemoveSingle.size()+" multiblock recipes, removing by force.");
+ for (GT_Recipe remove : aToRemoveMulti) {
+ StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(remove);
+ }
+ }
+
+ }
+
+
+
+ Logger.INFO("Finished clean-up of GT Rocket Fuel Recipes.");
+ return true;
+ }
+
+ private static GTPP_Recipe getHalfBakedRecipe(ItemStack[] aInputs, FluidStack[] aFluidInputs, int aEU) {
+ return new GTPP_Recipe(false, aInputs, null, null, null, aFluidInputs, null, 0, aEU, 0);
+
+ }
+
+ public static boolean removeRecipe(GT_Recipe aRecipe, GT_Recipe_Map aMap) {
+ if (aMap != GT_Recipe_Map.sChemicalRecipes) {
+ GT_Recipe aFoundRecipe = aMap.findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs);
+ boolean aSingle = false;
+ if (aFoundRecipe != null) {
+ Logger.INFO("Found Single Block Recipe, removing.");
+ aSingle = aMap.mRecipeList.remove(aFoundRecipe);
+ Logger.INFO("Success? "+aSingle);
+ }
+ return aSingle;
+ }
+ else {
+ GT_Recipe aFoundRecipe = aMap.findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs);
+ GT_Recipe aFoundRecipe2 = StaticFields59.getLargeChemicalReactorRecipeMap().findRecipe(null, false, true, aRecipe.mEUt, aRecipe.mFluidInputs, aRecipe.mInputs);
+ boolean aSingle = false;
+ boolean aMulti = false;
+ if (aFoundRecipe != null) {
+ Logger.INFO("Found Single Block Recipe, removing.");
+ aSingle = GT_Recipe_Map.sChemicalRecipes.mRecipeList.remove(aFoundRecipe);
+ Logger.INFO("Success? "+aSingle);
+ }
+ if (aFoundRecipe2 != null) {
+ Logger.INFO("Found Multiblock Recipe, removing.");
+ aMulti = StaticFields59.getLargeChemicalReactorRecipeMap().mRecipeList.remove(aFoundRecipe2);
+ Logger.INFO("Success? "+aSingle);
+ }
+ return aSingle && aMulti;
+ }
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java b/src/main/java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java
new file mode 100644
index 0000000000..10eaaf0da9
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/StandardBaseParticles.java
@@ -0,0 +1,161 @@
+package gtPlusPlus.core.item.chemistry;
+
+import java.util.HashMap;
+import java.util.List;
+
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.item.base.misc.BaseItemParticle;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Particle;
+import gtPlusPlus.core.material.Particle.ElementaryGroup;
+import gtPlusPlus.core.util.Utils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+
+public class StandardBaseParticles extends BaseItemParticle {
+
+ public static HashMap<String, Integer> NameToMetaMap = new HashMap<String, Integer>();
+ public static HashMap<Integer, String> MetaToNameMap = new HashMap<Integer, String>();
+
+ public StandardBaseParticles() {
+ super("Base", aTypes.length, EnumRarity.rare);
+ }
+
+ private static final String[] aTypes = new String[] { "Graviton", "Up", "Down", "Charm", "Strange", "Top",
+ "Bottom", "Electron", "Electron Neutrino", "Muon", "Muon Neutrino", "Tau", "Tau Neutrino", "Gluon",
+ "Photon", "Z Boson", "W Boson", "Higgs Boson", "Proton", "Neutron", "Lambda", "Omega", "Pion",
+ "ETA Meson", "Unknown" };
+
+ public IIcon[] icons = new IIcon[aTypes.length];
+
+ static {
+ //Generate Ions
+ int key = 0;
+
+
+ for (String s : aTypes) {
+ //Map names to Meta
+ NameToMetaMap.put(Utils.sanitizeString(s.toLowerCase()), key);
+ MetaToNameMap.put(key, Utils.sanitizeString(s.toLowerCase()));
+ for (Particle o : Particle.aMap) {
+ int aColour = 0;
+ if (o.mParticleName.toLowerCase().equals(s.toLowerCase())) {
+ if (o.mParticleType == ElementaryGroup.BARYON) {
+ aColour = Utils.rgbtoHexValue(174, 226, 156);
+ aColourMap.put(key++, aColour);
+ }
+ else if (o.mParticleType == ElementaryGroup.BOSON) {
+ if (o == Particle.HIGGS_BOSON) {
+ aColour = Utils.rgbtoHexValue(226, 196, 104);
+ aColourMap.put(key++, aColour);
+ }
+ else {
+ aColour = Utils.rgbtoHexValue(226, 52, 66);
+ aColourMap.put(key++, aColour);
+ }
+ }
+ else if (o.mParticleType == ElementaryGroup.LEPTON) {
+ aColour = Utils.rgbtoHexValue(126, 226, 95);
+ aColourMap.put(key++, aColour);
+ }
+ else if (o.mParticleType == ElementaryGroup.MESON) {
+ aColour = Utils.rgbtoHexValue(90, 154, 226);
+ aColourMap.put(key++, aColour);
+ }
+ else {
+ aColour = Utils.rgbtoHexValue(188, 61, 226);
+ aColourMap.put(key++, aColour);
+ }
+ }
+ }
+ }
+
+ }
+
+ @Override
+ public String[] getAffixes() {
+ return new String[] {"", ""};
+ }
+
+ @Override
+ public String getUnlocalizedName() {
+ return "";
+ }
+
+ @Override
+ public String getUnlocalizedName(final ItemStack itemStack) {
+ return "item.particle.base" + "." + aTypes[itemStack.getItemDamage()];
+ }
+
+ public static Particle getParticle(ItemStack aStack) {
+ AutoMap<Particle> g = Particle.aMap;
+ for (Particle p : g) {
+ String aPartName = Utils.sanitizeString(p.mParticleName.toLowerCase());
+ String expectedPart = Utils.sanitizeString(aTypes[aStack.getItemDamage()].toLowerCase());
+ if (aPartName.equals(expectedPart)) {
+ return p;
+ }
+ }
+ return Particle.UNKNOWN;
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ //return Utils.rgbtoHexValue(200, 200, 200);
+ return super.getColorFromParentClass(stack, HEX_OxFFFFFF);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ Particle aCharge = getParticle(stack);
+ EnumChatFormatting aColour = EnumChatFormatting.GRAY;
+ String aState = aColour+"Unknown"+EnumChatFormatting.RESET;
+ if (aCharge != null) {
+ String aGroup = aCharge.mParticleType.name().toLowerCase();
+ if (aGroup.toLowerCase().contains("quark")) {
+ aColour = EnumChatFormatting.LIGHT_PURPLE;
+ }
+ else if (aGroup.toLowerCase().contains("lepton")) {
+ aColour = EnumChatFormatting.GREEN;
+ }
+ else if (aCharge == Particle.HIGGS_BOSON) {
+ aColour = EnumChatFormatting.YELLOW;
+ }
+ else if (aGroup.toLowerCase().contains("boson")) {
+ aColour = EnumChatFormatting.RED;
+ }
+ else if (aGroup.toLowerCase().contains("baryon")) {
+ aColour = EnumChatFormatting.BLUE;
+ }
+ else if (aGroup.toLowerCase().contains("meson")) {
+ aColour = EnumChatFormatting.WHITE;
+ }
+ else {
+ aColour = EnumChatFormatting.GRAY;
+ }
+ String aFirstLet = aGroup.substring(0, 1).toUpperCase();
+ aGroup = aGroup.replaceFirst(aGroup.substring(0, 1), aFirstLet);
+ aState = aColour+aGroup+EnumChatFormatting.RESET;
+ list.add(EnumChatFormatting.GRAY + "Type: "+aState);
+ }
+ super.addInformation(stack, player, list, bool);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ for (int i = 0; i < this.icons.length; i++) {
+ this.icons[i] = reg.registerIcon(CORE.MODID + ":" + "particle/new/"+i);
+ }
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[meta];
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java b/src/main/java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
new file mode 100644
index 0000000000..c763a1a434
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/general/ItemGenericChemBase.java
@@ -0,0 +1,319 @@
+package gtPlusPlus.core.item.chemistry.general;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.item.chemistry.GenericChem;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+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 net.minecraft.world.World;
+
+public class ItemGenericChemBase extends Item {
+
+ final protected IIcon base[];
+
+ final private int aMetaSize = 14;
+
+ /*
+ * 0 - Red Metal Catalyst //FeCu
+ * 1 - Yellow Metal Catalyst //WNi
+ * 2 - Blue Metal Catalyst //CoTi
+ * 3 - Orange Metal Catalyst //Vanadium Pd
+ * 4 - Purple Metal Catalyst //IrIdium Ruthenium
+ * 5 - Brown Metal Catalyst //NiAl
+ * 6 - Pink Metal Catalyst //PtRh
+ * 7 - Alumina Grinding Ball
+ * 8 - Soapstone Grinding Ball
+ * 9 - Sodium Ethoxide // 2 Sodium + 1 Ethanol | 2 C2H5OH + 2 Na → 2 C2H5ONa + H2
+ * 10 - Sodium Ethyl Xanthate //CH3CH2ONa + CS2 → CH3CH2OCS2Na
+ * 11 - Potassium Ethyl Xanthate //CH3CH2OH + CS2 + KOH → CH3CH2OCS2K + H2O
+ * 12 - Potassium Hydroxide // KOH
+ * 13 - Formaldehyde Catalyst //Fe16V1
+ */
+
+ public ItemGenericChemBase() {
+ this.setHasSubtypes(true);
+ this.setNoRepair();
+ this.setMaxStackSize(64);
+ this.setMaxDamage(0);
+ base = new IIcon[aMetaSize];
+ this.setUnlocalizedName("BasicGenericChemItem");
+ GameRegistry.registerItem(this, this.getUnlocalizedName());
+ }
+
+ @Override
+ public int getItemStackLimit(ItemStack stack) {
+ if (ItemUtils.isMillingBall(stack)) {
+ return 16;
+ }
+ return super.getItemStackLimit(stack);
+ }
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldRotateAroundWhenRendering() {
+ return super.shouldRotateAroundWhenRendering();
+ }
+
+ @Override
+ public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) {
+ super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack aStack) {
+ return super.getItemStackDisplayName(aStack);
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack p_77613_1_) {
+ return EnumRarity.common;
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses() {
+ return false;
+ }
+
+ @Override
+ public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) {
+ for (int i=0;i<aMetaSize;i++) {
+ aList.add(ItemUtils.simpleMetaStack(aItem, i, 1));
+ }
+ }
+
+ @Override
+ public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+
+ @Override
+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
+ return false;
+ }
+
+ @Override
+ public int getDisplayDamage(ItemStack stack) {
+ return stack.getItemDamage();
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public int getItemEnchantability(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister u) {
+ for (int i=0;i<this.aMetaSize;i++) {
+ String aPath = CORE.MODID + ":" + "science/general/MetaItem1/"+i;
+ this.base[i] = u.registerIcon(aPath);
+ }
+ }
+
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ return this.base[damage];
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int damage) {
+ return this.base[damage];
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
+ return this.base[stack.getItemDamage()];
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack stack, int pass) {
+ return this.base[stack.getItemDamage()];
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return super.getUnlocalizedName() + "." + stack.getItemDamage();
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack aStack) {
+ if (ItemUtils.isMillingBall(aStack)) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()){
+ createMillingBallNBT(aStack);
+ }
+ double currentDamage = getMillingBallDamage(aStack);
+ return currentDamage / getMaxBallDurability(aStack);
+ }
+ else if (ItemUtils.isCatalyst(aStack)) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()){
+ createCatalystNBT(aStack);
+ }
+ double currentDamage = getCatalystDamage(aStack);
+ return currentDamage / getCatalystMaxDamage(aStack);
+ }
+ else {
+ return 1D;
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer player, List list, boolean bool) {
+ boolean aHasSpecialTooltips = false;
+ int aMaxDamage = 0;
+ int aDamageSegment = 0;
+ int aDam = 0;
+ EnumChatFormatting durability = EnumChatFormatting.GRAY;
+ if (ItemUtils.isMillingBall(aStack)) {
+ list.add(EnumChatFormatting.GRAY+"Tumble Tumble Tumble");
+ aMaxDamage = getMillingBallMaxDamage(aStack);
+ aDamageSegment = aMaxDamage / 5;
+ aDam = aMaxDamage-getMillingBallDamage(aStack);
+ aHasSpecialTooltips = true;
+ }
+ if (ItemUtils.isCatalyst(aStack)) {
+ list.add(EnumChatFormatting.GRAY+"Active Reaction Agent");
+ aMaxDamage = getCatalystMaxDamage(aStack);
+ aDamageSegment = aMaxDamage / 5;
+ aDam = aMaxDamage-getCatalystDamage(aStack);
+ aHasSpecialTooltips = true;
+ }
+ if (aHasSpecialTooltips) {
+ if (aDam > aDamageSegment * 3){
+ durability = EnumChatFormatting.GREEN;
+ }
+ else if (aDam > aDamageSegment * 2){
+ durability = EnumChatFormatting.YELLOW;
+ }
+ else if (aDam > aDamageSegment){
+ durability = EnumChatFormatting.GOLD;
+ }
+ else if (aDam >= 0){
+ durability = EnumChatFormatting.RED;
+ }
+ list.add(durability+""+(aDam)+EnumChatFormatting.GRAY+" / "+aMaxDamage);
+ }
+ super.addInformation(aStack, player, list, bool);
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack aStack) {
+ if (ItemUtils.isMillingBall(aStack)) {
+ int aDam = getMillingBallDamage(aStack);
+ if (aDam > 0) {
+ return true;
+ }
+ }
+ else if (ItemUtils.isCatalyst(aStack)) {
+ int aDam = getCatalystDamage(aStack);
+ if (aDam > 0) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean createMillingBallNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Damage", 0);
+ tagNBT.setLong("MaxDamage", getMaxBallDurability(rStack));
+ tagMain.setTag("MillingBall", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static int getMillingBallDamage(ItemStack aStack) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) {
+ createMillingBallNBT(aStack);
+ }
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ return aNBT.getCompoundTag("MillingBall").getInteger("Damage");
+ }
+
+ public static int getMillingBallMaxDamage(ItemStack aStack) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) {
+ createMillingBallNBT(aStack);
+ }
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ return aNBT.getCompoundTag("MillingBall").getInteger("MaxDamage");
+ }
+
+ public static void setMillingBallDamage(ItemStack aStack,int aAmount) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ aNBT = aNBT.getCompoundTag("MillingBall");
+ aNBT.setInteger("Damage", aAmount);
+ }
+
+ public static int getMaxBallDurability(ItemStack aStack) {
+ if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallAlumina, true)) {
+ return 100;
+ }
+ if (GT_Utility.areStacksEqual(aStack, GenericChem.mMillingBallSoapstone, true)) {
+ return 50;
+ }
+ return 0;
+ }
+
+ public static boolean createCatalystNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Damage", 0);
+ tagNBT.setLong("MaxDamage", getMaxCatalystDurability(rStack));
+ tagMain.setTag("catalyst", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static int getCatalystDamage(ItemStack aStack) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) {
+ createCatalystNBT(aStack);
+ }
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ return aNBT.getCompoundTag("catalyst").getInteger("Damage");
+ }
+
+ public static int getCatalystMaxDamage(ItemStack aStack) {
+ if (aStack.getTagCompound() == null || aStack.getTagCompound().hasNoTags()) {
+ createCatalystNBT(aStack);
+ }
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ return aNBT.getCompoundTag("catalyst").getInteger("MaxDamage");
+ }
+
+ public static void setCatalystDamage(ItemStack aStack,int aAmount) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ aNBT = aNBT.getCompoundTag("catalyst");
+ aNBT.setInteger("Damage", aAmount);
+ }
+
+ public static int getMaxCatalystDurability(ItemStack aStack) {
+ return 50;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/chemistry/general/ItemNuclearChemBase.java b/src/main/java/gtPlusPlus/core/item/chemistry/general/ItemNuclearChemBase.java
new file mode 100644
index 0000000000..cfd3fd6259
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/chemistry/general/ItemNuclearChemBase.java
@@ -0,0 +1,152 @@
+package gtPlusPlus.core.item.chemistry.general;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class ItemNuclearChemBase extends Item {
+
+ final protected IIcon base[];
+
+ final private int aMetaSize = 4;
+
+ /*
+ * 0 - Uranium Residue
+ * 1 - Plutonium Residue
+ * 2 - Fluoride Reside
+ * 3 - Noble Gas Residue
+ */
+
+ public ItemNuclearChemBase() {
+ this.setHasSubtypes(true);
+ this.setNoRepair();
+ this.setMaxStackSize(64);
+ this.setMaxDamage(0);
+ base = new IIcon[aMetaSize];
+ this.setUnlocalizedName("BasicNuclearChemItem");
+ GameRegistry.registerItem(this, this.getUnlocalizedName());
+ }
+
+ @Override
+ public int getItemStackLimit(ItemStack stack) {
+ return super.getItemStackLimit(stack);
+ }
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldRotateAroundWhenRendering() {
+ return super.shouldRotateAroundWhenRendering();
+ }
+
+ @Override
+ public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) {
+ super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack aStack) {
+ return super.getItemStackDisplayName(aStack);
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack p_77613_1_) {
+ return EnumRarity.common;
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses() {
+ return false;
+ }
+
+ @Override
+ public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) {
+ for (int i=0;i<aMetaSize;i++) {
+ aList.add(ItemUtils.simpleMetaStack(aItem, i, 1));
+ }
+ }
+
+ @Override
+ public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+
+ @Override
+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
+ return false;
+ }
+
+ @Override
+ public int getDisplayDamage(ItemStack stack) {
+ return stack.getItemDamage();
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public int getItemEnchantability(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister u) {
+ for (int i=0;i<this.aMetaSize;i++) {
+ String aPath = CORE.MODID + ":" + "science/nuclear/MetaItem1/"+i;
+ this.base[i] = u.registerIcon(aPath);
+ }
+ }
+
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ return this.base[damage];
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int damage) {
+ return this.base[damage];
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
+ return this.base[stack.getItemDamage()];
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack stack, int pass) {
+ return this.base[stack.getItemDamage()];
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return super.getUnlocalizedName() + "." + stack.getItemDamage();
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer player, List list, boolean bool) {
+ super.addInformation(aStack, player, list, bool);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/circuit/ItemAdvancedChip.java b/src/main/java/gtPlusPlus/core/item/circuit/ItemAdvancedChip.java
new file mode 100644
index 0000000000..17321a0c45
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/circuit/ItemAdvancedChip.java
@@ -0,0 +1,237 @@
+package gtPlusPlus.core.item.circuit;
+
+import java.util.*;
+import java.util.function.BiFunction;
+import java.util.function.Predicate;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.gui.GT_GUIDialogSelectItem;
+import gregtech.api.interfaces.INetworkUpdatableItem;
+import gregtech.api.net.GT_Packet_UpdateItem;
+import gregtech.api.objects.XSTR;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.Constants;
+import net.minecraftforge.common.util.FakePlayer;
+import org.apache.commons.lang3.tuple.Pair;
+
+public class ItemAdvancedChip extends Item implements INetworkUpdatableItem {
+ private static final List<ItemStack> ALL_VARIANTS = new ArrayList<>();
+ protected IIcon base;
+
+ public ItemAdvancedChip() {
+ this.setHasSubtypes(true);
+ this.setNoRepair();
+ this.setMaxStackSize(64);
+ this.setMaxDamage(0);
+ this.setUnlocalizedName("T3RecipeSelector");
+ GameRegistry.registerItem(this, this.getUnlocalizedName());
+ ALL_VARIANTS.add(new ItemStack(this, 0, 0));
+ for (int i = 1; i <= 24; i++) {
+ ItemStack aStack = new ItemStack(this, 0, i);
+ ALL_VARIANTS.add(aStack);
+ }
+ }
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldRotateAroundWhenRendering() {
+ return super.shouldRotateAroundWhenRendering();
+ }
+
+ @Override
+ public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) {
+ super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack aStack) {
+ return super.getItemStackDisplayName(aStack);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) {
+ try {
+ aList.add("Configuration == "+aStack.getItemDamage());
+ aList.add(GT_LanguageManager.addStringLocalization(new StringBuilder().append(getUnlocalizedName()).append(".tooltip.0").toString(), "Right click to reconfigure"));
+ aList.add(GT_LanguageManager.addStringLocalization(new StringBuilder().append(getUnlocalizedName()).append(".tooltip.1").toString(), "Needs a screwdriver or circuit programming tool"));
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ super.addInformation(aStack, p_77624_2_, aList, p_77624_4_);
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack p_77613_1_) {
+ return EnumRarity.common;
+ }
+
+ @Override
+ public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) {
+ aList.add(ItemUtils.simpleMetaStack(aItem, 0, 1));
+ }
+
+ @Override
+ public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+
+ @Override
+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
+ return false;
+ }
+
+ @Override
+ public int getDisplayDamage(ItemStack stack) {
+ return stack.getItemDamage();
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public int getItemEnchantability(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister u) {
+ this.base = u.registerIcon(CORE.MODID + ":" + "science/general/AdvancedCircuit");
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ return this.base;
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int damage) {
+ return this.base;
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
+ return this.base;
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack stack, int pass) {
+ return this.base;
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return super.getUnlocalizedName();
+ }
+
+ @Override
+ public boolean receive(ItemStack stack, EntityPlayerMP player, NBTTagCompound tag) {
+ int meta = tag.hasKey("meta", Constants.NBT.TAG_BYTE) ? tag.getByte("meta") : -1;
+ if (meta < 0 || meta > 24)
+ return true;
+
+ if (!player.capabilities.isCreativeMode) {
+ Pair<Integer, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> toolIndex = findConfiguratorInInv(player);
+ if (toolIndex == null) return true;
+
+ ItemStack[] mainInventory = player.inventory.mainInventory;
+ mainInventory[toolIndex.getKey()] = toolIndex.getValue().apply(mainInventory[toolIndex.getKey()], player);
+ }
+ stack.setItemDamage(meta);
+
+ return true;
+ }
+
+ @Override
+ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
+ // nothing on server side or fake player
+ if (player instanceof FakePlayer || !world.isRemote) return false;
+ // check if any screwdriver
+ ItemStack configuratorStack;
+ if (player.capabilities.isCreativeMode) {
+ configuratorStack = null;
+ } else {
+ Pair<Integer, ?> configurator = findConfiguratorInInv(player);
+ if (configurator == null) {
+ int count;
+ try {
+ count = Integer.parseInt(StatCollector.translateToLocal("GT5U.item.programmed_circuit.no_screwdriver.count"));
+ } catch (NumberFormatException e) {
+ player.addChatComponentMessage(new ChatComponentText("Error in translation GT5U.item.programmed_circuit.no_screwdriver.count: " + e.getMessage()));
+ count = 1;
+ }
+ player.addChatComponentMessage(new ChatComponentTranslation("GT5U.item.programmed_circuit.no_screwdriver." + XSTR.XSTR_INSTANCE.nextInt(count)));
+ return false;
+ }
+ configuratorStack = player.inventory.mainInventory[configurator.getKey()];
+ }
+ openSelectorGui(configuratorStack, stack.getItemDamage());
+ return true;
+ }
+
+ private void openSelectorGui(ItemStack configurator, int meta) {
+ FMLCommonHandler.instance().showGuiScreen(new GT_GUIDialogSelectItem(
+ StatCollector.translateToLocal("GT5U.item.programmed_circuit.select.header"),
+ configurator,
+ null,
+ ItemAdvancedChip::onConfigured,
+ ALL_VARIANTS,
+ meta,
+ true
+ ));
+ }
+
+ private static void onConfigured(ItemStack stack) {
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setByte("meta", (byte) stack.getItemDamage());
+ GT_Values.NW.sendToServer(new GT_Packet_UpdateItem(tag));
+ }
+
+ private static Pair<Integer, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> findConfiguratorInInv(EntityPlayer player) {
+ ItemStack[] mainInventory = player.inventory.mainInventory;
+ for (int j = 0, mainInventoryLength = mainInventory.length; j < mainInventoryLength; j++) {
+ ItemStack toolStack = mainInventory[j];
+
+ if (!GT_Utility.isStackValid(toolStack))
+ continue;
+
+ for (Map.Entry<Predicate<ItemStack>, BiFunction<ItemStack, EntityPlayerMP, ItemStack>> p : GregTech_API.sCircuitProgrammerList.entrySet())
+ if (p.getKey().test(toolStack))
+ return Pair.of(j, p.getValue());
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java b/src/main/java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java
new file mode 100644
index 0000000000..d8ddb26675
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/crafting/ItemDummyResearch.java
@@ -0,0 +1,114 @@
+package gtPlusPlus.core.item.crafting;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.item.general.ItemGenericToken;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+public class ItemDummyResearch extends ItemGenericToken {
+
+ public static enum ASSEMBLY_LINE_RESEARCH {
+
+
+ RESEARCH_1_CONTAINMENT("Containment Fields", "Advanced scientific study"),
+ RESEARCH_2_BASIC_CHEM("Basic Chemistry", "Time to start at the beginning"),
+ RESEARCH_3_ADV_CHEM("Advanced Chemistry", "Best learn more than chemical equations"),
+ RESEARCH_4_BASIC_PHYSICS("Basic Physics", "Fundamental laws of motion"),
+ RESEARCH_5_ADV_PHYSICS("Advanced Physics", "Advanced knowledge!"),
+ RESEARCH_6_BASIC_METALLURGY("Basic Metallurgy", "Information about material smelting"),
+ RESEARCH_7_ADV_METALLURGY("Advanced Metallurgy", "Advanced Material Sciences!"),
+ RESEARCH_8_TURBINE_AUTOMATION("Turbine Automation", "You really don't want to share this with anyone!"),
+ RESEARCH_9_CLOAKING("Cloaking Technologies", "Sneaking around like a mouse"),
+ RESEARCH_10_SPARGING("Gas Sparging", "Blowing gas for results");
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private String mName;
+ private String mDesc;
+
+ private ASSEMBLY_LINE_RESEARCH(String aName, String aDesc) {
+ mName = aName;
+ mDesc = aDesc;
+ ModItems.itemDummyResearch.register(mName, mDesc);
+ }
+
+ }
+
+
+
+
+
+
+
+
+
+
+ private static Map<String, Integer> mInternalNameToIdMap = new LinkedHashMap<String, Integer>();
+
+ public static ItemStack getResearchStack(ASSEMBLY_LINE_RESEARCH aResearchName, int aStacksize) {
+ Integer aMeta = mInternalNameToIdMap.get(Utils.sanitizeString(aResearchName.mName));
+ if (aMeta == null) {
+ aMeta = 0;
+ }
+ return ItemUtils.simpleMetaStack(ModItems.itemDummyResearch, aMeta, aStacksize);
+ }
+
+ private int aID = 0;
+ public ItemDummyResearch() {
+ super("dummyResearch", "Research", new String[] {"This object requires some further study"}, "research");
+
+
+
+ }
+
+ /**
+ *
+ * @param aResearchType - What is the research for?
+ * @param aDescriptThe - tooltip for this research
+ * @return - Did we register a custom research item?
+ */
+ public boolean register(String aResearchType, String aDescript) {
+ int aNewID = aID++;
+ mInternalNameToIdMap.put(Utils.sanitizeString(aResearchType), aNewID);
+ return register(aNewID, "Research on "+aResearchType, 1, aDescript);
+ }
+
+ @Override
+ public boolean register(int id, String aLocalName, int aMaxStack, String aDescript) {
+ return register(id, aLocalName, 1, new String[] {aDescript, EnumChatFormatting.DARK_GRAY+"Used to further your knowledge"}, EnumRarity.common, EnumChatFormatting.LIGHT_PURPLE);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public final void registerIcons(final IIconRegister aIconRegister) {
+ for (int i = 0, j = mLocalNames.size(); i < j; i++) {
+ mIcons.put(i, aIconRegister.registerIcon(CORE.MODID + ":" + "research" + "/" + "note"));
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/effects/RarityEffect.java b/src/main/java/gtPlusPlus/core/item/effects/RarityEffect.java
new file mode 100644
index 0000000000..7cfd64a2e7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/effects/RarityEffect.java
@@ -0,0 +1,42 @@
+package gtPlusPlus.core.item.effects;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+/*
+ *
+This determines the name colour. EnumRarity can be:
+EnumRarity.common - the standard white colour.
+EnumRarity.uncommon - a yellow colour.
+EnumRarity.rare - a light blue colour. This is used for enchanted items.
+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){
+ super();
+ this.setCreativeTab(CreativeTabs.tabMaterials);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return EnumRarity.common;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return true;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/effects/RarityEpic.java b/src/main/java/gtPlusPlus/core/item/effects/RarityEpic.java
new file mode 100644
index 0000000000..74ee5ab12c
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/effects/RarityEpic.java
@@ -0,0 +1,29 @@
+package gtPlusPlus.core.item.effects;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class RarityEpic extends Item {
+
+ public RarityEpic(final int par1){
+ super();
+ this.setCreativeTab(CreativeTabs.tabMaterials);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return EnumRarity.epic;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return true;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/effects/RarityRare.java b/src/main/java/gtPlusPlus/core/item/effects/RarityRare.java
new file mode 100644
index 0000000000..60d5a681b9
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/effects/RarityRare.java
@@ -0,0 +1,29 @@
+package gtPlusPlus.core.item.effects;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class RarityRare extends Item {
+
+ public RarityRare(){
+ super();
+ this.setCreativeTab(CreativeTabs.tabMaterials);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return EnumRarity.rare;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return true;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/effects/RarityUncommon.java b/src/main/java/gtPlusPlus/core/item/effects/RarityUncommon.java
new file mode 100644
index 0000000000..1ce8eec5d8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/effects/RarityUncommon.java
@@ -0,0 +1,23 @@
+package gtPlusPlus.core.item.effects;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+
+public class RarityUncommon extends Item {
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return EnumRarity.uncommon;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return true;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/food/BaseItemMetaFood.java b/src/main/java/gtPlusPlus/core/item/food/BaseItemMetaFood.java
new file mode 100644
index 0000000000..94d5a8e80f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/food/BaseItemMetaFood.java
@@ -0,0 +1,431 @@
+package gtPlusPlus.core.item.food;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemFood;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class BaseItemMetaFood extends ItemFood {
+
+ private static final HashMap<Integer, IIcon> mIconMap = new HashMap<Integer, IIcon>();
+ private static int mTotalMetaItems = 0;
+
+ /*
+ * 0 - Raw Human Meat
+ * 1 - Cooked Human Meat
+ * 2 - Raw Horse Meat
+ * 3 - Cooked Horse Meat
+ * 4 - Raw Wolf Meat
+ * 5 - Cooked Wolf Meat
+ * 6 - Raw Ocelot Meat
+ * 7 - Cooked Ocelot Meat
+ * 8 - Blaze Flesh
+ */
+
+ //listAllmeatraw
+ //listAllmeatcooked
+
+ public static void registerMetaFoods() {
+ registerNewMetaFood(0, "I wouldn't eat this unless I was starving", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessModerate(80), new EffectSlownessModerate(80)), getOreDictNamesAsArrayList("listAllmeatraw"));
+ registerNewMetaFood(1, "Doesn't look any better cooked", 4, 1, 64, getPotionEffectPackage(new EffectWeaknessBasic(50), new EffectSlownessBasic(50)), getOreDictNamesAsArrayList("listAllmeatcooked"));
+ registerNewMetaFood(2, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(30), new EffectSlownessBasic(30)), getOreDictNamesAsArrayList("listAllmeatraw"));
+ registerNewMetaFood(3, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked"));
+ registerNewMetaFood(4, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(25), new EffectSlownessBasic(30)), getOreDictNamesAsArrayList("listAllmeatraw"));
+ registerNewMetaFood(5, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked"));
+ registerNewMetaFood(6, "", 2, 0, 64, getPotionEffectPackage(new EffectWeaknessBasic(30), new EffectSlownessBasic(25)), getOreDictNamesAsArrayList("listAllmeatraw"));
+ registerNewMetaFood(7, "", 4, 1, 64, getOreDictNamesAsArrayList("listAllmeatcooked"));
+ registerNewMetaFood(8, "Warm to the touch", EnumRarity.uncommon, 4, 1, 64, new AutoMap<PotionEffectPackage>(), new setOnFire(), getOreDictNamesAsArrayList("listAllmeatcooked"));
+ }
+
+ private static final HashMap<Integer, Integer> mMaxStackSizeMap = new HashMap<Integer, Integer>();
+ private static final HashMap<Integer, String> mTooltipMap = new HashMap<Integer, String>();
+ private static final HashMap<Integer, EnumRarity> mRarityMap = new HashMap<Integer, EnumRarity>();
+ private static final HashMap<Integer, Integer> mHealAmountMap = new HashMap<Integer, Integer>();
+ private static final HashMap<Integer, Float> mSaturationAmountMap = new HashMap<Integer, Float>();
+ private static final HashMap<Integer, AutoMap<PotionEffectPackage>> mPotionEffectsMap = new HashMap<Integer, AutoMap<PotionEffectPackage>>();
+ private static final HashMap<Integer, Boolean> mHasSpecialBehaviourMap = new HashMap<Integer, Boolean>();
+ private static final HashMap<Integer, SpecialFoodBehaviour> mSpecialBehaviourMap = new HashMap<Integer, SpecialFoodBehaviour>();
+ private static final HashMap<Integer, ArrayList<String>> mOreDictNames = new HashMap<Integer, ArrayList<String>>();
+
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize) {
+ registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, new ArrayList<String>());
+ }
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final ArrayList<String> aOreDictNames) {
+ registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, aOreDictNames);
+ }
+
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects) {
+ registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, new AutoMap<PotionEffectPackage>(), null, new ArrayList<String>());
+ }
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final ArrayList<String> aOreDictNames) {
+ registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, aPotionEffects, null, aOreDictNames);
+ }
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, EnumRarity aRarity, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final SpecialFoodBehaviour aSpecialBehaviour) {
+ registerNewMetaFood(aMetaID, aTooltip, EnumRarity.common, aHealAmount, aSaturationModifier, aMaxStacksize, aPotionEffects, null, new ArrayList<String>());
+ }
+
+ public static void registerNewMetaFood(final int aMetaID, String aTooltip, EnumRarity aRarity, final int aHealAmount, final float aSaturationModifier, final int aMaxStacksize, final AutoMap<PotionEffectPackage> aPotionEffects, final SpecialFoodBehaviour aSpecialBehaviour, final ArrayList<String> aOreDictNames) {
+ mTotalMetaItems++;
+ mMaxStackSizeMap.put(aMetaID, aMaxStacksize);
+ mTooltipMap.put(aMetaID, aTooltip);
+ mRarityMap.put(aMetaID, aRarity);
+ mHealAmountMap.put(aMetaID, aHealAmount);
+ mSaturationAmountMap.put(aMetaID, aSaturationModifier);
+ mPotionEffectsMap.put(aMetaID, aPotionEffects);
+ mHasSpecialBehaviourMap.put(aMetaID, (aSpecialBehaviour != null));
+ if (aSpecialBehaviour != null) {
+ mSpecialBehaviourMap.put(aMetaID, aSpecialBehaviour);
+ }
+ mOreDictNames.put(aMetaID, aOreDictNames);
+ }
+
+ public static void registerFoodsToOreDict() {
+ for (int aMetaID=0; aMetaID < mTotalMetaItems; aMetaID++) {
+ ArrayList<String> aOreDictNames = mOreDictNames.get(aMetaID);
+ if (aOreDictNames != null && !aOreDictNames.isEmpty()) {
+ ItemStack aFoodStack = ItemUtils.simpleMetaStack(ModItems.itemMetaFood, aMetaID, 1);
+ for (String aOreName : aOreDictNames) {
+ ItemUtils.addItemToOreDictionary(aFoodStack, aOreName);
+ }
+ }
+ }
+ }
+
+
+ public BaseItemMetaFood() {
+ super(0, 0, false);
+ this.setHasSubtypes(true);
+ this.setNoRepair();
+ this.setMaxStackSize(64);
+ this.setMaxDamage(0);
+ this.setUnlocalizedName("BasicMetaFood");
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ GameRegistry.registerItem(this, this.getUnlocalizedName());
+ BaseItemMetaFood.registerMetaFoods();
+ }
+
+ private static final int getMetaKey(ItemStack aStack) {
+ return aStack.getItemDamage();
+ }
+
+ // Heal Amount
+ public int func_150905_g(ItemStack aStack) {
+ return mHealAmountMap.get(getMetaKey(aStack));
+ }
+
+ // Saturation Amount
+ public float func_150906_h(ItemStack aStack) {
+ return mSaturationAmountMap.get(getMetaKey(aStack));
+ }
+
+ // Whether wolves like this food, sadly doesn't support meta items
+ public boolean isWolfsFavoriteMeat() {
+ return false;
+ }
+
+ @Override
+ protected void onFoodEaten(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) {
+ //super.onFoodEaten(stack, world, player);
+ AutoMap<PotionEffectPackage> aPotionEffects = mPotionEffectsMap.get(getMetaKey(aStack));
+ if (!aWorld.isRemote && aPotionEffects != null && aPotionEffects.size() > 0) {
+ for (PotionEffectPackage aFoodEffect : aPotionEffects) {
+ if (MathUtils.randInt(0, 100) <= aFoodEffect.getChance() || aFoodEffect.getChance() == 100) {
+ PotionEffect aEffect = aFoodEffect.getEffect();
+ if (aEffect != null && aEffect.getPotionID() > 0) {
+ aPlayer.addPotionEffect(new PotionEffect(aEffect.getPotionID(), aEffect.getDuration() * 20, aEffect.getAmplifier(), aEffect.getIsAmbient()));
+ }
+ }
+ }
+ }
+
+ boolean aHasEpcialBehaviour = mHasSpecialBehaviourMap.get(getMetaKey(aStack));
+ if (!aWorld.isRemote && aHasEpcialBehaviour) {
+ SpecialFoodBehaviour aBehaviour = mSpecialBehaviourMap.get(getMetaKey(aStack));
+ if (aBehaviour != null) {
+ aBehaviour.doBehaviour(aPlayer);
+ }
+ }
+ }
+
+ @Override
+ public ItemStack onEaten(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
+ return super.onEaten(aStack, aWorld, aPlayer);
+ }
+
+
+ @Override
+ public int getItemStackLimit(ItemStack aStack) {
+ return mMaxStackSizeMap.get(getMetaKey(aStack));
+ }
+
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public boolean shouldRotateAroundWhenRendering() {
+ return super.shouldRotateAroundWhenRendering();
+ }
+
+ @Override
+ public void onUpdate(ItemStack p_77663_1_, World p_77663_2_, Entity p_77663_3_, int p_77663_4_, boolean p_77663_5_) {
+ super.onUpdate(p_77663_1_, p_77663_2_, p_77663_3_, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack aStack) {
+ return super.getItemStackDisplayName(aStack);
+ }
+
+ @Override
+ public void addInformation(ItemStack aStack, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) {
+ try {
+ String aTooltip = mTooltipMap.get(getMetaKey(aStack));
+ if (aTooltip != null && aTooltip.length() > 0) {
+ aList.add(aTooltip);
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ super.addInformation(aStack, p_77624_2_, aList, p_77624_4_);
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack aStack) {
+ return mRarityMap.get(getMetaKey(aStack));
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses() {
+ return false;
+ }
+
+ @Override
+ public void getSubItems(Item aItem, CreativeTabs p_150895_2_, List aList) {
+ for (int i=0;i<mIconMap.size();i++) {
+ aList.add(ItemUtils.simpleMetaStack(aItem, i, 1));
+ }
+ }
+
+ @Override
+ public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+
+ @Override
+ public boolean isBookEnchantable(ItemStack stack, ItemStack book) {
+ return false;
+ }
+
+ @Override
+ public int getDisplayDamage(ItemStack stack) {
+ return stack.getItemDamage();
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public int getItemEnchantability(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister u) {
+ for (int i=0;i<mTotalMetaItems;i++) {
+ String aPath = CORE.MODID + ":" + "food/MetaItem1/"+i;
+ mIconMap.put(i, u.registerIcon(aPath));
+ }
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) {
+ return mIconMap.get(damage);
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int damage) {
+ return mIconMap.get(damage);
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack aStack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
+ return mIconMap.get(getMetaKey(aStack));
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack aStack, int pass) {
+ return mIconMap.get(getMetaKey(aStack));
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return super.getUnlocalizedName() + "." + stack.getItemDamage();
+ }
+
+ private static class PotionEffectPackage {
+
+ private final PotionEffect mEffect;
+ private final int mChance;
+
+ private PotionEffectPackage(PotionEffect aEffect, int aChance) {
+ mEffect = aEffect;
+ mChance = aChance;
+ }
+
+ public PotionEffect getEffect() {
+ return this.mEffect;
+ }
+
+ public int getChance() {
+ return this.mChance;
+ }
+
+ }
+
+ private static AutoMap<PotionEffectPackage> getPotionEffectPackage(PotionEffectPackage... aEffects){
+ AutoMap<PotionEffectPackage> aPackage = new AutoMap<PotionEffectPackage>();
+ if (aEffects != null && aEffects.length > 0) {
+ for (PotionEffectPackage aEffect : aEffects) {
+ aPackage.put(aEffect);
+ }
+ }
+ return aPackage;
+ }
+
+ private static ArrayList<String> getOreDictNamesAsArrayList(String... aOreDictNames){
+ ArrayList<String> aPackage = new ArrayList<String>();
+ if (aOreDictNames != null && aOreDictNames.length > 0) {
+ for (String aEffect : aOreDictNames) {
+ aPackage.add(aEffect);
+ }
+ }
+ return aPackage;
+ }
+
+ private static class EffectWeaknessBasic extends PotionEffectPackage {
+
+ protected EffectWeaknessBasic(int aChance) {
+ super(new PotionEffect(Potion.weakness.getId(), 1, 20), aChance);
+ }
+
+ }
+
+ private static class EffectWeaknessModerate extends PotionEffectPackage {
+
+ protected EffectWeaknessModerate(int aChance) {
+ super(new PotionEffect(Potion.weakness.getId(), 2, 40), aChance);
+ }
+
+ }
+
+ private static class EffectWeaknessSevere extends PotionEffectPackage {
+
+ protected EffectWeaknessSevere(int aChance) {
+ super(new PotionEffect(Potion.weakness.getId(), 3, 60), aChance);
+ }
+
+ }
+
+ private static class EffectSlownessBasic extends PotionEffectPackage {
+
+ protected EffectSlownessBasic(int aChance) {
+ super(new PotionEffect(Potion.moveSlowdown.getId(), 1, 20), aChance);
+ }
+
+ }
+
+ private static class EffectSlownessModerate extends PotionEffectPackage {
+
+ protected EffectSlownessModerate(int aChance) {
+ super(new PotionEffect(Potion.moveSlowdown.getId(), 2, 40), aChance);
+ }
+
+ }
+
+ private static class EffectSlownessSevere extends PotionEffectPackage {
+
+ protected EffectSlownessSevere(int aChance) {
+ super(new PotionEffect(Potion.moveSlowdown.getId(), 3, 60), aChance);
+ }
+
+ }
+
+
+
+
+ private static abstract class SpecialFoodBehaviour {
+
+ protected final int mChance;
+
+ public SpecialFoodBehaviour(int aChance) {
+ mChance = aChance;
+ }
+
+ public final void doBehaviour(EntityPlayer aPlayer) {
+ if (aPlayer != null && !aPlayer.worldObj.isRemote) {
+ if (MathUtils.randInt(0, 100) < mChance || mChance == 100) {
+ behaviour(aPlayer);
+ }
+ }
+ }
+
+ protected abstract void behaviour(EntityPlayer aPlayer);
+
+ }
+
+
+ private static class setOnFire extends SpecialFoodBehaviour {
+
+ public setOnFire() {
+ super(100);
+ }
+
+ @Override
+ public void behaviour(EntityPlayer aPlayer) {
+ EntityUtils.setEntityOnFire(aPlayer, 5);
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/BaseItemGrindle.java b/src/main/java/gtPlusPlus/core/item/general/BaseItemGrindle.java
new file mode 100644
index 0000000000..0ff922d853
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/BaseItemGrindle.java
@@ -0,0 +1,84 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.handler.GuiHandler;
+import gtPlusPlus.core.lib.CORE;
+
+public class BaseItemGrindle extends Item {
+
+ protected final String unlocalName;
+
+ public BaseItemGrindle() {
+ this.unlocalName = "itemGrindleTablet";
+ this.setUnlocalizedName("itemGrindleTablet");
+ this.setTextureName(CORE.MODID + ":" + "itemTablet");
+ GameRegistry.registerItem(this, "itemGrindleTablet");
+ this.setMaxStackSize(1);
+ this.setCreativeTab(AddToCreativeTab.tabOther);
+ }
+
+ @Override
+ public int getMaxItemUseDuration(final ItemStack stack) {
+ return 1;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) {
+ if (!world.isRemote) {
+ if (!player.isSneaking()) {
+ player.openGui(GTplusplus.instance, GuiHandler.GUI9, world, 0, 0, 0);
+ }
+ }
+ return itemstack;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack aStack) {
+ String aName = super.getItemStackDisplayName(aStack);
+ if (aName.toLowerCase().contains(".name") || aName.toLowerCase().contains("git")) {
+ aName = "Grindle";
+ }
+ return aName;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(final IIconRegister iconRegister) {
+ this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + "itemTablet");
+ }
+
+ @Override
+ public String getPotionEffect(ItemStack p_150896_1_) {
+ return super.getPotionEffect(p_150896_1_);
+ }
+
+ @Override
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) {
+ super.addInformation(p_77624_1_, p_77624_2_, aList, p_77624_4_);
+ aList.add("Used to read data from DataSticks & DataOrbs.");
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack i) {
+ return EnumRarity.uncommon;
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/BedLocator_Base.java b/src/main/java/gtPlusPlus/core/item/general/BedLocator_Base.java
new file mode 100644
index 0000000000..5aa2e4ae9e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/BedLocator_Base.java
@@ -0,0 +1,107 @@
+package gtPlusPlus.core.item.general;
+
+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.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+
+public class BedLocator_Base extends Item{
+
+ public int bed_X = 0;
+ public int bed_Y = 0;
+ public int bed_Z = 0;
+
+ public BedLocator_Base(final String unlocalizedName) {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+
+
+ int NBT_X = this.bed_X;
+ int NBT_Y = this.bed_Y;
+ int NBT_Z = this.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);
+ }
+ }
+
+ //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) {
+ 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);
+ }
+
+ @Override
+ public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) {
+
+
+ }
+
+ @Override
+ public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final 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;
+ }
+ 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);
+ return super.onItemRightClick(itemStack, world, par3Entity);
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/BufferCore.java b/src/main/java/gtPlusPlus/core/item/general/BufferCore.java
new file mode 100644
index 0000000000..9b00d3d034
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/BufferCore.java
@@ -0,0 +1,72 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.GT_Values;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import gtPlusPlus.core.item.base.BaseItemWithDamageValue;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+
+public class BufferCore extends BaseItemWithDamageValue{
+
+ public int coreTier = 0;
+
+ public BufferCore(final String unlocalizedName, final int i) {
+ super(unlocalizedName+i);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setMaxStackSize(32);
+ this.coreTier = i;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack stack) {
+ return super.getItemStackDisplayName(stack)/*+" ["+GT_Values.VN[this.coreTier-1]+"]."*/;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses()
+ {
+ return true;
+ }
+
+ @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 "+GT_Values.VN[this.coreTier-1]+" Applicances");
+ }
+
+ public final int getCoreTier() {
+ return this.coreTier;
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
+
+ int[] mTierTypes = new int[] {
+ Utils.rgbtoHexValue(200, 180, 180),
+ Utils.rgbtoHexValue(142, 153, 161),
+ Utils.rgbtoHexValue(230, 121, 75),
+ Utils.rgbtoHexValue(215, 156, 70),
+ Utils.rgbtoHexValue(97, 97, 96), //EV
+ Utils.rgbtoHexValue(202, 202, 201),
+ Utils.rgbtoHexValue(247, 159, 157),
+ Utils.rgbtoHexValue(181, 223, 223),
+ Utils.rgbtoHexValue(187, 219, 185),
+ };
+
+ if (this.coreTier == 10){
+ return Utils.rgbtoHexValue(MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250));
+ }
+
+ return mTierTypes[this.coreTier-1];
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemAirFilter.java b/src/main/java/gtPlusPlus/core/item/general/ItemAirFilter.java
new file mode 100644
index 0000000000..a354e63fe3
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemAirFilter.java
@@ -0,0 +1,141 @@
+package gtPlusPlus.core.item.general;
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+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.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+
+public class ItemAirFilter extends Item {
+
+ public IIcon[] icons = new IIcon[1];
+
+ public ItemAirFilter() {
+ super();
+ this.setHasSubtypes(true);
+ String unlocalizedName = "itemAirFilter";
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setMaxStackSize(1);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "itemAirFilter");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[0];
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 2; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return this.getUnlocalizedName() + "_" + stack.getItemDamage();
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+
+ if (tItem == null) {
+ return "Air Filter";
+ }
+
+ String itemName = tItem == null ? "Air Filter" : super.getItemStackDisplayName(tItem);
+ String suffixName = "";
+ if (tItem.getItemDamage() == 0){
+ suffixName = " [Tier 1]";
+ }
+ else if (tItem.getItemDamage() == 1){
+ suffixName = " [Tier 2]";
+ }
+ return (itemName+suffixName);
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
+ int meta = stack.getItemDamage();
+ if (meta == 1){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(150,180,35);
+ }
+ return HEX_OxFFFFFF;
+ }
+
+ private static boolean createNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Damage", 0);
+ tagMain.setTag("AirFilter", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static final long getFilterDamage(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("AirFilter");
+ if (aNBT != null) {
+ return aNBT.getLong("Damage");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return 0L;
+ }
+
+ public static final boolean setFilterDamage(final ItemStack aStack, final long aDamage) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("AirFilter");
+ if (aNBT != null) {
+ aNBT.setLong("Damage", aDamage);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ if (stack.getTagCompound() == null){
+ createNBT(stack);
+ }
+ double currentDamage = getFilterDamage(stack);
+ double meta = stack.getItemDamage() == 0 ? 50 : 2500;
+ double durabilitypercent = currentDamage / meta;
+ return durabilitypercent;
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ list.add(EnumChatFormatting.GRAY+"An Air filter for Atmospheric Reconditioning.");
+ int maxDamage = (stack.getItemDamage() == 0 ? 50 : 2500);
+ list.add(EnumChatFormatting.GRAY+""+(maxDamage-getFilterDamage(stack))+"/"+maxDamage+" uses left.");
+ super.addInformation(stack, player, list, bool);
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemAreaClear.java b/src/main/java/gtPlusPlus/core/item/general/ItemAreaClear.java
new file mode 100644
index 0000000000..5be184b3db
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemAreaClear.java
@@ -0,0 +1,202 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.List;
+
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.common.blocks.GT_Block_Ores;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+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 net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.block.base.BlockBaseOre;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+
+public class ItemAreaClear extends CoreItem {
+
+ public IIcon[] mIcon = new IIcon[1];
+
+ public ItemAreaClear() {
+ super("itemDebugClearing", AddToCreativeTab.tabMachines, 1, 100, new String[] {EnumChatFormatting.OBFUSCATED+"F A M C Y N A M E"}, EnumRarity.rare,
+ EnumChatFormatting.BOLD, false, null);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.mIcon[0] = reg.registerIcon(CORE.MODID + ":" + "itemLavaFilter");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.mIcon[0];
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 2; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ String itemName = "Debug Square";
+ String suffixName = "";
+ if (tItem.getItemDamage() == 0){
+ suffixName = " [1]";
+ }
+ else if (tItem.getItemDamage() == 1){
+ suffixName = " [2]";
+ }
+ return (itemName+suffixName);
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ String mMode = (stack.getItemDamage() == 0 ? "Clear" : "Fill");
+ list.add(EnumChatFormatting.GRAY+""+("Mode: "+mMode));
+ super.addInformation(stack, player, list, bool);
+ }
+
+ private static boolean createNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Mode", 0);
+ tagMain.setTag("GTPP_DEBUG", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static final long getFilterDamage(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("GTPP_DEBUG");
+ if (aNBT != null) {
+ return aNBT.getLong("Mode");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return 0L;
+ }
+
+ public static final boolean setFilterDamage(final ItemStack aStack, final long aDamage) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("GTPP_DEBUG");
+ if (aNBT != null) {
+ aNBT.setLong("Mode", aDamage);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean removeBlocks(World world, BlockPos pos){
+ int x1 = pos.xPos;
+ int y1 = pos.yPos;
+ int z1 = pos.zPos;
+
+ int x2 = (x1-24);
+ int y2 = (y1-10);
+ int z2 = (z1-24);
+
+ removeBlockColumn(world, new BlockPos(x2, y2, z2, world));
+ return true;
+ }
+
+ public boolean removeBlockColumn(World world, BlockPos pos){
+ for (int i=0; i<50; i++){
+ removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos-10, pos.zPos+i, world));
+ removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos, pos.zPos+i, world));
+ removeBlockRow(world, new BlockPos(pos.xPos, pos.yPos+10, pos.zPos+i, world));
+ }
+ return true;
+ }
+
+ public boolean removeBlockRow(World world, BlockPos pos){
+ for (int j=0; j<20; j++){
+ for (int i=0; i<50; i++){
+
+ if (!(world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) instanceof BlockBaseOre) &&
+ !(world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) instanceof IGregTechTileEntity) &&
+ !(world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) instanceof GT_Block_Ores)){
+ if (!world.isAirBlock(pos.xPos+i, pos.yPos+j, pos.zPos) &&
+ world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.bedrock){
+ int chance = MathUtils.randInt(0, 500);
+ if (chance <= 0){
+ if (pos.yPos+j <= 50){
+ world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.glowstone);
+ }
+ }
+ else {
+ if ((world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) == Blocks.glowstone && ((pos.yPos+j) > 50)) || world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.glowstone){
+ world.setBlockToAir(pos.xPos+i, pos.yPos+j, pos.zPos);
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ public boolean fillBlocks(World world, BlockPos pos){
+ int x1 = pos.xPos;
+ int y1 = pos.yPos;
+ int z1 = pos.zPos;
+
+ int x2 = (x1-10);
+ int y2 = (y1-1);
+ int z2 = (z1-10);
+
+ fillBlockColumn(world, new BlockPos(x2, y2, z2, world));
+ return true;
+ }
+
+ public boolean fillBlockColumn(World world, BlockPos pos){
+ for (int i=0; i<21; i++){
+ fillBlockRow(world, new BlockPos(pos.xPos, pos.yPos, pos.zPos+i, world));
+ }
+ return true;
+ }
+
+ public boolean fillBlockRow(World world, BlockPos pos){
+ for (int j=0; j<2; j++){
+ for (int i=0; i<21; i++){
+ if (world.getBlock(pos.xPos+i, pos.yPos+j, pos.zPos) != Blocks.bedrock){
+ world.setBlock(pos.xPos+i, pos.yPos+j, pos.zPos, Blocks.grass);
+ }
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack thisItem, World world, EntityPlayer parEntity) {
+ BlockPos groundBlock = EntityUtils.findBlockPosUnderEntity(parEntity);
+ if (thisItem.getItemDamage() == 0){
+ removeBlocks(world, groundBlock);
+ }
+ else {
+ Logger.INFO("Filling.");
+ fillBlocks(world, groundBlock);
+ }
+ return super.onItemRightClick(thisItem, world, parEntity);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java b/src/main/java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java
new file mode 100644
index 0000000000..ca6c5e8c8c
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemBasicFirestarter.java
@@ -0,0 +1,85 @@
+package gtPlusPlus.core.item.general;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.block.general.FirePit;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+
+public class ItemBasicFirestarter extends CoreItem {
+
+ public ItemBasicFirestarter() {
+ super("itemSimpleFiremaker", AddToCreativeTab.tabTools, 1, 5, "Can probably make you a fire");
+ this.setTextureName(CORE.MODID+":"+"itemFireStarter");
+ }
+
+ @Override
+ public boolean onItemUse(
+ final ItemStack thisItem, final EntityPlayer thisPlayer, final World thisWorld,
+ int blockX, int blockY, int blockZ,
+ final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
+ if (p_77648_7_ == 0) {
+ --blockY;
+ }
+ if (p_77648_7_ == 1) {
+ ++blockY;
+ }
+ if (p_77648_7_ == 2) {
+ --blockZ;
+ }
+ if (p_77648_7_ == 3) {
+ ++blockZ;
+ }
+ if (p_77648_7_ == 4) {
+ --blockX;
+ }
+ if (p_77648_7_ == 5) {
+ ++blockX;
+ }
+ if (!thisPlayer.canPlayerEdit(blockX, blockY, blockZ, p_77648_7_, thisItem)) {
+ return false;
+ }
+ if (thisWorld.getBlock(blockX, blockY, blockZ) instanceof FirePit){
+ thisWorld.setBlockMetadataWithNotify(blockX, blockY, blockZ, 2, 4);
+ PlayerUtils.messagePlayer(thisPlayer, "You light the fire pit. ");
+ }
+ if (thisWorld.isAirBlock(blockX, blockY, blockZ))
+ {
+ final int random = MathUtils.randInt(0, 3);
+ //Explode, lol.
+ if (random == 0){
+ PlayerUtils.messagePlayer(thisPlayer, "You somehow managed to set yourself on fire... ");
+ thisWorld.playSoundEffect(thisPlayer.posX + 0.5D, thisPlayer.posY + 0.5D, thisPlayer.posZ + 0.5D, "fire.ignite", 1.0F, (itemRand.nextFloat() * 0.4F) + 0.8F);
+ thisPlayer.setFire(4);
+ thisItem.damageItem(thisItem.getMaxDamage(), thisPlayer);
+ }
+
+ //Create a fire
+ else if (random == 2){
+ PlayerUtils.messagePlayer(thisPlayer, "You created a fire!");
+ thisWorld.playSoundEffect(blockX + 0.5D, blockY + 0.5D, blockZ + 0.5D, "fire.ignite", 1.0F, (itemRand.nextFloat() * 0.4F) + 0.8F);
+ thisWorld.setBlock(blockX, blockY, blockZ, Blocks.fire);
+ }
+
+ //Do nothing
+ else {
+ PlayerUtils.messagePlayer(thisPlayer, "Your attemp does nothing.");
+ thisItem.damageItem(1, thisPlayer);
+ return false;
+ }
+ }
+ thisItem.damageItem(1, thisPlayer);
+ return true;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack thisItem) {
+ return "Basic Firemaker";
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java b/src/main/java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java
new file mode 100644
index 0000000000..2b7b98640e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemBasicScrubberTurbine.java
@@ -0,0 +1,153 @@
+package gtPlusPlus.core.item.general;
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+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.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+
+public class ItemBasicScrubberTurbine extends Item {
+
+ public IIcon[] icons = new IIcon[1];
+
+ public ItemBasicScrubberTurbine() {
+ super();
+ this.setHasSubtypes(true);
+ String unlocalizedName = "itemBasicTurbine";
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setMaxStackSize(1);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "itemBasicTurbine");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[0];
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 3; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return this.getUnlocalizedName() + "_" + stack.getItemDamage();
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ if (tItem == null) {
+ return "Basic Turbine";
+ }
+ return super.getItemStackDisplayName(tItem);
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
+ int meta = stack.getItemDamage();
+ if (meta == 0){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(200,200,200);
+ }
+ if (meta == 1){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(255,128,0);
+ }
+ if (meta == 2){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(128,128,128);
+ }
+ return HEX_OxFFFFFF;
+ }
+
+ private static boolean createNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Damage", 0);
+ tagMain.setTag("BasicTurbine", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static final long getFilterDamage(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("BasicTurbine");
+ if (aNBT != null) {
+ return aNBT.getLong("Damage");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return 0L;
+ }
+
+ public static final boolean setFilterDamage(final ItemStack aStack, final long aDamage) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("BasicTurbine");
+ if (aNBT != null) {
+ aNBT.setLong("Damage", aDamage);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public int getMaxDurability(ItemStack aStack) {
+ if (aStack != null) {
+ int aMeta = aStack.getItemDamage();
+ if (aMeta == 0) {
+ return 2000;
+ }
+ if (aMeta == 1) {
+ return 4000;
+ }
+ if (aMeta == 2) {
+ return 6000;
+ }
+ }
+ return 0;
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ if (stack.getTagCompound() == null){
+ createNBT(stack);
+ }
+ double currentDamage = getFilterDamage(stack);
+ double meta = getMaxDurability(stack);
+ double durabilitypercent = currentDamage / meta;
+ return durabilitypercent;
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ list.add(EnumChatFormatting.GRAY+"An early tier Turbine for Atmospheric Reconditioning.");
+ int maxDamage = getMaxDurability(stack);
+ list.add(EnumChatFormatting.GRAY+""+(maxDamage-getFilterDamage(stack))+"/"+maxDamage+" uses left.");
+ super.addInformation(stack, player, list, bool);
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java
new file mode 100644
index 0000000000..eded4e2585
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java
@@ -0,0 +1,295 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.interfaces.IItemBlueprint;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+
+public class ItemBlueprint extends Item implements IItemBlueprint{
+
+ public ItemBlueprint(final String unlocalizedName) {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ //this.bpID = MathUtils.randInt(0, 1000);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(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);
+ }
+ //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");
+ }
+ //Write to tooltip list for each viable setting.
+ if (itemStack.hasTagCompound()) {
+ if (id != -1){
+ list.add(EnumChatFormatting.GRAY+"Technical Document No. "+id);
+ }
+ if(blueprint){
+ list.add(EnumChatFormatting.BLUE+"Currently holding a blueprint for "+name);
+ }
+ else {
+ list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything.");
+ }
+ }
+ else {
+ list.add(EnumChatFormatting.RED+"Currently not holding a blueprint for anything.");
+ }
+ super.addInformation(itemStack, aPlayer, list, bool);
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return "Blueprint [I am useless]";
+ }
+
+ @Override
+ public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) {
+ this.createNBT(itemStack);
+ }
+
+ @Override
+ public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final boolean par5) {
+
+ }
+
+ @Override
+ public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final 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)));
+ }
+ else {
+ this.createNBT(itemStack);
+ PlayerUtils.messagePlayer(par3Entity, "This is a placeholder. "+this.getNBT(itemStack, "mID"));
+ }
+
+
+ return super.onItemRightClick(itemStack, world, par3Entity);
+ }
+
+ public ItemStack[] readItemsFromNBT(final 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[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 < INV_SIZE))
+ {
+ blueprint[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
+ return blueprint;
+ }
+ return null;
+ }
+
+ 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<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);
+ }
+ }
+ nbt.setTag("Items", list);
+ itemStack.setTagCompound(nbt);
+ return itemStack;
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isBlueprint(final ItemStack stack) {
+ return true;
+ }
+
+ @Override
+ public boolean setBlueprint(final ItemStack stack, final IInventory craftingTable, final ItemStack output) {
+ boolean hasBP = false;
+ ItemStack[] blueprint = new ItemStack[9];
+
+ if (stack.hasTagCompound()){
+ hasBP = (boolean) this.getNBT(stack, "mBlueprint");
+ blueprint = this.readItemsFromNBT(stack);
+ }
+
+ if (!hasBP){
+ try {
+ for (int o=0; o<craftingTable.getSizeInventory(); o++){
+ blueprint[o] = craftingTable.getStackInSlot(o);
+ if (blueprint[0] != null){
+ blueprint[0].stackSize = 0;
+ }
+ }
+ this.writeItemsToNBT(stack, blueprint);
+ if (stack.hasTagCompound()){
+ if(stack.getTagCompound().getCompoundTag("Items") != null){
+ stack.stackTagCompound.setBoolean("mBlueprint", true);
+ }
+ else {
+ //Invalid BP saved?
+ }
+ hasBP = (boolean) this.getNBT(stack, "mBlueprint");
+ }
+
+ if (output != null){
+ this.setBlueprintName(stack, output.getDisplayName());
+ hasBP = true;
+ return true;
+ }
+ return false;
+ } catch (final Throwable t){
+ return false;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void setBlueprintName(final ItemStack stack, final String name) {
+ stack.stackTagCompound.setString("mName", name);
+ }
+
+ @Override
+ public boolean hasBlueprint(final ItemStack stack) {
+ if (stack.hasTagCompound()){
+ return (boolean) this.getNBT(stack, "mBlueprint");
+ }
+ return false;
+ }
+
+ @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;
+ }
+ }
+
+ 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
+ Logger.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
+ Logger.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
+ Logger.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 = "";
+ Logger.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 = "";
+ Logger.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(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; }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemCloakingDevice.java b/src/main/java/gtPlusPlus/core/item/general/ItemCloakingDevice.java
new file mode 100644
index 0000000000..b54fc56563
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemCloakingDevice.java
@@ -0,0 +1,259 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.List;
+
+import cpw.mods.fml.common.Optional;
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+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 gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import ic2.api.item.IElectricItemManager;
+
+@Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")})
+public class ItemCloakingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{
+
+ private final String unlocalizedName = "personalCloakingDevice";
+ private final ItemStack thisStack;
+ private final static int maxValueEU = 10000*20*500;
+ protected double chargeEU = 0;
+
+ public ItemCloakingDevice(final double charge){
+ this.chargeEU = charge;
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ this.setUnlocalizedName(this.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);
+ }
+ GameRegistry.registerItem(this, this.unlocalizedName+"-"+charge);
+ }
+
+ @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;
+ }
+
+ 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_);
+ }
+
+ @Override
+ public boolean canProvideEnergy(final ItemStack itemStack) {
+ return true;
+ }
+
+ @Override
+ public Item getChargedItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(maxValueEU);
+ return x.getItem();
+ }
+
+ @Override
+ public Item getEmptyItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(0);
+ return x.getItem();
+ }
+
+ @Override
+ public double getMaxCharge(final ItemStack itemStack) {
+ return maxValueEU;
+ }
+
+ @Override
+ public int getTier(final ItemStack itemStack) {
+ return 5;
+ }
+
+ @Override
+ public double getTransferLimit(final ItemStack itemStack) {
+ return 8196;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+
+ return (EnumChatFormatting.BLUE+"Personal Cloaking Device"+EnumChatFormatting.GRAY);
+ }
+
+ @Override
+ public double getDurabilityForDisplay(final ItemStack stack)
+ {
+ //return 1.0D - getEnergyStored(stack) / this.capacity;
+ return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack));
+ }
+
+ @Override
+ public boolean showDurabilityBar(final ItemStack stack)
+ {
+ return true;
+ }
+
+ public int secondsLeft(final ItemStack stack){
+ double r = 0;
+ r = this.getCharge(stack)/(10000*20);
+ return (int) MathUtils.decimalRounding(r);
+ }
+
+ @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);
+ }
+
+ /*@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 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);
+ }
+
+ @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);
+ }
+
+ @Override
+ public double getCharge(final ItemStack stack) {
+ return ElectricItem.manager.getCharge(stack);
+ }
+
+ @Override
+ public boolean canUse(final ItemStack stack, final double amount) {
+ return ElectricItem.manager.canUse(stack, amount);
+ }
+
+ @Override
+ public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) {
+ return ElectricItem.manager.use(stack, amount, entity);
+ }
+
+ @Override
+ public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) {
+ ElectricItem.manager.chargeFromArmor(stack, entity);
+ }
+
+ @Override
+ public String getToolTip(final ItemStack stack) {
+ return ElectricItem.manager.getToolTip(stack);
+ }
+
+ @Override
+ public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public BaubleType getBaubleType(final ItemStack arg0) {
+ return BaubleType.BELT;
+ }
+
+ @Override //TODO
+ public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) {
+
+ }
+
+ @Override //TODO
+ public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) {
+
+ }
+
+ @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){
+ arg1.addPotionEffect(new PotionEffect(Potion.invisibility.id, 10, 2));
+ this.discharge(arg0, 10000, 5, true, true, false);
+ }
+ else {
+ if (arg1.isPotionActive((Potion.invisibility))){
+ arg1.removePotionEffect(Potion.invisibility.id);
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemControlCore.java b/src/main/java/gtPlusPlus/core/item/general/ItemControlCore.java
new file mode 100644
index 0000000000..b74b7972be
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemControlCore.java
@@ -0,0 +1,128 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+
+import gtPlusPlus.core.lib.CORE;
+
+public class ItemControlCore extends Item {
+
+ public static IIcon[] icons = new IIcon[10];
+
+ public ItemControlCore() {
+ super();
+ this.setHasSubtypes(true);
+ String unlocalizedName = "itemControlCore";
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(GregTech_API.TAB_GREGTECH);
+ //this.setCreativeTab(AddToCreativeTab.tabMisc);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ icons[0] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_0");
+ icons[1] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_1");
+ icons[2] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_2");
+ icons[3] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_3");
+ icons[4] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_4");
+ icons[5] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_5");
+ icons[6] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_6");
+ icons[7] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_7");
+ icons[8] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_8");
+ icons[9] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_9");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[meta];
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 10; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return this.getUnlocalizedName() + "_" + stack.getItemDamage();
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add(EnumChatFormatting.GRAY+"Allows a Multiblock to function upto "+GT_Values.VN[stack.getItemDamage()]+"");
+ list.add(EnumChatFormatting.GRAY+"Required Tier is determined by the sum of the eu/t of all Energy Inputs");
+ list.add(EnumChatFormatting.GRAY+"Lower tiers may be used to underclock, which is useful in some situations");
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ if (tItem == null) {
+ return "Control Core";
+ }
+ String aReturnValue = super.getItemStackDisplayName(tItem);
+ if (tItem != null) {
+ try {
+ if (aReturnValue != null) {
+ if (aReturnValue.toLowerCase().contains(".name")) {
+ aReturnValue = "Control Core";
+ }
+ else {
+ return aReturnValue;
+ }
+ }
+ }
+ catch (Throwable t) {}
+ }
+ if (aReturnValue == null || !aReturnValue.toLowerCase().contains("control core") || aReturnValue.length() <= 0) {
+ aReturnValue = "Error";
+ }
+ String suffixName = "";
+ if (tItem.getItemDamage() == 0){
+ suffixName = " [ULV]";
+ }
+ else if (tItem.getItemDamage() == 1){
+ suffixName = " [LV]";
+ }
+ else if (tItem.getItemDamage() == 2){
+ suffixName = " [MV]";
+ }
+ else if (tItem.getItemDamage() == 3){
+ suffixName = " [HV]";
+ }
+ else if (tItem.getItemDamage() == 4){
+ suffixName = " [EV]";
+ }
+ else if (tItem.getItemDamage() == 5){
+ suffixName = " [IV]";
+ }
+ else if (tItem.getItemDamage() == 6){
+ suffixName = " [LuV]";
+ }
+ else if (tItem.getItemDamage() == 7){
+ suffixName = " [ZPM]";
+ }
+ else if (tItem.getItemDamage() == 8){
+ suffixName = " [UV]";
+ }
+ else if (tItem.getItemDamage() == 9){
+ suffixName = " [MAX]";
+ }
+ return (aReturnValue+suffixName);
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemCreativeTab.java b/src/main/java/gtPlusPlus/core/item/general/ItemCreativeTab.java
new file mode 100644
index 0000000000..c1a2655a03
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemCreativeTab.java
@@ -0,0 +1,59 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gregtech.api.GregTech_API;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+public class ItemCreativeTab extends Item {
+
+ public IIcon[] icons = new IIcon[10];
+
+ public ItemCreativeTab() {
+ super();
+ this.setHasSubtypes(true);
+ String unlocalizedName = "itemCreativeTabs";
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(GregTech_API.TAB_GREGTECH);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_0");
+ this.icons[1] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_1");
+ this.icons[2] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_2");
+ this.icons[3] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_3");
+ this.icons[4] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_4");
+ this.icons[5] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_5");
+ this.icons[6] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_6");
+ this.icons[7] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_7");
+ this.icons[8] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_8");
+ this.icons[9] = reg.registerIcon(CORE.MODID + ":" + "controlcore/Core_9");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[meta];
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 10; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return this.getUnlocalizedName() + "_" + stack.getItemDamage();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemEmpty.java b/src/main/java/gtPlusPlus/core/item/general/ItemEmpty.java
new file mode 100644
index 0000000000..c832d28bbd
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemEmpty.java
@@ -0,0 +1,21 @@
+package gtPlusPlus.core.item.general;
+
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+
+public class ItemEmpty extends CoreItem{
+
+ public ItemEmpty() {
+ super("item.empty", AddToCreativeTab.tabMisc);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack tItem) {
+ return "Empty";
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemGemShards.java b/src/main/java/gtPlusPlus/core/item/general/ItemGemShards.java
new file mode 100644
index 0000000000..5181a32bc7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemGemShards.java
@@ -0,0 +1,78 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.List;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import gtPlusPlus.core.item.base.BaseItemColourable;
+import gtPlusPlus.core.util.Utils;
+
+public class ItemGemShards extends BaseItemColourable{
+
+ public ItemGemShards(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg,
+ String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect, int rgb) {
+ super(unlocalizedName, creativeTab, stackSize, maxDmg, description, regRarity, colour, Effect, rgb);
+ }
+
+ public ItemGemShards(String unlocalizedName, String displayName, CreativeTabs creativeTab, int stackSize,
+ int maxDmg, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect, int rgb) {
+ super(unlocalizedName, displayName, creativeTab, stackSize, maxDmg, description, regRarity, colour, Effect, rgb);
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 4; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ //0 - Diamond
+ //1 - Emerald
+ //2 - Ruby
+ //3 - Sapphire
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ String suffix = " Shards";
+ String gemType = "";
+ if (tItem.getItemDamage() == 0){
+ gemType = "Diamond";
+ }
+ else if (tItem.getItemDamage() == 1){
+ gemType = "Emerald";
+ }
+ else if (tItem.getItemDamage() == 2){
+ gemType = "Ruby";
+ }
+ else if (tItem.getItemDamage() == 3){
+ gemType = "Sapphire";
+ }
+ return (gemType+suffix);
+
+ }
+
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ if (this.getDamage(stack)==0){
+ return Utils.rgbtoHexValue(150, 150, 220);
+ }
+ else if (this.getDamage(stack)==1){
+ return Utils.rgbtoHexValue(75, 182, 75);
+ }
+ else if (this.getDamage(stack)==2){
+ return Utils.rgbtoHexValue(182, 77, 77);
+ }
+ else {
+ return Utils.rgbtoHexValue(77, 75, 182);
+ }
+ }
+
+
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemGenericToken.java b/src/main/java/gtPlusPlus/core/item/general/ItemGenericToken.java
new file mode 100644
index 0000000000..21d2c6e120
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemGenericToken.java
@@ -0,0 +1,182 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.HashMap;
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+
+public class ItemGenericToken extends CoreItem {
+
+ public final HashMap<Integer, String> mLocalNames;
+ public final HashMap<Integer, Integer> mMaxStackSizes;
+ public final HashMap<Integer, String[]> mDescriptionArrays;
+ public final HashMap<Integer, EnumRarity> mRarities;
+ public final HashMap<Integer, EnumChatFormatting> mCustomNameColours;
+ public final HashMap<Integer, IIcon> mIcons;
+ private final String mTextureDir;
+
+ public ItemGenericToken() {
+ this("itemGenericToken", "Token", new String[] { "Can be reclaimed in some way, shape or form" }, "token");
+ }
+
+ public ItemGenericToken(String aUnlocalName, String aInternalName, String[] aBaseTooltip, String aTextureDir) {
+ super(aUnlocalName, aInternalName, AddToCreativeTab.tabMisc, 64, 1000, aBaseTooltip, EnumRarity.common, EnumChatFormatting.RESET, false, null);
+ mLocalNames = new HashMap<Integer, String>();
+ mMaxStackSizes = new HashMap<Integer, Integer>();
+ mDescriptionArrays = new HashMap<Integer, String[]>();
+ mRarities = new HashMap<Integer, EnumRarity>();
+ mCustomNameColours = new HashMap<Integer, EnumChatFormatting>();
+ mIcons = new HashMap<Integer, IIcon>();
+ mTextureDir = aTextureDir;
+ }
+
+ public boolean register(int id, String aLocalName, int aMaxStack, String aDescript) {
+ return register(id, aLocalName, aMaxStack, new String[] { aDescript });
+ }
+
+ public boolean register(int id, String aLocalName, int aMaxStack, String[] aDescript) {
+ return register(id, aLocalName, aMaxStack, aDescript, EnumRarity.common, EnumChatFormatting.RESET);
+ }
+
+ public boolean register(int id, String aLocalName, int aMaxStack, String[] aDescript, EnumRarity aRarity,
+ EnumChatFormatting aCustomNameColour) {
+ int[][] sizes = new int[2][6];
+ sizes[0][0] = mLocalNames.size();
+ sizes[0][1] = mMaxStackSizes.size();
+ sizes[0][2] = mDescriptionArrays.size();
+ sizes[0][3] = mRarities.size();
+ sizes[0][4] = mCustomNameColours.size();
+ //sizes[0][5] = mIcons.size();
+ mLocalNames.put(id, aLocalName);
+ mMaxStackSizes.put(id, aMaxStack);
+ mDescriptionArrays.put(id, aDescript);
+ mRarities.put(id, aRarity);
+ mCustomNameColours.put(id, aCustomNameColour);
+ sizes[1][0] = mLocalNames.size();
+ sizes[1][1] = mMaxStackSizes.size();
+ sizes[1][2] = mDescriptionArrays.size();
+ sizes[1][3] = mRarities.size();
+ sizes[1][4] = mCustomNameColours.size();
+ //sizes[1][5] = mIcons.size();
+ boolean b = sizes[0][0] > sizes[1][0] && sizes[0][1] > sizes[1][1] && sizes[0][2] > sizes[1][2]
+ && sizes[0][3] > sizes[1][3] && sizes[0][4] > sizes[1][4];
+ return b;
+ }
+
+ // Handle Sub items
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) {
+ for (int i = 0, j = mIcons.size(); i < j; i++) {
+ final ItemStack tStack = new ItemStack(this, 1, i);
+ aList.add(tStack);
+ }
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ super.addInformation(stack, aPlayer, list, bool);
+ for (String s : mDescriptionArrays.get(stack.getItemDamage())) {
+ list.add(s);
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+
+ String s = "" + mCustomNameColours.get(tItem.getItemDamage());
+ String parent = super.getItemStackDisplayName(tItem);
+ if (mLocalNames.get(tItem.getItemDamage()).length() > 0 && parent.toLowerCase().contains(".name")) {
+ s = s + mLocalNames.get(tItem.getItemDamage());
+ } else {
+ s = s + parent;
+ }
+ return s;
+ }
+
+ @Override
+ public EnumRarity getRarity(ItemStack par1ItemStack) {
+ return mRarities.get(par1ItemStack.getItemDamage());
+ }
+
+ @Override
+ public boolean hasEffect(ItemStack par1ItemStack) {
+ return false;
+ }
+
+ @Override
+ public int getMetadata(int p_77647_1_) {
+ return 0;
+ }
+
+ @Override
+ public int getDisplayDamage(ItemStack stack) {
+ return 0;
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ return 0D;
+ }
+
+ @Override
+ public boolean isDamaged(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public int getItemStackLimit() {
+ return 64;
+ }
+
+ @Override
+ public int getItemStackLimit(ItemStack aStack) {
+ if (aStack == null) {
+ return getItemStackLimit();
+ }
+ else {
+ Integer aSize = mMaxStackSizes.get(aStack.getItemDamage());
+ if (aSize != null) {
+ return aSize;
+ }
+ else {
+ return getItemStackLimit();
+ }
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(final IIconRegister aIconRegister) {
+ for (int i = 0, j = mLocalNames.size(); i < j; i++) {
+ mIcons.put(i, aIconRegister.registerIcon(CORE.MODID + ":" + mTextureDir + "/" + i));
+ }
+ }
+
+ @Override
+ public final IIcon getIconFromDamage(final int aMetaData) {
+ if (aMetaData < 0) {
+ return null;
+ }
+ return mIcons.get(aMetaData);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemGiantEgg.java b/src/main/java/gtPlusPlus/core/item/general/ItemGiantEgg.java
new file mode 100644
index 0000000000..b3338bb681
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemGiantEgg.java
@@ -0,0 +1,300 @@
+package gtPlusPlus.core.item.general;
+
+import static gtPlusPlus.core.lib.CORE.RANDOM;
+
+import java.util.List;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.entity.item.ItemEntityGiantEgg;
+import gtPlusPlus.core.item.base.BaseItemTickable;
+import gtPlusPlus.core.item.general.spawn.ItemCustomSpawnEgg;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+public class ItemGiantEgg extends BaseItemTickable {
+
+ private static ItemStack turnsIntoItem;
+ private static ItemStack mCorrectEgg;
+ private static ItemStack mCorrectStemCells;
+
+ public void registerFuel(int burn){
+ CORE.burnables.add(new Pair<Integer, ItemStack>(burn, ItemUtils.getSimpleStack(this, 1)));
+ }
+
+ public final void registerOrdictionary(String name){
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), name);
+ }
+
+ public ItemGiantEgg() {
+ this(Utils.rgbtoHexValue(255, 255, 255), Short.MAX_VALUE * Byte.MAX_VALUE, new String[] {"I had best try disassemble this.. for science!"});
+ }
+
+ private ItemGiantEgg(int colour, int maxTicks, String[] desc1) {
+ super(true, false, "itemBigEgg", colour, maxTicks, desc1);
+ setTextureName(CORE.MODID + ":itemBigEgg");
+ this.setMaxStackSize(1);
+ registerFuel(5000);
+ registerOrdictionary("fuelLargeChickenEgg");
+ }
+
+ public static void postInit(ItemGiantEgg aGiantEggItem) {
+ ItemGiantEgg.turnsIntoItem = getSpawnEggStack();
+ //new DecayableRecipe(aGiantEggItem.maxTicks, getSimpleStack(aGiantEggItem), ItemUtils.getSimpleStack(ItemGiantEgg.turnsIntoItem, 1));
+ }
+
+ private static ItemStack getSpawnEggStack() {
+ //Set the correct egg for future hatches
+ if (mCorrectEgg == null) {
+ /*for (int g=0;g<Byte.MAX_VALUE;g++) {
+ ItemStack mSpawn = ItemUtils.simpleMetaStack(Items.spawn_egg, g, 1);
+ if (mSpawn != null) {
+ //String s = ("" + StatCollector.translateToLocal(mSpawn.getUnlocalizedName() + ".name")).trim();
+ String s1 = EntityList.getStringFromID(mSpawn.getItemDamage());
+ if (s1 != null){
+ //s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name");
+ if (s1.equalsIgnoreCase("bigChickenFriendly")) {
+ mCorrectEgg = mSpawn;
+ return mCorrectEgg;
+ }
+ }
+ }
+ }*/
+ ItemStack aTempEgg = ItemCustomSpawnEgg.getSpawnEggForEntityname("bigChickenFriendly", 1);
+ if (aTempEgg != null) {
+ mCorrectEgg = aTempEgg;
+ }
+ }
+ return mCorrectEgg;
+ }
+
+ private static ItemStack getStemCellStack() {
+ if (mCorrectStemCells == null) {
+ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 28) {
+ ItemStack xl = ItemUtils.getValueOfItemList("Circuit_Chip_Stemcell", 1, ItemUtils.getSimpleStack(Items.egg, 2));
+ if (xl != null) {
+ mCorrectStemCells = xl.copy();
+ }
+ }
+ else {
+ mCorrectStemCells = ItemUtils.getSimpleStack(Items.egg, 2);
+ }
+ }
+ return mCorrectStemCells;
+ }
+
+ protected int getMaxTicks(ItemStack aStack) {
+ if (aStack != null && aStack.hasTagCompound() && aStack.getTagCompound().hasKey("mEggAge")) {
+ return NBTUtils.getInteger(aStack, "mEggAge");
+ }
+ return maxTicks;
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister i) {
+ this.mIcon[0] = i.registerIcon(CORE.MODID + ":" + "itemBigEgg");
+ }
+
+
+ @Override
+ protected boolean createNBT(World world, ItemStack aStack){
+
+ if (aStack.getTagCompound() != null && aStack.getTagCompound().hasKey("size")) {
+ return false;
+ }
+ Logger.INFO("Egg: "+ReflectionUtils.getMethodName(1));
+ Logger.INFO("Egg: "+ReflectionUtils.getMethodName(2));
+ Logger.INFO("Egg: "+ReflectionUtils.getMethodName(3));
+ Logger.INFO("Egg: "+ReflectionUtils.getMethodName(4));
+ Logger.INFO("Egg: "+ReflectionUtils.getMethodName(5));
+ Logger.INFO("Egg: "+ReflectionUtils.getMethodName(6));
+ //Logger.INFO("Creating Egg NBT.");
+ boolean aSuper = super.createNBT(world, aStack);
+ int size = MathUtils.randInt(1, 8);
+ NBTUtils.setInteger(aStack, "size", size);
+ NBTUtils.setInteger(aStack, "mEggAge", ((MathUtils.randInt(8000, 16000)*size)));
+ ItemStack aStemCells = getStemCellStack();
+ if (aStemCells != null) {
+ int mSize = NBTUtils.getInteger(aStack, "size");
+ float mSizeMod = (MathUtils.randInt(-5, 5)/5);
+ mSize += mSizeMod;
+ mSize = Math.max(mSize, 1);
+ ItemStack eggYolks[] = new ItemStack[mSize];
+ for (int u=0;u<mSize;u++) {
+ eggYolks[u] = ItemUtils.getSimpleStack(aStemCells, MathUtils.randInt(1, 4));
+ }
+ int mexpected = 0;
+ for (ItemStack e : eggYolks) {
+ if (e != null) {
+ mexpected += e.stackSize;
+ }
+ }
+ if (mexpected > 0) {
+ NBTUtils.setInteger(aStack, "mExpected", mexpected);
+ NBTUtils.writeItemsToGtCraftingComponents(aStack, new ItemStack[]{ ItemUtils.getSimpleStack(aStemCells, mexpected)}, true);
+ }
+ }
+ return aSuper;
+
+ }
+
+
+ @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 == null || iStack == null) {
+ return;
+ }
+ if (world.isRemote) {
+ return;
+ }
+ if (iStack.getTagCompound() == null || !iStack.getTagCompound().hasKey("size")) {
+ this.createNBT(world, iStack);
+ Logger.INFO("Egg has no NBT, creating (onUpdate)");
+ }
+ boolean a1, a2;
+ a1 = this.isTicking(world, iStack);
+ a2 = a1 ? tickItemTag(world, iStack) : false;
+
+ //Logger.INFO("Is Ticking? "+a1);
+ //Logger.INFO("Did Tick? "+a2);
+ if (!a1 && !a2) {
+ if (entityHolding instanceof EntityPlayer){
+ if (MathUtils.randInt(0, 1000) >= 990) {
+ if (NBTUtils.hasKey(iStack, "size")) {
+ if ((NBTUtils.getInteger(iStack, "size")+1) >= MathUtils.randInt(0, 9)) {
+ ItemStack replacement = ItemUtils.getSimpleStack(getHatchResult(), 1);
+ if (replacement == null) {
+
+ }
+ //Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+replacement.getDisplayName()+".");
+ final ItemStack tempTransform = replacement.copy();
+ if (iStack.stackSize > 1){
+ int u = iStack.stackSize;
+ tempTransform.stackSize = u;
+ ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
+ for (int l=0;l<u;l++){
+ ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
+ }
+ }
+ else {
+ tempTransform.stackSize=1;
+ ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
+ ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public ItemStack getHatchResult() {
+ return turnsIntoItem;
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack aStack) {
+ String localName = super.getItemStackDisplayName(aStack);
+ /*if (aStack.getTagCompound() == null){
+ createNBT(null, aStack);
+ Logger.INFO("Egg has no NBT, creating (getDisplayName)");
+ }*/
+ int size = 1;
+ if (NBTUtils.hasKey(aStack, "size")){
+ size = NBTUtils.getInteger(aStack, "size");
+ return ""+size+" "+localName;
+ }
+ return "?? "+localName;
+ }
+
+
+ @Override
+ public boolean hasCustomEntity(ItemStack stack) {
+ return true;
+ }
+
+ @Override
+ public Entity createEntity(World world, Entity location, ItemStack itemstack) {
+ if (location instanceof EntityPlayer) {
+ EntityPlayer player = (EntityPlayer) location;
+ if (itemstack == null) {
+ return null;
+ }
+ else if (itemstack.stackSize == 0) {
+ return null;
+ }
+ else {
+ ItemEntityGiantEgg entityitem = new ItemEntityGiantEgg(world, player.posX, player.posY - 0.30000001192092896D + (double)player.getEyeHeight(), player.posZ, itemstack);
+ entityitem.delayBeforeCanPickup = 40;
+ entityitem.func_145799_b(player.getCommandSenderName());
+ float f = 0.1F;
+ float f1;
+ f = 0.3F;
+ entityitem.motionX = (double)(-MathHelper.sin(player.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float)Math.PI) * f);
+ entityitem.motionZ = (double)(MathHelper.cos(player.rotationYaw / 180.0F * (float)Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float)Math.PI) * f);
+ entityitem.motionY = (double)(-MathHelper.sin(player.rotationPitch / 180.0F * (float)Math.PI) * f + 0.1F);
+ f = 0.02F;
+ f1 = RANDOM.nextFloat() * (float)Math.PI * 2.0F;
+ f *= RANDOM.nextFloat();
+ entityitem.motionX += Math.cos((double)f1) * (double)f;
+ entityitem.motionY += (double)((RANDOM.nextFloat() - RANDOM.nextFloat()) * 0.1F);
+ entityitem.motionZ += Math.sin((double)f1) * (double)f;
+ return entityitem;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ int size = 0;
+ long age = 0;
+ long life = 0;
+ int expected = 0;
+ if (this.descriptionString.length > 0) {
+ list.add(EnumChatFormatting.GRAY+this.descriptionString[0]);
+ }
+ if (NBTUtils.hasKey(stack, "size")){
+ size = NBTUtils.getInteger(stack, "size");
+ if (size > 0 && NBTUtils.hasKey(stack, "TickableItem")){
+ NBTTagCompound aNBT = stack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("TickableItem");
+ if (aNBT != null) {
+ age = aNBT.getLong("Tick");
+ }
+ }
+ }
+ if (NBTUtils.hasKey(stack, "mEggAge")){
+ life = NBTUtils.getInteger(stack, "mEggAge");
+ }
+ if (NBTUtils.hasKey(stack, "mExpected")){
+ expected = NBTUtils.getInteger(stack, "mExpected");
+ }
+ }
+ String aSize = size > 0 ? ""+size : "??";
+ String aExpected = expected > 0 ? ""+expected : "??";
+ String aAge = age > 0 ? ""+(age/20) : "??";
+ String aLife = life > 0 ? ""+(life/20) : "??";
+ list.add("Egg Size: "+aSize+" ounces");
+ list.add("Expected Stem Cells: "+aExpected);
+ list.add("Age: "+aAge+"s"+" / "+aLife+"s");
+ list.add("Larger eggs take longer to hatch,");
+ list.add("but have a better chance of hatching.");
+
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemHalfCompleteCasings.java b/src/main/java/gtPlusPlus/core/item/general/ItemHalfCompleteCasings.java
new file mode 100644
index 0000000000..ad9abc8ab2
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemHalfCompleteCasings.java
@@ -0,0 +1,63 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.List;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import gtPlusPlus.core.item.base.BaseItemColourable;
+import gtPlusPlus.core.util.Utils;
+
+public class ItemHalfCompleteCasings extends BaseItemColourable{
+
+ public ItemHalfCompleteCasings(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg,
+ String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect, int rgb) {
+ super(unlocalizedName, creativeTab, stackSize, maxDmg, description, regRarity, colour, Effect, rgb);
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 4; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ String prefix = super.getItemStackDisplayName(tItem);
+ String casingType = "";
+ if (tItem.getItemDamage() == 0){
+ casingType = " I";
+ }
+ else if (tItem.getItemDamage() == 1){
+ casingType = " II";
+ }
+ else if (tItem.getItemDamage() == 2){
+ casingType = " III";
+ }
+ else if (tItem.getItemDamage() == 3){
+ casingType = " IV";
+ }
+ return (prefix+casingType);
+ }
+
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ if (this.getDamage(stack)==0){
+ return Utils.rgbtoHexValue(52, 52, 52);
+ }
+ else if (this.getDamage(stack)==1){
+ return Utils.rgbtoHexValue(80, 90, 222);
+ }
+ else if (this.getDamage(stack)==2){
+ return Utils.rgbtoHexValue(182, 77, 177);
+ }
+ else {
+ return Utils.rgbtoHexValue(77, 175, 182);
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemHealingDevice.java b/src/main/java/gtPlusPlus/core/item/general/ItemHealingDevice.java
new file mode 100644
index 0000000000..db06af8297
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemHealingDevice.java
@@ -0,0 +1,432 @@
+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.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
+import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import ic2.api.item.IElectricItemManager;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
+
+@Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")})
+public class ItemHealingDevice extends Item implements IElectricItem, IElectricItemManager, IBauble{
+
+ private final String unlocalizedName = "personalHealingDevice";
+ private final ItemStack thisStack;
+ private final static int maxValueEU = 1000000000;
+ protected double chargeEU = 0;
+
+ public ItemHealingDevice(){
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ this.setUnlocalizedName(this.unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setTextureName(CORE.MODID + ":" + "personalCloakingDevice");
+ this.thisStack = ItemUtils.getSimpleStack(this);
+ GameRegistry.registerItem(this, this.unlocalizedName);
+ }
+
+ @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;
+ }
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public boolean canProvideEnergy(final ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public Item getChargedItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(maxValueEU);
+ return x.getItem();
+ }
+
+ @Override
+ public Item getEmptyItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(0);
+ return x.getItem();
+ }
+
+ @Override
+ public double getMaxCharge(final ItemStack itemStack) {
+ return maxValueEU;
+ }
+
+ @Override
+ public int getTier(final ItemStack itemStack) {
+ return 5;
+ }
+
+ @Override
+ public double getTransferLimit(final ItemStack itemStack) {
+ return 32784;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+
+ return (EnumChatFormatting.BLUE+"Personal Healing NanoBooster"+EnumChatFormatting.RESET);
+ }
+
+ @Override
+ public double getDurabilityForDisplay(final ItemStack stack)
+ {
+ //return 1.0D - getEnergyStored(stack) / this.capacity;
+ return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack));
+ }
+
+ @Override
+ public boolean showDurabilityBar(final ItemStack stack)
+ {
+ return true;
+ }
+
+ public double secondsLeft(final ItemStack stack){
+
+ double r = 0;
+ r = this.getCharge(stack)/(1638400/4);
+ return (int) r;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+
+ String aString1 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.1");
+ String aString2 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.2");
+ String aString3 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.3");
+ String aString4 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.4");
+ String aString5 = StatCollector.translateToLocal("GTPP.nanohealer.tooltip.5");
+ String aStringTooltip = StatCollector.translateToLocal("GTPP.nanohealer.hidden");
+ String aEuInfo = StatCollector.translateToLocal("GTPP.info.euInfo");
+ String aTier = StatCollector.translateToLocal("GTPP.machines.tier");
+ String aInputLimit = StatCollector.translateToLocal("GTPP.info.inputLimit");
+ String aCurrentPower = StatCollector.translateToLocal("GTPP.info.currentPower");
+ String aEU = StatCollector.translateToLocal("GTPP.info.eu");
+ String aEUT = aEU+"/t";
+ boolean isShowing = getShowMessages(stack);
+
+ list.add("");
+
+ list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN + aString2 + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN + aString3 + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.RED + aString4 + EnumChatFormatting.GRAY);
+
+ list.add("");
+
+ list.add(EnumChatFormatting.GOLD + aEuInfo + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GRAY + aTier+": [" + EnumChatFormatting.YELLOW + this.getTier(stack)
+ + EnumChatFormatting.GRAY + "] "+aInputLimit+": [" + EnumChatFormatting.YELLOW
+ + this.getTransferLimit(stack) + EnumChatFormatting.GRAY + aEUT+"]");
+ list.add(EnumChatFormatting.GRAY + aCurrentPower +": [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack)
+ + EnumChatFormatting.GRAY + aEU +"] [" + EnumChatFormatting.YELLOW
+ + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY
+ + "%]");
+ list.add(EnumChatFormatting.GOLD + aString5 + EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GOLD + aStringTooltip + " " + (!isShowing ? EnumChatFormatting.DARK_GREEN : EnumChatFormatting.DARK_RED) + !isShowing + EnumChatFormatting.GRAY);
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @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);
+ }
+
+ @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);
+ }
+
+ @Override
+ public double getCharge(final ItemStack stack) {
+ return ElectricItem.manager.getCharge(stack);
+ }
+
+ @Override
+ public boolean canUse(final ItemStack stack, final double amount) {
+ return ElectricItem.manager.canUse(stack, amount);
+ }
+
+ @Override
+ public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) {
+ return ElectricItem.manager.use(stack, amount, entity);
+ }
+
+ @Override
+ public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) {
+ ElectricItem.manager.chargeFromArmor(stack, entity);
+ }
+
+ @Override
+ public String getToolTip(final ItemStack stack) {
+ return ElectricItem.manager.getToolTip(stack);
+ }
+
+ @Override
+ public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public BaubleType getBaubleType(final ItemStack arg0) {
+ return BaubleType.AMULET;
+ }
+
+ @Override //TODO
+ public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) {
+
+ }
+
+ @Override //TODO
+ public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) {
+
+ }
+
+ @Override //TODO
+ public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase arg1) {
+ if (arg1 != null && arg1.worldObj != null && !arg1.worldObj.isRemote){
+
+ //Try Charge First
+
+ //Inv Slots
+ for (final ItemStack aInvStack : ((EntityPlayer) arg1).inventory.mainInventory) {
+ if (aInvStack == aBaubleStack) {
+ continue;
+ }
+
+ if (this.getCharge(aBaubleStack) == this.getMaxCharge(aBaubleStack)) {
+ break;
+ }
+
+ if (aInvStack != null) {
+ if (ChargingHelper.isItemValid(aInvStack)) {
+
+
+ double aTransferRate;
+ double aCurrentChargeForThisBauble;
+ int mTier;
+ final IElectricItem electricItem = (IElectricItem) aInvStack.getItem();
+
+ if (electricItem != null) {
+
+ aTransferRate = electricItem.getTransferLimit(aInvStack);
+ mTier = electricItem.getTier(aInvStack);
+ aCurrentChargeForThisBauble = ElectricItem.manager.getCharge(aBaubleStack);
+
+ if (aCurrentChargeForThisBauble < maxValueEU) {
+ if ((ElectricItem.manager.getCharge(aInvStack) >= aTransferRate)) {
+ if (electricItem.canProvideEnergy(aInvStack)) {
+ double d = ElectricItem.manager.discharge(aInvStack, aTransferRate, mTier, false, true, false);
+ //Logger.INFO("Charging from "+aInvStack.getDisplayName() +" | "+d);
+ ElectricItem.manager.charge(aBaubleStack, d, mTier, true, false);
+ }
+ }
+ }
+ }
+ }
+ }
+ if (this.getCharge(aBaubleStack) <= (this.getMaxCharge(aBaubleStack) - getTransferLimit(aBaubleStack))) {
+ continue;
+ }
+ else {
+ break;
+ }
+ }
+
+
+ //Try Heal
+ if (this.getCharge(aBaubleStack) > 0){
+
+ //health Check
+ float hp = 0;
+ if (arg1.getHealth() < arg1.getMaxHealth()){
+ final float rx = arg1.getMaxHealth()-arg1.getHealth();
+ Logger.INFO("rx:"+rx);
+ arg1.heal(rx*2);
+ hp = rx;
+ this.discharge(aBaubleStack, (1638400)*rx, 6, true, true, false);
+ }
+
+ //Hunger Check
+ int hunger = 0;
+ if (arg1 instanceof EntityPlayerMP) {
+ EntityPlayerMP g = (EntityPlayerMP) arg1;
+ if (g != null) {
+ hunger = 20 - g.getFoodStats().getFoodLevel();
+ g.getFoodStats().setFoodLevel(g.getFoodStats().getFoodLevel() + hunger);
+ this.discharge(aBaubleStack, (1638400) * hunger, 6, true, true, false);
+ }
+ }
+
+ //Saturation Check
+ float saturation = 0;
+ if (arg1 instanceof EntityPlayerMP) {
+ EntityPlayerMP g = (EntityPlayerMP) arg1;
+ if (g != null) {
+ saturation = 5f - g.getFoodStats().getSaturationLevel();
+ g.getFoodStats().setFoodSaturationLevel(g.getFoodStats().getSaturationLevel() + saturation);
+ this.discharge(aBaubleStack, (1638400) * saturation, 6, true, true, false);
+ }
+ }
+
+
+ saturation = (int) saturation;
+
+ //Only show Messages if they're enabled.
+ if (getShowMessages(aBaubleStack)) {
+ if (hp > 0 || hunger > 0 || saturation > 0)
+ PlayerUtils.messagePlayer((EntityPlayer) arg1,
+ "Your NanoBooster Whirs! Leaving you feeling stronger.");
+
+ if (hp > 0)
+ PlayerUtils.messagePlayer((EntityPlayer) arg1, "Healed " + hp + " hp.");
+
+ if (hunger > 0)
+ PlayerUtils.messagePlayer((EntityPlayer) arg1, "Healed " + hunger + " hunger.");
+
+ if (saturation > 0)
+ PlayerUtils.messagePlayer((EntityPlayer) arg1, "Satured Hunger by " + saturation + ".");
+
+ if (hp > 0 || hunger > 0 || saturation > 0)
+ PlayerUtils.messagePlayer((EntityPlayer) arg1,
+ "You check it's remaining uses, it has " + (int) this.secondsLeft(aBaubleStack) + ".");
+
+ }
+
+
+
+
+ }
+ }
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ private static boolean createNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ tagMain.setBoolean("ShowMSG", false);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static final boolean getShowMessages(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT == null) {
+ if (!createNBT(aStack)) {
+ return false;
+ }
+ else {
+ aNBT = aStack.getTagCompound();
+ }
+ }
+ return aNBT.getBoolean("ShowMSG");
+
+ }
+
+ public static final boolean setShowMessages(final ItemStack aStack, final boolean aShow) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT == null) {
+ if (!createNBT(aStack)) {
+ return false;
+ } else {
+ aNBT = aStack.getTagCompound();
+ }
+ }
+ aNBT.setBoolean("ShowMSG", aShow);
+ return true;
+ }
+
+ @Override
+ public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_,
+ int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
+ // TODO Auto-generated method stub
+ return super.onItemUse(p_77648_1_, p_77648_2_, p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_8_,
+ p_77648_9_, p_77648_10_);
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
+ ItemStack superStack = super.onItemRightClick(aStack, aWorld, aPlayer);
+ boolean isShiftHeld = KeyboardUtils.isShiftKeyDown();
+ if (isShiftHeld) {
+ boolean oldState = getShowMessages(superStack);
+ boolean newState = Utils.invertBoolean(oldState);
+ ItemHealingDevice.setShowMessages(superStack, newState);
+ PlayerUtils.messagePlayer(aPlayer, (!oldState ? "Showing info messages" : "Hiding info messages"));
+ }
+ return superStack;
+ }
+
+ @Override
+ public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) {
+ return true;
+ }
+
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemLavaFilter.java b/src/main/java/gtPlusPlus/core/item/general/ItemLavaFilter.java
new file mode 100644
index 0000000000..c34ad9e8d3
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemLavaFilter.java
@@ -0,0 +1,127 @@
+package gtPlusPlus.core.item.general;
+
+import java.util.List;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+
+import gregtech.api.enums.ItemList;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+
+public class ItemLavaFilter extends CoreItem {
+
+ public IIcon[] mIcon = new IIcon[1];
+
+ public ItemLavaFilter() {
+ super("itemLavaFilter", AddToCreativeTab.tabMachines, 1, 100, new String[] {"Lava Filter"}, EnumRarity.common,
+ EnumChatFormatting.BLACK, false, null);
+ setGregtechItemList();
+ }
+
+ private final boolean setGregtechItemList() {
+ ItemList.Component_LavaFilter.set(this);
+ return ItemList.Component_LavaFilter.get(1) != null ? true : false;
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.mIcon[0] = reg.registerIcon(CORE.MODID + ":" + "itemLavaFilter");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.mIcon[0];
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack tItem) {
+ return "Lava Filter";
+ }
+
+ private static boolean createNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+ tagNBT.setLong("Damage", 0);
+ tagMain.setTag("LavaFilter", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ public static final long getFilterDamage(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("LavaFilter");
+ if (aNBT != null) {
+ return aNBT.getLong("Damage");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return 0L;
+ }
+
+ public static final boolean setFilterDamage(final ItemStack aStack, final long aDamage) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("LavaFilter");
+ if (aNBT != null) {
+ aNBT.setLong("Damage", aDamage);
+ return true;
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return false;
+ }
+
+ @Override
+ public double getDurabilityForDisplay(ItemStack stack) {
+ if (stack.getTagCompound() == null){
+ createNBT(stack);
+ }
+ double currentDamage = getFilterDamage(stack);
+ double durabilitypercent = currentDamage / 100;
+ return durabilitypercent;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ list.add(EnumChatFormatting.GRAY+"Filters Lava within a Thermal Boiler.");
+ EnumChatFormatting durability = EnumChatFormatting.GRAY;
+ if (100-getFilterDamage(stack) > 80){
+ durability = EnumChatFormatting.GRAY;
+ }
+ else if (100-getFilterDamage(stack) > 60){
+ durability = EnumChatFormatting.GREEN;
+ }
+ else if (100-getFilterDamage(stack) > 40){
+ durability = EnumChatFormatting.YELLOW;
+ }
+ else if (100-getFilterDamage(stack) > 20){
+ durability = EnumChatFormatting.GOLD;
+ }
+ else if (100-getFilterDamage(stack) > 0){
+ durability = EnumChatFormatting.RED;
+ }
+ list.add(durability+""+(100-getFilterDamage(stack))+EnumChatFormatting.GRAY+" / "+100);
+ //super.addInformation(stack, player, list, bool);
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return true;
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java b/src/main/java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java
new file mode 100644
index 0000000000..fa008bf1a3
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/ItemSlowBuildingRing.java
@@ -0,0 +1,140 @@
+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.handler.events.CustomMovementHandler;
+import gtPlusPlus.core.handler.events.SneakManager;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+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;
+
+@Optional.InterfaceList(value = {@Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles")})
+public class ItemSlowBuildingRing extends Item implements IBauble{
+
+ private final String unlocalizedName = "SlowBuildingRing";
+ CustomMovementHandler x;
+
+ public ItemSlowBuildingRing(){
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ this.setUnlocalizedName(this.unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setTextureName(CORE.MODID + ":" + "itemSlowBuildersRing");
+ ItemUtils.getSimpleStack(this);
+ GameRegistry.registerItem(this, this.unlocalizedName);
+ }
+
+ @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;
+ }
+ super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return (EnumChatFormatting.YELLOW+"Slow Building Ring"+EnumChatFormatting.GRAY);
+ }
+
+ @Override
+ public boolean showDurabilityBar(final ItemStack stack)
+ {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @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 Ring within Baubles. Prevents you from sprinting."+EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN+"Movement speed reduced to crouch speed."+EnumChatFormatting.GRAY);
+ list.add(EnumChatFormatting.GREEN+"Press shift while worn to toggle crouch on/off."+EnumChatFormatting.GRAY);
+ list.add("");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) {
+ return true;
+ }
+
+ @Override
+ public BaubleType getBaubleType(final ItemStack arg0) {
+ return BaubleType.RING;
+ }
+
+ @Override //TODO
+ public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) {
+ try {
+ EntityPlayer aPlayer;
+ if (arg1 instanceof EntityPlayer) {
+ aPlayer = (EntityPlayer) arg1;
+ SneakManager s = SneakManager.get(aPlayer);
+ s.putRingOn();
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ @Override //TODO
+ public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) {
+ try {
+ EntityPlayer aPlayer;
+ if (arg1 instanceof EntityPlayer) {
+ aPlayer = (EntityPlayer) arg1;
+ SneakManager s = SneakManager.get(aPlayer);
+ s.takeRingOff();
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ @Override //TODO
+ public void onWornTick(final ItemStack arg0, final EntityLivingBase arg1) {
+ doEffect(arg1);
+ }
+
+ private static void doEffect(final EntityLivingBase arg1){
+ try {
+ // Get World
+ World aWorld = arg1.worldObj;
+ if (aWorld != null && !aWorld.isRemote) {
+ EntityPlayer aPlayer;
+ if (arg1 instanceof EntityPlayer) {
+ aPlayer = (EntityPlayer) arg1;
+ SneakManager s = SneakManager.get(aPlayer);
+ if (!aPlayer.isSneaking()){
+ aPlayer.setSneaking(true);
+ }
+ if (aPlayer.isSprinting()) {
+ aPlayer.setSprinting(false);
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java b/src/main/java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java
new file mode 100644
index 0000000000..9feea3c91a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/NuclearFuelRodBase.java
@@ -0,0 +1,211 @@
+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;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.player.FillBucketEvent;
+
+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);
+ }
+
+ /**
+ * 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_;
+ }
+
+ 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_3_.inventory.addItemStackToInventory(event.result))
+ {
+ p_77659_3_.dropPlayerItemWithRandomChoice(event.result, false);
+ }
+
+ 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);
+ }
+ }
+ }
+
+ return p_77659_1_;
+ }
+
+ 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_;
+ }
+ }
+
+ /**
+ * 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;
+ }
+ 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(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);
+ }
+
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/RF2EU_Battery.java b/src/main/java/gtPlusPlus/core/item/general/RF2EU_Battery.java
new file mode 100644
index 0000000000..5ff5b5a62b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/RF2EU_Battery.java
@@ -0,0 +1,315 @@
+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 net.minecraft.client.Minecraft;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+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.EnumChatFormatting;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import ic2.api.item.IElectricItemManager;
+
+public class RF2EU_Battery extends ItemEnergyContainer implements IElectricItem, IElectricItemManager, IFuelHandler{
+
+ public static double rfPerEU = 3.4;
+ private final String unlocalizedName = "rfEUBattery";
+ private final ItemStack thisStack;
+ private final static int maxValueEU = 100000000;
+ private final static int maxValueRF = (int) (maxValueEU * rfPerEU);
+ protected double chargeEU = 0;
+
+ public RF2EU_Battery(){
+ super(maxValueRF);
+ GameRegistry.registerFuelHandler(this);
+ //this.setMaxDamage(Integer.MAX_VALUE);
+ //this.setDamage(UtilsItems.getSimpleStack(this), 0);
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ this.setUnlocalizedName(this.unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setTextureName(CORE.MODID + ":" + "itemIngot");
+ this.thisStack = ItemUtils.getSimpleStack(this);
+ GameRegistry.registerItem(this, this.unlocalizedName);
+ }
+
+ @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_);
+ }
+
+ @Override
+ public boolean canProvideEnergy(final ItemStack itemStack) {
+ return true;
+ }
+
+ @Override
+ public Item getChargedItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(maxValueEU);
+ return x.getItem();
+ }
+
+ @Override
+ public Item getEmptyItem(final ItemStack itemStack) {
+ final ItemStack x = itemStack.copy();
+ x.setItemDamage(0);
+ return x.getItem();
+ }
+
+ @Override
+ public double getMaxCharge(final ItemStack itemStack) {
+ return maxValueEU;
+ }
+
+ @Override
+ public int getTier(final ItemStack itemStack) {
+ return 3;
+ }
+
+ @Override
+ public double getTransferLimit(final ItemStack itemStack) {
+ return 8196;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+
+ return ("Universally Chargeable Battery");
+ }
+
+ @Override
+ public double getDurabilityForDisplay(final ItemStack stack)
+ {
+ //return 1.0D - getEnergyStored(stack) / this.capacity;
+ return MathUtils.findPercentage(this.getEnergyStored(stack), this.getMaxEnergyStored(stack));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(final ItemStack par1ItemStack, final int par2)
+ {
+ final int i = 30;
+
+ final float f13 = (((Minecraft.getSystemTime() % 6000L) / 3000.0F) * CORE.PI * 2.0F);
+
+ final float t = 0.9F + (0.1F * MathHelper.cos(f13));
+
+ final double v = 1.0D - this.getDurabilityForDisplay(par1ItemStack);
+
+ int r = i + (int)(v * (255 - i) * t);
+ if (r > 255) {
+ r = 255;
+ }
+ final int g = i + (int)(v * (64 - i) * t);
+
+ return (r << 16) | (g << 8) | i;
+ }
+
+ @Override
+ public boolean showDurabilityBar(final ItemStack stack)
+ {
+ return false;
+ }
+
+ @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);
+ }
+
+ @Override
+ public ItemStack getContainerItem(final ItemStack itemStack)
+ {
+ final ItemStack newItem = itemStack.copy();
+ newItem.stackSize = 1;
+ this.extractEnergy(newItem, 150000, false);
+ return newItem;
+ }
+
+ @Override
+ public boolean hasContainerItem(final ItemStack stack)
+ {
+ return true;
+ }
+
+ @Override
+ public int getBurnTime(final ItemStack fuel) {
+ if ((fuel == null) || (fuel.getItem() != this)) {
+ return 0;
+ }
+ return this.extractEnergy(fuel, 150000, true) / 50 / 100;
+ }
+
+ @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/rfPerEU, 3, true, false);
+
+ }
+ return ElectricItem.manager.charge(stack, amount, tier, ignoreTransferLimit, simulate);
+ }
+
+ @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*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/rfPerEU, 3, true, false);
+ }
+
+ return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate);
+ }
+
+ @Override
+ public double getCharge(final ItemStack stack) {
+ return ElectricItem.manager.getCharge(stack);
+ }
+
+ @Override
+ public boolean canUse(final ItemStack stack, final double amount) {
+ return ElectricItem.manager.canUse(stack, amount);
+ }
+
+ @Override
+ public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) {
+ return ElectricItem.manager.use(stack, amount, entity);
+ }
+
+ @Override
+ public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) {
+ ElectricItem.manager.chargeFromArmor(stack, entity);
+ }
+
+ @Override
+ public String getToolTip(final 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*rfPerEU));
+ }
+ return 0;
+ }
+ int energy = container.stackTagCompound.getInteger("Energy");
+ final 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/rfPerEU, 3, true, false);
+
+ }
+ return energyReceived;
+ }
+
+ @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*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/rfPerEU, 3, true, false);
+ }
+ return energyExtracted;
+ }
+
+ @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*rfPerEU));
+ }
+ 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/rfPerEU, 3, true, false);
+ return energy;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/books/ItemBaseBook.java b/src/main/java/gtPlusPlus/core/item/general/books/ItemBaseBook.java
new file mode 100644
index 0000000000..9ac09b92e4
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/books/ItemBaseBook.java
@@ -0,0 +1,130 @@
+package gtPlusPlus.core.item.general.books;
+
+import static gtPlusPlus.core.handler.BookHandler.mBookMap;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.ItemWritableBook;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.handler.BookHandler;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+
+public class ItemBaseBook extends ItemWritableBook{
+
+ public ItemBaseBook(){
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setMaxStackSize(1);
+ this.setTextureName(CORE.MODID+":"+"itemBook");
+ this.setUnlocalizedName("itembookgt");
+ GameRegistry.registerItem(this, "bookGT");
+
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < BookHandler.mBookMap.size(); i ++) {
+ ItemStack bookstack = new ItemStack(item, 1, i);
+
+ /*bookstack = Utils.getWrittenBook(
+ bookstack,
+ i,
+ mBookMap.get(i).mMapping,
+ mBookMap.get(i).mTitle,
+ mBookMap.get(i).mAuthor,
+ mBookMap.get(i).mPages);*/
+
+ NBTUtils.createIntegerTagCompound(bookstack, "stats", "mMeta", i);
+ list.add(bookstack);
+ }
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ if (NBTUtils.hasKey(tItem, "title")){
+ return NBTUtils.getString(tItem, "title");
+ }
+ else if (tItem.getItemDamage() > -1 && tItem.getItemDamage() <= mBookMap.size()){
+ return EnumChatFormatting.ITALIC+""+mBookMap.get(tItem.getItemDamage()).mTitle;
+ }
+ //NBTUtils.tryIterateNBTData(tItem);
+ return "GT++ Storybook";
+ }
+
+ @Override
+ public void addInformation(ItemStack tItem, EntityPlayer player, List list, boolean bool) {
+ // TODO Auto-generated method stub
+ if (NBTUtils.hasKey(tItem, "author")){
+ list.add(EnumChatFormatting.GRAY+"Author: "+NBTUtils.getString(tItem, "author"));
+ }
+ else if (mBookMap.get(tItem.getItemDamage()).mAuthor != null){
+ list.add(EnumChatFormatting.WHITE+"Author: "+mBookMap.get(tItem.getItemDamage()).mAuthor);
+ }
+ if (NBTUtils.hasKey(tItem, "title")){
+ list.add(EnumChatFormatting.GRAY+"Pages: "+NBTUtils.getString(tItem, "pages"));
+ }
+ else if (mBookMap.get(tItem.getItemDamage()).mPages != null){
+ list.add(EnumChatFormatting.WHITE+"Pages: "+mBookMap.get(tItem.getItemDamage()).mPages.length);
+ }
+ //super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
+ //player.displayGUIBook(item);
+ int i = item.getItemDamage();
+ ItemStack bookstack = Utils.getWrittenBook(
+ null,
+ mBookMap.get(i).mMeta,
+ mBookMap.get(i).mMapping,
+ mBookMap.get(i).mTitle,
+ mBookMap.get(i).mAuthor,
+ mBookMap.get(i).mPages);
+
+ if (player.worldObj.isRemote){
+ try {
+ Class<?> clazz = ReflectionUtils.getClass("net.minecraft.client.gui.GuiScreenBook");
+ Constructor<?> ctor = clazz.getConstructor(EntityPlayer.class, ItemStack.class, boolean.class);
+ Object object = ctor.newInstance(new Object[] { player, bookstack, false });
+ Minecraft.getMinecraft().displayGuiScreen((GuiScreen) object);
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ //Minecraft.getMinecraft().displayGuiScreen(new GuiScreenBook(player, bookstack, false));
+ }
+ return item;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java b/src/main/java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java
new file mode 100644
index 0000000000..a95fab4b6c
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/capture/ItemEntityCatcher.java
@@ -0,0 +1,246 @@
+package gtPlusPlus.core.item.general.capture;
+
+import java.util.List;
+import java.util.UUID;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.entity.*;
+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.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.interfaces.IEntityCatcher;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+
+public class ItemEntityCatcher extends Item implements IEntityCatcher {
+
+ // PlayerInteractEvent.EntityInteract;
+
+
+ public ItemEntityCatcher() {
+ //Probably won't ever need this event handler.
+ //Utils.registerEvent(this);
+ this.setUnlocalizedName("itemDragonJar");
+ this.setTextureName(CORE.MODID + ":" + getUnlocalizedName());
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setMaxStackSize(16);
+ this.setMaxDamage(0);
+ GameRegistry.registerItem(this, getUnlocalizedName());
+ }
+
+ @Override
+ public boolean hasEntity(ItemStack aStack) {
+ if (NBTUtils.hasKey(aStack, "mHasEntity")) {
+ return NBTUtils.getBoolean(aStack, "mHasEntity");
+ }
+ return false;
+ }
+
+ @Override
+ public Entity getStoredEntity(World aWorld, ItemStack aStack) {
+ if (aStack == null || !hasEntity(aStack)) {
+ Logger.INFO("Cannot get stored entity.");
+ return null;
+ }
+
+ Entity mEntityToSpawn;
+ int mEntityID;
+ Logger.WARNING("getStoredEntity(1)");
+
+ mEntityID = NBTUtils.getInteger(aStack, "mEntityID");
+ mEntityToSpawn = EntityList.createEntityByID(mEntityID, aWorld);
+ if (mEntityToSpawn != null) {
+ Logger.WARNING("getStoredEntity(2)");
+ return mEntityToSpawn;
+ }
+
+ Logger.INFO("Failed to get stored entity. - getStoredEntity()");
+ return null;
+ }
+
+ @Override
+ public boolean setStoredEntity(World aWorld, ItemStack aStack, Entity aEntity) {
+ if (aEntity == null) {
+ NBTUtils.setBoolean(aStack, "mHasEntity", false);
+ Logger.INFO("Bad Entity being stored.");
+ return false;
+ }
+
+ Logger.WARNING("setStoredEntity(1)");
+
+ NBTTagCompound mEntityData;
+ Class<? extends Entity> mEntityClass;
+ String mClassName;
+ String mEntityName;
+ int mEntityID, mEntityHashcode;
+ UUID mUuidPersistent, mUuidUnique;
+ Logger.WARNING("setStoredEntity(2)");
+
+ mEntityData = aEntity.getEntityData();
+ mEntityClass = aEntity.getClass();
+ mClassName = mEntityClass.getName();
+ mEntityName = aEntity.getCommandSenderName();
+ // mEntityID = aEntity.getEntityId();
+ mEntityID = EntityList.getEntityID(aEntity);
+ mEntityHashcode = aEntity.hashCode();
+ mUuidPersistent = aEntity.getPersistentID();
+ mUuidUnique = aEntity.getUniqueID();
+ Logger.WARNING("setStoredEntity(3)");
+
+ NBTUtils.createTagCompound(aStack, "mEntityData", mEntityData);
+ NBTUtils.setString(aStack,"mEntityName", mEntityName);
+ NBTUtils.setInteger(aStack,"mEntityID", mEntityID);
+ NBTUtils.setString(aStack,"mClassName", mClassName);
+ NBTUtils.setString(aStack,"mUuidPersistent", mUuidPersistent.toString());
+ NBTUtils.setString(aStack,"mUuidUnique", mUuidUnique.toString());
+ NBTUtils.setInteger(aStack,"mEntityHashcode", mEntityHashcode);
+ NBTUtils.setBoolean(aStack,"mHasEntity", true);
+ Logger.WARNING("setStoredEntity(4)");
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends Entity> getStoredEntityClass(ItemStack aStack) {
+ if (aStack == null || !hasEntity(aStack)) {
+ return null;
+ }
+ Class<? extends Entity> mEntityClass;
+ String mClassName;
+ mClassName = NBTUtils.getString(aStack, "mClassName");
+ mEntityClass = (Class<? extends Entity>) ReflectionUtils.getClass(mClassName);
+ if (mEntityClass != null) {
+ return mEntityClass;
+ }
+ return null;
+ }
+
+ @Override
+ public boolean spawnStoredEntity(World aWorld, ItemStack aStack, BlockPos aPos) {
+ if (aStack == null || !hasEntity(aStack)) {
+ Logger.INFO("Cannot release, either invalid Itemstack or no entity stored.");
+ return false;
+ }
+
+ NBTTagCompound mEntityData = NBTUtils.getTagCompound(aStack, "mEntityData");
+
+ int mEntityID = NBTUtils.getInteger(aStack,"mEntityID");
+ String mClassName = NBTUtils.getString(aStack,"mClassName");
+ UUID mUuidPersistent = UUID.fromString(NBTUtils.getString(aStack,"mUuidPersistent"));
+ UUID mUuidUnique = UUID.fromString(NBTUtils.getString(aStack,"mUuidUnique"));
+ int mEntityHashcode = NBTUtils.getInteger(aStack,"mEntityHashcode");
+
+ EntityLiving mEntityToSpawn = (EntityLiving) getStoredEntity(aWorld, aStack);
+ Class<? extends Entity> mEntityClass = getStoredEntityClass(aStack);
+
+ Logger.WARNING("spawnStoredEntity(1)");
+
+ if (mEntityToSpawn != null && mEntityClass != null) {
+ Logger.WARNING("spawnStoredEntity(2)");
+ if (mEntityToSpawn.getEntityData() != mEntityData) {
+ Logger.WARNING("spawnStoredEntity(x)");
+ NBTUtils.setEntityCustomData(mEntityToSpawn, mEntityData);
+ }
+
+ mEntityToSpawn.setLocationAndAngles(aPos.xPos, aPos.yPos, aPos.zPos, aWorld.rand.nextFloat() * 360.0F,
+ 0.0F);
+ if (mEntityToSpawn != null) {
+ mEntityToSpawn.onSpawnWithEgg(null);
+ aWorld.spawnEntityInWorld(mEntityToSpawn);
+ Logger.WARNING("spawnStoredEntity(3)");
+ }
+ if (mEntityToSpawn != null) {
+ mEntityToSpawn.playLivingSound();
+ Logger.WARNING("spawnStoredEntity(4)");
+ }
+ Logger.WARNING("spawnStoredEntity(5)");
+ NBTUtils.setBoolean(aStack,"mHasEntity", false);
+ return true;
+ }
+ Logger.INFO("Failed to spawn stored entity. - spawnStoredEntity()");
+ return false;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
+ return super.onItemRightClick(aStack, aWorld, aPlayer);
+ }
+
+ @Override
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) {
+ if (hasEntity(p_77624_1_)){
+ String mName = NBTUtils.getString(p_77624_1_,"mEntityName");
+ if (mName != null && !mName.equals("")){
+ p_77624_3_.add(EnumChatFormatting.GRAY+"Contains a "+mName+".");
+ }
+ }
+ else {
+ p_77624_3_.add(EnumChatFormatting.GRAY+"Does not contain anything.");
+ }
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+ @Override
+ public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side,
+ float xOffset, float yOffset, float zOffset) {
+ if (Utils.isServer()) {
+ Logger.WARNING("Trying to release (1)");
+ if (NBTUtils.hasKey(itemstack,"mHasEntity")
+ && NBTUtils.getBoolean(itemstack,"mHasEntity")) {
+ Logger.WARNING("Trying to release (2)");
+ boolean mDidSpawn = spawnStoredEntity(world, itemstack, new BlockPos(x, y+1, z, world));
+
+ if (!mDidSpawn){
+ PlayerUtils.messagePlayer(player, "You failed to release a "+NBTUtils.getString(itemstack,"mEntityName")+".");
+ }
+
+ return mDidSpawn;
+
+ }
+ }
+ return super.onItemUse(itemstack, player, world, x, y, z, side, xOffset, yOffset, zOffset);
+
+ }
+
+ @Override
+ public boolean itemInteractionForEntity(ItemStack aStack, EntityPlayer aPlayer, EntityLivingBase aEntity) {
+ if (Utils.isServer()) {
+ Logger.WARNING("Trying to catch (1)");
+ if (!hasEntity(aStack)) {
+ Logger.WARNING("Trying to catch (2)");
+ boolean mStored = setStoredEntity(aPlayer.worldObj, aStack, aEntity);
+ if (mStored) {
+ Logger.WARNING("Trying to catch (3)");
+ aEntity.setDead();
+ PlayerUtils.messagePlayer(aPlayer, "You have captured a "+NBTUtils.getString(aStack,"mEntityName")+" in the Jar.");
+ //NBTUtils.tryIterateNBTData(aStack);
+ }
+ }
+ }
+ return super.itemInteractionForEntity(aStack, aPlayer, aEntity);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack aStack) {
+ if (hasEntity(aStack)){
+ return "Captured Dragon Jar";
+ }
+ return "Dragon Capture Jar";
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/chassis/ItemBoilerChassis.java b/src/main/java/gtPlusPlus/core/item/general/chassis/ItemBoilerChassis.java
new file mode 100644
index 0000000000..86c52cc048
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/chassis/ItemBoilerChassis.java
@@ -0,0 +1,86 @@
+package gtPlusPlus.core.item.general.chassis;
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+
+public class ItemBoilerChassis extends Item {
+
+ public IIcon[] icons = new IIcon[1];
+
+ public ItemBoilerChassis() {
+ super();
+ this.setHasSubtypes(true);
+ String unlocalizedName = "itemBoilerChassis";
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "itemBoilerChassis");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[0];
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 3; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return this.getUnlocalizedName() + "_" + stack.getItemDamage();
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ String itemName = "Advanced Boiler Chassis";
+ String suffixName = "";
+ if (tItem.getItemDamage() == 0){
+ suffixName = " [Tier 1]";
+ }
+ else if (tItem.getItemDamage() == 1){
+ suffixName = " [Tier 2]";
+ }
+ else if (tItem.getItemDamage() == 2){
+ suffixName = " [Tier 3]";
+ }
+ return (itemName+suffixName);
+
+ }
+
+ @Override //TODO
+ public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
+ int meta = stack.getItemDamage();
+ if (meta == 0){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(10,110,30);
+ }
+ else if (meta == 1){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(150,180,35);
+ }
+ else if (meta == 2){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(200,85,40);
+ }
+ else if (meta == 3){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(255,100,50);
+ }
+ return HEX_OxFFFFFF;
+ }
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoil.java b/src/main/java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoil.java
new file mode 100644
index 0000000000..be1fdfc491
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoil.java
@@ -0,0 +1,93 @@
+package gtPlusPlus.core.item.general.chassis;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+
+public class ItemDehydratorCoil extends Item {
+
+ public IIcon[] icons = new IIcon[4];
+
+ public ItemDehydratorCoil() {
+ super();
+ this.setHasSubtypes(true);
+ String unlocalizedName = "itemDehydratorCoil";
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoil_0");
+ this.icons[1] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoil_1");
+ this.icons[2] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoil_2");
+ this.icons[3] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoil_3");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[meta];
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 4; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return this.getUnlocalizedName() + "_" + stack.getItemDamage();
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ String itemName = "Dehydrator Coil";
+ String suffixName = "";
+ if (tItem.getItemDamage() == 0){
+ suffixName = " [EV]";
+ }
+ else if (tItem.getItemDamage() == 1){
+ suffixName = " [IV]";
+ }
+ else if (tItem.getItemDamage() == 2){
+ suffixName = " [LuV]";
+ }
+ else if (tItem.getItemDamage() == 3){
+ suffixName = " [ZPM]";
+ }
+ return (itemName+suffixName);
+
+ }
+
+ /*@Override
+ public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
+ int meta = stack.getItemDamage();
+ if (meta == 0){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(10,110,30);
+ }
+ else if (meta == 1){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(150,180,35);
+ }
+ else if (meta == 2){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(200,85,40);
+ }
+ else if (meta == 3){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(255,150,50);
+ }
+ return HEX_OxFFFFFF;
+ }*/
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoilWire.java b/src/main/java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoilWire.java
new file mode 100644
index 0000000000..99d4a139dd
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/chassis/ItemDehydratorCoilWire.java
@@ -0,0 +1,93 @@
+package gtPlusPlus.core.item.general.chassis;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+
+public class ItemDehydratorCoilWire extends Item {
+
+ public IIcon[] icons = new IIcon[4];
+
+ public ItemDehydratorCoilWire() {
+ super();
+ this.setHasSubtypes(true);
+ String unlocalizedName = "itemDehydratorCoilWire";
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ this.icons[0] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoilWire_0");
+ this.icons[1] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoilWire_1");
+ this.icons[2] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoilWire_2");
+ this.icons[3] = reg.registerIcon(CORE.MODID + ":" + "dehydrator/itemDehydratorCoilWire_3");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[meta];
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 4; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return this.getUnlocalizedName() + "_" + stack.getItemDamage();
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack tItem) {
+ String itemName = "Coil Wire";
+ String suffixName = "";
+ if (tItem.getItemDamage() == 0){
+ suffixName = " [EV]";
+ }
+ else if (tItem.getItemDamage() == 1){
+ suffixName = " [IV]";
+ }
+ else if (tItem.getItemDamage() == 2){
+ suffixName = " [LuV]";
+ }
+ else if (tItem.getItemDamage() == 3){
+ suffixName = " [ZPM]";
+ }
+ return (itemName+suffixName);
+
+ }
+
+/* @Override
+ public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
+ int meta = stack.getItemDamage();
+ if (meta == 0){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(10,110,30);
+ }
+ else if (meta == 1){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(150,180,35);
+ }
+ else if (meta == 2){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(200,85,40);
+ }
+ else if (meta == 3){
+ HEX_OxFFFFFF = Utils.rgbtoHexValue(255,150,50);
+ }
+ return HEX_OxFFFFFF;
+ }*/
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java b/src/main/java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java
new file mode 100644
index 0000000000..628fba9291
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Base.java
@@ -0,0 +1,223 @@
+package gtPlusPlus.core.item.general.fuelrods;
+
+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.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+
+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) {
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setMaxDamage(maxFuel);
+ this.maximumFuel = maxFuel;
+ this.fuelRemaining = fuelLeft;
+ this.fuelType = type;
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ }
+
+ private float getMaxHeat(){
+ float tempvar;
+ if (this.fuelType == "Thorium"){
+ tempvar = 2500;
+ }
+
+ else if (this.fuelType == "Uranium"){
+ tempvar = 5000;
+ }
+
+ else if (this.fuelType == "Plutonium"){
+ tempvar = 10000;
+ }
+
+ else {
+ tempvar = 5000;
+ }
+ return tempvar;
+
+ }
+
+ private void updateVars(final ItemStack stack){
+ if (stack.stackTagCompound != null) {
+ this.heat = stack.stackTagCompound.getFloat("heat");
+ this.fuelRemaining = stack.stackTagCompound.getInteger("fuelRemaining");
+ }
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+
+ Float NBT_Heat = this.heat;
+ Float NBT_MaxHeat = this.maxHeat;
+ int NBT_Fuel = this.fuelRemaining;
+ String NBT_Type= this.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;
+ }
+ else {
+ formattedFuelLeft = EnumChatFormatting.GRAY+tempFuel+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 >= (this.maxHeat/3)) && (tempMax < ((this.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 {
+ 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.");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ public String getType(final ItemStack stack){
+ if (stack.stackTagCompound != null){
+ return stack.stackTagCompound.getString("fuelType");
+ }
+ return this.fuelType;
+ }
+
+ public int getFuelRemaining(final ItemStack stack){
+ if (stack.stackTagCompound != null){
+ return stack.stackTagCompound.getInteger("fuelRemaining");
+ }
+ return 0;
+ }
+
+ public int getMaxFuel(){
+ return this.maximumFuel;
+ }
+
+ public int getFuel(final ItemStack stack){
+ if (stack != null){
+ final int i = stack.getItemDamage();
+ final int r = this.maximumFuel - i;
+ return r;
+ }
+ return 0;
+ }
+
+ public boolean setFuelRemainingExplicitly(final int i){
+ final int tempFuel = this.fuelRemaining;
+ this.fuelRemaining = i;
+ if (i != tempFuel){
+ return true;
+ }
+ return false;
+ }
+
+ public boolean addFuel(final int i){
+ final int tempFuel = this.fuelRemaining;
+ this.fuelRemaining = tempFuel+i;
+ if (this.fuelRemaining != tempFuel){
+ return true;
+ }
+ return false;
+ }
+
+ public float getHeat(final ItemStack value){
+ if (value.stackTagCompound != null){
+ return value.stackTagCompound.getFloat("heat");
+ }
+ return 0f;
+ }
+
+ public boolean addHeat(final float i){
+ final float tempFuel = this.heat;
+ this.heat = tempFuel+i;
+ if (this.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;
+ *
+ */
+ @Override
+ public void onCreated(final ItemStack itemStack, final World world, final 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);
+ }
+
+ @Override
+ public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, final 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);
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java b/src/main/java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java
new file mode 100644
index 0000000000..dbf1209b50
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/fuelrods/FuelRod_Thorium.java
@@ -0,0 +1,13 @@
+package gtPlusPlus.core.item.general.fuelrods;
+
+public class FuelRod_Thorium extends FuelRod_Base{
+
+ public FuelRod_Thorium(final String unlocalizedName, final String type, final int fuelLeft, final int maxFuel) {
+ super(unlocalizedName, type, fuelLeft, maxFuel);
+ this.setMaxDamage(maxFuel);
+ this.maximumFuel = maxFuel;
+ this.fuelRemaining = fuelLeft;
+ this.fuelType = type;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java b/src/main/java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java
new file mode 100644
index 0000000000..238e765384
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/rfchargingpack/ChargingPackBase.java
@@ -0,0 +1,84 @@
+package gtPlusPlus.core.item.general.rfchargingpack;
+
+import java.util.List;
+
+import cofh.api.energy.ItemEnergyContainer;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.util.math.MathUtils;
+
+public class ChargingPackBase extends ItemEnergyContainer {
+
+ protected final int mCapacityMax;
+ protected final byte mTier;
+
+ public ChargingPackBase(byte tier) {
+ this(tier, (tier == 1 ? 4000000 : tier == 2 ? 8000000 : tier == 3 ? 16000000 : tier == 4 ? 32000000 : 64000000));
+ }
+
+ private ChargingPackBase(byte tier, int maxStorage) {
+ super(maxStorage);
+ mTier = tier;
+ mCapacityMax = maxStorage;
+ }
+
+ public int getMaxEnergyInput(ItemStack container)
+ {
+ return this.maxReceive;
+ }
+
+ public int getMaxEnergyExtracted(ItemStack container)
+ {
+ return this.maxExtract;
+ }
+
+ @Override
+ public void onUpdate(ItemStack aStack, World aWorld, Entity aEnt, int p_77663_4_, boolean p_77663_5_) {
+ super.onUpdate(aStack, aWorld, aEnt, p_77663_4_, p_77663_5_);
+
+ ItemEnergyContainer current = this;
+ int currentStored = 0;
+ if (current != null) {
+ currentStored = current.getEnergyStored(aStack);
+ }
+ if (currentStored > 0) {
+ if (aEnt instanceof EntityPlayer) {
+ if (((EntityPlayer) aEnt).inventory != null) {
+ for (ItemStack invStack : ((EntityPlayer) aEnt).inventory.mainInventory) {
+ if (invStack != null) {
+ if (invStack.getItem() instanceof ItemEnergyContainer) {
+ if (current != null) {
+ currentStored = current.getEnergyStored(aStack);
+ if (currentStored > 0) {
+ int mTransLimit;
+ int mMaxStorage;
+ int mCurrent;
+ mTransLimit = getMaxEnergyInput(invStack);
+ mMaxStorage = current.getMaxEnergyStored(invStack);
+ mCurrent = current.getEnergyStored(invStack);
+ if (mCurrent+mTransLimit <= mMaxStorage) {
+ current.extractEnergy(aStack, current.receiveEnergy(invStack, mTransLimit, false), false);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) {
+ 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, p_77624_2_, list, p_77624_4_);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java b/src/main/java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java
new file mode 100644
index 0000000000..727b933fa7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/spawn/ItemCustomSpawnEgg.java
@@ -0,0 +1,285 @@
+package gtPlusPlus.core.item.general.spawn;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+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.item.ModItems;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+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.player.EntityPlayer;
+import net.minecraft.item.*;
+import net.minecraft.util.*;
+import net.minecraft.world.World;
+
+public class ItemCustomSpawnEgg extends ItemMonsterPlacer {
+
+ private static final HashMap<Integer, IIcon> mIconMap = new HashMap<Integer, IIcon>();
+ private static int mTotalMetaItems = 0;
+
+ private static final HashMap<Integer, Integer> mMaxStackSizeMap = new HashMap<Integer, Integer>();
+ private static final HashMap<Integer, EnumRarity> mRarityMap = new HashMap<Integer, EnumRarity>();
+ private static final HashMap<Integer, ArrayList<String>> mOreDictNames = new HashMap<Integer, ArrayList<String>>();
+
+ private static final HashMap<Integer, Integer> mColourBaseMap = new HashMap<Integer, Integer>();
+ private static final HashMap<Integer, Integer> mColourSpotsMap = new HashMap<Integer, Integer>();
+ private static final HashMap<Integer, String> mEntityNameMap = new HashMap<Integer, String>();
+ private static final HashMap<Integer, String> mEntityFullNameMap = new HashMap<Integer, String>();
+
+ private static final HashMap<String, Integer> mReverseEntityMap = new HashMap<String, Integer>();
+
+ protected EntityLiving entityToSpawn = null;
+
+ public static ItemStack getSpawnEggForEntityname(String aEntityName, int aSize) {
+ return ItemUtils.simpleMetaStack(ModItems.itemCustomSpawnEgg, mReverseEntityMap.get(aEntityName), aSize);
+ }
+
+ public static void registerEntityForSpawnEgg(final int aMetaID, String parEntityToSpawnName, int aPrimaryColor, int aSecondaryColor) {
+ registerEntityForSpawnEgg(aMetaID, parEntityToSpawnName, aPrimaryColor, aSecondaryColor, EnumRarity.common, new ArrayList<String>());
+ }
+
+ public static void registerEntityForSpawnEgg(final int aMetaID, String parEntityToSpawnName, int aPrimaryColor, int aSecondaryColor, EnumRarity aRarity, final ArrayList<String> aOreDictNames) {
+ mTotalMetaItems++;
+ mMaxStackSizeMap.put(aMetaID, 64);
+ mRarityMap.put(aMetaID, aRarity);
+ mOreDictNames.put(aMetaID, aOreDictNames);
+ mColourBaseMap.put(aMetaID, aPrimaryColor);
+ mColourSpotsMap.put(aMetaID, aSecondaryColor);
+ mReverseEntityMap.put(parEntityToSpawnName, aMetaID);
+ setEntityToSpawnName(aMetaID, parEntityToSpawnName);
+ }
+
+ public static void registerEggsToOreDict() {
+ for (int aMetaID = 0; aMetaID < mTotalMetaItems; aMetaID++) {
+ ArrayList<String> aOreDictNames = mOreDictNames.get(aMetaID);
+ if (aOreDictNames != null && !aOreDictNames.isEmpty()) {
+ ItemStack aFoodStack = ItemUtils.simpleMetaStack(ModItems.itemCustomSpawnEgg, aMetaID, 1
+ );
+ for (String aOreName : aOreDictNames) {
+ ItemUtils.addItemToOreDictionary(aFoodStack, aOreName);
+ }
+ }
+ }
+ }
+
+ public ItemCustomSpawnEgg() {
+ super();
+ this.setNoRepair();
+ this.setMaxStackSize(64);
+ this.setMaxDamage(0);
+ this.setUnlocalizedName("BasicMetaSpawnEgg");
+ GameRegistry.registerItem(this, this.getUnlocalizedName());
+ }
+
+ /**
+ * 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;
+ }
+ else {
+ 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;
+ }
+
+ Entity entity = spawnEntity(par1ItemStack, 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;
+ }
+ }
+
+ return true;
+ }
+ }
+
+ /**
+ * 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;
+ }
+ else {
+ MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true);
+
+ if (movingobjectposition == null) {
+ return par1ItemStack;
+ }
+ else {
+ if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ 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(par1ItemStack, 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.
+ * @param par1ItemStack
+ */
+ public Entity spawnEntity(ItemStack par1ItemStack, World parWorld, double parX, double parY, double parZ) {
+
+ if (!parWorld.isRemote) // never spawn entity on client side
+ {
+ int aDamage = par1ItemStack.getItemDamage();
+ String entityToSpawnNameFull = mEntityFullNameMap.get(aDamage);
+ String entityToSpawnName = mEntityNameMap.get(aDamage);
+ //entityToSpawnNameFull = WildAnimals.MODID + "." + 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
+ System.out.println("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 aItem, CreativeTabs p_150895_2_, List aList) {
+ for (int aMeta : mReverseEntityMap.values()) {
+ aList.add(ItemUtils.simpleMetaStack(aItem, aMeta, 1));
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getColorFromItemStack(ItemStack par1ItemStack, int parColorType) {
+ int aID = par1ItemStack.getItemDamage();
+ return (parColorType == 0) ? mColourBaseMap.get(aID) : mColourSpotsMap.get(aID);
+ }
+
+ @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 " + mEntityNameMap.get(par1ItemStack.getItemDamage());
+ }
+
+
+ @Override
+ public void registerIcons(final IIconRegister u) {
+ mIconMap.put(0, u.registerIcon(CORE.MODID + ":" + "spawn_egg"));
+ mIconMap.put(1, u.registerIcon(CORE.MODID + ":" + "spawn_egg_overlay"));
+ }
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(final int damage, final int renderPass) {
+ return mIconMap.get(renderPass);
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int damage) {
+ return getIconFromDamageForRenderPass(0, 0);
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack aStack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
+ return getIconFromDamageForRenderPass(0, renderPass);
+ }
+
+ @Override
+ public IIcon getIcon(ItemStack aStack, int renderPass) {
+ return getIconFromDamageForRenderPass(0, renderPass);
+ }
+
+ @Override
+ public String getUnlocalizedName(ItemStack stack) {
+ return super.getUnlocalizedName() + "." + stack.getItemDamage();
+ }
+
+ public static void setEntityToSpawnName(int aMetaID, String parEntityToSpawnName) {
+ mEntityNameMap.put(aMetaID, parEntityToSpawnName);
+ mEntityFullNameMap.put(aMetaID, CORE.MODID + "." + parEntityToSpawnName);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java b/src/main/java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java
new file mode 100644
index 0000000000..57cf8986fa
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/throwables/ItemHydrofluoricAcidPotion.java
@@ -0,0 +1,30 @@
+package gtPlusPlus.core.item.general.throwables;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion;
+import gtPlusPlus.core.item.base.CoreItem;
+
+public class ItemHydrofluoricAcidPotion extends CoreItem {
+
+ public ItemHydrofluoricAcidPotion(String unlocalizedName, String displayName, String description) {
+ super(unlocalizedName, displayName, AddToCreativeTab.tabMisc, 16, 0, new String[] {description}, EnumRarity.uncommon, EnumChatFormatting.GRAY, false, null);
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
+ if (!player.capabilities.isCreativeMode) {
+ --item.stackSize;
+ }
+ world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
+ if (!world.isRemote) {
+ world.spawnEntityInWorld(new EntityHydrofluoricAcidPotion(world, player));
+ }
+ return item;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java b/src/main/java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java
new file mode 100644
index 0000000000..27b35e48d1
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/throwables/ItemSulfuricAcidPotion.java
@@ -0,0 +1,30 @@
+package gtPlusPlus.core.item.general.throwables;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.entity.projectile.EntitySulfuricAcidPotion;
+import gtPlusPlus.core.item.base.CoreItem;
+
+public class ItemSulfuricAcidPotion extends CoreItem {
+
+ public ItemSulfuricAcidPotion(String unlocalizedName, String displayName, String description) {
+ super(unlocalizedName, displayName, AddToCreativeTab.tabMisc, 16, 0, new String[] {description}, EnumRarity.common, EnumChatFormatting.GRAY, false, null);
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
+ if (!player.capabilities.isCreativeMode) {
+ --item.stackSize;
+ }
+ world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
+ if (!world.isRemote) {
+ world.spawnEntityInWorld(new EntitySulfuricAcidPotion(world, player));
+ }
+ return item;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/general/throwables/ItemThrowableBomb.java b/src/main/java/gtPlusPlus/core/item/general/throwables/ItemThrowableBomb.java
new file mode 100644
index 0000000000..e8f76ce64c
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/general/throwables/ItemThrowableBomb.java
@@ -0,0 +1,124 @@
+package gtPlusPlus.core.item.general.throwables;
+
+import java.util.List;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.entity.projectile.EntityThrowableBomb;
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
+import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class ItemThrowableBomb extends CoreItem {
+
+ private static AutoMap<ItemStack> mLighters = new AutoMap<ItemStack>();
+ public static IIcon[] icons = new IIcon[10];
+
+ public ItemThrowableBomb() {
+ super("gtpp.throwable.bomb", "Bomb", AddToCreativeTab.tabMisc, 16, 0, new String[] {"Just like Bomberman", "Have a fire source in inventory to prime"}, EnumRarity.uncommon, EnumChatFormatting.GRAY, false, null);
+ this.setHasSubtypes(true);
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack item, World world, EntityPlayer player) {
+
+ if (mLighters.isEmpty()) {
+ mLighters.put(ItemUtils.getSimpleStack(Items.flint_and_steel));
+ mLighters.put(ItemList.Tool_Lighter_Invar_Full.get(1));
+ mLighters.put(ItemList.Tool_Lighter_Invar_Used.get(1));
+ mLighters.put(ItemList.Tool_Lighter_Platinum_Full.get(1));
+ mLighters.put(ItemList.Tool_Lighter_Platinum_Used.get(1));
+ mLighters.put(ItemUtils.getSimpleStack(ModItems.itemBasicFireMaker));
+ }
+
+ //Unlit
+ if (item.getItemDamage() == 0) {
+ boolean hasLighter = false;
+ for (ItemStack aPlaySlot : player.inventory.mainInventory) {
+ if (aPlaySlot != null) {
+ for (ItemStack aLighter : mLighters) {
+ if (GT_Utility.areStacksEqual(aPlaySlot, aLighter) || (aPlaySlot.getItem() instanceof MetaGeneratedGregtechTools && aPlaySlot.getItemDamage() == MetaGeneratedGregtechTools.ELECTRIC_LIGHTER)) {
+ hasLighter = true;
+ break;
+ }
+ }
+ }
+ }
+ if (hasLighter) {
+ item.setItemDamage(1);
+ }
+ }
+ //Lit
+ else if (item.getItemDamage() == 1) {
+ if (!player.capabilities.isCreativeMode) {
+ --item.stackSize;
+ }
+ world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
+ if (!world.isRemote) {
+ world.spawnEntityInWorld(new EntityThrowableBomb(world, player));
+ }
+ /*if (item.stackSize <= 0) {
+ item = null;
+ }*/
+ }
+ return item;
+ }
+
+
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ icons[0] = reg.registerIcon(CORE.MODID + ":" + "bomb");
+ icons[1] = reg.registerIcon(CORE.MODID + ":" + "bomb_lit");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int meta) {
+ return this.icons[meta];
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 2; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ String aLitStatus = "unlit";
+ if (stack.getItemDamage() == 0) {
+ aLitStatus = EnumChatFormatting.BLUE+"Unlit";
+ }
+ else if (stack.getItemDamage() == 1) {
+ aLitStatus = EnumChatFormatting.RED+"Lit";
+ }
+ list.add(EnumChatFormatting.GOLD+"Fuse Status: "+aLitStatus);
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ // TODO Auto-generated method stub
+ return super.getItemStackDisplayName(p_77653_1_);
+ }
+
+
+
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/init/ItemsFoods.java b/src/main/java/gtPlusPlus/core/item/init/ItemsFoods.java
new file mode 100644
index 0000000000..e5c403c503
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/init/ItemsFoods.java
@@ -0,0 +1,80 @@
+package gtPlusPlus.core.item.init;
+
+import gregtech.api.util.GT_OreDictUnificator;
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.item.base.foods.BaseItemFood;
+import gtPlusPlus.core.item.base.foods.BaseItemHotFood;
+import gtPlusPlus.core.item.food.BaseItemMetaFood;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.RecipeUtils;
+import net.minecraft.entity.monster.EntityBlaze;
+import net.minecraft.entity.passive.EntityHorse;
+import net.minecraft.entity.passive.EntityOcelot;
+import net.minecraft.entity.passive.EntityVillager;
+import net.minecraft.entity.passive.EntityWolf;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+
+public class ItemsFoods {
+
+ 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.getItemStackFromFQRN(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.getItemStackFromFQRN(CORE.MODID+":itemHotIngotRaisinBread", 1));
+
+ //Raisin Bread
+ ModItems.itemFoodRaisinToast = new BaseItemFood("itemFoodRaisinToast", "Raisin Toast", 1, 0.5f, false).setAlwaysEdible();
+ GT_OreDictUnificator.registerOre("foodRaisinToast", ItemUtils.getItemStackFromFQRN(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.getItemStackFromFQRN(CORE.MODID+":itemHotFoodRaisinToast", 1));
+
+ //Raisin Bread
+ ModItems.itemFoodCurriedSausages = new BaseItemFood("itemFoodCurriedSausages", "Curried Sausages", 5, 2f, false);
+ GT_OreDictUnificator.registerOre("foodCurriedSausages", ItemUtils.getItemStackFromFQRN(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.getItemStackFromFQRN(CORE.MODID+":itemHotFoodCurriedSausages", 1));
+
+ ModItems.itemMetaFood = new BaseItemMetaFood();
+ BaseItemMetaFood.registerFoodsToOreDict();
+ addCookingRecipes();
+ addFoodDropsToMobs();
+
+ }
+
+ private static ItemStack getMetaFoodStack(int aID) {
+ return ItemUtils.simpleMetaStack(ModItems.itemMetaFood, aID, 1);
+ }
+
+ private static void addCookingRecipes() {
+
+ RecipeUtils.addSmeltingRecipe(getMetaFoodStack(0), getMetaFoodStack(1), 0.4F);
+ RecipeUtils.addSmeltingRecipe(getMetaFoodStack(2), getMetaFoodStack(3), 0.35F);
+ RecipeUtils.addSmeltingRecipe(getMetaFoodStack(4), getMetaFoodStack(5), 0.35F);
+ RecipeUtils.addSmeltingRecipe(getMetaFoodStack(6), getMetaFoodStack(7), 0.35F);
+
+ }
+
+ private static void addFoodDropsToMobs() {
+
+ EntityUtils.registerDropsForMob(EntityVillager.class, getMetaFoodStack(0), 2, 1500);
+ EntityUtils.registerDropsForMob(EntityHorse.class, getMetaFoodStack(2), 4, 4000);
+ EntityUtils.registerDropsForMob(EntityWolf.class, getMetaFoodStack(4), 2, 4000);
+ EntityUtils.registerDropsForMob(EntityOcelot.class, getMetaFoodStack(6), 2, 4000);
+ EntityUtils.registerDropsForMob(EntityBlaze.class, getMetaFoodStack(8), 1, 500);
+
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/init/ItemsMultiTools.java b/src/main/java/gtPlusPlus/core/item/init/ItemsMultiTools.java
new file mode 100644
index 0000000000..9f87408b56
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/init/ItemsMultiTools.java
@@ -0,0 +1,74 @@
+package gtPlusPlus.core.item.init;
+
+import gregtech.api.enums.Materials;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.ALLOY;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class ItemsMultiTools {
+
+ public static void load(){
+ run();
+ }
+
+ private static void run(){
+
+ //Load Multitools
+ final boolean gtStyleTools = LoadedMods.Gregtech;
+ if (CORE.ConfigSwitches.enableMultiSizeTools){
+
+ //GT Materials
+ final Materials[] rm = Materials.values();
+ for (final Materials m : rm){
+ toolFactoryGT(m, gtStyleTools);
+ }
+
+ //GT++ Materials
+ toolFactory(ALLOY.HASTELLOY_C276);
+ toolFactory(ALLOY.HASTELLOY_N);
+ toolFactory(ALLOY.HASTELLOY_W);
+ toolFactory(ALLOY.HASTELLOY_X);
+ toolFactory(ALLOY.INCOLOY_020);
+ toolFactory(ALLOY.INCOLOY_DS);
+ toolFactory(ALLOY.INCOLOY_MA956);
+ toolFactory(ALLOY.INCONEL_625);
+ toolFactory(ALLOY.INCONEL_690);
+ toolFactory(ALLOY.INCONEL_792);
+ toolFactory(ALLOY.LEAGRISIUM);
+ toolFactory(ALLOY.TANTALLOY_60);
+ toolFactory(ALLOY.TANTALLOY_61);
+ toolFactory(ALLOY.STABALLOY);
+ toolFactory(ALLOY.QUANTUM);
+ //toolFactory(ALLOY.BEDROCKIUM);
+ toolFactory(ALLOY.POTIN);
+ toolFactory(ALLOY.TUMBAGA);
+ toolFactory(ALLOY.TALONITE);
+ toolFactory(ALLOY.STELLITE);
+ toolFactory(ALLOY.TUNGSTEN_CARBIDE);
+ toolFactory(ALLOY.TANTALUM_CARBIDE);
+
+
+ }
+
+ }
+
+
+ private static boolean toolFactoryGT(final Materials m, final boolean b){
+ ModItems.MP_GTMATERIAL = ItemUtils.generateMultiPick(b, m);
+ ModItems.MS_GTMATERIAL = ItemUtils.generateMultiShovel(b, m);
+ return true;
+ }
+
+ private static boolean toolFactory(final Material m){
+ Logger.WARNING("Generating Multi-Tools for "+m.getLocalizedName());
+ ModItems.MP_GTMATERIAL = ItemUtils.generateMultiPick(m);
+ ModItems.MS_GTMATERIAL = ItemUtils.generateMultiShovel(m);
+ return true;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/materials/DustDecayable.java b/src/main/java/gtPlusPlus/core/item/materials/DustDecayable.java
new file mode 100644
index 0000000000..d42ac85012
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/materials/DustDecayable.java
@@ -0,0 +1,97 @@
+package gtPlusPlus.core.item.materials;
+
+import static gtPlusPlus.core.util.minecraft.ItemUtils.getSimpleStack;
+
+import java.util.List;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+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;
+
+import gregtech.api.util.GT_OreDictUnificator;
+import gtPlusPlus.core.handler.Recipes.DecayableRecipe;
+import gtPlusPlus.core.item.base.BaseItemTickable;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.EntityUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+
+public class DustDecayable extends BaseItemTickable {
+
+ private final Item turnsIntoItem;
+ private final int radLevel;
+
+ public DustDecayable(String unlocal, int colour, int maxTicks, String[] desc1, Item turnsInto, int radLevel) {
+ super(true, true, unlocal, colour, (maxTicks/1), desc1);
+ this.turnsIntoItem = turnsInto;
+ this.radLevel = radLevel;
+ GT_OreDictUnificator.registerOre(unlocal, ItemUtils.getSimpleStack(this));
+ new DecayableRecipe(maxTicks, getSimpleStack(this), getSimpleStack(turnsInto));
+ }
+
+ @Override
+ public void registerIcons(IIconRegister reg) {
+ String gt = "gregtech" + ":" + "materialicons/"+"NUCLEAR"+"/" + "dust";
+ this.mIcon[0] = reg.registerIcon(gt);
+ String gt2 = "gregtech" + ":" + "materialicons/"+"NUCLEAR"+"/" + "dust" + "_OVERLAY";
+ this.mIcon[1] = reg.registerIcon(gt2);
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
+ super.addInformation(stack, player, list, bool);
+ if (this.radLevel > 0) {
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }
+ }
+
+ @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 == null || iStack == null) {
+ return;
+ }
+ if (world.isRemote) {
+ return;
+ }
+
+ if (entityHolding instanceof EntityPlayer){
+ if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){
+ EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.radLevel, world, entityHolding);
+ }
+ }
+ boolean a1, a2;
+
+ a1 = this.isTicking(world, iStack);
+ a2 = tickItemTag(world, iStack);
+
+ if (!a1 && !a2) {
+ if (entityHolding instanceof EntityPlayer){
+ ItemStack replacement = ItemUtils.getSimpleStack(getDecayResult());
+ //Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+replacement.getDisplayName()+".");
+ final ItemStack tempTransform = replacement;
+ if (iStack.stackSize > 1){
+ int u = iStack.stackSize;
+ tempTransform.stackSize = u;
+ ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
+ for (int l=0;l<u;l++){
+ ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
+ }
+
+ }
+ else {
+ tempTransform.stackSize=1;
+ ((EntityPlayer) entityHolding).inventory.addItemStackToInventory((tempTransform));
+ ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
+ }
+ }
+ }
+ }
+
+ public Item getDecayResult() {
+ return turnsIntoItem;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/materials/MaterialHandler.java b/src/main/java/gtPlusPlus/core/item/materials/MaterialHandler.java
new file mode 100644
index 0000000000..40fc6539e6
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/materials/MaterialHandler.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.core.item.materials;
+
+public class MaterialHandler {
+
+ @SuppressWarnings("unused")
+ private String Staballoy;
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/ConnectedBlockFinder.java b/src/main/java/gtPlusPlus/core/item/tool/misc/ConnectedBlockFinder.java
new file mode 100644
index 0000000000..555635741e
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/ConnectedBlockFinder.java
@@ -0,0 +1,142 @@
+package gtPlusPlus.core.item.tool.misc;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.BaseItemWithDamageValue;
+
+public class ConnectedBlockFinder extends BaseItemWithDamageValue{
+
+ public ConnectedBlockFinder() {
+ super("item.test.connector");
+ this.setTextureName("stick");
+ this.setMaxStackSize(1);
+ this.setMaxDamage(10000);
+ setCreativeTab(AddToCreativeTab.tabTools);
+ GameRegistry.registerItem(this, getUnlocalizedName());
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add(EnumChatFormatting.GRAY+"Finds connected blocks, turns them to Glass once found.");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public boolean doesContainerItemLeaveCraftingGrid(final ItemStack itemStack){
+ return false;
+ }
+
+ @Override
+ public boolean getShareTag(){
+ return true;
+ }
+
+ @Override
+ public boolean hasContainerItem(final ItemStack itemStack){
+ return true;
+ }
+ @Override
+ public ItemStack getContainerItem(final ItemStack itemStack){
+ return itemStack;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return EnumRarity.uncommon;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return false;
+ }
+
+
+ @Override
+ public boolean onItemUse(
+ ItemStack stack, EntityPlayer player, World world,
+ int x, int y, int z, int side,
+ float hitX, float hitY, float hitZ) {
+
+ BlockPos mStartPoint = new BlockPos(x,y,z, world);
+ Block mBlockType = world.getBlock(x, y, z);
+ int mBlockMeta = mBlockType.getDamageValue(world, x, y, z);
+
+ //Return if Air.
+ if (world.isAirBlock(x, y, z)) {
+ return false;
+ }
+
+ int breaker = 0;
+ Set<BlockPos> mTotalIndex = new HashSet<BlockPos>();
+
+ Set<BlockPos> mFirstSearch = new HashSet<BlockPos>();
+ Set<BlockPos> mSearch_A = new HashSet<BlockPos>();
+
+ Set<BlockPos> mSearch_B = new HashSet<BlockPos>();
+ Set<BlockPos> mSearch_C = new HashSet<BlockPos>();
+ Set<BlockPos> mSearch_D = new HashSet<BlockPos>();
+
+ mFirstSearch.add(mStartPoint);
+ mTotalIndex.add(mStartPoint);
+
+
+
+
+ for (BlockPos G : mSearch_D) {
+ if (!world.isAirBlock(G.xPos, G.yPos, G.zPos)) {
+ world.setBlock(G.xPos, G.yPos, G.zPos, Blocks.diamond_ore);
+ }
+ }
+
+
+
+ return super.onItemUse(stack, player, world, x, y, z, side, hitX, hitY, hitZ);
+ }
+
+ public Set<BlockPos> getValidNeighboursForSet(Set<BlockPos> set){
+ Set<BlockPos> results = set;
+ for (BlockPos F : set) {
+ results.addAll(F.getValidNeighboursAndSelf());
+ }
+ return results;
+ }
+
+ public Set<BlockPos> getExtraNeighboursForSet(Set<BlockPos> set){
+ Set<BlockPos> results = set;
+ for (BlockPos F : set) {
+ results.addAll(F.getValidNeighboursAndSelf());
+ }
+ return results;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
+ // TODO Auto-generated method stub
+ return super.onItemRightClick(p_77659_1_, p_77659_2_, p_77659_3_);
+ }
+
+
+
+
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/DebugScanner.java b/src/main/java/gtPlusPlus/core/item/tool/misc/DebugScanner.java
new file mode 100644
index 0000000000..0170df0dc7
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/DebugScanner.java
@@ -0,0 +1,104 @@
+package gtPlusPlus.core.item.tool.misc;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class DebugScanner extends CoreItem {
+
+ public DebugScanner() {
+ super("gtpp.debug.scanner", AddToCreativeTab.tabTools, 1, 0,
+ new String[] {
+ "Used to obtain information from GT/GT++ content",
+ "Right Click to use",
+ },
+ EnumRarity.epic);
+ setTextureName(CORE.MODID + ":itemStickyRubber");
+ }
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int p_77648_4_,
+ int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
+ // TODO Auto-generated method stub
+ return super.onItemUse(aStack, aPlayer, aWorld, p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_8_,
+ p_77648_9_, p_77648_10_);
+ }
+
+ @Override
+ public boolean isRepairable() {
+ return false;
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
+ // TODO Auto-generated method stub
+ return super.onItemRightClick(p_77659_1_, p_77659_2_, p_77659_3_);
+ }
+
+ @Override
+ public float getDigSpeed(ItemStack itemstack, Block block, int metadata) {
+ return 0f;
+ }
+
+ @Override
+ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
+ if (entity != null && player != null) {
+ PlayerUtils.messagePlayer(player, "Entity ID: "+entity.getEntityId());
+ PlayerUtils.messagePlayer(player, "UUID: "+entity.getUniqueID());
+ PlayerUtils.messagePlayer(player, "Invulnerable? "+entity.isEntityInvulnerable());
+ PlayerUtils.messagePlayer(player, "Invisible? "+entity.isInvisible());
+ PlayerUtils.messagePlayer(player, "Age: "+entity.ticksExisted);
+
+ if (entity instanceof EntityLivingBase) {
+ EntityLivingBase g = (EntityLivingBase) entity;
+ PlayerUtils.messagePlayer(player, "Health: "+g.getHealth()+"/"+g.getMaxHealth());
+ PlayerUtils.messagePlayer(player, "On ground? "+g.onGround);
+ PlayerUtils.messagePlayer(player, "Child? "+g.isChild());
+ }
+ if (entity instanceof EntityLiving) {
+ EntityLiving g = (EntityLiving) entity;
+ PlayerUtils.messagePlayer(player, "Can Loot? "+g.canPickUpLoot());
+
+ }
+ if (entity instanceof EntityPlayer) {
+ EntityPlayer y = (EntityPlayer) entity;
+ PlayerUtils.messagePlayer(player, "Experience: "+y.experience);
+ PlayerUtils.messagePlayer(player, "Name: "+y.getCommandSenderName());
+ }
+
+ }
+ return true;
+ }
+
+ @Override
+ public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) {
+ return false;
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return true;
+ }
+
+ @Override
+ public int getHarvestLevel(ItemStack stack, String toolClass) {
+ return 0;
+ }
+
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/FakeGregtechTool.java b/src/main/java/gtPlusPlus/core/item/tool/misc/FakeGregtechTool.java
new file mode 100644
index 0000000000..47856b44c0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/FakeGregtechTool.java
@@ -0,0 +1,74 @@
+package gtPlusPlus.core.item.tool.misc;
+
+import java.util.List;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
+import gregtech.api.enums.Materials;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+
+public class FakeGregtechTool extends CoreItem{
+
+ public final int componentColour;
+ public Object extraData;
+
+ protected IIcon base[] = new IIcon[6];
+ protected IIcon overlay[] = new IIcon[6];
+
+ public FakeGregtechTool() {
+ super("GregeriousT's Display Tool", AddToCreativeTab.tabTools, 1);
+ short[] tempCol = Materials.TungstenSteel.getRGBA();
+ this.componentColour = Utils.rgbtoHexValue(tempCol[0], tempCol[1], tempCol[2]);
+ }
+
+ @Override
+ public void registerIcons(final IIconRegister i) {
+ //ScrewDriver
+ this.base[0] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadScrewdriver");
+ this.overlay[0] = i.registerIcon("gregtech" + ":" + "iconsets/" + "HANDLE_SCREWDRIVER");
+ //Soldering iron
+ this.base[1] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadSoldering");
+ this.overlay[1] = i.registerIcon("gregtech" + ":" + "iconsets/" + "HANDLE_SOLDERING");
+ //Mallet
+ this.base[2] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "handleMallet");
+ this.overlay[2] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadMallet");
+ //Hammer
+ this.base[3] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "stick");
+ this.overlay[3] = i.registerIcon("gregtech" + ":" + "materialicons/METALLIC/" + "toolHeadHammer");
+ //Wrench
+ this.base[4] = i.registerIcon("gregtech" + ":" + "iconsets/" + "WRENCH");
+ this.overlay[4] = i.registerIcon("gregtech" + ":" + "iconsets/" + "WRENCH_OVERLAY");
+ //Crowbar
+ this.base[5] = i.registerIcon("gregtech" + ":" + "iconsets/" + "CROWBAR");
+ this.overlay[5] = i.registerIcon("gregtech" + ":" + "iconsets/" + "CROWBAR_OVERLAY");
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int renderPass) {
+ if (renderPass == 1){
+ return Utils.rgbtoHexValue(230, 230, 230);
+ }
+ return this.componentColour;
+ }
+
+ @Override
+ public boolean requiresMultipleRenderPasses() {
+ return true;
+ }
+
+ @Override
+ public void getSubItems(Item item, CreativeTabs tab, List list) {
+ for (int i = 0; i < 6; i ++) {
+ list.add(new ItemStack(item, 1, i));
+ }
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/GregtechPump.java b/src/main/java/gtPlusPlus/core/item/tool/misc/GregtechPump.java
new file mode 100644
index 0000000000..e43dc8546b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/GregtechPump.java
@@ -0,0 +1,1302 @@
+package gtPlusPlus.core.item.tool.misc;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.SubTag;
+import gregtech.api.enums.TC_Aspects.TC_AspectStack;
+import gregtech.api.interfaces.IItemBehaviour;
+import gregtech.api.interfaces.IItemContainer;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
+import gregtech.api.objects.ItemData;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.ModItems;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import gtPlusPlus.core.util.minecraft.NBTUtils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import ic2.api.item.IElectricItemManager;
+import ic2.api.item.ISpecialElectricItem;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidContainerItem;
+import net.minecraftforge.fluids.IFluidHandler;
+import net.minecraftforge.fluids.IFluidTank;
+
+public class GregtechPump extends Item implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem {
+
+ /**
+ * Right Click Functions
+ */
+
+ @Override
+ public boolean onItemUse(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int a4,
+ float p_77648_8_, float p_77648_9_, float p_77648_10_) {
+ if (aStack == null || aPlayer == null || aWorld == null || aWorld.isRemote) {
+ return false;
+ }
+ if (!aWorld.isRemote && tryDrainTile(aStack, aWorld, aPlayer, aX, aY, aZ)) {
+ return true;
+ } else {
+ //return super.onItemUse(aStack, aPlayer, aWorld, aX, aY, aZ, a4, p_77648_8_, p_77648_9_, p_77648_10_);
+ return false;
+ }
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
+ return p_77659_1_;
+ }
+
+ /**
+ * GT Code
+ */
+
+ /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */
+ private final HashMap<Short, ArrayList<IItemBehaviour<GregtechPump>>> mItemBehaviors = new HashMap<>();
+ public final short mOffset, mItemAmount;
+ public final BitSet mEnabledItems;
+ public final BitSet mVisibleItems;
+ /** The unlocalized name of this item. */
+ private String unlocalizedName;
+
+ private final HashMap<Integer, IIcon> mIconMap = new LinkedHashMap<Integer, IIcon>();
+ private final HashMap<Integer, EnumRarity> rarity = new LinkedHashMap<Integer, EnumRarity>();
+ private final HashMap<Integer, EnumChatFormatting> descColour = new LinkedHashMap<Integer, EnumChatFormatting>();
+ private final HashMap<Integer, String> itemName = new LinkedHashMap<Integer, String>();
+ private final HashMap<Integer, String> itemDescription = new LinkedHashMap<Integer, String>();
+ private final HashMap<Integer, Boolean> hasEffect = new LinkedHashMap<Integer, Boolean>();
+
+ public final HashMap<Short, Long[]> mElectricStats = new LinkedHashMap<Short, Long[]>();
+ public final HashMap<Short, Short> mBurnValues = new LinkedHashMap<Short, Short>();
+
+ public void registerPumpType(final int aID, final String aPumpName, final int aEuMax, final int aTier) {
+ ModItems.toolGregtechPump.registerItem(aID, // ID
+ aPumpName, // Name
+ aEuMax, // Eu Storage
+ (short) aTier, // Tier
+ "Can be used to remove fluids from GT machine input & output slots.", // Tooltip
+ aTier <= 0 ? EnumRarity.common : aTier == 1 ? EnumRarity.uncommon : aTier == 2 ? EnumRarity.rare : aTier == 3 ? EnumRarity.epic : EnumRarity.common, // Rarity
+ EnumChatFormatting.GRAY, // Desc colour
+ false // Effect?
+ );
+ }
+
+ public GregtechPump() {
+ this("MU-metatool.01", AddToCreativeTab.tabTools, (short) 1000, (short) 31766);
+ }
+
+ public GregtechPump(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.setHasSubtypes(true);
+ this.setMaxDamage(0);
+ this.setUnlocalizedName(unlocalizedName);
+ this.setCreativeTab(creativeTab);
+ this.setMaxStackSize(1);
+ if (GameRegistry.findItem(CORE.MODID, unlocalizedName) == null) {
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+ }
+
+ 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[] {});
+ if (euStorage > 0 && tier > 0)
+ this.setElectricStats(this.mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true);
+ this.rarity.put(id, regRarity);
+ this.itemName.put(id, localizedName);
+ this.itemDescription.put(id, description);
+ this.descColour.put(id, colour);
+ this.hasEffect.put(id, Effect);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack) {
+ int h = getCorrectMetaForItemstack(par1ItemStack);
+ if (this.rarity.get(h) != null) {
+ return this.rarity.get(h);
+ }
+ return EnumRarity.common;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack) {
+ int h = getCorrectMetaForItemstack(par1ItemStack);
+ if (this.hasEffect.get(h) != null) {
+ return this.hasEffect.get(h);
+ }
+ return false;
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ @Override
+ public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, final boolean aF3_H) {
+ // aList.add("Meta: "+(aStack.getItemDamage()-mOffset));
+
+ int aOffsetMeta = getCorrectMetaForItemstack(aStack);
+
+ if ((this.descColour.get(aOffsetMeta) != null)
+ && (this.itemDescription.get(aOffsetMeta) != null)) {
+ aList.add(this.descColour.get(aOffsetMeta)
+ + this.itemDescription.get(aOffsetMeta));
+ }
+
+
+ if (aOffsetMeta <= 3) {
+ FluidStack f = getFluid(aStack);
+ aList.add("Cannot drain any other standard fluid container block");
+ aList.add("Cannot be emptied via RMB, use inside a tank with GUI");
+ aList.add(EnumChatFormatting.DARK_GRAY+"This is technically just a fancy fluid cell");
+ aList.add(EnumChatFormatting.BLUE + (f != null ? f.getLocalizedName() : "No Fluids Contained"));
+ aList.add(EnumChatFormatting.BLUE + (f != null ? ""+f.amount : ""+0) + "L" + " / " + getCapacity(aStack) + "L");
+ }
+
+ 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: "
+ + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)]
+ + EnumChatFormatting.GRAY);
+ }
+ }
+ }
+
+ final ArrayList<IItemBehaviour<GregtechPump>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack));
+ if (tList != null) {
+ for (final IItemBehaviour<GregtechPump> tBehavior : tList) {
+ aList = tBehavior.getAdditionalToolTips(this, aList, aStack);
+ }
+ }
+ }
+
+ @Override
+ public final Item getChargedItem(final ItemStack itemStack) {
+ return this;
+ }
+
+ @Override
+ public final Item getEmptyItem(final ItemStack itemStack) {
+ return this;
+ }
+
+ @Override
+ public final double getMaxCharge(final ItemStack aStack) {
+ final Long[] tStats = this.getElectricStats(aStack);
+ if (tStats == null) {
+ return 0;
+ }
+ return Math.abs(tStats[0]);
+ }
+
+ @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]);
+ }
+
+ @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 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;
+ }
+
+ @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)) {
+ return 0;
+ }
+ if (aBatteryAlike && !this.canProvideEnergy(aStack)) {
+ return 0;
+ }
+ if (tStats[3] > 0) {
+ 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);
+ }
+ return tChargeBefore - tNewCharge;
+ }
+
+ @Override
+ public final double getCharge(final ItemStack aStack) {
+ return this.getRealCharge(aStack);
+ }
+
+ @Override
+ public final boolean canUse(final ItemStack aStack, final double aAmount) {
+ return this.getRealCharge(aStack) >= aAmount;
+ }
+
+ @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;
+ }
+
+ @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)));
+ }
+
+ @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 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");
+ }
+
+ 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;
+ }
+
+ public short getChargedMetaData(final ItemStack aStack) {
+ return (short) aStack.getItemDamage();
+ }
+
+ public short getEmptyMetaData(final ItemStack aStack) {
+ return (short) aStack.getItemDamage();
+ }
+
+ public boolean isItemStackUsable(final ItemStack aStack) {
+ final ArrayList<IItemBehaviour<GregtechPump>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack));
+ if (tList != null) {
+ for (final IItemBehaviour<GregtechPump> tBehavior : tList) {
+ if (!tBehavior.isItemStackUsable(this, aStack)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ @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 IElectricItemManager getManager(final ItemStack aStack) {
+ return this;
+ } // We are our own Manager
+
+ /**
+ * Sets the Furnace Burn Value for the Item.
+ *
+ * @param aMetaValue
+ * the Meta Value of the Item you want to set it to. [0 - 32765]
+ * @param aValue
+ * 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU)
+ * @return the Item itself for convenience in constructing.
+ */
+ public final GregtechPump 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;
+ }
+
+ /**
+ * @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 GregtechPump 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;
+ }
+
+ @SuppressWarnings({ "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));
+ 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);
+ aList.add(tStack);
+ }
+ if ((tStats == null) || (tStats[3] != -2)) {
+ final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i);
+ this.isItemStackUsable(tStack);
+ aList.add(tStack);
+ }
+ }
+ }
+ }
+
+ @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)) {
+ mIconMap.put((int) i, aIconRegister.registerIcon(CORE.MODID + ":" + (this.getUnlocalizedName() + "/" + i)));
+ }
+ }
+ }
+
+ @Override
+ public final IIcon getIconFromDamage(final int aMetaData) {
+ if (aMetaData < 0) {
+ return null;
+ }
+ if (aMetaData < this.mOffset) {
+ return mIconMap.get(0);
+ }
+ else {
+ int newMeta = aMetaData - this.mOffset;
+ newMeta = (Math.max(0, Math.min(3, newMeta)));
+ return mIconMap.get(newMeta);
+ }
+ }
+
+ /**
+ * Sets the unlocalized name of this item to the string passed as the parameter"
+ */
+ @Override
+ public Item setUnlocalizedName(final String p_77655_1_) {
+ this.unlocalizedName = p_77655_1_;
+ super.setUnlocalizedName(p_77655_1_);
+ return this;
+ }
+
+ /**
+ * Returns the unlocalized name of this item.
+ */
+ @Override
+ public String getUnlocalizedName() {
+ return this.unlocalizedName;
+ }
+
+ public final Long[] getElectricStats(final ItemStack aStack) {
+ return this.mElectricStats.get((short) aStack.getItemDamage());
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) {
+ return false;
+ }
+
+ @Override
+ public boolean getIsRepairable(final ItemStack aStack, final 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 GregtechPump addItemBehavior(final int aMetaValue, final IItemBehaviour<GregtechPump> aBehavior) {
+ if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) {
+ return this;
+ }
+ ArrayList<IItemBehaviour<GregtechPump>> tList = this.mItemBehaviors.get((short) aMetaValue);
+ if (tList == null) {
+ tList = new ArrayList<>(1);
+ this.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(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<>();
+ // 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<GregtechPump>) tRandomData);
+ tUseOreDict = false;
+ }
+ if (tRandomData instanceof IItemContainer) {
+ ((IItemContainer) tRandomData).set(rStack);
+ tUseOreDict = false;
+ }
+ if (tRandomData instanceof SubTag) {
+ continue;
+ }
+ if (tRandomData instanceof TC_AspectStack) {
+ ((TC_AspectStack) tRandomData).addToAspectList(tAspects);
+ continue;
+ }
+ if (tRandomData instanceof ItemData) {
+ if (GT_Utility.isStringValid(tRandomData)) {
+ GT_OreDictUnificator.registerOre(tRandomData, rStack);
+ } else {
+ GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData);
+ }
+ continue;
+ }
+ if (tUseOreDict) {
+ GT_OreDictUnificator.registerOre(tRandomData, rStack);
+ continue;
+ }
+ }
+ }
+ if (GregTech_API.sThaumcraftCompat != null) {
+ GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false);
+ }
+ return rStack;
+ }
+ return null;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack aStack) {
+ int keyValue = (getCorrectMetaForItemstack(aStack));
+ if (keyValue < 0 || keyValue > 3) {
+ keyValue = 0;
+ }
+ return this.itemName.get(keyValue);
+ }
+
+ /**
+ * Fluid Handling
+ */
+
+ /*
+ * IFluidContainer Functions
+ */
+
+ public void emptyStoredFluid(ItemStack aStack) {
+ if (aStack.hasTagCompound()) {
+ NBTTagCompound t = aStack.getTagCompound();
+ if (t.hasKey("mInit")) {
+ t.removeTag("mInit");
+ }
+ if (t.hasKey("mFluid")) {
+ t.removeTag("mFluid");
+ }
+ if (t.hasKey("mFluidAmount")) {
+ t.removeTag("mFluidAmount");
+ }
+ }
+ }
+
+ public void storeFluid(ItemStack aStack, FluidStack aFluid) {
+ if (aFluid == null) {
+ return;
+ } else {
+ String fluidname = aFluid.getFluid().getName();
+ int amount = aFluid.amount;
+ if (fluidname != null && fluidname.length() > 0 && amount > 0) {
+ NBTUtils.setString(aStack, "mFluid", fluidname);
+ NBTUtils.setInteger(aStack, "mFluidAmount", amount);
+ }
+ }
+ }
+
+ @Override
+ public FluidStack getFluid(ItemStack container) {
+ if (!container.hasTagCompound() || !container.getTagCompound().hasKey("mInit")) {
+ initNBT(container);
+ }
+ if (container.getTagCompound().hasKey("mInit") && container.getTagCompound().getBoolean("mInit")) {
+ String fluidname;
+ Integer amount = 0;
+ fluidname = NBTUtils.getString(container, "mFluid");
+ amount = NBTUtils.getInteger(container, "mFluidAmount");
+ if (fluidname != null && amount != null && amount > 0) {
+ return FluidUtils.getFluidStack(fluidname, amount);
+ } else {
+ return null;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public int getCapacity(ItemStack container) {
+ if (!container.hasTagCompound() || !container.getTagCompound().hasKey("mInit")) {
+ initNBT(container);
+ }
+ if (container.getTagCompound().hasKey("mInit") && container.getTagCompound().getBoolean("mInit")) {
+ return container.getTagCompound().getInteger("mCapacity");
+ }
+ int aMeta = this.getCorrectMetaForItemstack(container);
+ int aCapacity = (aMeta == 0 ? 2000 : (aMeta == 1 ? 8000 : (aMeta == 2 ? 32000 : 128000)));
+ return aCapacity;
+ }
+
+ public int fill(ItemStack container, FluidStack resource) {
+ return fill(container, resource, true);
+ }
+
+ @Override
+ public int fill(ItemStack container, FluidStack resource, boolean doFill) {
+ if (!doFill || resource == null) {
+ return 0;
+ }
+
+ if (!container.hasTagCompound() || !container.getTagCompound().hasKey("mInit")) {
+ initNBT(container);
+ }
+ if (container.getTagCompound().hasKey("mInit") && container.getTagCompound().getBoolean("mInit")) {
+ String aStored;
+ int aStoredAmount = 0;
+ int aCapacity = getCapacity(container);
+ FluidStack aStoredFluid = getFluid(container);
+ if (aStoredFluid != null) {
+ aStored = aStoredFluid.getFluid().getName();
+ aStoredAmount = aStoredFluid.amount;
+ if (aStoredAmount == aCapacity) {
+ return 0;
+ }
+ }
+ // Handle no stored fluid first
+ if (aStoredFluid == null) {
+ Logger.INFO("Pump is empty, filling with tank fluids.");
+ FluidStack toConsume;
+ int amountToConsume = 0;
+ if (resource.amount >= aCapacity) {
+ amountToConsume = aCapacity;
+ } else {
+ amountToConsume = resource.amount;
+ }
+ toConsume = FluidUtils.getFluidStack(resource, amountToConsume);
+ if (toConsume != null && amountToConsume > 0) {
+ storeFluid(container, toConsume);
+ return amountToConsume;
+ }
+ } else {
+ Logger.INFO("Pump is Partially full, filling with tank fluids.");
+ if (aStoredFluid.isFluidEqual(resource)) {
+ Logger.INFO("Found matching fluids.");
+ int aSpaceLeft = (aCapacity - aStoredAmount);
+ Logger.INFO(
+ "Capacity: " + aCapacity + " | Stored: " + aStoredAmount + " | Space left: " + aSpaceLeft);
+ FluidStack toConsume;
+ int amountToConsume = 0;
+ if (resource.amount >= aSpaceLeft) {
+ amountToConsume = aSpaceLeft;
+ Logger.INFO("More or equal fluid amount to pump container space.");
+ } else {
+ amountToConsume = resource.amount;
+ Logger.INFO("Less fluid than container space");
+ }
+ Logger.INFO("Amount to consume: " + amountToConsume);
+ toConsume = FluidUtils.getFluidStack(resource, (aStoredAmount + amountToConsume));
+ if (toConsume != null && amountToConsume > 0) {
+ Logger.INFO("Storing Fluid");
+ storeFluid(container, toConsume);
+ return amountToConsume;
+ } else {
+ Logger.INFO("Not storing fluid");
+ }
+ } else {
+ Logger.INFO("Fluids did not match.");
+ }
+ }
+ }
+ return 0;
+ }
+
+ public FluidStack drain(ItemStack container, int drainAmt) {
+ return drain(container, drainAmt, true);
+ }
+
+ @Override
+ public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) {
+ if (!doDrain || maxDrain == 0) {
+ return null;
+ }
+ if (!container.hasTagCompound() || !container.getTagCompound().hasKey("mInit")) {
+ initNBT(container);
+ }
+ if (container.getTagCompound().hasKey("mInit") && container.getTagCompound().getBoolean("mInit")) {
+
+ String aStored;
+ int aStoredAmount = 0;
+ FluidStack aStoredFluid = getFluid(container);
+
+ if (aStoredFluid != null) {
+ aStored = aStoredFluid.getFluid().getName();
+ aStoredAmount = aStoredFluid.amount;
+ }
+ // We cannot drain this if it's empty.
+ else if (aStoredFluid == null) {
+ return null;
+ }
+
+ if (maxDrain >= aStoredAmount) {
+ emptyStoredFluid(container);
+ return aStoredFluid;
+ } else {
+ // Handle Partial removal
+ int amountRemaining = (aStoredAmount - maxDrain);
+ if (amountRemaining == 0) {
+ emptyStoredFluid(container);
+ } else {
+ FluidStack newAmount = FluidUtils.getFluidStack(aStoredFluid, amountRemaining);
+ FluidStack drained = FluidUtils.getFluidStack(aStoredFluid, maxDrain);
+ if (newAmount != null && drained != null) {
+ storeFluid(container, newAmount);
+ return drained;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Handle ItemStack NBT
+ */
+
+ public void initNBT(ItemStack aStack) {
+ NBTTagCompound aNewNBT;
+ if (!aStack.hasTagCompound()) {
+ aNewNBT = new NBTTagCompound();
+ } else {
+ aNewNBT = aStack.getTagCompound();
+ }
+
+ if (!aNewNBT.hasKey("mInit")) {
+ int aMeta = this.getCorrectMetaForItemstack(aStack);
+ aNewNBT.setInteger("mMeta", aMeta);
+ aNewNBT.setBoolean("mInit", true);
+ aNewNBT.setString("mFluid", "@@@@@");
+ aNewNBT.setInteger("mFluidAmount", 0);
+ int aCapacity = (aMeta == 0 ? 2000 : (aMeta == 1 ? 8000 : (aMeta == 2 ? 32000 : 128000)));
+ aNewNBT.setInteger("mCapacity", aCapacity);
+ aStack.setTagCompound(aNewNBT);
+ }
+ }
+
+ /**
+ * Tile Handling
+ */
+
+ /*
+ * Custom Fluid Handling for Tiles and GT Tiles.
+ */
+
+ public boolean tryDrainTile(ItemStack aStack, World aWorld, EntityPlayer aPlayer, int aX, int aY, int aZ) {
+ try {
+ if (aWorld.isRemote || aStack == null) {
+ return false;
+ } else {
+ int aTier = (aStack.getItemDamage() - 1000);
+ int removal;
+ if (aTier == 0) {
+ removal = 0;
+ } else if (aTier == 1) {
+ removal = 32;
+ } else if (aTier == 2) {
+ removal = 128;
+ } else if (aTier == 3) {
+ removal = 512;
+ } else {
+ removal = 8;
+ }
+ if (!canUse(aStack, removal) && aTier > 0) {
+ PlayerUtils.messagePlayer(aPlayer, "Not enough power.");
+ Logger.INFO("No Power");
+ return false;
+ }
+
+ final Block aBlock = aWorld.getBlock(aX, aY, aZ);
+ if (aBlock == null) {
+ return false;
+ }
+ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
+ if (tTileEntity == null) {
+ return false;
+ } else {
+ double aCharge = this.getCharge(aStack);
+ boolean didDrain = false;
+ if (aTier > 0 && aCharge > 0) {
+ if (discharge(aStack, removal, aTier, true, true, false) > 0) {
+ didDrain = true;
+ }
+ } else if (aTier == 0) {
+ didDrain = true;
+ } else {
+ didDrain = false;
+ }
+
+ if (didDrain) {
+ if ((tTileEntity instanceof IGregTechTileEntity)) {
+ return this.drainTankGT(tTileEntity, aStack, aWorld, aPlayer, aX, aY, aZ);
+ }
+ //Try support Standard Fluid Tanks too (May disable if dupes appear again)
+ else if ((tTileEntity instanceof IFluidTank || tTileEntity instanceof IFluidHandler)) {
+ //return this.drainIFluidTank(tTileEntity, aStack, aWorld, aPlayer, aX, aY, aZ);
+ return false;
+ }
+ }
+ }
+ }
+ } catch (Throwable t) {
+ }
+ return false;
+ }
+
+ /*
+ * Vanilla IFluidTank
+ */
+
+ public boolean drainIFluidTank(TileEntity tTileEntity, ItemStack aStack, World aWorld, EntityPlayer aPlayer, int aX,
+ int aY, int aZ) {
+ if (tTileEntity == null) {
+ Logger.INFO("Invalid Tile, somehow.");
+ return false;
+ }
+ if ((tTileEntity instanceof IFluidTank || tTileEntity instanceof IFluidHandler)) {
+ if (this.getFluid(aStack) == null || (this.getFluid(aStack) != null && this.getFluid(aStack).amount < this.getCapacity(aStack))) {
+ Logger.INFO("Trying to find Stored Fluid - Behaviour Class.");
+ FluidStack aStored = getStoredFluidOfVanillaTank(tTileEntity);
+ if (aStored != null) {
+ int mAmountInserted = fill(aStack, aStored);
+ FluidStack newStackRemainingInTank;
+ if (mAmountInserted > 0) {
+ if (mAmountInserted == aStored.amount) {
+ newStackRemainingInTank = null;
+ } else {
+ newStackRemainingInTank = FluidUtils.getFluidStack(aStored, (aStored.amount - mAmountInserted));
+ }
+ boolean b = setStoredFluidOfVanillaTank(tTileEntity, newStackRemainingInTank);
+ Logger.INFO("Cleared Tank? " + b + " | mAmountInserted: " + mAmountInserted);
+ Logger.INFO("Returning " + b + " - drainTankVanilla.");
+ if (b) {
+ PlayerUtils.messagePlayer(aPlayer, "Drained "+mAmountInserted+"L of "+aStored.getLocalizedName()+".");
+ }
+ return b;
+ }
+ } else {
+ Logger.INFO("Found no valid Fluidstack - drainTankVanilla.");
+ }
+ }
+ else {
+ Logger.INFO("Pump is full.");
+ }
+ }
+ Logger.INFO("Could not drain vanilla tank.");
+ return false;
+ }
+
+ /*
+ * GT Tanks
+ */
+
+ public boolean drainTankGT(TileEntity tTileEntity, ItemStack aStack, World aWorld, EntityPlayer aPlayer, int aX,
+ int aY, int aZ) {
+ if (tTileEntity == null) {
+ return false;
+ }
+ if ((tTileEntity instanceof IGregTechTileEntity)) {
+ Logger.INFO("Right Clicking on GT Tile - drainTankGT.");
+ if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) {
+ Logger.INFO("Returning False - Behaviour Class. Timer < 50");
+ return false;
+ } else if ((!aWorld.isRemote) && (!((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer))) {
+ Logger.INFO("Returning True - drainTankGT. NotUsable()");
+ return true;
+ } else {
+ if (this.getFluid(aStack) == null || (this.getFluid(aStack) != null && this.getFluid(aStack).amount < this.getCapacity(aStack))) {
+ Logger.INFO("Trying to find Stored Fluid - drainTankGT.");
+ FluidStack aStored = getStoredFluidOfGTMachine((IGregTechTileEntity) tTileEntity);
+ if (aStored != null) {
+ int mAmountInserted = fill(aStack, aStored);
+ FluidStack newStackRemainingInTank;
+ if (mAmountInserted > 0) {
+ if (mAmountInserted == aStored.amount) {
+ newStackRemainingInTank = null;
+ } else {
+ newStackRemainingInTank = FluidUtils.getFluidStack(aStored, (aStored.amount - mAmountInserted));
+ }
+ boolean b = setStoredFluidOfGTMachine((IGregTechTileEntity) tTileEntity, newStackRemainingInTank);
+ Logger.INFO("Cleared Tank? " + b + " | mAmountInserted: " + mAmountInserted);
+ Logger.INFO("Returning " + b + " - drainTankGT.");
+ if (b) {
+ PlayerUtils.messagePlayer(aPlayer, "Drained "+mAmountInserted+"L of "+aStored.getLocalizedName()+".");
+ }
+ return b;
+ }
+ } else {
+ Logger.INFO("Found no valid Fluidstack - drainTankGT.");
+ }
+ }
+ else {
+ Logger.INFO("Pump is full.");
+ }
+ }
+ }
+ Logger.INFO("Could not drain GT tank.");
+ return false;
+ }
+
+ /*
+ * Vanilla Tanks
+ */
+
+ public FluidStack getStoredFluidOfVanillaTank(TileEntity aTileEntity) {
+ if (aTileEntity == null) {
+ return null;
+ } else if ((aTileEntity instanceof IFluidTank || aTileEntity instanceof IFluidHandler)) {
+ if (aTileEntity instanceof IFluidTank) {
+ return getStoredFluidOfVanillaTank((IFluidTank) aTileEntity);
+ } else {
+ return getStoredFluidOfVanillaTank((IFluidHandler) aTileEntity);
+ }
+ } else {
+ return null;
+ }
+ }
+
+ public FluidStack getStoredFluidOfVanillaTank(IFluidTank aTileEntity) {
+ FluidStack f = aTileEntity.getFluid();
+ Logger.INFO("Returning Fluid stack from tile. Found: "
+ + (f != null ? f.getLocalizedName() + " - " + f.amount + "L" : "Nothing"));
+ return f;
+ }
+
+ public FluidStack getStoredFluidOfVanillaTank(IFluidHandler aTileEntity) {
+ if (aTileEntity instanceof IFluidTank) {
+ return getStoredFluidOfVanillaTank((IFluidTank) aTileEntity);
+ }
+ FluidStack f;
+ AutoMap<FluidTankInfo[]> m = new AutoMap<FluidTankInfo[]>();
+ for (int i = 0; i < 6; i++) {
+ m.put(aTileEntity.getTankInfo(ForgeDirection.getOrientation(i)));
+ }
+ if (m.get(0) != null && m.get(0)[0] != null && m.get(0)[0].fluid != null) {
+ return m.get(0)[0].fluid;
+ } else {
+ return null;
+ }
+ }
+
+ public boolean setStoredFluidOfVanillaTank(TileEntity aTileEntity, FluidStack aSetFluid) {
+ Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [1]");
+
+ if (aTileEntity == null) {
+ return false;
+ }
+ else if ((aTileEntity instanceof IFluidTank || aTileEntity instanceof IFluidHandler)) {
+ if (aTileEntity instanceof IFluidTank) {
+ Logger.INFO("Tile Was instanceof IFluidTank.");
+ FluidStack f = ((IFluidTank) aTileEntity).getFluid();
+ if (aSetFluid == null) {
+ aSetFluid = f;
+ aSetFluid.amount = f.amount;
+ }
+ int toDrain = (f.amount - aSetFluid.amount);
+ FluidStack newStack;
+ if (toDrain <= 0) {
+ newStack = f;
+ } else {
+ newStack = ((IFluidTank) aTileEntity).drain(toDrain, true);
+ }
+
+ if (newStack.isFluidEqual(aSetFluid) && newStack.amount == aSetFluid.amount) {
+ Logger.INFO("Removed fluid from vanilla IFluidTank successfully.");
+ return true;
+ } else {
+ Logger.INFO("Failed trying to remove fluid from vanilla IFluidTank.");
+ return false;
+ }
+ }
+ else {
+
+ //Rewrite Fluid handling for Vanilla type tanks
+ if (!IFluidHandler.class.isInstance(aTileEntity)) {
+ Logger.INFO("Tile Was not an instance of IFluidHandler.");
+ return false;
+ }
+
+
+ IFluidHandler aTank = (IFluidHandler) aTileEntity;
+ FluidStack aTankContents = null;
+ FluidTankInfo[] a1 = aTank.getTankInfo(ForgeDirection.UNKNOWN);
+ if (a1 != null) {
+ if (a1[0] != null) {
+ aTankContents = a1[0].fluid;
+ Logger.INFO("Found Fluid in Tank. "+aTankContents.getLocalizedName()+" - "+aTankContents.amount);
+ }
+ }
+ if (aSetFluid == null) {
+ Logger.INFO("Setting fluid to tank contents, as we're going to empty it totally.");
+ aSetFluid = aTankContents.copy();
+ }
+ else {
+ Logger.INFO("Setting fluid to tank contents, as we're going to empty it totally.");
+ }
+ Logger.INFO("Tile Was instance of IFluidHandler. Trying to Drain "+aSetFluid.getLocalizedName()+" - "+aSetFluid.amount);
+
+ if (a1 == null || aTankContents == null) {
+ Logger.INFO("Tank is empty.");
+ return false;
+ }
+ //Found some Fluid in the tank
+ else {
+ FluidStack aDrainedStack = aTank.drain(ForgeDirection.UNKNOWN, aSetFluid, true);
+ if (aDrainedStack.isFluidStackIdentical(aSetFluid)) {
+ Logger.INFO("Drained!");
+ return true;
+ }
+ else {
+ Logger.INFO("Partially Drained! This is probably an error.");
+ return true;
+ }
+ }
+ }
+ } else {
+ Logger.INFO("Bad Tank Tile to drain.");
+ return false;
+ }
+
+ }
+
+ /*
+ * GT Tanks
+ */
+
+ public FluidStack getStoredFluidOfGTMachine(IGregTechTileEntity aTileEntity) {
+ if (aTileEntity == null) {
+ return null;
+ }
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ ;
+ if (aMetaTileEntity == null) {
+ return null;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicTank) {
+ Logger.INFO("Tile Was Instanceof BasicTank.");
+ return getStoredFluidOfGTMachine((GT_MetaTileEntity_BasicTank) aMetaTileEntity);
+ } else {
+ return null;
+ }
+ }
+
+ public FluidStack getStoredFluidOfGTMachine(GT_MetaTileEntity_BasicTank aTileEntity) {
+ FluidStack f = aTileEntity.mFluid;
+
+ //Let's see if this machine has output fluid too
+ /*
+ * if (f == null) {
+ * Logger.INFO("Could not find any input fluid, checking output if possible.");
+ * if (aTileEntity instanceof GT_MetaTileEntity_BasicMachine) {
+ * GT_MetaTileEntity_BasicMachine g = (GT_MetaTileEntity_BasicMachine)
+ * aTileEntity;
+ * Logger.INFO("Tile is a Basic Machine of some sort - "+g.mNEIName); if (g !=
+ * null) { f = g.mOutputFluid; if (f != null) {
+ * Logger.INFO("Found output fluid! "+f.getLocalizedName()); } else {
+ * Logger.INFO("Did not find anything!"); f = g.getFluid(); if (f != null) {
+ * Logger.INFO("Found fluid! "+f.getLocalizedName()); } else {
+ * Logger.INFO("Did not find anything!"); f = g.getFluid(); } } } } }
+ */
+
+ Logger.INFO("Returning Fluid stack from tile. Found: "
+ + (f != null ? f.getLocalizedName() + " - " + f.amount + "L" : "Nothing"));
+ return f;
+ }
+
+ public boolean setStoredFluidOfGTMachine(IGregTechTileEntity aTileEntity, FluidStack aSetFluid) {
+ Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [1]");
+ if (aTileEntity == null) {
+ return false;
+ }
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicTank) {
+ Logger.INFO("Trying to clear Tile's tank. - Behaviour Class. [2]");
+ return setStoredFluidOfGTMachine((GT_MetaTileEntity_BasicTank) aMetaTileEntity, aSetFluid);
+ } else {
+ return false;
+ }
+ }
+
+ public boolean setStoredFluidOfGTMachine(GT_MetaTileEntity_BasicTank aTileEntity, FluidStack aSetFluid) {
+ try {
+
+ //Try Handle Outputs First
+ /*
+ * if (aTileEntity.setDrainableStack(aSetFluid) != null) { return true; }
+ */
+
+ aTileEntity.mFluid = aSetFluid;
+ boolean b = aTileEntity.mFluid == aSetFluid;
+ Logger.INFO("Trying to set Tile's tank. - Behaviour Class. [3] " + b);
+ return b;
+ } catch (Throwable t) {
+ Logger.INFO("Trying to clear Tile's tank. FAILED - Behaviour Class. [x]");
+ return false;
+ }
+ }
+
+
+ public int getCorrectMetaForItemstack(ItemStack aStack) {
+ if (aStack == null) {
+ return 0;
+ }
+ else {
+ if (aStack.getItemDamage() < this.mOffset) {
+ return 0;
+ }
+ else {
+ int newMeta = aStack.getItemDamage() - this.mOffset;
+ newMeta = (Math.max(0, Math.min(3, newMeta)));
+ return newMeta;
+ }
+ }
+
+
+
+
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java b/src/main/java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java
new file mode 100644
index 0000000000..555fc0f23f
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java
@@ -0,0 +1,80 @@
+package gtPlusPlus.core.item.tool.misc;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import gtPlusPlus.core.item.base.BaseItemWithDamageValue;
+import gtPlusPlus.core.lib.CORE;
+
+public class SandstoneHammer extends BaseItemWithDamageValue{
+
+ /* (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 SandstoneHammer(final String unlocalizedName) {
+ super(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setMaxDamage(2500);
+ }
+
+ @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.");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public boolean doesContainerItemLeaveCraftingGrid(final ItemStack itemStack)
+ {
+ return false;
+ }
+
+ @Override
+ public boolean getShareTag()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean hasContainerItem(final ItemStack itemStack)
+ {
+ return true;
+ }
+ @Override
+ public ItemStack getContainerItem(final ItemStack itemStack)
+ {
+ itemStack.setItemDamage(itemStack.getItemDamage() + 8);
+
+ return itemStack;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return EnumRarity.uncommon;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return false;
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java b/src/main/java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java
new file mode 100644
index 0000000000..baed16db03
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/box/AutoLunchBox.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+public class AutoLunchBox extends BaseBoxItem {
+
+ public final static int SLOTS = 9;
+
+ public AutoLunchBox(String displayName) {
+ super(displayName, new String[] {"Stores 9 pieces of food", "Food will automatically be eaten from slot 1, through to "+gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS}, gtPlusPlus.core.item.tool.misc.box.AutoLunchBox.SLOTS);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java b/src/main/java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java
new file mode 100644
index 0000000000..10a3ae5804
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/box/BaseBoxItem.java
@@ -0,0 +1,59 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.item.base.CoreItem;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+public class BaseBoxItem extends CoreItem {
+
+ private final int GUI;
+
+ public BaseBoxItem(String displayName, String[] description, int GUI_ID) {
+ super("item." + Utils.sanitizeString(displayName), displayName, AddToCreativeTab.tabTools, 1, 0,
+ modifyDescriptionStringArray(description), EnumRarity.uncommon, EnumChatFormatting.GRAY, false, null);
+ GUI = GUI_ID;
+ }
+
+ private static String[] modifyDescriptionStringArray(String[] array) {
+ String[] a = new String[array.length + 1];
+ for (int b = 0; b < array.length; b++) {
+ a[b] = array[b];
+ }
+ a[a.length - 1] = "Right Click to open";
+ return a;
+ }
+
+ // Without this method, your inventory will NOT work!!!
+ @Override
+ public int getMaxItemUseDuration(ItemStack stack) {
+ return 1; // return any value greater than zero
+ }
+
+ @Override
+ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) {
+ if (!world.isRemote) {
+ // If player not sneaking, open the inventory gui
+ if (!player.isSneaking()) {
+ player.openGui(GTplusplus.instance, GUI, world, (int) player.posX, (int) player.posY,
+ (int) player.posZ);
+ }
+ }
+ return itemstack;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister iconRegister) {
+ this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName().substring(5));
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java b/src/main/java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java
new file mode 100644
index 0000000000..035859c388
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/box/ContainerBoxBase.java
@@ -0,0 +1,328 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import gregtech.api.enums.Materials;
+import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class ContainerBoxBase extends Container {
+
+ /*
+ * Finally, in your Container class, you will need to check if the currently
+ * opened inventory's uniqueID is equal to the itemstack's uniqueID in the
+ * method 'transferStackInSlot' as well as check if the itemstack is the
+ * currently equipped item in the method 'slotClick'. In both cases, you'll need
+ * to prevent the itemstack from being moved or it will cause bad things to
+ * happen.
+ */
+
+ /**
+ * Step 3: Create a custom Container for your Inventory
+ */
+
+ /*
+ * There's a LOT of code in this one, but read through all of the comments
+ * carefully and it should become clear what everything does. As a bonus, one of
+ * my previous tutorials is included within!
+ * "How to Properly Override Shift-Clicking" is here and better than ever! At
+ * least in my opinion. If you're like me, and you find no end of frustration
+ * trying to figure out which f-ing index you should use for which slots in your
+ * container when overriding transferStackInSlot, or if your following the
+ * original tutorial, then read on.
+ */
+
+ /**
+ * The Item Inventory for this Container, only needed if you want to reference
+ * isUseableByPlayer
+ */
+ private final CustomBoxInventory inventory;
+ /**
+ * Using these will make transferStackInSlot easier to understand and implement
+ * INV_START is the index of the first slot in the Player's Inventory, so our
+ * CustomBoxInventory's number of slots (e.g. 5 slots is array indices 0-4, so
+ * start at 5) Notice how we don't have to remember how many slots we made? We
+ * can just use CustomBoxInventory.INV_SIZE and if we ever change it, the
+ * Container updates automatically.
+ */
+ private final int INV_START, INV_END, HOTBAR_START, HOTBAR_END;
+
+ // If you're planning to add armor slots, put those first like this:
+ // ARMOR_START = CustomBoxInventory.INV_SIZE, ARMOR_END = ARMOR_START+3,
+ // INV_START = ARMOR_END+1, and then carry on like above.
+
+ private Slot generateSlot(final Constructor<?> aClazz, final IInventory base, final int id, final int x,
+ final int y) {
+ Slot aSlot;
+ try {
+ aSlot = (Slot) aClazz.newInstance(base, id, x, y);
+ if (aSlot != null) {
+ return aSlot;
+ }
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public ContainerBoxBase(EntityPlayer par1Player, InventoryPlayer inventoryPlayer,
+ CustomBoxInventory CustomBoxInventory, Class<?> aClazz, int aSlotCount) {
+
+ INV_START = aSlotCount;
+ INV_END = INV_START + 26;
+ HOTBAR_START = INV_END + 1;
+ HOTBAR_END = HOTBAR_START + 8;
+
+ this.inventory = CustomBoxInventory;
+ try {
+
+ Constructor<?> constructor;
+ constructor = aClazz.getConstructor(IInventory.class, int.class, int.class, int.class);
+
+ int i;
+
+ // ITEM INVENTORY - you'll need to adjust the slot locations to match your
+ // texture file
+ // I have them set vertically in columns of 4 to the right of the player model
+ for (i = 0; i < CustomBoxInventory.INV_SIZE; ++i) {
+ // You can make a custom Slot if you need different behavior,
+ // such as only certain item types can be put into this slot
+ // We made a custom slot to prevent our inventory-storing item
+ // from being stored within itself, but if you want to allow that and
+ // you followed my advice at the end of the above step, then you
+ // could get away with using the vanilla Slot class
+ this.addSlotToContainer(generateSlot(constructor, this.getInventoryObject(), i,
+ 80 + (18 * (int) (i / 4)), 8 + (18 * (i % 4))));
+ }
+
+ // If you want, you can add ARMOR SLOTS here as well, but you need to
+ // make a public version of SlotArmor. I won't be doing that in this tutorial.
+ /*
+ * for (i = 0; i < 4; ++i) { // These are the standard positions for survival
+ * inventory layout this.addSlotToContainer(new SlotArmor(this.player,
+ * inventoryPlayer, inventoryPlayer.getSizeInventory() - 1 - i, 8, 8 + i * 18,
+ * i)); }
+ */
+
+ // PLAYER INVENTORY - uses default locations for standard inventory texture file
+ for (i = 0; i < 3; ++i) {
+ for (int j = 0; j < 9; ++j) {
+ this.addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
+ }
+ }
+
+ // PLAYER ACTION BAR - uses default locations for standard action bar texture
+ // file
+ for (i = 0; i < 9; ++i) {
+ this.addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
+ }
+
+ } catch (NoSuchMethodException | SecurityException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer entityplayer) {
+ // be sure to return the inventory's isUseableByPlayer method
+ // if you defined special behavior there:
+ return getInventoryObject().isUseableByPlayer(entityplayer);
+ }
+
+ /**
+ * Called when a player shift-clicks on a slot. You must override this or you
+ * will crash when someone does that.
+ */
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int index) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) this.inventorySlots.get(index);
+
+ if (slot != null && slot.getHasStack()) {
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+
+ // If item is in our custom Inventory or armor slot
+ if (index < INV_START) {
+ // try to place in player inventory / action bar
+ if (!this.mergeItemStack(itemstack1, INV_START, HOTBAR_END + 1, true)) {
+ return null;
+ }
+
+ slot.onSlotChange(itemstack1, itemstack);
+ }
+ // Item is in inventory / hotbar, try to place in custom inventory or armor
+ // slots
+ else {
+ /*
+ * If your inventory only stores certain instances of Items, you can implement
+ * shift-clicking to your inventory like this:
+ *
+ * // Check that the item is the right type if (itemstack1.getItem() instanceof
+ * ItemCustom) { // Try to merge into your custom inventory slots // We use
+ * 'CustomBoxInventory.INV_SIZE' instead of INV_START just in case // you also
+ * add armor or other custom slots if (!this.mergeItemStack(itemstack1, 0,
+ * CustomBoxInventory.INV_SIZE, false)) { return null; } } // If you added armor
+ * slots, check them here as well: // Item being shift-clicked is armor - try to
+ * put in armor slot if (itemstack1.getItem() instanceof ItemArmor) { int type =
+ * ((ItemArmor) itemstack1.getItem()).armorType; if
+ * (!this.mergeItemStack(itemstack1, ARMOR_START + type, ARMOR_START + type + 1,
+ * false)) { return null; } } Otherwise, you have basically 2 choices: 1.
+ * shift-clicking between player inventory and custom inventory 2.
+ * shift-clicking between action bar and inventory
+ *
+ * Be sure to choose only ONE of the following implementations!!!
+ */
+ /**
+ * Implementation number 1: Shift-click into your custom inventory
+ */
+ if (index >= INV_START) {
+ // place in custom inventory
+ if (!this.mergeItemStack(itemstack1, 0, INV_START, false)) {
+ return null;
+ }
+ }
+
+ /**
+ * Implementation number 2: Shift-click items between action bar and inventory
+ */
+ // item is in player's inventory, but not in action bar
+ if (index >= INV_START && index < HOTBAR_START) {
+ // place in action bar
+ if (!this.mergeItemStack(itemstack1, HOTBAR_START, HOTBAR_END + 1, false)) {
+ return null;
+ }
+ }
+ // item in action bar - place in player inventory
+ else if (index >= HOTBAR_START && index < HOTBAR_END + 1) {
+ if (!this.mergeItemStack(itemstack1, INV_START, INV_END + 1, false)) {
+ return null;
+ }
+ }
+ }
+
+ if (itemstack1.stackSize == 0) {
+ slot.putStack((ItemStack) null);
+ } else {
+ slot.onSlotChanged();
+ }
+
+ if (itemstack1.stackSize == itemstack.stackSize) {
+ return null;
+ }
+
+ slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
+ }
+
+ return itemstack;
+ }
+
+ /**
+ * You should override this method to prevent the player from moving the stack
+ * that opened the inventory, otherwise if the player moves it, the inventory
+ * will not be able to save properly
+ */
+ @Override
+ public ItemStack slotClick(int slot, int button, int flag, EntityPlayer player) {
+ // this will prevent the player from interacting with the item that opened the
+ // inventory:
+ if (slot >= 0 && getSlot(slot) != null && getSlot(slot).getStack() == player.getHeldItem()) {
+ return null;
+ }
+ return super.slotClick(slot, button, flag, player);
+ }
+
+ /*
+ * Special note: If your custom inventory's stack limit is 1 and you allow
+ * shift-clicking itemstacks into it, you will need to override mergeStackInSlot
+ * to avoid losing all the items but one in a stack when you shift-click.
+ */
+ /**
+ * Vanilla mergeItemStack method doesn't correctly handle inventories whose max
+ * stack size is 1 when you shift-click into the inventory. This is a modified
+ * method I wrote to handle such cases. Note you only need it if your slot /
+ * inventory's max stack size is 1
+ */
+ @Override
+ protected boolean mergeItemStack(ItemStack stack, int start, int end, boolean backwards) {
+ boolean flag1 = false;
+ int k = (backwards ? end - 1 : start);
+ Slot slot;
+ ItemStack itemstack1;
+
+ if (stack.isStackable()) {
+ while (stack.stackSize > 0 && (!backwards && k < end || backwards && k >= start)) {
+ slot = (Slot) inventorySlots.get(k);
+ itemstack1 = slot.getStack();
+
+ if (!slot.isItemValid(stack)) {
+ k += (backwards ? -1 : 1);
+ continue;
+ }
+
+ if (itemstack1 != null && itemstack1.getItem() == stack.getItem()
+ && (!stack.getHasSubtypes() || stack.getItemDamage() == itemstack1.getItemDamage())
+ && ItemStack.areItemStackTagsEqual(stack, itemstack1)) {
+ int l = itemstack1.stackSize + stack.stackSize;
+
+ if (l <= stack.getMaxStackSize() && l <= slot.getSlotStackLimit()) {
+ stack.stackSize = 0;
+ itemstack1.stackSize = l;
+ getInventoryObject().markDirty();
+ flag1 = true;
+ } else if (itemstack1.stackSize < stack.getMaxStackSize() && l < slot.getSlotStackLimit()) {
+ stack.stackSize -= stack.getMaxStackSize() - itemstack1.stackSize;
+ itemstack1.stackSize = stack.getMaxStackSize();
+ getInventoryObject().markDirty();
+ flag1 = true;
+ }
+ }
+
+ k += (backwards ? -1 : 1);
+ }
+ }
+ if (stack.stackSize > 0) {
+ k = (backwards ? end - 1 : start);
+ while (!backwards && k < end || backwards && k >= start) {
+ slot = (Slot) inventorySlots.get(k);
+ itemstack1 = slot.getStack();
+
+ if (!slot.isItemValid(stack)) {
+ k += (backwards ? -1 : 1);
+ continue;
+ }
+
+ if (itemstack1 == null) {
+ int l = stack.stackSize;
+ if (l <= slot.getSlotStackLimit()) {
+ slot.putStack(stack.copy());
+ stack.stackSize = 0;
+ getInventoryObject().markDirty();
+ flag1 = true;
+ break;
+ } else {
+ putStackInSlot(k,
+ new ItemStack(stack.getItem(), slot.getSlotStackLimit(), stack.getItemDamage()));
+ stack.stackSize -= slot.getSlotStackLimit();
+ getInventoryObject().markDirty();
+ flag1 = true;
+ }
+ }
+
+ k += (backwards ? -1 : 1);
+ }
+ }
+
+ return flag1;
+ }
+
+ public CustomBoxInventory getInventoryObject() {
+ return inventory;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java b/src/main/java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java
new file mode 100644
index 0000000000..0737e463d8
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/box/CustomBoxInventory.java
@@ -0,0 +1,243 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+import java.util.UUID;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+import net.minecraftforge.common.util.Constants;
+
+public abstract class CustomBoxInventory implements IInventory {
+
+ private final String name;
+ protected String uniqueID;
+
+ /** Provides NBT Tag Compound to reference */
+ private final ItemStack invItem;
+
+ /** Defining your inventory size this way is handy */
+ public final int INV_SIZE;
+
+ /** Inventory's size must be same as number of slots you add to the Container class */
+ private ItemStack[] inventory;
+
+ /**
+ * @param itemstack - the ItemStack to which this inventory belongs
+ */
+ public CustomBoxInventory(ItemStack stack, String name2){
+ this(stack, name2, 8);
+ }
+
+ /**
+ * @param itemstack - the ItemStack to which this inventory belongs
+ */
+ public CustomBoxInventory(ItemStack stack, String name2, int slots)
+ {
+ invItem = stack;
+ name = name2;
+ INV_SIZE = slots;
+ inventory = new ItemStack[INV_SIZE];
+
+ /** initialize variable within the constructor: */
+ uniqueID = "";
+
+ if (!stack.hasTagCompound())
+ {
+ stack.setTagCompound(new NBTTagCompound());
+ // no tag compound means the itemstack does not yet have a UUID, so assign one:
+ uniqueID = UUID.randomUUID().toString();
+ }
+
+ /** When reading from NBT: */
+ if ("".equals(uniqueID))
+ {
+ // try to read unique ID from NBT
+ uniqueID = stack.getTagCompound().getString("uniqueID");
+ // if it's still "", assign a new one:
+ if ("".equals(uniqueID))
+ {
+ uniqueID = UUID.randomUUID().toString();
+ }
+ }
+
+ /** Writing to NBT: */
+ // just add this line:
+ stack.getTagCompound().setString("uniqueID", this.uniqueID);
+
+ // note that it's okay to use stack instead of invItem right there
+ // both reference the same memory location, so whatever you change using
+ // either reference will change in the other
+
+ // Read the inventory contents from NBT
+ readFromNBT(stack.getTagCompound());
+ }
+
+ @Override
+ public int getSizeInventory()
+ {
+ return inventory.length;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int slot)
+ {
+ return inventory[slot];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int slot, int amount)
+ {
+ ItemStack stack = getStackInSlot(slot);
+ if(stack != null)
+ {
+ if(stack.stackSize > amount)
+ {
+ stack = stack.splitStack(amount);
+ // Don't forget this line or your inventory will not be saved!
+ markDirty();
+ }
+ else
+ {
+ // this method also calls onInventoryChanged, so we don't need to call it again
+ setInventorySlotContents(slot, null);
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int slot)
+ {
+ ItemStack stack = getStackInSlot(slot);
+ setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ @Override
+ public void setInventorySlotContents(int slot, ItemStack stack)
+ {
+ inventory[slot] = stack;
+
+ if (stack != null && stack.stackSize > getInventoryStackLimit())
+ {
+ stack.stackSize = getInventoryStackLimit();
+ }
+
+ // Don't forget this line or your inventory will not be saved!
+ markDirty();
+ }
+
+ // 1.7.2+ renamed to getInventoryName
+ @Override
+ public String getInventoryName()
+ {
+ return name;
+ }
+
+ // 1.7.2+ renamed to hasCustomInventoryName
+ @Override
+ public boolean hasCustomInventoryName()
+ {
+ return name.length() > 0;
+ }
+
+ @Override
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ /**
+ * This is the method that will handle saving the inventory contents, as it is called (or should be called!)
+ * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also
+ * let you change things in your inventory without ever opening a Gui, if you want.
+ */
+ // 1.7.2+ renamed to markDirty
+ @Override
+ public void markDirty()
+ {
+ for (int i = 0; i < getSizeInventory(); ++i)
+ {
+ if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
+ inventory[i] = null;
+ }
+ }
+
+ // This line here does the work:
+ writeToNBT(invItem.getTagCompound());
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ {
+ return true;
+ }
+
+ // 1.7.2+ renamed to openInventory(EntityPlayer player)
+ @Override
+ public void openInventory() {}
+
+ // 1.7.2+ renamed to closeInventory(EntityPlayer player)
+ @Override
+ public void closeInventory() {}
+
+ /**
+ * This method doesn't seem to do what it claims to do, as
+ * items can still be left-clicked and placed in the inventory
+ * even when this returns false
+ */
+ @Override
+ public abstract boolean isItemValidForSlot(int slot, ItemStack itemstack);
+
+ /**
+ * A custom method to read our inventory from an ItemStack's NBT compound
+ */
+ public void readFromNBT(NBTTagCompound compound)
+ {
+ // Gets the custom taglist we wrote to this compound, if any
+ // 1.7.2+ change to compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND);
+ NBTTagList items = compound.getTagList("ItemInventory", Constants.NBT.TAG_COMPOUND);
+
+ for (int i = 0; i < items.tagCount(); ++i)
+ {
+ // 1.7.2+ change to items.getCompoundTagAt(i)
+ NBTTagCompound item = (NBTTagCompound) items.getCompoundTagAt(i);
+ int slot = item.getInteger("Slot");
+
+ // Just double-checking that the saved slot index is within our inventory array bounds
+ if (slot >= 0 && slot < getSizeInventory()) {
+ inventory[slot] = ItemStack.loadItemStackFromNBT(item);
+ }
+ }
+ }
+
+ /**
+ * A custom method to write our inventory to an ItemStack's NBT compound
+ */
+ public void writeToNBT(NBTTagCompound tagcompound)
+ {
+ // Create a new NBT Tag List to store itemstacks as NBT Tags
+ NBTTagList items = new NBTTagList();
+
+ for (int i = 0; i < getSizeInventory(); ++i)
+ {
+ // Only write stacks that contain items
+ if (getStackInSlot(i) != null)
+ {
+ // Make a new NBT Tag Compound to write the itemstack and slot index to
+ NBTTagCompound item = new NBTTagCompound();
+ item.setInteger("Slot", i);
+ // Writes the itemstack in slot(i) to the Tag Compound we just made
+ getStackInSlot(i).writeToNBT(item);
+
+ // add the tag compound to our tag list
+ items.appendTag(item);
+ }
+ }
+ // Add the TagList to the ItemStack's Tag Compound with the name "ItemInventory"
+ tagcompound.setTag("ItemInventory", items);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java b/src/main/java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java
new file mode 100644
index 0000000000..65b884bd51
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/box/MagicToolBag.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+public class MagicToolBag extends BaseBoxItem {
+
+ public final static int SLOTS = 24;
+
+ public MagicToolBag(String displayName) {
+ super(displayName, new String[] {"Can store magic tools from TC, BM, etc", "Please ask for additional mod support on Github"}, gtPlusPlus.core.item.tool.misc.box.MagicToolBag.SLOTS);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java b/src/main/java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java
new file mode 100644
index 0000000000..92b1382e01
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/misc/box/UniversalToolBox.java
@@ -0,0 +1,13 @@
+package gtPlusPlus.core.item.tool.misc.box;
+
+import gtPlusPlus.core.handler.GuiHandler;
+
+public class UniversalToolBox extends BaseBoxItem {
+
+ public final static int SLOTS = 16;
+
+ public UniversalToolBox(String displayName) {
+ super(displayName, new String[] {"Can store tools from Gregtech, IC2, BC, Forestry", "Please ask for additional mod support on Github"}, GuiHandler.GUI10);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java
new file mode 100644
index 0000000000..2c2441064b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java
@@ -0,0 +1,311 @@
+package gtPlusPlus.core.item.tool.staballoy;
+
+import java.util.List;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.block.Block;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.enchantment.Enchantment;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.RecipeUtils;
+
+public class MultiPickaxeBase extends StaballoyPickaxe{
+
+ /* (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;
+ }
+
+ protected boolean canBreak = true;
+ protected final int colour;
+ protected final String materialName;
+ protected final String displayName;
+ public boolean isValid = true;
+ private final Pair<?, ?> enchantment;
+
+ public MultiPickaxeBase(final String unlocalizedName, final ToolMaterial material, final long materialDurability, final int colour, final Object enchant) {
+ super(Utils.sanitizeString(unlocalizedName), material);
+ this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName));
+ //this.setTextureName(CORE.MODID + ":" + "itemPickaxe");
+ this.setTextureName("minecraft"+":"+"iron_pickaxe");
+ this.setMaxStackSize(1);
+ if ((materialDurability*3) <= Integer.MAX_VALUE){
+ this.setMaxDamage((int) (materialDurability*3));
+ }
+ else {
+ this.setMaxDamage(Integer.MAX_VALUE);
+ this.canBreak = false;
+ }
+ this.colour = colour;
+ this.materialName = material.name();
+ this.displayName = unlocalizedName;
+ this.setCreativeTab(AddToCreativeTab.tabTools);
+ this.miningLevel = material.getHarvestLevel();
+
+
+
+ if (enchant != null){
+ if (enchant instanceof Pair){
+ this.enchantment = (Pair<?, ?>) enchant;
+ }
+ else {
+ this.enchantment = null;
+ }
+ }
+ else {
+ this.enchantment = null;
+ }
+
+ try {this.isValid = this.addRecipe();} catch (final Throwable e){}
+ if ((colour != 0) && this.isValid && (materialDurability > 10000)){
+ if (GameRegistry.findItem(CORE.MODID, Utils.sanitizeString(unlocalizedName)) == null){
+ GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName));
+ }
+ }
+
+ }
+
+ /*
+ *
+ *
+ *
+ * Methods
+ *
+ *
+ *
+ */
+
+ private boolean addRecipe(){
+
+ final String cleanName = Utils.sanitizeString(this.materialName);
+
+ final String plateDense = "plateDense"+cleanName;
+ final String plateDouble = "plateDouble"+cleanName;
+ final String rodLong = "stickLong"+cleanName;
+ final String toolHammer = "craftingToolHardHammer";
+ final String toolWrench = "craftingToolWrench";
+ final String toolFile = "craftingToolFile";
+ final String toolScrewDriver = "craftingToolScrewdriver";
+
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){
+ Logger.WARNING("stickLong of "+cleanName+" does not exist.");
+ return false;
+ }
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){
+ Logger.WARNING("plateDense of "+cleanName+" does not exist.");
+ if (null != ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDouble, 1)){
+ Logger.WARNING("plateDouble of "+cleanName+" does exist. Using it instead.");
+ RecipeUtils.recipeBuilder(
+ plateDouble, plateDouble, plateDouble,
+ toolFile, rodLong, toolHammer,
+ toolWrench, rodLong, toolScrewDriver,
+ ItemUtils.getSimpleStack(this));
+
+ return true;
+ }
+ Logger.WARNING("plateDouble of "+cleanName+" does not exist.");
+ return false;
+ }
+
+ RecipeUtils.recipeBuilder(
+ plateDense, plateDense, plateDense,
+ toolFile, rodLong, toolHammer,
+ toolWrench, rodLong, toolScrewDriver,
+ ItemUtils.getSimpleStack(this));
+
+ return true;
+ }
+
+ public final String getMaterialName() {
+ return this.materialName;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack iStack) {
+ return this.displayName;
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ if (this.colour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return this.colour;
+
+ }
+
+ 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;
+ Logger.INFO("Hardness: "+bHardness);
+
+ bDurabilityLoss = 100;
+ //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss);
+
+ correctTool = this.canPickaxeBlock(removalist, world, new int[]{X,Y,Z});
+ Logger.WARNING(""+correctTool);
+
+ if (!correctTool){
+ return 0;
+ }
+
+ } catch (final NullPointerException e){
+
+ }
+ }
+ return bDurabilityLoss;
+ }
+
+ //Should clear up blocks quicker if I chain it.
+ /*@Override
+ public void removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){
+ localWorld = world;
+ try {
+ 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, world, new int[]{X,Y,Z}, miningLevel)){
+ if (canPickaxeBlock(block, world, new int[]{X,Y,Z})){
+ 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 {
+ return;
+ }
+
+ }
+ }
+ else {
+ Utils.LOG_WARNING("Incorrect Tool for mining this block.");
+ }
+ }
+ } catch (NullPointerException e){
+
+ }
+ }*/
+
+ @Override
+ public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){
+ if (this.canBreak){
+ item.damageItem(damage, localPlayer);
+ }
+ }
+
+ @Override
+ public void setItemDamage(final ItemStack item, final int damage){
+ if (this.canBreak){
+ item.setItemDamage(damage-1);
+ }
+ }
+
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return EnumRarity.uncommon;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return false;
+ }
+
+ @Override
+ public void onCreated(final ItemStack mThisItem, final World mWorld, final EntityPlayer mPlayer) {
+ Enchantment enchant = null;
+ int enchantmentLevel = 0;
+ final Pair<?, ?> Y = this.enchantment;
+ if (Y != null){
+ if (Y.getKey() != null){
+ enchant = (Enchantment) this.enchantment.getKey();
+ }
+ if (Y.getValue() != null){
+ enchantmentLevel = ((Integer) this.enchantment.getValue()).intValue();
+ }
+ }
+ final ItemStack itemToEnchant = mThisItem;
+ if ((enchant != null) && (enchantmentLevel != 0) && (enchantmentLevel >= 1)){
+ itemToEnchant.addEnchantment(enchant, enchantmentLevel);
+ }
+ super.onCreated(itemToEnchant, mWorld, mPlayer);
+ }
+
+ @Override
+ public void getSubItems(final Item mItem, final CreativeTabs mCreativeTab, final List mList) {
+ Enchantment enchant = null;
+ int enchantmentLevel = 0;
+ final Pair<?, ?> Y = this.enchantment;
+ if (Y != null){
+ if (Y.getKey() != null){
+ enchant = (Enchantment) this.enchantment.getKey();
+ }
+ if (Y.getValue() != null){
+ enchantmentLevel = ((Integer) this.enchantment.getValue()).intValue();
+ }
+ }
+
+ final Item thisItem = mItem;
+ final ItemStack itemToEnchant = ItemUtils.getSimpleStack(thisItem);
+ if ((enchant != null) && (enchantmentLevel != 0) && (enchantmentLevel >= 1)){
+ itemToEnchant.addEnchantment(enchant, enchantmentLevel);
+ mList.add(itemToEnchant);
+ }
+ else {
+ mList.add(new ItemStack(thisItem, 1, 0));
+ }
+
+ }
+
+
+ /**
+ *
+ * Time to Override Minecraft stupid mechanics, allowing unbreakable stuff.
+ *
+ */
+
+ @Override
+ public boolean isDamageable(){
+ if (this.getMaxDamage() > 0 && !this.hasSubtypes){
+ if (this.canBreak){
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java b/src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java
new file mode 100644
index 0000000000..d01b400fab
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java
@@ -0,0 +1,126 @@
+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 net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.RecipeUtils;
+
+public class MultiSpadeBase extends StaballoySpade{
+
+ /* (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;
+ }
+
+ protected final int colour;
+ protected final String materialName;
+ protected final String displayName;
+ public boolean isValid = true;
+
+ public MultiSpadeBase(final String unlocalizedName, final ToolMaterial material, final int materialDurability, final int colour) {
+ super(Utils.sanitizeString(unlocalizedName), material);
+ this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName));
+ //this.setTextureName(CORE.MODID + ":" + "itemShovel");
+ this.setTextureName("minecraft"+":"+"iron_shovel");
+ this.setMaxStackSize(1);
+ this.setMaxDamage(materialDurability*3);
+ this.colour = colour;
+ this.materialName = material.name();
+ this.displayName = unlocalizedName;
+ this.setCreativeTab(AddToCreativeTab.tabTools);
+ try {
+ this.isValid = this.addRecipe();
+ }
+ catch (final Throwable e){}
+ if ((colour != 0) && this.isValid){
+ if (GameRegistry.findItem(CORE.MODID, Utils.sanitizeString(unlocalizedName)) == null) {
+ GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName));
+ }
+ }
+ }
+
+ private boolean addRecipe(){
+ final String cleanName = Utils.sanitizeString(this.materialName);
+ final String plateDense = "plateDense"+cleanName;
+ final String plateDouble = "plateDouble"+cleanName;
+ final String rodLong = "stickLong"+cleanName;
+ final String toolHammer = "craftingToolHardHammer";
+ final String toolWrench = "craftingToolWrench";
+ final String toolFile = "craftingToolFile";
+ final String toolScrewDriver = "craftingToolScrewdriver";
+
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){
+ return false;
+ }
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){
+ if (null != ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDouble, 1)){
+ RecipeUtils.recipeBuilder(
+ toolFile, plateDouble, toolHammer,
+ null, rodLong, null,
+ toolWrench, rodLong, toolScrewDriver,
+ ItemUtils.getSimpleStack(this));
+
+ return true;
+ }
+ return false;
+ }
+
+ RecipeUtils.recipeBuilder(
+ toolFile, plateDense, toolHammer,
+ null, rodLong, null,
+ toolWrench, rodLong, toolScrewDriver,
+ ItemUtils.getSimpleStack(this));
+
+ return true;
+ }
+
+ public final String getMaterialName() {
+ return this.materialName;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack iStack) {
+ return this.displayName;
+ /*String name;
+ if (getUnlocalizedName().toLowerCase().contains("wood")){
+ name = "Wooden";
+ }
+ else {
+ }
+ return "Big "+name+" Spade";*/
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ if (this.colour == 0){
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return this.colour;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return EnumRarity.uncommon;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return false;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java b/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java
new file mode 100644
index 0000000000..153a417d7b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java
@@ -0,0 +1,345 @@
+package gtPlusPlus.core.item.tool.staballoy;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.block.*;
+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.EnumRarity;
+import net.minecraft.item.ItemAxe;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.lib.CORE;
+
+public class StaballoyAxe extends ItemAxe{
+ public String mat;
+
+ public StaballoyAxe(final String unlocalizedName, final ToolMaterial material) {
+ super(material);
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ }
+
+ // EXPLODE TREE
+ byte[] tre= new byte[32000];
+ byte unchecked=0;
+ byte needcheck=1;
+ byte ignore =2;
+ byte harvest =3;
+
+ 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;
+ }
+ 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.");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ public static 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());
+ 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 (!canIgnore(bit)) {
+ return 2;
+ }
+ }
+ }
+ return f;
+ }
+
+ public int checkTree(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.check(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;
+ }
+ }
+ }
+ }
+ }
+ return 1;
+ }
+
+ 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;
+ }
+ }
+ }
+ }
+ }else if (bit instanceof BlockLeavesBase){
+ }else{
+ if (!canIgnore(bit)) {
+ return 2;
+ }
+ }
+ }
+ return f;
+ }
+
+ 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;
+ }
+ }
+ }
+ }
+
+ 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 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);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private static 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 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){
+ 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
+ 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);
+ 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);
+ }
+ }
+
+ 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);
+ }
+ }
+ }
+ }
+ return super.onBlockDestroyed(itm, wld, blk, x, y, z, plr);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return EnumRarity.rare;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java b/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java
new file mode 100644
index 0000000000..830c4994ba
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java
@@ -0,0 +1,462 @@
+package gtPlusPlus.core.item.tool.staballoy;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemPickaxe;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.MiningUtils;
+
+public class StaballoyPickaxe extends ItemPickaxe{
+
+ /* (non-Javadoc)
+ * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack)
+ */
+ @Override
+ public double getDurabilityForDisplay(final ItemStack stack) {
+ return (double)stack.getItemDamageForDisplay() / (double)stack.getMaxDamage();
+ }
+
+ /**
+ * Creates an NBT tag for this item if it doesn't have one.
+ * This also set some default values.
+ * @param rStack
+ * @return
+ */
+
+ private static boolean createNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+
+ tagNBT.setBoolean("FACING_HORIZONTAL", true);
+ tagNBT.setString("FACING", "north");
+ tagNBT.setString("lookingDirection", "");
+
+ tagMain.setTag("PickStats", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ /*
+ * Is the player facing horizontally?
+ */
+
+ public static final boolean isFacingHorizontal(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ return aNBT.getBoolean("FACING_HORIZONTAL");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return true;
+ }
+
+ public static final boolean setFacingHorizontal(final ItemStack aStack, final boolean aFacingHorizontal) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ aNBT.setBoolean("FACING_HORIZONTAL", aFacingHorizontal);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * Handles the Direction the player is facing
+ */
+
+ public static final String getFacingDirection(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ return aNBT.getString("FACING");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return "north";
+ }
+
+ public static final boolean setFacingDirection(final ItemStack aStack, final String aFacingHorizontal) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ aNBT.setString("FACING", aFacingHorizontal);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * The Looking Direction handlers
+ */
+
+ public static final String getLookingDirection(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ return aNBT.getString("lookingDirection");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return "";
+ }
+
+ public static final boolean setLookingDirection(final ItemStack aStack, final String aFacingHorizontal) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ aNBT.setString("lookingDirection", aFacingHorizontal);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected int miningLevel;
+
+ /*
+ *
+ *
+ *
+ * Methods
+ *
+ *
+ *
+ */
+
+ @Override
+ public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer aPlayer) {
+ return super.onItemRightClick(stack, world, aPlayer);
+ }
+
+
+
+ @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) {
+ if (!world.isRemote){
+ if (entity instanceof EntityPlayer) {
+ this.GetDestroyOrientation((EntityPlayer) entity, block, getLookingDirection(stack), world, X, Y, Z, stack);
+ }
+ }
+ return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity);
+ }
+
+ 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);
+ Logger.WARNING("Hardness: "+bHardness);
+
+ bDurabilityLoss = (bDurabilityLoss + bHardness);
+ //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss);
+
+ correctTool = this.canPickaxeBlock(removalist, world, new int[]{X,Y,Z});
+ Logger.WARNING(""+correctTool);
+
+ if (!correctTool){
+ return 0;
+ }
+
+ } catch (final NullPointerException e){
+
+ }
+ }
+ return 100;
+ }
+
+ public Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld, final int[] xyz){
+ String correctTool = "";
+ if (!currentWorld.isRemote){
+ try {
+ correctTool = currentBlock.getHarvestTool(0);
+ if (MiningUtils.getBlockType(currentBlock, currentWorld, xyz, this.miningLevel) || correctTool.equals("pickaxe") || correctTool.equals("null")){
+ //Utils.LOG_WARNING(correctTool);
+ return true;}
+ } catch (final NullPointerException e){
+ return false;}
+ }
+ return false;
+ }
+
+ private void GetDestroyOrientation(EntityPlayer entity, final Block block, final String FACING, final World world, final int X, final int Y, final int Z, final ItemStack heldItem){
+ float DURABILITY_LOSS = 0;
+ if (!world.isRemote){
+
+ Logger.WARNING("hardness:"+block.getBlockHardness(world, X, Y, Z));
+ 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);
+ Logger.WARNING("Added Loss: "+dur);
+ this.removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem);
+ }
+ }
+ }
+
+ else if (FACING.equals("facingEast") || FACING.equals("facingWest")){
+ DURABILITY_LOSS = 0;
+ for(int i = -1; i < 2; i++) {
+ for(int j = -1; j < 2; j++) {
+ final float dur = this.calculateDurabilityLoss(world, X, Y + i, Z + j);
+ DURABILITY_LOSS = (DURABILITY_LOSS + dur);
+ Logger.WARNING("Added Loss: "+dur);
+ this.removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem);
+ }
+ }
+ }
+
+ else if (FACING.equals("facingNorth") || FACING.equals("facingSouth")){
+ DURABILITY_LOSS = 0;
+ for(int i = -1; i < 2; i++) {
+ for(int j = -1; j < 2; j++) {
+ final float dur = this.calculateDurabilityLoss(world, X + j, Y + i, Z);
+ DURABILITY_LOSS = (DURABILITY_LOSS + dur);
+ Logger.WARNING("Added Loss: "+dur);
+ this.removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem);
+ }
+ }
+ }
+
+ //int heldItemDurability = heldItem.getDamage(1);
+ Logger.WARNING("Total Loss: "+(int)DURABILITY_LOSS);
+ //heldItem.setDamage(heldStack, DURABILITY_LOSS);
+ //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage());
+ //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack));
+ Logger.WARNING("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);
+
+ Logger.WARNING(
+ "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
+ Logger.WARNING("Breaking Tool");
+ heldItem.stackSize = 0;
+ }
+ //Do Damage
+ else {
+ //setItemDamage(heldItem, durLeft);
+ Logger.WARNING(""+(durNow-durLeft));
+ this.damageItem(heldItem, (durNow-durLeft)-1, entity);
+ }
+
+
+ /*if (heldItem.getItemDamage() <= ((heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)){
+ Utils.LOG_WARNING("2: "+DURABILITY_LOSS+" 3: "+((heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS));
+ setItemDamage(heldItem, (int) (heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS));
+ }
+ else {
+ Utils.LOG_WARNING("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;
+
+ }
+ }
+
+ public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){
+ item.damageItem(damage, localPlayer);
+ }
+
+ public void setItemDamage(final ItemStack item, final int damage){
+ item.setItemDamage(damage-1);
+ }
+
+ //Should clear up blocks quicker if I chain it.
+ public final void removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z, final ItemStack heldItem){
+ try {
+ final Block block = world.getBlock(X, Y, Z);
+ final float dur = this.calculateDurabilityLoss(world, X, Y, Z);
+ Logger.WARNING(block.toString());
+ String removalTool = "";
+ removalTool = block.getHarvestTool(1);
+
+ Logger.WARNING("Removing.1 "+removalTool);
+ /*if ((removalTool.equalsIgnoreCase("pickaxe") || removalTool.equalsIgnoreCase("null") || removalTool == null)){
+ Utils.LOG_WARNING("Removing.2");
+ if (UtilsMining.getBlockType(block, world, new int[]{X,Y,Z}, miningLevel)) {
+ Utils.LOG_WARNING("Removing.3"); */
+ if (this.canPickaxeBlock(block, world, new int[]{X,Y,Z})){
+ Logger.WARNING("Removing.4");
+
+ if (block == Blocks.air){
+ return;
+ }
+
+ if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) >= 0) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){
+
+ Logger.WARNING("Removing.5");
+ if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-dur)){
+
+ if (X == 0 && Y == 0 && Z == 0){
+
+ }
+ else {
+ block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0);
+ world.setBlockToAir(X, Y, Z);
+ }
+
+ }
+
+ }
+ /*}
+
+ }*/
+ }
+ else {
+ Logger.WARNING("Incorrect Tool for mining this block.");
+ }
+ } catch (final NullPointerException e){
+
+ }
+ }
+
+ public boolean checkFacing(final ItemStack aStack, final EntityPlayer aPlayer, final World world){
+ if (aPlayer != null){
+ final int direction = MathHelper.floor_double((aPlayer.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, aPlayer, 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";
+ setFacingHorizontal(aStack, false);
+ }
+ else if (sideHit == 1){
+ playerStandingPosition = "below";
+ setFacingHorizontal(aStack, false);
+ }
+ else if (sideHit == 2){
+ playerStandingPosition = "facingSouth";
+ setFacingHorizontal(aStack, true);
+ }
+ else if (sideHit == 3){
+ playerStandingPosition = "facingNorth";
+ setFacingHorizontal(aStack, true);
+ }
+ else if (sideHit == 4){
+ playerStandingPosition = "facingEast";
+ setFacingHorizontal(aStack, true);
+ }
+ else if (sideHit == 5){
+ playerStandingPosition = "facingWest";
+ setFacingHorizontal(aStack, true);
+ }
+ setLookingDirection(aStack, playerStandingPosition);
+
+ if (direction == 0){
+ setFacingDirection(aStack, "south");
+ }
+ else if (direction == 1){
+ setFacingDirection(aStack, "west");
+ }
+ else if (direction == 2){
+ setFacingDirection(aStack, "north");
+ }
+ else if (direction == 3){
+ setFacingDirection(aStack, "east");
+ }
+ }
+
+
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add(EnumChatFormatting.GRAY+"Mines a 3x3 at 100 durability per block mined.");
+ list.add(EnumChatFormatting.GRAY+"Durability: "+(stack.getMaxDamage()-stack.getItemDamage())+"/"+stack.getMaxDamage());
+ //super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack){
+ return EnumRarity.rare;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return true;
+ }
+
+
+ @Override
+ public boolean onBlockStartBreak(final ItemStack itemstack, final int X, final int Y, final int Z, final EntityPlayer aPlayer) {
+ this.checkFacing(itemstack, aPlayer, aPlayer.getEntityWorld());
+ return super.onBlockStartBreak(itemstack, X, Y, Z, aPlayer);
+ }
+
+ public StaballoyPickaxe(final String unlocalizedName, final ToolMaterial material) {
+ super(material);
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setMaxDamage(3200);
+ this.miningLevel = 5;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java b/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java
new file mode 100644
index 0000000000..6265c9f0a3
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java
@@ -0,0 +1,411 @@
+package gtPlusPlus.core.item.tool.staballoy;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemSpade;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.MiningUtils;
+
+public class StaballoySpade extends ItemSpade{
+
+ /* (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;
+ }
+
+
+ /**
+ * Creates an NBT tag for this item if it doesn't have one.
+ * This also set some default values.
+ * @param rStack
+ * @return
+ */
+
+ private static boolean createNBT(ItemStack rStack){
+ final NBTTagCompound tagMain = new NBTTagCompound();
+ final NBTTagCompound tagNBT = new NBTTagCompound();
+
+ tagNBT.setBoolean("FACING_HORIZONTAL", true);
+ tagNBT.setString("FACING", "north");
+ tagNBT.setString("lookingDirection", "");
+
+ tagMain.setTag("PickStats", tagNBT);
+ rStack.setTagCompound(tagMain);
+ return true;
+ }
+
+ /*
+ * Is the player facing horizontally?
+ */
+
+ public static final boolean isFacingHorizontal(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ return aNBT.getBoolean("FACING_HORIZONTAL");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return true;
+ }
+
+ public static final boolean setFacingHorizontal(final ItemStack aStack, final boolean aFacingHorizontal) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ aNBT.setBoolean("FACING_HORIZONTAL", aFacingHorizontal);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * Handles the Direction the player is facing
+ */
+
+ public static final String getFacingDirection(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ return aNBT.getString("FACING");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return "north";
+ }
+
+ public static final boolean setFacingDirection(final ItemStack aStack, final String aFacingHorizontal) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ aNBT.setString("FACING", aFacingHorizontal);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * The Looking Direction handlers
+ */
+
+ public static final String getLookingDirection(final ItemStack aStack) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ return aNBT.getString("lookingDirection");
+ }
+ }
+ else {
+ createNBT(aStack);
+ }
+ return "";
+ }
+
+ public static final boolean setLookingDirection(final ItemStack aStack, final String aFacingHorizontal) {
+ NBTTagCompound aNBT = aStack.getTagCompound();
+ if (aNBT != null) {
+ aNBT = aNBT.getCompoundTag("PickStats");
+ if (aNBT != null) {
+ aNBT.setString("lookingDirection", aFacingHorizontal);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private int miningLevel;
+
+ /*
+ *
+ *
+ *
+ * Methods
+ *
+ *
+ *
+ */
+
+ @Override
+ public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer aPlayer) {
+ return super.onItemRightClick(stack, world, aPlayer);
+ }
+
+
+
+ @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) {
+ if (!world.isRemote){
+ if (entity instanceof EntityPlayer) {
+ this.GetDestroyOrientation((EntityPlayer) entity, getLookingDirection(stack), world, X, Y, Z, stack);
+ }
+ }
+ return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity);
+ }
+
+ public Boolean canPickaxeBlock(final Block currentBlock, final World currentWorld, final int[] xyz){
+ String correctTool = "";
+ if (!currentWorld.isRemote){
+ try {
+ correctTool = currentBlock.getHarvestTool(0);
+ //Utils.LOG_WARNING(correctTool);
+
+ Logger.WARNING("Tool for Block: "+correctTool+" | Current block: "+currentBlock.getLocalizedName());
+ if (MiningUtils.getBlockType(currentBlock, currentWorld, xyz, this.miningLevel) || correctTool.equals("shovel")){
+ return true;}
+ } catch (final NullPointerException e){
+ return false;}
+ }
+ return false;
+ }
+
+ private void GetDestroyOrientation(EntityPlayer player, final String FACING, final World world, final int X, final int Y, final int Z, final ItemStack heldItem){
+ float DURABILITY_LOSS = 0;
+ if (!world.isRemote){
+
+ if (FACING.equals("below") || FACING.equals("above")){
+ DURABILITY_LOSS = 0;
+ for(int i = -1; i < 2; i++) {
+ for(int j = -1; j < 2; j++) {
+ DURABILITY_LOSS = (DURABILITY_LOSS + this.removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem));
+ }
+ }
+ }
+
+ else if (FACING.equals("facingEast") || FACING.equals("facingWest")){
+ DURABILITY_LOSS = 0;
+ for(int i = -1; i < 2; i++) {
+ for(int j = -1; j < 2; j++) {
+ DURABILITY_LOSS = (DURABILITY_LOSS + this.removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem));
+ }
+ }
+ }
+
+ else if (FACING.equals("facingNorth") || FACING.equals("facingSouth")){
+ DURABILITY_LOSS = 0;
+ for(int i = -1; i < 2; i++) {
+ for(int j = -1; j < 2; j++) {
+ DURABILITY_LOSS = (DURABILITY_LOSS + this.removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem));
+ }
+ }
+ }
+
+ //int heldItemDurability = heldItem.getDamage(1);
+ Logger.WARNING("Total Loss: "+(int)DURABILITY_LOSS);
+ //heldItem.setDamage(heldStack, DURABILITY_LOSS);
+ //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage());
+ //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack));
+ Logger.WARNING("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);
+
+ Logger.WARNING(
+ "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
+ Logger.WARNING("Breaking Tool");
+ heldItem.stackSize = 0;
+ }
+ //Do Damage
+ else {
+ //setItemDamage(heldItem, durLeft);
+ Logger.WARNING(""+(durNow-durLeft));
+ this.damageItem(heldItem, (durNow-durLeft)-1, player);
+ }
+ DURABILITY_LOSS = 0;
+
+ }
+ }
+
+ public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){
+ item.damageItem(damage, localPlayer);
+ }
+
+ public void setItemDamage(final ItemStack item, final 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){
+ Logger.WARNING("Trying to drop/remove a block.");
+ try {
+ final Block block = world.getBlock(X, Y, Z);
+ Logger.WARNING(block.toString());
+ String removalTool = "";
+ removalTool = block.getHarvestTool(0);
+ if (removalTool != null){
+ if (removalTool.equals("shovel")){
+ if (this.canPickaxeBlock(block, world, new int[]{X,Y,Z})){
+ 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);
+ Logger.WARNING("Adding 100 damage to item.");
+ return 100;
+ }
+ Logger.WARNING("Incorrect Tool for mining this block. Wrong Block Water/lava/bedrock/blacklist");
+ return 0;
+ }
+ Logger.WARNING("Incorrect Tool for mining this block. Cannot Shovel this block type.");
+ return 0;
+ }
+ Logger.WARNING("Incorrect Tool for mining this block. Blocks mining tool is now Shovel.");
+ return 0;
+ }
+ Logger.WARNING("Either the block was air or it declares an invalid mining tool.");
+ return 0;
+ } catch (final NullPointerException e){
+ Logger.WARNING("Something Broke");
+ e.printStackTrace();
+ return 0;
+ }
+ }
+
+ public boolean checkFacing(final ItemStack aStack, final EntityPlayer aPlayer, final World world){
+ if (aPlayer != null){
+ final int direction = MathHelper.floor_double((aPlayer.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, aPlayer, 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";
+ setFacingHorizontal(aStack, false);
+ }
+ else if (sideHit == 1){
+ playerStandingPosition = "below";
+ setFacingHorizontal(aStack, false);
+ }
+ else if (sideHit == 2){
+ playerStandingPosition = "facingSouth";
+ setFacingHorizontal(aStack, true);
+ }
+ else if (sideHit == 3){
+ playerStandingPosition = "facingNorth";
+ setFacingHorizontal(aStack, true);
+ }
+ else if (sideHit == 4){
+ playerStandingPosition = "facingEast";
+ setFacingHorizontal(aStack, true);
+ }
+ else if (sideHit == 5){
+ playerStandingPosition = "facingWest";
+ setFacingHorizontal(aStack, true);
+ }
+ setLookingDirection(aStack, playerStandingPosition);
+
+ if (direction == 0){
+ setFacingDirection(aStack, "south");
+ }
+ else if (direction == 1){
+ setFacingDirection(aStack, "west");
+ }
+ else if (direction == 2){
+ setFacingDirection(aStack, "north");
+ }
+ else if (direction == 3){
+ setFacingDirection(aStack, "east");
+ }
+ }
+
+
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ 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(final ItemStack par1ItemStack){
+ return EnumRarity.rare;
+ }
+
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack){
+ return true;
+ }
+
+
+ @Override
+ public boolean onBlockStartBreak(final ItemStack itemstack, final int X, final int Y, final int Z, final EntityPlayer aPlayer) {
+ this.checkFacing(itemstack, aPlayer, aPlayer.worldObj);
+ return super.onBlockStartBreak(itemstack, X, Y, Z, aPlayer);
+ }
+ public StaballoySpade(final String unlocalizedName, final ToolMaterial material) {
+ super(material);
+ this.setUnlocalizedName(unlocalizedName);
+ this.setTextureName(CORE.MODID + ":" + unlocalizedName);
+ this.setMaxStackSize(1);
+ this.setMaxDamage(3200);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/WearableLoader.java b/src/main/java/gtPlusPlus/core/item/wearable/WearableLoader.java
new file mode 100644
index 0000000000..6912b4e771
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/WearableLoader.java
@@ -0,0 +1,15 @@
+package gtPlusPlus.core.item.wearable;
+
+import gtPlusPlus.core.item.wearable.armour.ArmourLoader;
+
+public class WearableLoader {
+
+ public static void run() {
+ execute();
+ }
+
+ private static void execute() {
+ ArmourLoader.run();
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/armour/ArmourLoader.java b/src/main/java/gtPlusPlus/core/item/wearable/armour/ArmourLoader.java
new file mode 100644
index 0000000000..6918f2b048
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/armour/ArmourLoader.java
@@ -0,0 +1,41 @@
+package gtPlusPlus.core.item.wearable.armour;
+
+import cpw.mods.fml.common.registry.GameRegistry;
+import gtPlusPlus.core.item.wearable.armour.tinfoil.ArmourTinFoilHat;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemArmor.ArmorMaterial;
+
+import net.minecraftforge.common.util.EnumHelper;
+
+public class ArmourLoader {
+
+ //Glass
+ public static Item ClearGlassChestplate;
+ public static Item ClearGlassBoots;
+ public static Item ClearGlassLeggings;
+ public static Item ClearGlassHelmet;
+
+ //Tin Foil
+ public static Item TinFoilHat;
+
+ public static ArmorMaterial ClearGlassArmour = EnumHelper.addArmorMaterial("ClearGlassArmor", 1, new int[] {1, 1, 1, 1}, 100);
+ public static ArmorMaterial TinFoilArmour = EnumHelper.addArmorMaterial("TINFOIL", 5, new int[]{1, 1, 1, 1}, 50);
+
+
+ public static void run() {
+ glassArmour();
+ tinfoilArmour();
+ }
+
+ private static void glassArmour() {
+ //RenderingRegistry.addNewArmourRendererPrefix("ClearGlassArmor"); This needs to be client side only TODO
+ //ClearGlassHelmet = new ClearGlassArmor(2055, ClearGlassArmor, 5, 0).setUnlocalizedName("amethyst_helmet");
+ }
+
+ private static void tinfoilArmour() {
+ TinFoilHat = new ArmourTinFoilHat().setUnlocalizedName("itemHatTinFoil");
+ GameRegistry.registerItem(TinFoilHat, "itemHatTinFoil", CORE.MODID);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmour.java b/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmour.java
new file mode 100644
index 0000000000..0c6a547d34
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmour.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.wearable.armour.base;
+
+import gtPlusPlus.core.item.wearable.base.BaseItemWearable;
+
+public abstract class BaseArmour extends BaseItemWearable {
+
+ public BaseArmour(ArmorMaterial material, int renderIndex, int armourType) {
+ super(material, renderIndex, armourType);
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourBoots.java b/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourBoots.java
new file mode 100644
index 0000000000..2ace8919d0
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourBoots.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.core.item.wearable.armour.base;
+
+public abstract class BaseArmourBoots extends BaseArmour {
+
+ public BaseArmourBoots(ArmorMaterial material, int renderIndex) {
+ super(material, renderIndex, 3);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourChest.java b/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourChest.java
new file mode 100644
index 0000000000..16899c4229
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourChest.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.core.item.wearable.armour.base;
+
+public abstract class BaseArmourChest extends BaseArmour {
+
+ public BaseArmourChest(ArmorMaterial material, int renderIndex) {
+ super(material, renderIndex, 1);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourHelm.java b/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourHelm.java
new file mode 100644
index 0000000000..c3676277eb
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourHelm.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.core.item.wearable.armour.base;
+
+public abstract class BaseArmourHelm extends BaseArmour {
+
+ public BaseArmourHelm(ArmorMaterial material, int renderIndex) {
+ super(material, renderIndex, 0);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourLegs.java b/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourLegs.java
new file mode 100644
index 0000000000..9794a713ac
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/armour/base/BaseArmourLegs.java
@@ -0,0 +1,10 @@
+package gtPlusPlus.core.item.wearable.armour.base;
+
+public abstract class BaseArmourLegs extends BaseArmour {
+
+ public BaseArmourLegs(ArmorMaterial material, int renderIndex) {
+ super(material, renderIndex, 2);
+ // TODO Auto-generated constructor stub
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java b/src/main/java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java
new file mode 100644
index 0000000000..9fd7bf7020
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java
@@ -0,0 +1,117 @@
+package gtPlusPlus.core.item.wearable.armour.hazmat;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.core.item.wearable.armour.ArmourLoader;
+import gtPlusPlus.core.item.wearable.armour.base.BaseArmourHelm;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class ArmourHazmat extends BaseArmourHelm {
+
+ public IIcon iconHelm;
+
+ public ArmourHazmat() {
+ super(ArmourLoader.TinFoilArmour, 0);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister ir) {
+ this.iconHelm = ir.registerIcon(CORE.MODID + ":itemHatTinFoil");
+ }
+
+ @Override
+ public int getRenderIndex() {
+ return 0;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int par1) {
+ return this.iconHelm;
+ }
+
+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
+ return CORE.MODID + ":textures/models/TinFoil.png";
+ }
+
+ public EnumRarity getRarity(ItemStack itemstack) {
+ return EnumRarity.rare;
+ }
+
+ public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
+ return false;
+ }
+
+ @Override
+ public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
+ return super.getArmorDisplay(player, armor, slot);
+ }
+
+ @Override
+ public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
+
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ @Override
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) {
+ aList.add("DoomSquirter's protection against cosmic radiation!");
+ aList.add("General paranoia makes the wearer unable to collect xp");
+ aList.add("Movement speed is also reduced, to keep you safe");
+ aList.add("This hat may also have other strange powers");
+ }
+
+ @Override
+ public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage,
+ int slot) {
+ return new ArmorProperties(0, 0, 0);
+ }
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_,
+ EntityLivingBase p_111207_3_) {
+ return super.itemInteractionForEntity(p_111207_1_, p_111207_2_, p_111207_3_);
+ }
+
+ @Override
+ public void onUpdate(ItemStack aStack, World aWorld, Entity aEntity, int p_77663_4_, boolean p_77663_5_) {
+ super.onUpdate(aStack, aWorld, aEntity, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public boolean onEntityItemUpdate(EntityItem entityItem) {
+ return super.onEntityItemUpdate(entityItem);
+ }
+
+ @Override
+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
+ if (itemStack != null && player != null && world != null && !world.isRemote) {
+ if (player instanceof EntityPlayer) {
+
+ }
+ }
+ super.onArmorTick(world, player, itemStack);
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/armour/tinfoil/ArmourTinFoilHat.java b/src/main/java/gtPlusPlus/core/item/wearable/armour/tinfoil/ArmourTinFoilHat.java
new file mode 100644
index 0000000000..c1fe96efb5
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/armour/tinfoil/ArmourTinFoilHat.java
@@ -0,0 +1,183 @@
+package gtPlusPlus.core.item.wearable.armour.tinfoil;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.item.wearable.armour.ArmourLoader;
+import gtPlusPlus.core.item.wearable.armour.base.BaseArmourHelm;
+import gtPlusPlus.core.lib.CORE;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.item.EntityBoat;
+import net.minecraft.entity.item.EntityEnderEye;
+import net.minecraft.entity.item.EntityEnderPearl;
+import net.minecraft.entity.item.EntityExpBottle;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.item.EntityXPOrb;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityEgg;
+import net.minecraft.entity.projectile.EntityFireball;
+import net.minecraft.entity.projectile.EntitySnowball;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.ItemStack;
+import net.minecraft.potion.Potion;
+import net.minecraft.potion.PotionEffect;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.DamageSource;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
+public class ArmourTinFoilHat extends BaseArmourHelm {
+
+ public IIcon iconHelm;
+
+ public ArmourTinFoilHat() {
+ super(ArmourLoader.TinFoilArmour, 0);
+ }
+
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister ir) {
+ this.iconHelm = ir.registerIcon(CORE.MODID + ":itemHatTinFoil");
+ }
+
+ @Override
+ public int getRenderIndex() {
+ return 0;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public IIcon getIconFromDamage(int par1) {
+ return this.iconHelm;
+ }
+
+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
+ return CORE.MODID + ":textures/models/TinFoil.png";
+ }
+
+ public EnumRarity getRarity(ItemStack itemstack) {
+ return EnumRarity.uncommon;
+ }
+
+ public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
+ return false;
+ }
+
+ @Override
+ public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
+ return super.getArmorDisplay(player, armor, slot);
+ }
+
+ @Override
+ public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
+
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) {
+ aList.add("DoomSquirter's protection against cosmic radiation!");
+ aList.add("General paranoia makes the wearer unable to collect xp");
+ aList.add("Movement speed is also reduced, to keep you safe");
+ aList.add("This hat may also have other strange powers");
+ }
+
+ @Override
+ public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage,
+ int slot) {
+ return new ArmorProperties(0, 0, 0);
+ }
+
+ @Override
+ public boolean isDamageable() {
+ return false;
+ }
+
+ @Override
+ public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_,
+ EntityLivingBase p_111207_3_) {
+ return super.itemInteractionForEntity(p_111207_1_, p_111207_2_, p_111207_3_);
+ }
+
+ @Override
+ public void onUpdate(ItemStack aStack, World aWorld, Entity aEntity, int p_77663_4_, boolean p_77663_5_) {
+ super.onUpdate(aStack, aWorld, aEntity, p_77663_4_, p_77663_5_);
+ }
+
+ @Override
+ public boolean onEntityItemUpdate(EntityItem entityItem) {
+ return super.onEntityItemUpdate(entityItem);
+ }
+
+ @Override
+ public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
+ if (itemStack != null && player != null && world != null && !world.isRemote) {
+ if (player instanceof EntityPlayer) {
+
+ // Apply Slow
+ if (!GT_Utility.getPotion(player, Potion.moveSlowdown.id)) {
+ player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2, 1, true));
+ }
+
+ // Move Xp orbs away
+ try {
+ AxisAlignedBB box = player.boundingBox;
+ box.maxX = player.posX + 5;
+ box.maxY = player.posY + 5;
+ box.maxZ = player.posZ + 5;
+ box.minX = player.posX - 5;
+ box.minY = player.posY - 5;
+ box.minZ = player.posZ - 5;
+ @SuppressWarnings("unchecked")
+ List<Entity> g = world.getEntitiesWithinAABBExcludingEntity(player, box);
+ if (g.size() > 0) {
+ for (Entity e : g) {
+ if (e != null) {
+ if (
+ !EntityXPOrb.class.isInstance(e) &&
+ !EntityBoat.class.isInstance(e) &&
+ !EntitySnowball.class.isInstance(e) &&
+ !EntityFireball.class.isInstance(e) &&
+ !EntityEgg.class.isInstance(e) &&
+ !EntityExpBottle.class.isInstance(e) &&
+ !EntityEnderEye.class.isInstance(e) &&
+ !EntityEnderPearl.class.isInstance(e)
+ ) {
+ continue;
+ }
+ else {
+ //Logger.INFO("Found "+e.getClass().getName());
+ double distX = player.posX - e.posX;
+ double distZ = player.posZ - e.posZ;
+ double distY = e.posY + 1.5D - player.posY;
+ double dir = Math.atan2(distZ, distX);
+ double speed = 1F / e.getDistanceToEntity(player) * 0.5;
+ speed = -speed;
+ if (distY < 0) {
+ e.motionY += speed;
+ }
+ e.motionX = Math.cos(dir) * speed;
+ e.motionZ = Math.sin(dir) * speed;
+ }
+
+
+ }
+ }
+ }
+ } catch (Throwable t) {
+ }
+ }
+ }
+
+ super.onArmorTick(world, player, itemStack);
+ }
+
+ @Override
+ public boolean showDurabilityBar(ItemStack stack) {
+ return false;
+ }
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/base/BaseItemWearable.java b/src/main/java/gtPlusPlus/core/item/wearable/base/BaseItemWearable.java
new file mode 100644
index 0000000000..f23079bc8b
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/base/BaseItemWearable.java
@@ -0,0 +1,65 @@
+package gtPlusPlus.core.item.wearable.base;
+
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemArmor;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.DamageSource;
+
+import net.minecraftforge.common.ISpecialArmor;
+
+public abstract class BaseItemWearable extends ItemArmor implements ISpecialArmor {
+
+ public BaseItemWearable(ArmorMaterial material, int renderIndex, int armourType) {
+ super(material, renderIndex, armourType);
+ }
+
+ public abstract int getRenderIndex();
+
+
+
+ @Override
+ public abstract ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage,
+ int slot);
+
+ @Override
+ public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public abstract void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot);
+
+ public void dyeArmour(ItemStack aArmour, int aColour) {
+ func_82813_b(aArmour, aColour);
+ }
+
+ @Override
+ public void func_82813_b(ItemStack p_82813_1_, int p_82813_2_) {
+ NBTTagCompound nbttagcompound = p_82813_1_.getTagCompound();
+ if (nbttagcompound == null) {
+ nbttagcompound = new NBTTagCompound();
+ p_82813_1_.setTagCompound(nbttagcompound);
+ }
+ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display");
+ if (!nbttagcompound.hasKey("display", 10)) {
+ nbttagcompound.setTag("display", nbttagcompound1);
+ }
+ nbttagcompound1.setInteger("color", p_82813_2_);
+ }
+
+ @Override
+ public void removeColor(ItemStack p_82815_1_) {
+ NBTTagCompound nbttagcompound = p_82815_1_.getTagCompound();
+ if (nbttagcompound != null) {
+ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("display");
+ if (nbttagcompound1.hasKey("color")) {
+ nbttagcompound1.removeTag("color");
+ }
+ }
+ }
+
+
+}
diff --git a/src/main/java/gtPlusPlus/core/item/wearable/hazmat/ItemArmorHazmatEx.java b/src/main/java/gtPlusPlus/core/item/wearable/hazmat/ItemArmorHazmatEx.java
new file mode 100644
index 0000000000..1f8009e54a
--- /dev/null
+++ b/src/main/java/gtPlusPlus/core/item/wearable/hazmat/ItemArmorHazmatEx.java
@@ -0,0 +1,31 @@
+package gtPlusPlus.core.item.wearable.hazmat;
+
+import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
+import gtPlusPlus.xmod.ic2.CustomInternalName;
+import ic2.core.IC2;
+import ic2.core.init.InternalName;
+import ic2.core.item.armor.ItemArmorHazmat;
+import net.minecraft.entity.Entity;
+import net.minecraft.item.ItemStack;
+
+public class ItemArmorHazmatEx extends ItemArmorHazmat {
+
+ public static void init() {
+ GregtechItemList.Armour_Hazmat_Advanced_Helmet.set(new ItemStack(new ItemArmorHazmatEx(CustomInternalName.aHazmatHelmetEx, 0)));
+ GregtechItemList.Armour_Hazmat_Advanced_Chest.set(new ItemStack(new ItemArmorHazmatEx(CustomInternalName.aHazmatChestEx, 1)));
+ GregtechItemList.Armour_Hazmat_Advanced_Legs.set(new ItemStack(new ItemArmorHazmatEx(CustomInternalName.aHazmatLegsEx, 2)));
+ GregtechItemList.Armour_Hazmat_Advanced_Boots.set(new ItemStack(new ItemArmorHazmatEx(CustomInternalName.aHazmatBootsEx, 3)));
+ }
+
+ private ItemArmorHazmatEx(InternalName internalName, int type) {
+ super(internalName, type);
+ this.setMaxDamage(256);
+ }
+
+ @Override
+ public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
+ int suffix = this.armorType == 2 ? 2 : 1;
+ return IC2.textureDomain + ":textures/armor/" + "hazmatEx_" + suffix + ".png";
+ }
+
+}