aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item/base
diff options
context:
space:
mode:
authordraknyte1 <draknyte1@hotmail.com>2016-11-02 15:49:00 +1000
committerdraknyte1 <draknyte1@hotmail.com>2016-11-02 15:49:00 +1000
commitd594987b2cfdefa447ee585a68d4a4bef4ece3a5 (patch)
tree814813fc14ce5dcd8dfa7aeaecd939ac42d12877 /src/Java/gtPlusPlus/core/item/base
parent26292158575a0f0acb51ae50715887f871d2b5a0 (diff)
parent49a520da5da01594b5c42652d9db5c7c04e49ad8 (diff)
downloadGT5-Unofficial-d594987b2cfdefa447ee585a68d4a4bef4ece3a5.tar.gz
GT5-Unofficial-d594987b2cfdefa447ee585a68d4a4bef4ece3a5.tar.bz2
GT5-Unofficial-d594987b2cfdefa447ee585a68d4a4bef4ece3a5.zip
Merge branch 'master' of https://github.com/draknyte1/GTplusplus
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/base')
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseEuItem.java517
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java108
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java160
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java2
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java108
-rw-r--r--src/Java/gtPlusPlus/core/item/base/CoreItem.java2
-rw-r--r--src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java76
-rw-r--r--src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java42
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java104
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java9
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java56
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java56
-rw-r--r--src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java76
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java11
-rw-r--r--src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java6
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java8
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java43
-rw-r--r--src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java11
-rw-r--r--src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java91
-rw-r--r--src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java118
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java89
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java128
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java95
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java92
-rw-r--r--src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java73
29 files changed, 1203 insertions, 894 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java
new file mode 100644
index 0000000000..80412fdd3c
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java
@@ -0,0 +1,517 @@
+package gtPlusPlus.core.item.base;
+
+import static gregtech.api.enums.GT_Values.D1;
+import static gregtech.api.enums.GT_Values.V;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.SubTag;
+import gregtech.api.enums.TC_Aspects.TC_AspectStack;
+import gregtech.api.interfaces.IItemBehaviour;
+import gregtech.api.interfaces.IItemContainer;
+import gregtech.api.objects.ItemData;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_OreDictUnificator;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.array.Pair;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import ic2.api.item.IElectricItemManager;
+import ic2.api.item.ISpecialElectricItem;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.HashMap;
+import java.util.List;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.item.EnumRarity;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricItemManager {
+
+ /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */
+ private final HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>> mItemBehaviors = new HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>>();
+ public final short mOffset, mItemAmount;
+ public final BitSet mEnabledItems;
+ public final BitSet mVisibleItems;
+ public final IIcon[][] mIconList;
+ /** The unlocalized name of this item. */
+ private String unlocalizedName;
+
+ private ArrayList<Pair<Integer, EnumRarity>> rarity = new ArrayList<Pair<Integer, EnumRarity>>();
+ private ArrayList<Pair<Integer, EnumChatFormatting>> descColour = new ArrayList<Pair<Integer, EnumChatFormatting>>();
+ private ArrayList<Pair<Integer, String>> itemName = new ArrayList<Pair<Integer, String>>();
+ private ArrayList<Pair<Integer, String>> itemDescription = new ArrayList<Pair<Integer, String>>();
+ private ArrayList<Pair<Integer, Boolean>> hasEffect = new ArrayList<Pair<Integer, Boolean>>();
+
+ public final HashMap<Short, Long[]> mElectricStats = new HashMap<Short, Long[]>();
+ public final HashMap<Short, Short> mBurnValues = new HashMap<Short, Short>();
+
+ public BaseEuItem() {
+ this("MU-metaitem.02", AddToCreativeTab.tabOther, (short) 1000, (short) 31766);
+ }
+
+ public BaseEuItem(String unlocalizedName, CreativeTabs creativeTab, short aOffset, short aItemAmount) {
+ mEnabledItems = new BitSet(aItemAmount);
+ mVisibleItems = new BitSet(aItemAmount);
+ mOffset = (short) Math.min(32766, aOffset);
+ mItemAmount = (short) Math.min(aItemAmount, 32766 - mOffset);
+ mIconList = new IIcon[aItemAmount][1];
+ setHasSubtypes(true);
+ setMaxDamage(0);
+ setUnlocalizedName(unlocalizedName);
+ setCreativeTab(creativeTab);
+ setMaxStackSize(1);
+ GameRegistry.registerItem(this, unlocalizedName);
+ }
+
+
+ public void registerItem(int id, String localizedName, long euStorage, int tier, String description) {
+ registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false);
+ }
+
+ public void registerItem(int id, String localizedName, long euStorage, int tier, String description, int burnTime) {
+ registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false);
+ setBurnValue(id, burnTime);
+ }
+
+
+ public void registerItem(int id, String localizedName, long euStorage, short tier, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect) {
+ addItem(id, localizedName, EnumChatFormatting.YELLOW+"Electric", new Object[]{});
+ setElectricStats(mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true);
+ this.rarity.add(new Pair<Integer, EnumRarity>(id, regRarity));
+ this.itemName.add(new Pair<Integer, String>(id, localizedName));
+ this.itemDescription.add(new Pair<Integer, String>(id, description));
+ this.descColour.add(new Pair<Integer, EnumChatFormatting>(id, colour));
+ this.hasEffect.add(new Pair<Integer, Boolean>(id, Effect));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(ItemStack par1ItemStack){
+ if (rarity.get(par1ItemStack.getItemDamage()-mOffset) != null)
+ return rarity.get(par1ItemStack.getItemDamage()-mOffset).getValue();
+ return EnumRarity.common;
+ }
+
+ @Override
+ public boolean hasEffect(ItemStack par1ItemStack){
+ if (hasEffect.get(par1ItemStack.getItemDamage()-mOffset) != null)
+ return hasEffect.get(par1ItemStack.getItemDamage()-mOffset).getValue();
+ return false;
+ }
+
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public final void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) {
+ //aList.add("Meta: "+(aStack.getItemDamage()-mOffset));
+ if (descColour.get(aStack.getItemDamage()-mOffset) != null && itemDescription.get(aStack.getItemDamage()-mOffset) != null)
+ aList.add(descColour.get(aStack.getItemDamage()-mOffset).getValue()+itemDescription.get(aStack.getItemDamage()-mOffset).getValue());
+ String tKey = getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey);
+ if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) aList.add(tString);
+ Long[] tStats = getElectricStats(aStack);
+ if (tStats != null) {
+ if (tStats[3] > 0) {
+ aList.add(EnumChatFormatting.AQUA + "Contains " + GT_Utility.formatNumbers(tStats[3]) + " EU Tier: " + (tStats[2] >= 0 ? tStats[2] : 0) + EnumChatFormatting.GRAY);
+ } else {
+ long tCharge = getRealCharge(aStack);
+ if (tStats[3] == -2 && tCharge <= 0) {
+ aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY);
+ } else {
+ aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY);
+ }
+ }
+ }
+ ArrayList<IItemBehaviour<BaseEuItem>> tList = mItemBehaviors.get((short) getDamage(aStack));
+ if (tList != null) for (IItemBehaviour<BaseEuItem> tBehavior : tList)
+ aList = tBehavior.getAdditionalToolTips(this, aList, aStack);
+ }
+
+
+ @Override
+ public final Item getChargedItem(ItemStack itemStack) {
+ return this;
+ }
+
+ @Override
+ public final Item getEmptyItem(ItemStack itemStack) {
+ return this;
+ }
+
+ @Override
+ public final double getMaxCharge(ItemStack aStack) {
+ Long[] tStats = getElectricStats(aStack);
+ if (tStats == null) return 0;
+ return Math.abs(tStats[0]);
+ }
+
+ @Override
+ public final double getTransferLimit(ItemStack aStack) {
+ Long[] tStats = getElectricStats(aStack);
+ if (tStats == null) return 0;
+ return Math.max(tStats[1], tStats[3]);
+ }
+
+ @Override
+ public final int getTier(ItemStack aStack) {
+ Long[] tStats = getElectricStats(aStack);
+ return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]);
+ }
+
+ @Override
+ public final double charge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aSimulate) {
+ Long[] tStats = getElectricStats(aStack);
+ if (tStats == null || tStats[2] > aTier || !(tStats[3] == -1 || tStats[3] == -3 || (tStats[3] < 0 && aCharge == Integer.MAX_VALUE)) || aStack.stackSize != 1)
+ return 0;
+ long tChargeBefore = getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge)));
+ if (!aSimulate) setCharge(aStack, tNewCharge);
+ return tNewCharge - tChargeBefore;
+ }
+
+ @Override
+ public final double discharge(ItemStack aStack, double aCharge, int aTier, boolean aIgnoreTransferLimit, boolean aBatteryAlike, boolean aSimulate) {
+ Long[] tStats = getElectricStats(aStack);
+ if (tStats == null || tStats[2] > aTier) return 0;
+ if (aBatteryAlike && !canProvideEnergy(aStack)) return 0;
+ if (tStats[3] > 0) {
+ if (aCharge < tStats[3] || aStack.stackSize < 1) return 0;
+ if (!aSimulate) aStack.stackSize--;
+ return tStats[3];
+ }
+ long tChargeBefore = getRealCharge(aStack), tNewCharge = Math.max(0, tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge)));
+ if (!aSimulate) setCharge(aStack, tNewCharge);
+ return tChargeBefore - tNewCharge;
+ }
+
+ @Override
+ public final double getCharge(ItemStack aStack) {
+ return getRealCharge(aStack);
+ }
+
+ @Override
+ public final boolean canUse(ItemStack aStack, double aAmount) {
+ return getRealCharge(aStack) >= aAmount;
+ }
+
+ @Override
+ public final boolean use(ItemStack aStack, double aAmount, EntityLivingBase aPlayer) {
+ chargeFromArmor(aStack, aPlayer);
+ if (aPlayer instanceof EntityPlayer && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) return true;
+ double tTransfer = discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true);
+ if (tTransfer == aAmount) {
+ discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false);
+ chargeFromArmor(aStack, aPlayer);
+ return true;
+ }
+ discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false);
+ chargeFromArmor(aStack, aPlayer);
+ return false;
+ }
+
+ @Override
+ public final boolean canProvideEnergy(ItemStack aStack) {
+ Long[] tStats = getElectricStats(aStack);
+ if (tStats == null) return false;
+ return tStats[3] > 0 || (aStack.stackSize == 1 && (tStats[3] == -2 || tStats[3] == -3));
+ }
+
+ @Override
+ public final void chargeFromArmor(ItemStack aStack, EntityLivingBase aPlayer) {
+ if (aPlayer == null || aPlayer.worldObj.isRemote) return;
+ for (int i = 1; i < 5; i++) {
+ ItemStack tArmor = aPlayer.getEquipmentInSlot(i);
+ if (GT_ModHandler.isElectricItem(tArmor)) {
+ IElectricItem tArmorItem = (IElectricItem) tArmor.getItem();
+ if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= getTier(aStack)) {
+ double tCharge = ElectricItem.manager.discharge(tArmor, charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), Integer.MAX_VALUE, true, true, false);
+ if (tCharge > 0) {
+ charge(aStack, tCharge, Integer.MAX_VALUE, true, false);
+ if (aPlayer instanceof EntityPlayer) {
+ Container tContainer = ((EntityPlayer) aPlayer).openContainer;
+ if (tContainer != null) tContainer.detectAndSendChanges();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public final long getRealCharge(ItemStack aStack) {
+ Long[] tStats = getElectricStats(aStack);
+ if (tStats == null) return 0;
+ if (tStats[3] > 0) return (int) (long) tStats[3];
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge");
+ }
+
+ public final boolean setCharge(ItemStack aStack, long aCharge) {
+ Long[] tStats = getElectricStats(aStack);
+ if (tStats == null || tStats[3] > 0) return false;
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) tNBT = new NBTTagCompound();
+ tNBT.removeTag("GT.ItemCharge");
+ aCharge = Math.min(tStats[0] < 0 ? Math.abs(tStats[0] / 2) : aCharge, Math.abs(tStats[0]));
+ if (aCharge > 0) {
+ aStack.setItemDamage(getChargedMetaData(aStack));
+ tNBT.setLong("GT.ItemCharge", aCharge);
+ } else {
+ aStack.setItemDamage(getEmptyMetaData(aStack));
+ }
+ if (tNBT.hasNoTags()) aStack.setTagCompound(null);
+ else aStack.setTagCompound(tNBT);
+ isItemStackUsable(aStack);
+ return true;
+ }
+
+ @SuppressWarnings("static-method")
+ public short getChargedMetaData(ItemStack aStack) {
+ return (short) aStack.getItemDamage();
+ }
+
+ @SuppressWarnings("static-method")
+ public short getEmptyMetaData(ItemStack aStack) {
+ return (short) aStack.getItemDamage();
+ }
+
+
+ public boolean isItemStackUsable(ItemStack aStack) {
+ ArrayList<IItemBehaviour<BaseEuItem>> tList = mItemBehaviors.get((short) getDamage(aStack));
+ if (tList != null) for (IItemBehaviour<BaseEuItem> tBehavior : tList)
+ if (!tBehavior.isItemStackUsable(this, aStack)) return false;
+ return true;
+ }
+
+ @Override
+ public final String getToolTip(ItemStack aStack) {
+ return null;
+ } // This has its own ToolTip Handler, no need to let the IC2 Handler screw us up at this Point
+
+ @Override
+ public final IElectricItemManager getManager(ItemStack aStack) {
+ return this;
+ } // We are our own Manager
+
+ /**
+ * Sets the Furnace Burn Value for the Item.
+ *
+ * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765]
+ * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU)
+ * @return the Item itself for convenience in constructing.
+ */
+ public final BaseEuItem setBurnValue(int aMetaValue, int aValue) {
+ if (aMetaValue < 0 || aValue < 0) return this;
+ if (aValue == 0) mBurnValues.remove((short) aMetaValue);
+ else mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue);
+ return this;
+ }
+
+ /**
+ * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765]
+ * @param aMaxCharge Maximum Charge. (if this is == 0 it will remove the Electric Behavior)
+ * @param aTransferLimit Transfer Limit.
+ * @param aTier The electric Tier.
+ * @param aSpecialData If this Item has a Fixed Charge, like a SingleUse Battery (if > 0).
+ * Use -1 if you want to make this Battery chargeable (the use and canUse Functions will still discharge if you just use this)
+ * Use -2 if you want to make this Battery dischargeable.
+ * Use -3 if you want to make this Battery charge/discharge-able.
+ * @return the Item itself for convenience in constructing.
+ */
+ public final BaseEuItem setElectricStats(int aMetaValue, long aMaxCharge, long aTransferLimit, long aTier, long aSpecialData, boolean aUseAnimations) {
+ if (aMetaValue < 0) return this;
+ if (aMaxCharge == 0) mElectricStats.remove((short) aMetaValue);
+ else {
+ mElectricStats.put((short) aMetaValue, new Long[]{aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData});
+ }
+ return this;
+ }
+
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item var1, CreativeTabs aCreativeTab, List aList) {
+ for (int i = 0, j = mEnabledItems.length(); i < j; i++)
+ if (mVisibleItems.get(i) || (D1 && mEnabledItems.get(i))) {
+ Long[] tStats = mElectricStats.get((short) (mOffset + i));
+ if (tStats != null && tStats[3] < 0) {
+ ItemStack tStack = new ItemStack(this, 1, mOffset + i);
+ setCharge(tStack, Math.abs(tStats[0]));
+ isItemStackUsable(tStack);
+ aList.add(tStack);
+ }
+ if (tStats == null || tStats[3] != -2) {
+ ItemStack tStack = new ItemStack(this, 1, mOffset + i);
+ isItemStackUsable(tStack);
+ aList.add(tStack);
+ }
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public final void registerIcons(IIconRegister aIconRegister) {
+ for (short i = 0, j = (short) mEnabledItems.length(); i < j; i++)
+ if (mEnabledItems.get(i)) {
+ for (byte k = 1; k < mIconList[i].length; k++) {
+ mIconList[i][k] = aIconRegister.registerIcon(CORE.MODID+":" + (getUnlocalizedName() + "/" + i + "/" + k));
+ }
+ mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":" + (getUnlocalizedName() + "/" + i));
+ }
+ }
+
+
+ @Override
+ public final IIcon getIconFromDamage(int aMetaData) {
+ if (aMetaData < 0) return null;
+ return aMetaData - mOffset < mIconList.length ? mIconList[aMetaData - mOffset][0] : null;
+ }
+
+ /**
+ * Sets the unlocalized name of this item to the string passed as the parameter"
+ */
+ @Override
+ public Item setUnlocalizedName(String p_77655_1_){
+ this.unlocalizedName = p_77655_1_;
+ super.setUnlocalizedName(p_77655_1_);
+ return this;
+ }
+
+ /**
+ * Returns the unlocalized name of this item.
+ */
+ @Override
+ public String getUnlocalizedName()
+ {
+ return this.unlocalizedName;
+ }
+
+ public final Long[] getElectricStats(ItemStack aStack) {
+ return mElectricStats.get((short) aStack.getItemDamage());
+ }
+
+ @Override
+ public int getItemEnchantability() {
+ return 0;
+ }
+
+ @Override
+ public boolean isBookEnchantable(ItemStack aStack, ItemStack aBook) {
+ return false;
+ }
+
+ @Override
+ public boolean getIsRepairable(ItemStack aStack, ItemStack aMaterial) {
+ return false;
+ }
+
+
+ /**
+ * Adds a special Item Behaviour to the Item.
+ * <p/>
+ * Note: the boolean Behaviours sometimes won't be executed if another boolean Behaviour returned true before.
+ *
+ * @param aMetaValue the Meta Value of the Item you want to add it to. [0 - 32765]
+ * @param aBehavior the Click Behavior you want to add.
+ * @return the Item itself for convenience in constructing.
+ */
+ public final BaseEuItem addItemBehavior(int aMetaValue, IItemBehaviour<BaseEuItem> aBehavior) {
+ if (aMetaValue < 0 || aMetaValue >= 32766 || aBehavior == null) return this;
+ ArrayList<IItemBehaviour<BaseEuItem>> tList = mItemBehaviors.get((short) aMetaValue);
+ if (tList == null) {
+ tList = new ArrayList<IItemBehaviour<BaseEuItem>>(1);
+ mItemBehaviors.put((short) aMetaValue, tList);
+ }
+ tList.add(aBehavior);
+ return this;
+ }
+
+ /**
+ * This adds a Custom Item to the ending Range.
+ *
+ * @param aID The Id of the assigned Item [0 - mItemAmount] (The MetaData gets auto-shifted by +mOffset)
+ * @param aEnglish The Default Localized Name of the created Item
+ * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip
+ * @param aFoodBehavior The Food Value of this Item. Can be null aswell. Just a convenience thing.
+ * @param aRandomData The OreDict Names you want to give the Item. Also used for TC Aspects and some other things.
+ * @return An ItemStack containing the newly created Item.
+ */
+ @SuppressWarnings("unchecked")
+ public final ItemStack addItem(int aID, String aEnglish, String aToolTip, Object... aRandomData) {
+ if (aToolTip == null) aToolTip = "";
+ if (aID >= 0 && aID < mItemAmount) {
+ ItemStack rStack = new ItemStack(this, 1, mOffset + aID);
+ mEnabledItems.set(aID);
+ mVisibleItems.set(aID);
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".name", aEnglish);
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName(rStack) + ".tooltip", aToolTip);
+ List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>();
+ // Important Stuff to do first
+ for (Object tRandomData : aRandomData)
+ if (tRandomData instanceof SubTag) {
+ if (tRandomData == SubTag.INVISIBLE) {
+ mVisibleItems.set(aID, false);
+ continue;
+ }
+ if (tRandomData == SubTag.NO_UNIFICATION) {
+ GT_OreDictUnificator.addToBlacklist(rStack);
+ continue;
+ }
+ }
+ // now check for the rest
+ for (Object tRandomData : aRandomData)
+ if (tRandomData != null) {
+ boolean tUseOreDict = true;
+ if (tRandomData instanceof IItemBehaviour) {
+ addItemBehavior(mOffset + aID, (IItemBehaviour<BaseEuItem>) tRandomData);
+ tUseOreDict = false;
+ }
+ if (tRandomData instanceof IItemContainer) {
+ ((IItemContainer) tRandomData).set(rStack);
+ tUseOreDict = false;
+ }
+ if (tRandomData instanceof SubTag) {
+ continue;
+ }
+ if (tRandomData instanceof TC_AspectStack) {
+ ((TC_AspectStack) tRandomData).addToAspectList(tAspects);
+ continue;
+ }
+ if (tRandomData instanceof ItemData) {
+ if (GT_Utility.isStringValid(tRandomData))
+ GT_OreDictUnificator.registerOre(tRandomData, rStack);
+ else GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData);
+ continue;
+ }
+ if (tUseOreDict) {
+ GT_OreDictUnificator.registerOre(tRandomData, rStack);
+ continue;
+ }
+ }
+ if (GregTech_API.sThaumcraftCompat != null)
+ GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false);
+ return rStack;
+ }
+ return null;
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack par1ItemStack) {
+ return itemName.get(par1ItemStack.getItemDamage()-mOffset).getValue();
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java
index 316f922639..391f7bb986 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java
@@ -5,7 +5,7 @@ import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.handler.GuiHandler;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.item.UtilsItems;
+import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
@@ -28,7 +28,7 @@ public class BaseItemBackpack extends Item{
this.setTextureName(CORE.MODID + ":" + "itemBackpack");
this.colourValue = colour;
GameRegistry.registerItem(this, unlocalizedName);
- GT_OreDictUnificator.registerOre("storageBackpack", UtilsItems.getSimpleStack(this));
+ GT_OreDictUnificator.registerOre("storageBackpack", ItemUtils.getSimpleStack(this));
setMaxStackSize(1);
setCreativeTab(AddToCreativeTab.tabOther);
}
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java
new file mode 100644
index 0000000000..86cd1c8046
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java
@@ -0,0 +1,108 @@
+package gtPlusPlus.core.item.base;
+
+import java.util.List;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.StatCollector;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+/*
+ *
+ *
+ Key Point: You can access the NBT compound data from the Item class (in those methods that pass an ItemStack), but the NBT compound can only be set on an ItemStack.
+
+ The steps to add NBT data to an ItemStack:
+ Create or otherwise get an ItemStack of the desired item
+ Create an NBTTagCompound and fill it with the appropriate data
+ Call ItemStack#setTagCompound() method to set it.
+
+ *
+ */
+
+public class BaseItemBrain extends Item{
+ // This is an array of all the types I am going to be adding.
+ String[] brainTypes = { "dead", "preserved", "fresh", "tasty" };
+
+ // This method allows us to have different language translation keys for
+ // each item we add.
+ @Override
+ public String getUnlocalizedName(ItemStack stack)
+ {
+ // This makes sure that the stack has a tag compound. This is how data
+ // is stored on items.
+ if (stack.hasTagCompound())
+ {
+ // This is the object holding all of the item data.
+ NBTTagCompound itemData = stack.getTagCompound();
+ // This checks to see if the item has data stored under the
+ // brainType key.
+ if (itemData.hasKey("brainType"))
+ {
+ // This retrieves data from the brainType key and uses it in
+ // the return value
+ return "item." + itemData.getString("brainType");
+ }
+ }
+ // This will be used if the item is obtained without nbt data on it.
+ return "item.nullBrain";
+ }
+
+
+ // This is a fun method which allows us to run some code when our item is
+ // shown in a creative tab. I am going to use it to add all the brain
+ // types.
+ @SuppressWarnings("unchecked")
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubItems(Item item, CreativeTabs tab, List itemList)
+ {
+ // This creates a loop with a counter. It will go through once for
+ // every listing in brainTypes, and gives us a number associated
+ // with each listing.
+ for (int pos = 0; pos < brainTypes.length; pos++)
+ {
+ // This creates a new ItemStack instance. The item parameter
+ // supplied is this item.
+ ItemStack brainStack = new ItemStack(item);
+ // By default, a new ItemStack does not have any nbt compound data.
+ // We need to give it some.
+ brainStack.setTagCompound(new NBTTagCompound());
+ // Now we set the type of the item, brainType is the key, and
+ // brainTypes[pos] is grabbing a
+ // entry from the brainTypes array.
+ brainStack.getTagCompound().setString("brainType",
+ brainTypes[pos]);
+ // And this adds it to the itemList, which is a list of all items
+ // in the creative tab.
+ itemList.add(brainStack);
+ }
+ }
+
+ // This code will allow us to tell the items apart in game. You can change
+ @SuppressWarnings("unchecked")
+ // texture based on nbt data, but I won't be covering that.
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean isAdvanced){
+ if ( stack.hasTagCompound()
+ && stack.getTagCompound().hasKey("brainType"))
+ {
+ // StatCollector is a class which allows us to handle string
+ // language translation. This requires that you fill out the
+ // translation in you language class.
+ tooltip.add(StatCollector.translateToLocal("tooltip.yourmod."
+ + stack.getTagCompound().getString("brainType") + ".desc"));
+ }
+ else // If the brain does not have valid tag data, a default message
+ {
+ tooltip.add(StatCollector.translateToLocal(
+ "tooltip.yourmod.nullbrain.desc"));
+ }
+ }
+}
+
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
new file mode 100644
index 0000000000..ee9d451948
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java
@@ -0,0 +1,160 @@
+package gtPlusPlus.core.item.base;
+
+import gregtech.api.util.GT_OreDictUnificator;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.entity.EntityUtils;
+import gtPlusPlus.core.util.item.ItemUtils;
+
+import java.util.List;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+import cpw.mods.fml.common.registry.GameRegistry;
+
+public class BaseItemComponent extends Item{
+
+ public final Material componentMaterial;
+ public final String materialName;
+ public final String unlocalName;
+ public final ComponentTypes componentType;
+
+ public BaseItemComponent(Material material, ComponentTypes componentType) {
+ this.componentMaterial = material;
+ this.unlocalName = "item"+componentType.COMPONENT_NAME+material.getUnlocalizedName();
+ this.materialName = material.getLocalizedName();
+ this.componentType = componentType;
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(unlocalName);
+ this.setMaxStackSize(64);
+ this.setTextureName(CORE.MODID + ":" + "item"+componentType.COMPONENT_NAME);
+ GameRegistry.registerItem(this, unlocalName);
+ GT_OreDictUnificator.registerOre(componentType.getOreDictName()+material.getUnlocalizedName(), ItemUtils.getSimpleStack(this));
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+
+ return (componentMaterial.getLocalizedName()+componentType.DISPLAY_NAME);
+ }
+
+ public final String getMaterialName() {
+ return materialName;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+
+ if (materialName != null && materialName != "" && !materialName.equals("")){
+
+
+ if (componentType == ComponentTypes.DUST){
+ list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust.");
+ }
+ if (componentType == ComponentTypes.INGOT){
+ list.add(EnumChatFormatting.GRAY+"A solid ingot of " + materialName + ".");
+ if (materialName != null && materialName != "" && !materialName.equals("") && unlocalName.toLowerCase().contains("ingothot")){
+ list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot! "+EnumChatFormatting.GRAY+" Avoid direct handling..");
+ }
+ }
+ if (componentType == ComponentTypes.PLATE){
+ list.add(EnumChatFormatting.GRAY+"A flat plate of " + materialName + ".");
+ }
+ if (componentType == ComponentTypes.PLATEDOUBLE){
+ list.add(EnumChatFormatting.GRAY+"A double plate of " + materialName + ".");
+ }
+ if (componentType == ComponentTypes.ROD){
+ list.add(EnumChatFormatting.GRAY+"A 40cm Rod of " + materialName + ".");
+ }
+ if (componentType == ComponentTypes.RODLONG){
+ list.add(EnumChatFormatting.GRAY+"A 80cm Rod of " + materialName + ".");
+ }
+ if (componentType == ComponentTypes.ROTOR){
+ list.add(EnumChatFormatting.GRAY+"A Rotor made out of " + materialName + ". ");
+ }
+ if (componentType == ComponentTypes.BOLT){
+ list.add(EnumChatFormatting.GRAY+"A small Bolt, constructed from " + materialName + ".");
+ }
+ if (componentType == ComponentTypes.SCREW){
+ list.add(EnumChatFormatting.GRAY+"A 8mm Screw, fabricated out of some " + materialName + ".");
+ }
+ if (componentType == ComponentTypes.GEAR){
+ list.add(EnumChatFormatting.GRAY+"A large Gear, constructed from " + materialName + ".");
+ }
+ if (componentType == ComponentTypes.RING){
+ list.add(EnumChatFormatting.GRAY+"A " + materialName + " Ring.");
+ }
+ if (componentMaterial.isRadioactive){
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }
+
+ }
+
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ return componentMaterial.getRgbAsHex();
+ }
+
+ @Override
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+ EntityUtils.applyRadiationDamageToEntity(componentMaterial.vRadioationLevel, world, entityHolding);
+ }
+
+
+
+
+
+
+
+
+ public static enum ComponentTypes {
+ DUST("Dust", " Dust", "dust"),
+ INGOT("Ingot", " Ingot", "ingot"),
+ PLATE("Plate", " Plate", "plate"),
+ PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble"),
+ ROD("Rod", " Rod", "stick"),
+ RODLONG("RodLong", " Long Rod", "stickLong"),
+ GEAR("Gear", " Gear", "gear"),
+ SCREW("Screw", " Screw", "screw"),
+ BOLT("Bolt", " Bolt", "bolt"),
+ ROTOR("Rotor", " Rotor", "rotor"),
+ RING("Ring", " Ring", "ring"),
+ CELL("Cell", " Cell", "cell"),
+ NUGGET("Nugget", " Nugget", "nugget");
+
+ private String COMPONENT_NAME;
+ private String DISPLAY_NAME;
+ private String OREDICT_NAME;
+ private ComponentTypes (final String LocalName, String DisplayName, String OreDictName){
+ this.COMPONENT_NAME = LocalName;
+ this.DISPLAY_NAME = DisplayName;
+ this.OREDICT_NAME = OreDictName;
+ }
+
+ public String getComponent(){
+ return COMPONENT_NAME;
+ }
+
+ public String getName(){
+ return DISPLAY_NAME;
+ }
+
+ public String getOreDictName(){
+ return OREDICT_NAME;
+ }
+
+ }
+
+}
+
+
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java b/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java
index a6cc29497e..431f93b3e6 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java
@@ -8,7 +8,6 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
public class BaseItemGeneric extends Item
{
@@ -24,7 +23,6 @@ public class BaseItemGeneric extends Item
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- list.add(EnumChatFormatting.GOLD+"");
super.addInformation(stack, aPlayer, list, bool);
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java b/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java
new file mode 100644
index 0000000000..ed87677970
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java
@@ -0,0 +1,108 @@
+package gtPlusPlus.core.item.base;
+
+import gregtech.api.enums.Materials;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Quality;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.item.ItemUtils;
+
+import java.util.List;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class BaseItemLoot extends Item{
+
+ private final String materialName;
+ private final String unlocalName;
+ private final LootTypes lootTypes;
+ private Quality lootQuality;
+ private final Materials lootMaterial;
+
+ public BaseItemLoot(LootTypes lootType, Materials material) {
+ this.lootTypes = lootType;
+ this.lootMaterial = material;
+ this.materialName = material.mDefaultLocalName;
+ this.unlocalName = "item"+lootType.LOOT_TYPE+this.materialName;
+ this.setUnlocalizedName(unlocalName);
+ this.setMaxStackSize(1);
+ this.setTextureName(CORE.MODID + ":" + "item"+lootType.LOOT_TYPE);
+ }
+
+ public ItemStack generateLootStack(){
+ lootQuality = Quality.getRandomQuality();
+ return ItemUtils.getSimpleStack(this, 1);
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+ return (materialName+lootTypes.DISPLAY_SUFFIX);
+ }
+
+ public final String getMaterialName() {
+ return materialName;
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ list.add(lootQuality.getQuality());
+
+ /*if (componentMaterial.isRadioactive){
+ list.add(CORE.GT_Tooltip_Radioactive);
+ }*/
+
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ short[] temp = lootMaterial.mRGBa;
+ return Utils.rgbtoHexValue(temp[0], temp[1], temp[2]);
+ }
+
+ @Override
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+ //EntityUtils.applyRadiationDamageToEntity(lootQuality.vRadioationLevel, world, entityHolding);
+ }
+
+
+
+
+
+
+
+
+ public static enum LootTypes {
+ Sword("Sword", " Longsword", "sword"),
+ Shortsword("Sword", " Short Blade", "blade"),
+ Helmet("Helmet", " Medium Helm", "helmet"),
+ Chestplate("Platebody", " Chestplate", "platebody"),
+ Leggings("Platelegs", " Platelegs", "platelegs"),
+ Boots("Boots", " Boots", "boots");
+ private String LOOT_TYPE;
+ private String DISPLAY_SUFFIX;
+ private String OREDICT_NAME;
+ private LootTypes (final String LocalName, final String DisplayName, final String OreDictName){
+ this.LOOT_TYPE = LocalName;
+ this.DISPLAY_SUFFIX = DisplayName;
+ this.OREDICT_NAME = OreDictName;
+ }
+ public String getLootType(){
+ return LOOT_TYPE;
+ }
+ public String getName(){
+ return DISPLAY_SUFFIX;
+ }
+ public String getOreDictName(){
+ return OREDICT_NAME;
+ }
+ }
+
+}
+
+
diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java
index b77b2d336e..0653cddbb8 100644
--- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java
+++ b/src/Java/gtPlusPlus/core/item/base/CoreItem.java
@@ -102,7 +102,7 @@ public class CoreItem extends Item
@Override
public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
list.add(descColour+itemDescription);
- super.addInformation(stack, aPlayer, list, bool);
+ //super.addInformation(stack, aPlayer, list, bool);
}
@Override
diff --git a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
index 3d56307f39..6292c5cde6 100644
--- a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
+++ b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
@@ -1,81 +1,11 @@
package gtPlusPlus.core.item.base.bolts;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.ItemList;
-import gregtech.api.util.GT_OreDictUnificator;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
-import gtPlusPlus.core.util.math.MathUtils;
-import java.util.List;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import cpw.mods.fml.common.registry.GameRegistry;
-
-public class BaseItemBolt extends Item{
-
- final Material boltMaterial;
- final String materialName;
- final String unlocalName;
+public class BaseItemBolt extends BaseItemComponent{
public BaseItemBolt(Material material) {
- this.boltMaterial = material;
- this.unlocalName = "itemBolt"+material.getUnlocalizedName();
- this.materialName = material.getLocalizedName();
- this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(unlocalName);
- this.setMaxStackSize(64);
- this.setTextureName(CORE.MODID + ":" + "itemBolt");
- GameRegistry.registerItem(this, unlocalName);
- GT_OreDictUnificator.registerOre(unlocalName.replace("itemB", "b"), UtilsItems.getSimpleStack(this));
- addExtruderRecipe();
+ super(material, BaseItemComponent.ComponentTypes.BOLT);
}
-
- @Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
-
- return (materialName+ " Bolt");
- }
-
- @Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- if (materialName != null && materialName != "" && !materialName.equals("")){
- list.add(EnumChatFormatting.GRAY+"A small Bolt, constructed from " + materialName + ".");
- }
- super.addInformation(stack, aPlayer, list, bool);
- }
-
- public final String getMaterialName() {
- return materialName;
- }
-
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (boltMaterial.getRgbAsHex() == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return boltMaterial.getRgbAsHex();
-
- }
-
- private void addExtruderRecipe(){
- Utils.LOG_WARNING("Adding recipe for "+materialName+" Bolts");
- String tempIngot = unlocalName.replace("itemBolt", "ingot");
- ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1);
- if (null != tempOutputStack){
- GT_Values.RA.addExtruderRecipe(tempOutputStack,
- ItemList.Shape_Extruder_Bolt.get(1),
- UtilsItems.getSimpleStack(this, 8),
- (int) Math.max(boltMaterial.getMass() * 2L * 1, 1),
- 8 * boltMaterial.vVoltageMultiplier);
- }
-
- }
-
}
diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
new file mode 100644
index 0000000000..f2c2187558
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java
@@ -0,0 +1,42 @@
+package gtPlusPlus.core.item.base.cell;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.util.IIcon;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+public class BaseItemCell extends BaseItemComponent{
+
+ private IIcon base;
+ private IIcon overlay;
+ ComponentTypes Cell = ComponentTypes.CELL;
+
+ public BaseItemCell(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.CELL);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean requiresMultipleRenderPasses(){
+ return true;
+ }
+
+ @Override
+ public void registerIcons(IIconRegister i) {
+ this.base = i.registerIcon(CORE.MODID + ":" + "item"+Cell.getComponent());
+ this.overlay = i.registerIcon(CORE.MODID + ":" + "item"+Cell.getComponent()+"_Overlay");
+ }
+
+
+ @Override
+ public IIcon getIconFromDamageForRenderPass(int damage, int pass) {
+ if(pass == 0) {
+ return this.base;
+ }
+ return this.overlay;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
index 236edca24d..69d5363240 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
@@ -7,9 +7,9 @@ import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
+import gtPlusPlus.core.util.entity.EntityUtils;
+import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.recipe.UtilsRecipe;
import java.util.List;
@@ -70,9 +70,8 @@ public class BaseItemDust extends Item{
}
if (temp != null && temp != ""){
oredictName = temp;
- GT_OreDictUnificator.registerOre(temp, UtilsItems.getSimpleStack(this));
+ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
}
- addMixerRecipe();
addFurnaceRecipe();
addMacerationRecipe();
}
@@ -95,7 +94,7 @@ public class BaseItemDust extends Item{
protected final int sRadiation;
@Override
public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
- Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
+ EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
}
@Override
@@ -113,6 +112,9 @@ public class BaseItemDust extends Item{
if (sRadiation > 0){
list.add(CORE.GT_Tooltip_Radioactive);
}
+ if (dustInfo != null){
+ list.add(dustInfo.vChemicalFormula);
+ }
//}
super.addInformation(stack, aPlayer, list, bool);
}
@@ -130,79 +132,6 @@ public class BaseItemDust extends Item{
}
-
-
- private void addMixerRecipe(){
-
- ItemStack thisItem;
- ItemStack normalDust = dustInfo.getDust(1);
- ItemStack smallDust = dustInfo.getSmallDust(1);
- ItemStack tinyDust = dustInfo.getTinyDust(1);
-
- ItemStack[] inputStacks = dustInfo.getMaterialComposites();
- ItemStack outputStacks = dustInfo.getDust(10);
-
- if (oredictName.contains("dustTiny")){
- thisItem = tinyDust;
- ItemStack normalStack = dustInfo.getDust(1);
- ItemStack tinyStack = dustInfo.getTinyDust(9);
- Utils.LOG_INFO("Generating a 9 Tiny dust to 1 Dust recipe for "+materialName);
- UtilsRecipe.recipeBuilder(
- thisItem, thisItem, thisItem,
- thisItem, thisItem, thisItem,
- thisItem, thisItem, thisItem,
- normalStack);
-
- Utils.LOG_INFO("Generating a 9 Tiny dust from 1 Dust recipe for "+materialName);
- UtilsRecipe.recipeBuilder(
- normalStack, null, null,
- null, null, null,
- null, null, null,
- tinyStack);
-
- }
- else if (oredictName.contains("dustSmall")){
- thisItem = smallDust;
- ItemStack normalStack = dustInfo.getDust(1);
- ItemStack smallStack = dustInfo.getSmallDust(4);
-
- Utils.LOG_INFO("Generating a 4 Small dust to 1 Dust recipe for "+materialName);
- UtilsRecipe.recipeBuilder(
- thisItem, thisItem, null,
- thisItem, thisItem, null,
- null, null, null,
- normalStack);
-
- Utils.LOG_INFO("Generating a 4 Small dust from 1 Dust recipe for "+materialName);
- UtilsRecipe.recipeBuilder(
- null, normalStack, null,
- null, null, null,
- null, null, null,
- smallStack);
-
- }
- else {
- thisItem = normalDust;
- }
-
- if (thisItem == normalDust){
- Utils.LOG_WARNING("Generating a Dust recipe for "+materialName+" in the mixer.");
-
- if (inputStacks.length != 0){
- GT_Values.RA.addMixerRecipe(
- inputStacks[0], inputStacks[1],
- inputStacks[2], inputStacks[3],
- null, null,
- outputStacks,
- 8*mTier*20, 8*mTier*2);
- }
- else {
- return;
- }
- }
- }
-
-
private void addMacerationRecipe(){
Utils.LOG_WARNING("Adding recipe for "+materialName+" Dusts");
@@ -228,8 +157,8 @@ public class BaseItemDust extends Item{
Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot);
ItemStack[] outputStacks = {dustInfo.getDust(1)};
if (tempIngot != null && tempIngot != ""){
- tempInputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1);
- tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempDust, 1);
+ tempInputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1);
+ tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempDust, 1);
ItemStack tempStackOutput2 = null;
int chance = mTier*10/MathUtils.randInt(10, 20);
if (outputStacks.length != 0){
@@ -273,25 +202,30 @@ public class BaseItemDust extends Item{
if (dustInfo.requiresBlastFurnace()){
Utils.LOG_WARNING("Adding recipe for Hot "+materialName+" Ingots in a Blast furnace.");
String tempIngot = temp.replace("ingot", "ingotHot");
- ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1);
+ ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1);
Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName() + " Debug: "+tempIngot);
if (null != tempOutputStack){
- addBlastFurnaceRecipe(UtilsItems.getSimpleStack(this), null, tempOutputStack, null, 350*mTier);
+ addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*mTier);
}
return;
}
Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a furnace.");
- ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(temp, 1);
+ ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1);
Utils.LOG_WARNING("This will produce an ingot of "+tempOutputStack.getDisplayName() + " Debug: "+temp);
if (null != tempOutputStack){
if (mTier < 5 || !dustInfo.requiresBlastFurnace()){
- CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(UtilsItems.getSimpleStack(this), tempOutputStack);
+ if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(ItemUtils.getSimpleStack(this), tempOutputStack)){
+ Utils.LOG_WARNING("Successfully added a furnace recipe for "+materialName);
+ }
+ else {
+ Utils.LOG_WARNING("Failed to add a furnace recipe for "+materialName);
+ }
}
else if (mTier >= 5 || dustInfo.requiresBlastFurnace()){
Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a Blast furnace.");
Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName());
if (null != tempOutputStack){
- addBlastFurnaceRecipe(UtilsItems.getSimpleStack(this), null, tempOutputStack, null, 350*mTier);
+ addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*mTier);
}
return;
}
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
index 78067e48c7..d5dd78a49b 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java
@@ -4,7 +4,8 @@ import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
+import gtPlusPlus.core.util.entity.EntityUtils;
+import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
import java.util.List;
@@ -35,7 +36,7 @@ public class BaseItemDustUnique extends Item{
this.setCreativeTab(tabMisc);
this.colour = colour;
this.materialName = materialName;
- this.sRadiation = UtilsItems.getRadioactivityLevel(materialName);
+ this.sRadiation = ItemUtils.getRadioactivityLevel(materialName);
GameRegistry.registerItem(this, unlocalizedName);
String temp = "";
@@ -60,7 +61,7 @@ public class BaseItemDustUnique extends Item{
Utils.LOG_WARNING("Generating OreDict Name: "+temp);
}
if (temp != null && temp != ""){
- GT_OreDictUnificator.registerOre(temp, UtilsItems.getSimpleStack(this));
+ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
}
}
@@ -82,7 +83,7 @@ public class BaseItemDustUnique extends Item{
protected final int sRadiation;
@Override
public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
- Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
+ EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
}
@Override
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java
new file mode 100644
index 0000000000..0faa781fd9
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java
@@ -0,0 +1,56 @@
+package gtPlusPlus.core.item.base.dusts.decimal;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+
+import java.util.List;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import cpw.mods.fml.common.registry.GameRegistry;
+
+public class BaseItemCentidust extends Item{
+
+ final Material dustMaterial;
+ final String materialName;
+ final String unlocalName;
+
+ public BaseItemCentidust(Material material) {
+ this.dustMaterial = material;
+ this.unlocalName = "itemCentidust"+material.getUnlocalizedName();
+ this.materialName = material.getLocalizedName();
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(unlocalName);
+ this.setMaxStackSize(10);
+ this.setTextureName(CORE.MODID + ":" + "itemCentidust"); //TODO
+ GameRegistry.registerItem(this, unlocalName);
+ //GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+
+ return (materialName+ " Centidust");
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ if (materialName != null && materialName != "" && !materialName.equals("")){
+ list.add(EnumChatFormatting.GRAY+"1% of a " + materialName + " dust pile.");
+ }
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ public final String getMaterialName() {
+ return materialName;
+ }
+
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ return dustMaterial.getRgbAsHex();
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java
new file mode 100644
index 0000000000..afb9eef473
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java
@@ -0,0 +1,56 @@
+package gtPlusPlus.core.item.base.dusts.decimal;
+
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+
+import java.util.List;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import cpw.mods.fml.common.registry.GameRegistry;
+
+public class BaseItemDecidust extends Item{
+
+ final Material dustMaterial;
+ final String materialName;
+ final String unlocalName;
+
+ public BaseItemDecidust(Material material) {
+ this.dustMaterial = material;
+ this.unlocalName = "itemDecidust"+material.getUnlocalizedName();
+ this.materialName = material.getLocalizedName();
+ this.setCreativeTab(AddToCreativeTab.tabMisc);
+ this.setUnlocalizedName(unlocalName);
+ this.setMaxStackSize(10);
+ this.setTextureName(CORE.MODID + ":" + "itemDecidust"); //TODO
+ GameRegistry.registerItem(this, unlocalName);
+ //GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this)); //TODO
+ }
+
+ @Override
+ public String getItemStackDisplayName(ItemStack p_77653_1_) {
+
+ return (materialName+ " Decidust");
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ if (materialName != null && materialName != "" && !materialName.equals("")){
+ list.add(EnumChatFormatting.GRAY+"10% of a " + materialName + " dust pile.");
+ }
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ public final String getMaterialName() {
+ return materialName;
+ }
+
+ @Override
+ public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
+ return dustMaterial.getRgbAsHex();
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java
index aaad22be9c..92b8c8c224 100644
--- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java
+++ b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java
@@ -1,7 +1,7 @@
package gtPlusPlus.core.item.base.foods;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
+import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
import java.util.List;
@@ -42,7 +42,7 @@ public class BaseItemHotFood extends BaseItemFood{
if(iStack.getItemDamage() == cooldownTime) {
if (entityHolding instanceof EntityPlayer){
Utils.LOG_INFO("Foods Done.");
- ((EntityPlayer) entityHolding).inventory.addItemStackToInventory(UtilsItems.getSimpleStack(output));
+ ((EntityPlayer) entityHolding).inventory.addItemStackToInventory(ItemUtils.getSimpleStack(output));
((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this);
}
}else if(iStack.getItemDamage() < cooldownTime){
diff --git a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
index 47ce5b7815..7c4fe89568 100644
--- a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
+++ b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
@@ -1,81 +1,11 @@
package gtPlusPlus.core.item.base.gears;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.ItemList;
-import gregtech.api.util.GT_OreDictUnificator;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
-import gtPlusPlus.core.util.math.MathUtils;
-import java.util.List;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import cpw.mods.fml.common.registry.GameRegistry;
-
-public class BaseItemGear extends Item{
-
- final Material gearMaterial;
- final String materialName;
- final String unlocalName;
+public class BaseItemGear extends BaseItemComponent{
public BaseItemGear(Material material) {
- this.gearMaterial = material;
- this.unlocalName = "itemGear"+material.getUnlocalizedName();
- this.materialName = material.getLocalizedName();
- this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(unlocalName);
- this.setMaxStackSize(64);
- this.setTextureName(CORE.MODID + ":" + "itemGear");
- GameRegistry.registerItem(this, unlocalName);
- GT_OreDictUnificator.registerOre(unlocalName.replace("itemG", "g"), UtilsItems.getSimpleStack(this));
- addExtruderRecipe();
- }
-
- @Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
-
- return (gearMaterial.getLocalizedName()+ " Gear");
- }
-
- @Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- if (materialName != null && materialName != "" && !materialName.equals("")){
- list.add(EnumChatFormatting.GRAY+"A large Gear, constructed from " + materialName + ".");
- }
- super.addInformation(stack, aPlayer, list, bool);
+ super(material, BaseItemComponent.ComponentTypes.GEAR);
}
-
- public final String getMaterialName() {
- return materialName;
- }
-
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (gearMaterial.getRgbAsHex() == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return gearMaterial.getRgbAsHex();
-
- }
-
- private void addExtruderRecipe(){
- Utils.LOG_WARNING("Adding recipe for "+materialName+" Gears");
- ItemStack tempOutputStack = gearMaterial.getIngot(8);
- if (null != tempOutputStack){
-
- GT_Values.RA.addExtruderRecipe(
- tempOutputStack,
- ItemList.Shape_Extruder_Gear.get(1),
- UtilsItems.getSimpleStack(this),
- (int) Math.max(gearMaterial.getMass() * 5L, 1),
- 8 * gearMaterial.vVoltageMultiplier);
- }
- }
-
}
diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java
index e193636043..9a0ef0d097 100644
--- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java
+++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java
@@ -5,7 +5,8 @@ import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
+import gtPlusPlus.core.util.entity.EntityUtils;
+import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
import java.util.List;
@@ -44,7 +45,7 @@ public class BaseItemIngot extends Item{
temp = unlocalName.replace("itemHotIngot", "ingotHot");
}
if (temp != null && temp != ""){
- GT_OreDictUnificator.registerOre(temp, UtilsItems.getSimpleStack(this));
+ GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this));
}
generateCompressorRecipe();
}
@@ -84,7 +85,7 @@ public class BaseItemIngot extends Item{
private void generateCompressorRecipe(){
if (unlocalName.contains("itemIngot")){
- ItemStack tempStack = UtilsItems.getSimpleStack(this, 9);
+ ItemStack tempStack = ItemUtils.getSimpleStack(this, 9);
ItemStack tempOutput = null;
String temp = getUnlocalizedName().replace("item.itemIngot", "block");
Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName());
@@ -95,7 +96,7 @@ public class BaseItemIngot extends Item{
temp = temp.replace("itemIngot", "block");
Utils.LOG_WARNING("Generating OreDict Name: "+temp);
if (temp != null && temp != ""){
- tempOutput = UtilsItems.getItemStackOfAmountFromOreDict(temp, 1);
+ tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1);
if (tempOutput != null){
GT_ModHandler.addCompressionRecipe(tempStack, tempOutput);
}
@@ -113,6 +114,6 @@ public class BaseItemIngot extends Item{
protected final int sRadiation;
@Override
public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
- Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
+ EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java
index 6fa358f36f..6b60e7f8d3 100644
--- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java
+++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java
@@ -3,7 +3,7 @@ package gtPlusPlus.core.item.base.ingots;
import gregtech.api.enums.GT_Values;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
+import gtPlusPlus.core.util.item.ItemUtils;
import java.util.List;
@@ -50,7 +50,7 @@ public class BaseItemIngotHot extends BaseItemIngot{
private void generateRecipe(){
Utils.LOG_WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+materialName+".");
- GT_Values.RA.addVacuumFreezerRecipe(UtilsItems.getSimpleStack(this), outputIngot.copy(), 60*mTier);
+ GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), outputIngot.copy(), 60*mTier);
}
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java
index 77af69f809..2e39a47f81 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java
@@ -3,7 +3,7 @@ package gtPlusPlus.core.item.base.itemblock;
import gtPlusPlus.core.fluids.BlockFluidBase;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
-import gtPlusPlus.core.util.item.UtilsItems;
+import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
import java.util.List;
@@ -26,7 +26,7 @@ public class ItemBlockFluid extends ItemBlock{
this.baseBlock = (BlockFluidBase) block;
this.blockColour = baseBlock.getRenderColor(1);
this.thisFluid = baseBlock.getFluidMaterial();
- this.sRadiation=UtilsItems.getRadioactivityLevel(baseBlock.getUnlocalizedName());
+ this.sRadiation=ItemUtils.getRadioactivityLevel(baseBlock.getUnlocalizedName());
this.name = baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", "");
//GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), UtilsItems.getSimpleStack(this));
}
@@ -60,7 +60,7 @@ public class ItemBlockFluid extends ItemBlock{
@Override
public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- list.add("Temperature: "+MathUtils.celsiusToKelvin(thisFluid.getMeltingPoint_C())+"K");
+ list.add("Temperature: "+MathUtils.celsiusToKelvin(thisFluid.getMeltingPointC())+"K");
if (sRadiation > 0){
list.add(CORE.GT_Tooltip_Radioactive);
}
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
index ed21b3642a..8bf5346084 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java
@@ -3,8 +3,8 @@ package gtPlusPlus.core.item.base.itemblock;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.core.block.base.BlockBaseModular;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
+import gtPlusPlus.core.util.entity.EntityUtils;
+import gtPlusPlus.core.util.item.ItemUtils;
import java.util.List;
@@ -30,7 +30,7 @@ public class ItemBlockGtBlock extends ItemBlock{
else {
sRadiation = 0;
}
- GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), UtilsItems.getSimpleStack(this));
+ GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this));
}
public int getRenderColor(int aMeta) {
@@ -47,7 +47,7 @@ public class ItemBlockGtBlock extends ItemBlock{
@Override
public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
- Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
+ EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java
index b4628f12ab..9d442e3102 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java
@@ -2,7 +2,7 @@ package gtPlusPlus.core.item.base.itemblock;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.core.block.base.BlockBaseModular;
-import gtPlusPlus.core.util.item.UtilsItems;
+import gtPlusPlus.core.util.item.ItemUtils;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
@@ -14,7 +14,7 @@ public class ItemBlockGtFrameBox extends ItemBlock{
super(block);
BlockBaseModular baseBlock = (BlockBaseModular) block;
this.blockColour = baseBlock.getRenderColor(1);
- GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), UtilsItems.getSimpleStack(this));
+ GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), ItemUtils.getSimpleStack(this));
}
public int getRenderColor(int aMeta) {
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java
new file mode 100644
index 0000000000..73fcbc2ab6
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java
@@ -0,0 +1,43 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class ItemBlockTileEntity extends ItemBlock{
+
+ String[] description;
+
+ public ItemBlockTileEntity(Block block) {
+ super(block);
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ for (int i =0; i< this.description.length; i++){
+ if (!this.description[i].equals("")){
+ list.add(this.description[i]);
+ }
+ }
+
+
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+
+ }
+
+ public void setDecription(String[] description){
+ for (int i =0; i< description.length; i++){
+ this.description[i] = description[i];
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java b/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java
new file mode 100644
index 0000000000..d4f7ac02a6
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java
@@ -0,0 +1,11 @@
+package gtPlusPlus.core.item.base.nugget;
+
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+
+public class BaseItemNugget extends BaseItemComponent{
+
+ public BaseItemNugget(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.NUGGET);
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java
index 103198a395..3d1153eb6a 100644
--- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java
+++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java
@@ -1,92 +1,19 @@
package gtPlusPlus.core.item.base.plates;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.util.GT_OreDictUnificator;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
-import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.materials.MaterialUtils;
-import java.util.List;
+public class BaseItemPlate extends BaseItemComponent{
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.World;
-import cpw.mods.fml.common.registry.GameRegistry;
-
-public class BaseItemPlate extends Item{
-
- protected int colour;
- protected String materialName;
- protected String unlocalName;
- private int mTier;
-
- public BaseItemPlate(String unlocalizedName, String materialName, int colour, int tier, int sRadioactivity) {
- setUnlocalizedName(unlocalizedName);
- this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(unlocalizedName);
- this.unlocalName = unlocalizedName;
- this.setMaxStackSize(64);
- this.setTextureName(CORE.MODID + ":" + "itemPlate");
- this.colour = colour;
- this.mTier = tier;
- this.materialName = materialName;
- this.sRadiation = sRadioactivity;
- GameRegistry.registerItem(this, unlocalizedName);
- GT_OreDictUnificator.registerOre(unlocalName.replace("itemP", "p"), UtilsItems.getSimpleStack(this));
- //addBendingRecipe();
- }
-
- @Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
-
- return (materialName+ " Plate");
- }
-
- @Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- if (materialName != null && materialName != "" && !materialName.equals("")){
- list.add(EnumChatFormatting.GRAY+"A flat plate of " + materialName + ".");
- }
- if (sRadiation > 0){
- list.add(CORE.GT_Tooltip_Radioactive);
- }
- super.addInformation(stack, aPlayer, list, bool);
+ public BaseItemPlate(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.PLATE);
}
-
- public final String getMaterialName() {
- return materialName;
+
+ public BaseItemPlate(String unlocalizedName, String materialName, short[] colour, int tier, int sRadioactivity) {
+ this(MaterialUtils.generateQuickMaterial(materialName, new short[]{colour[0], colour[1], colour[2], 0}, sRadioactivity));
}
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (colour == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return colour;
-
- }
- protected final int sRadiation;
- @Override
- public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
- Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
- }
-
- private void addBendingRecipe(){
- Utils.LOG_WARNING("Adding recipe for "+materialName+" Plates");
- String tempIngot = unlocalName.replace("itemPlate", "ingot");
- ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1);
- if (null != tempOutputStack){
- GT_Values.RA.addBenderRecipe(tempOutputStack,
- UtilsItems.getSimpleStack(this),
- 14*mTier*20,
- 64*mTier);
- }
- }
}
diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java
index e6bfc1253a..ce8bbe8191 100644
--- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java
+++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java
@@ -1,126 +1,18 @@
package gtPlusPlus.core.item.base.plates;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
-import gtPlusPlus.core.util.math.MathUtils;
-
-import java.util.List;
-
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.World;
-import cpw.mods.fml.common.registry.GameRegistry;
-
-public class BaseItemPlateDouble extends Item{
- protected int colour;
- protected String materialName;
- protected String unlocalName;
- private int mTier;
+public class BaseItemPlateDouble extends BaseItemComponent{
- public BaseItemPlateDouble(String unlocalizedName, String materialName, int colour, int tier, int sRadioactivity) {
- setUnlocalizedName(unlocalizedName);
- this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(unlocalizedName);
- this.unlocalName = unlocalizedName;
+ public BaseItemPlateDouble(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.PLATEDOUBLE);
this.setMaxStackSize(32);
- this.setTextureName(CORE.MODID + ":" + "itemPlateDouble");
- this.colour = colour;
- this.mTier = tier;
- this.materialName = materialName;
- this.sRadiation = sRadioactivity;
- GameRegistry.registerItem(this, unlocalizedName);
- GT_OreDictUnificator.registerOre(unlocalName.replace("itemP", "p"), UtilsItems.getSimpleStack(this));
- //addBendingRecipe();
- //addCraftingRecipe();
}
@Override
public String getItemStackDisplayName(ItemStack p_77653_1_) {
-
return ("Double "+materialName+ " Plate");
}
-
- @Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- if (materialName != null && materialName != "" && !materialName.equals("")){
- list.add(EnumChatFormatting.GRAY+"A double plate of " + materialName + ".");
- }
- if (sRadiation > 0){
- list.add(CORE.GT_Tooltip_Radioactive);
- }
- super.addInformation(stack, aPlayer, list, bool);
- }
-
- public final String getMaterialName() {
- return materialName;
- }
-
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (colour == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return colour;
-
- }
-
- protected final int sRadiation;
- @Override
- public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
- Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
- }
-
- private void addBendingRecipe(){
- Utils.LOG_WARNING("Adding bender recipe for "+materialName+" Double Plates");
- String tempIngot = unlocalName.replace("itemPlateDouble", "ingot");
- String tempPlate = unlocalName.replace("itemPlateDouble", "plate");
- ItemStack inputIngot = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 2);
- ItemStack inputPlate = UtilsItems.getItemStackOfAmountFromOreDict(tempPlate, 2);
- if (null != inputIngot){
- GT_Values.RA.addBenderRecipe(inputIngot,
- UtilsItems.getSimpleStack(this),
- 4*20,
- 96);
- }
- if (null != inputPlate){
- GT_Values.RA.addBenderRecipe(inputPlate,
- UtilsItems.getSimpleStack(this),
- 4*20,
- 96);
- }
- }
-
- private void addCraftingRecipe(){
- Utils.LOG_WARNING("Adding crafting recipes for "+materialName+" Double Plates");
- String tempPlate = unlocalName.replace("itemPlateDouble", "plate");
- ItemStack inputPlate = UtilsItems.getItemStackOfAmountFromOreDict(tempPlate, 1);
- if (null != inputPlate){
-
- GT_ModHandler.addCraftingRecipe(
- GT_Utility.copyAmount(1L, new Object[]{UtilsItems.getSimpleStack(this)}),
- gregtech.api.util.GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | gregtech.api.util.GT_ModHandler.RecipeBits.BUFFERED,
- new Object[]{"I", "B", "h",
- Character.valueOf('I'),
- inputPlate,
- Character.valueOf('B'),
- inputPlate});
-
- GT_ModHandler.addShapelessCraftingRecipe(
- GT_Utility.copyAmount(1L, new Object[]{UtilsItems.getSimpleStack(this)}),
- new Object[]{gregtech.api.enums.ToolDictNames.craftingToolForgeHammer,
- inputPlate,
- inputPlate});
- }
- }
-
}
diff --git a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java
index d03b2b4e2f..6ad3509876 100644
--- a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java
+++ b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java
@@ -1,94 +1,11 @@
package gtPlusPlus.core.item.base.rings;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.ItemList;
-import gregtech.api.util.GT_OreDictUnificator;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.recipe.UtilsRecipe;
-import java.util.List;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import cpw.mods.fml.common.registry.GameRegistry;
-
-public class BaseItemRing extends Item{
-
- final Material ringMaterial;
- final String materialName;
- final String unlocalName;
+public class BaseItemRing extends BaseItemComponent{
public BaseItemRing(Material material) {
- this.ringMaterial = material;
- this.unlocalName = "itemRing"+material.getUnlocalizedName();
- this.materialName = material.getLocalizedName();
- this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(unlocalName);
- this.setMaxStackSize(64);
- this.setTextureName(CORE.MODID + ":" + "itemRing");
- GameRegistry.registerItem(this, unlocalName);
- GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this));
- addExtruderRecipe();
- }
-
- @Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
-
- return (materialName+ " Ring");
- }
-
- @Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- if (materialName != null && materialName != "" && !materialName.equals("")){
- list.add(EnumChatFormatting.GRAY+"A " + materialName + " Ring.");
- }
- super.addInformation(stack, aPlayer, list, bool);
+ super(material, BaseItemComponent.ComponentTypes.RING);
}
-
- public final String getMaterialName() {
- return materialName;
- }
-
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (ringMaterial.getRgbAsHex() == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return ringMaterial.getRgbAsHex();
-
- }
-
- private void addExtruderRecipe(){
- Utils.LOG_WARNING("Adding recipe for "+materialName+" Rings");
-
- //Extruder Recipe
- String tempIngot = unlocalName.replace("itemRing", "ingot");
- ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1);
- if (null != tempOutputStack){
- GT_Values.RA.addExtruderRecipe(tempOutputStack,
- ItemList.Shape_Extruder_Ring.get(1),
- UtilsItems.getSimpleStack(this, 4),
- (int) Math.max(ringMaterial.getMass() * 2L * 1, 1),
- 6 * ringMaterial.vVoltageMultiplier);
- }
-
- //Shaped Recipe
- tempIngot = unlocalName.replace("itemRing", "stick");
- tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1);
- if (null != tempOutputStack){
- UtilsRecipe.addShapedGregtechRecipe(
- "craftingToolWrench", null, null,
- null, tempOutputStack, null,
- null, null, null,
- UtilsItems.getSimpleStack(this, 1));
- }
- }
-
}
diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
index 0e4802ad0c..2e4acd6ccb 100644
--- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
+++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java
@@ -1,141 +1,31 @@
package gtPlusPlus.core.item.base.rods;
import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.ItemList;
-import gregtech.api.util.GT_OreDictUnificator;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.material.ELEMENT;
+import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.recipe.UtilsRecipe;
-
-import java.util.List;
-
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.World;
-import cpw.mods.fml.common.registry.GameRegistry;
-
-public class BaseItemRod extends Item{
-
- final Material rodMaterial;
- final String materialName;
- final String unlocalName;
-
- public BaseItemRod(Material material, int sRadioactivity) {
- this.rodMaterial = material;
- this.unlocalName = "itemRod"+material.getUnlocalizedName();
- this.materialName = material.getLocalizedName();
- this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(unlocalName);
- this.setTextureName(CORE.MODID + ":" + "itemRod");
- this.setMaxStackSize(64);
- this.sRadiation = sRadioactivity;
- GameRegistry.registerItem(this, unlocalName);
- GT_OreDictUnificator.registerOre(unlocalName.replace("itemRod", "stick"), UtilsItems.getSimpleStack(this));
-
- if (!material.equals(ELEMENT.URANIUM233)){
- addExtruderRecipe();
- }
-
- }
-
- @Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
-
- return (materialName+ " Rod");
- }
-
- @Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- if (materialName != null && materialName != "" && !materialName.equals("")){
- list.add(EnumChatFormatting.GRAY+"A 40cm Rod of " + materialName + ".");
- }
- if (sRadiation > 0){
- list.add(CORE.GT_Tooltip_Radioactive);
- }
- super.addInformation(stack, aPlayer, list, bool);
- }
-
- public final String getMaterialName() {
- return materialName;
- }
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (rodMaterial.getRgbAsHex() == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return rodMaterial.getRgbAsHex();
+public class BaseItemRod extends BaseItemComponent{
+ public BaseItemRod(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.ROD);
+ addExtruderRecipe();
}
- protected final int sRadiation;
- @Override
- public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
- Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
- }
private void addExtruderRecipe(){
- Utils.LOG_WARNING("Adding recipe for "+materialName+" Rods");
-
- String tempStick = unlocalName.replace("itemRod", "stick");
- String tempStickLong = unlocalName.replace("itemRod", "stickLong");
- String tempBolt = unlocalName.replace("itemRod", "bolt");
- ItemStack stackStick = UtilsItems.getItemStackOfAmountFromOreDict(tempStick, 1);
- ItemStack stackStick2 = UtilsItems.getItemStackOfAmountFromOreDict(tempStick, 2);
- ItemStack stackBolt = UtilsItems.getItemStackOfAmountFromOreDict(tempBolt, 4);
- ItemStack stackStickLong = UtilsItems.getItemStackOfAmountFromOreDict(tempStickLong, 1);
- ItemStack stackIngot = rodMaterial.getIngot(1);
+ Utils.LOG_WARNING("Adding cutter recipe for "+materialName+" Rods");
-
- GT_Values.RA.addExtruderRecipe(
- stackIngot,
- ItemList.Shape_Extruder_Rod.get(1),
- stackStick2,
- (int) Math.max(rodMaterial.getMass() * 2L * 1, 1),
- 6 * rodMaterial.vVoltageMultiplier);
+ ItemStack stackStick = componentMaterial.getRod(1);
+ ItemStack stackBolt = componentMaterial.getBolt(4);
GT_Values.RA.addCutterRecipe(
stackStick,
stackBolt,
null,
- (int) Math.max(rodMaterial.getMass() * 2L, 1L),
+ (int) Math.max(componentMaterial.getMass() * 2L, 1L),
4);
-
- if (sRadiation == 0){
- UtilsRecipe.recipeBuilder(
- stackStick, stackStick, stackStick,
- stackStick, "craftingToolWrench", stackStick,
- stackStick, stackStick, stackStick,
- UtilsItems.getItemStackOfAmountFromOreDict(unlocalName.replace("itemRod", "frameGt"), 2));
- }
-
- //Shaped Recipe - Bolts
- stackBolt = UtilsItems.getItemStackOfAmountFromOreDict(tempBolt, 2);
- if (null != stackBolt){
- UtilsRecipe.recipeBuilder(
- "craftingToolSaw", null, null,
- null, stackStick, null,
- null, null, null,
- stackBolt);
- }
-
- //Shaped Recipe - Ingot to Rod
- if (null != stackIngot){
- UtilsRecipe.recipeBuilder(
- "craftingToolFile", null, null,
- null, stackIngot, null,
- null, null, null,
- stackStick);
- }
-
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
index 6d87fd5872..882dc8b2bf 100644
--- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
+++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java
@@ -1,94 +1,31 @@
package gtPlusPlus.core.item.base.rods;
import gregtech.api.enums.GT_Values;
-import gregtech.api.util.GT_OreDictUnificator;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.recipe.UtilsRecipe;
-
-import java.util.List;
-
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
+import gtPlusPlus.core.util.item.ItemUtils;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.world.World;
-import cpw.mods.fml.common.registry.GameRegistry;
-
-public class BaseItemRodLong extends Item{
- final Material rodLongMaterial;
- final String materialName;
- final String unlocalName;
+public class BaseItemRodLong extends BaseItemComponent{
- public BaseItemRodLong(Material material, int sRadioactivity) {
- this.rodLongMaterial = material;
- this.unlocalName = "itemRodLong"+material.getUnlocalizedName();
- this.materialName = material.getLocalizedName();
- this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(material.getUnlocalizedName());
- this.setTextureName(CORE.MODID + ":" + "itemRodLong");
- this.setMaxStackSize(64);
- this.sRadiation = sRadioactivity;
- GameRegistry.registerItem(this, unlocalName);
- GT_OreDictUnificator.registerOre(unlocalName.replace("itemRod", "stick"), UtilsItems.getSimpleStack(this));
+ public BaseItemRodLong(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.RODLONG);
addExtruderRecipe();
}
-
+
@Override
public String getItemStackDisplayName(ItemStack p_77653_1_) {
-
return ("Long "+materialName+ " Rod");
}
- @Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- if (materialName != null && materialName != "" && !materialName.equals("")){
- list.add(EnumChatFormatting.GRAY+"A 80cm Rod of " + materialName + ".");
- }
- if (sRadiation > 0){
- list.add(CORE.GT_Tooltip_Radioactive);
- }
- super.addInformation(stack, aPlayer, list, bool);
- }
-
- public final String getMaterialName() {
- return materialName;
- }
-
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (rodLongMaterial.getRgbAsHex() == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return rodLongMaterial.getRgbAsHex();
-
- }
-
- protected final int sRadiation;
- @Override
- public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
- Utils.applyRadiationDamageToEntity(sRadiation, world, entityHolding);
- }
-
private void addExtruderRecipe(){
Utils.LOG_WARNING("Adding recipe for Long "+materialName+" Rods");
String tempStick = unlocalName.replace("itemRodLong", "stick");
String tempStickLong = unlocalName.replace("itemRodLong", "stickLong");
- ItemStack stackStick = UtilsItems.getItemStackOfAmountFromOreDict(tempStick, 1);
- ItemStack stackLong = UtilsItems.getItemStackOfAmountFromOreDict(tempStickLong, 1);
-
- UtilsRecipe.addShapedGregtechRecipe(
- stackStick, "craftingToolHardHammer", stackStick,
- null, null, null,
- null, null, null,
- stackLong);
+ ItemStack stackStick = ItemUtils.getItemStackOfAmountFromOreDict(tempStick, 1);
+ ItemStack stackLong = ItemUtils.getItemStackOfAmountFromOreDict(tempStickLong, 1);
ItemStack temp = stackStick;
temp.stackSize = 2;
@@ -96,25 +33,15 @@ public class BaseItemRodLong extends Item{
GT_Values.RA.addForgeHammerRecipe(
temp,
stackLong,
- (int) Math.max(rodLongMaterial.getMass(), 1L),
+ (int) Math.max(componentMaterial.getMass(), 1L),
16);
GT_Values.RA.addCutterRecipe(
stackLong,
temp,
null,
- (int) Math.max(rodLongMaterial.getMass(), 1L),
- 4);
-
- //Shaped Recipe - Long Rod to two smalls
- if (null != stackLong){
- stackStick.stackSize = 2;
- UtilsRecipe.recipeBuilder(
- "craftingToolSaw", null, null,
- stackLong, null, null,
- null, null, null,
- stackStick);
- }
+ (int) Math.max(componentMaterial.getMass(), 1L),
+ 4);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java
index d8ecea32bd..f993cc64b2 100644
--- a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java
+++ b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java
@@ -1,93 +1,11 @@
package gtPlusPlus.core.item.base.rotors;
-import gregtech.api.util.GT_OreDictUnificator;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.recipe.UtilsRecipe;
+import gtPlusPlus.core.item.base.BaseItemComponent;
+import gtPlusPlus.core.material.Material;
-import java.util.List;
+public class BaseItemRotor extends BaseItemComponent{
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import cpw.mods.fml.common.registry.GameRegistry;
-
-public class BaseItemRotor extends Item{
-
- protected int colour;
- protected String materialName;
- protected String unlocalName;
-
- public BaseItemRotor(String unlocalizedName, String materialName, int colour) {
- setUnlocalizedName(unlocalizedName);
- this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(unlocalizedName);
- this.unlocalName = unlocalizedName;
- this.setMaxStackSize(64);
- this.setTextureName(CORE.MODID + ":" + "itemRotor");
- this.colour = colour;
- this.materialName = materialName;
- GameRegistry.registerItem(this, unlocalizedName);
- GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), UtilsItems.getSimpleStack(this));
- generateRecipe();
- }
-
- @Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
-
- return (materialName+ " Rotor");
- }
-
- @Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- if (materialName != null && materialName != "" && !materialName.equals("")){
- list.add(EnumChatFormatting.GRAY+"A spindley Rotor made out of " + materialName + ". ");
- }
- super.addInformation(stack, aPlayer, list, bool);
+ public BaseItemRotor(Material material) {
+ super(material, BaseItemComponent.ComponentTypes.ROTOR);
}
-
- public final String getMaterialName() {
- return materialName;
- }
-
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (colour == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return colour;
-
- }
-
- public static boolean getValidItemStack(ItemStack validStack){
- if (validStack != null){
- return true;
- }
- return false;
- }
-
- public void generateRecipe(){
-
- Utils.LOG_WARNING("Adding recipe for "+materialName+" Rotors");
- String tempIngot = unlocalName.replace("itemRotor", "plate");
- ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1);
- Utils.LOG_WARNING("Found for recipe:"+tempIngot+ "isValidStack()="+getValidItemStack(tempOutputStack));
- String screw = unlocalName.replace("itemRotor", "screw");
- ItemStack screwStack = UtilsItems.getItemStackOfAmountFromOreDict(screw, 1);
- Utils.LOG_WARNING("Found for recipe:"+screw+ "isValidStack()="+getValidItemStack(screwStack));
- String ring = unlocalName.replace("itemRotor", "ring");
- ItemStack ringStack = UtilsItems.getItemStackOfAmountFromOreDict(ring, 1);
- Utils.LOG_WARNING("Found for recipe:"+ring+ "isValidStack()="+getValidItemStack(ringStack));
-
- UtilsRecipe.addShapedGregtechRecipe(
- tempOutputStack, "craftingToolHardHammer", tempOutputStack,
- screwStack, ringStack, "craftingToolFile",
- tempOutputStack, "craftingToolScrewdriver", tempOutputStack,
- UtilsItems.getSimpleStack(this));
- }
-
}
diff --git a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java
index 8d727770ce..93aa5b7526 100644
--- a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java
+++ b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java
@@ -1,86 +1,29 @@
package gtPlusPlus.core.item.base.screws;
import gregtech.api.enums.GT_Values;
-import gregtech.api.util.GT_OreDictUnificator;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.item.base.BaseItemComponent;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.item.UtilsItems;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.recipe.UtilsRecipe;
-
-import java.util.List;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
+import gtPlusPlus.core.util.item.ItemUtils;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-import cpw.mods.fml.common.registry.GameRegistry;
-public class BaseItemScrew extends Item{
-
- final Material screwMaterial;
- final String materialName;
- final String unlocalName;
+public class BaseItemScrew extends BaseItemComponent{
public BaseItemScrew(Material material) {
- this.screwMaterial = material;
- this.unlocalName = "itemScrew"+material.getUnlocalizedName();
- this.materialName = material.getLocalizedName();
- this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(unlocalName);
- this.setMaxStackSize(64);
- this.setTextureName(CORE.MODID + ":" + "itemScrew");
- GameRegistry.registerItem(this, unlocalName);
- GT_OreDictUnificator.registerOre(unlocalName.replace("itemS", "s"), UtilsItems.getSimpleStack(this));
+ super(material, BaseItemComponent.ComponentTypes.SCREW);
addLatheRecipe();
}
- @Override
- public String getItemStackDisplayName(ItemStack p_77653_1_) {
-
- return (materialName+ " Screw");
- }
-
- @Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- if (materialName != null && materialName != "" && !materialName.equals("")){
- list.add(EnumChatFormatting.GRAY+"A 8mm Screw, fabricated out of some " + materialName + ".");
- }
- super.addInformation(stack, aPlayer, list, bool);
- }
-
- public final String getMaterialName() {
- return materialName;
- }
-
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (screwMaterial.getRgbAsHex() == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return screwMaterial.getRgbAsHex();
-
- }
-
private void addLatheRecipe(){
Utils.LOG_WARNING("Adding recipe for "+materialName+" Screws");
- ItemStack boltStack = UtilsItems.getItemStackOfAmountFromOreDict(unlocalName.replace("itemScrew", "bolt"), 1);
+ ItemStack boltStack = ItemUtils.getItemStackOfAmountFromOreDict(unlocalName.replace("itemScrew", "bolt"), 1);
if (null != boltStack){
GT_Values.RA.addLatheRecipe(
boltStack,
- UtilsItems.getSimpleStack(this),
+ ItemUtils.getSimpleStack(this),
null,
- (int) Math.max(screwMaterial.getMass() / 8L, 1L),
- 4);
-
-
- UtilsRecipe.recipeBuilder(
- "craftingToolFile", boltStack, null,
- boltStack, null, null,
- null, null, null,
- UtilsItems.getSimpleStack(this));
+ (int) Math.max(componentMaterial.getMass() / 8L, 1L),
+ 4);
}
}