diff options
author | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
---|---|---|
committer | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
commit | 0669f5eb9d5029a8b94ec552171b0837605f7747 (patch) | |
tree | 6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/core/item/base | |
parent | 3654052fb63a571c5eaca7f20714b87c17f7e966 (diff) | |
download | GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2 GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip |
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/base')
35 files changed, 1722 insertions, 1603 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java index e9e2317044..e92e69f0e0 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java @@ -1,8 +1,5 @@ package gtPlusPlus.core.item.base; -import static gregtech.api.enums.GT_Values.D1; -import static gregtech.api.enums.GT_Values.V; - import java.util.*; import cpw.mods.fml.common.registry.GameRegistry; @@ -33,474 +30,602 @@ import net.minecraft.util.IIcon; 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>(); + private final HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>> mItemBehaviors = new HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>>(); + public final short mOffset, mItemAmount; + public final BitSet mEnabledItems; + public final BitSet mVisibleItems; + public final IIcon[][] mIconList; + /** The unlocalized name of this item. */ + private String unlocalizedName; + + private final ArrayList<Pair<Integer, EnumRarity>> rarity = new ArrayList<Pair<Integer, EnumRarity>>(); + private final ArrayList<Pair<Integer, EnumChatFormatting>> descColour = new ArrayList<Pair<Integer, EnumChatFormatting>>(); + private final ArrayList<Pair<Integer, String>> itemName = new ArrayList<Pair<Integer, String>>(); + private final ArrayList<Pair<Integer, String>> itemDescription = new ArrayList<Pair<Integer, String>>(); + private final ArrayList<Pair<Integer, Boolean>> hasEffect = new ArrayList<Pair<Integer, Boolean>>(); + + public final HashMap<Short, Long[]> mElectricStats = new HashMap<Short, Long[]>(); + public final HashMap<Short, Short> mBurnValues = new HashMap<Short, Short>(); 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)); - } + this("MU-metaitem.02", AddToCreativeTab.tabOther, (short) 1000, (short) 31766); + } - @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; + public BaseEuItem(final String unlocalizedName, final CreativeTabs creativeTab, final short aOffset, + final short aItemAmount) { + this.mEnabledItems = new BitSet(aItemAmount); + this.mVisibleItems = new BitSet(aItemAmount); + this.mOffset = (short) Math.min(32766, aOffset); + this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset); + this.mIconList = new IIcon[aItemAmount][1]; + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setUnlocalizedName(unlocalizedName); + this.setCreativeTab(creativeTab); + this.setMaxStackSize(1); + GameRegistry.registerItem(this, unlocalizedName); } + @SuppressWarnings({ + "unchecked", "rawtypes" + }) @Override - public boolean hasEffect(ItemStack par1ItemStack){ - if (hasEffect.get(par1ItemStack.getItemDamage()-mOffset) != null) - return hasEffect.get(par1ItemStack.getItemDamage()-mOffset).getValue(); - return false; + public final void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, + final boolean aF3_H) { + // aList.add("Meta: "+(aStack.getItemDamage()-mOffset)); + if (this.descColour.get(aStack.getItemDamage() - this.mOffset) != null + && this.itemDescription.get(aStack.getItemDamage() - this.mOffset) != null) { + aList.add(this.descColour.get(aStack.getItemDamage() - this.mOffset).getValue() + + this.itemDescription.get(aStack.getItemDamage() - this.mOffset).getValue()); + } + final String tKey = this.getUnlocalizedName(aStack) + ".tooltip", + tString = GT_LanguageManager.getTranslation(tKey); + if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) { + aList.add(tString); + } + final Long[] tStats = this.getElectricStats(aStack); + if (tStats != null) { + if (tStats[3] > 0) { + aList.add(EnumChatFormatting.AQUA + "Contains " + GT_Utility.formatNumbers(tStats[3]) + " EU Tier: " + + (tStats[2] >= 0 ? tStats[2] : 0) + EnumChatFormatting.GRAY); + } + else { + final long tCharge = this.getRealCharge(aStack); + if (tStats[3] == -2 && tCharge <= 0) { + aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + + EnumChatFormatting.GRAY); + } + else { + aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + + GT_Values.V[(int) (tStats[2] >= 0 + ? tStats[2] < GT_Values.V.length ? tStats[2] : GT_Values.V.length - 1 : 1)] + + EnumChatFormatting.GRAY); + } + } + } + final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final IItemBehaviour<BaseEuItem> tBehavior : tList) { + aList = tBehavior.getAdditionalToolTips(this, aList, aStack); + } + } } - - @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; + /** + * This adds a Custom Item to the ending Range. + * + * @param aID + * The Id of the assigned Item [0 - mItemAmount] (The MetaData + * gets auto-shifted by +mOffset) + * @param aEnglish + * The Default Localized Name of the created Item + * @param aToolTip + * The Default ToolTip of the created Item, you can also insert + * null for having no ToolTip + * @param aFoodBehavior + * The Food Value of this Item. Can be null aswell. Just a + * convenience thing. + * @param aRandomData + * The OreDict Names you want to give the Item. Also used for TC + * Aspects and some other things. + * @return An ItemStack containing the newly created Item. + */ + @SuppressWarnings("unchecked") + public final ItemStack addItem(final int aID, final String aEnglish, String aToolTip, final Object... aRandomData) { + if (aToolTip == null) { + aToolTip = ""; + } + if (aID >= 0 && aID < this.mItemAmount) { + final ItemStack rStack = new ItemStack(this, 1, this.mOffset + aID); + this.mEnabledItems.set(aID); + this.mVisibleItems.set(aID); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".name", aEnglish); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName(rStack) + ".tooltip", aToolTip); + final List<TC_AspectStack> tAspects = new ArrayList<TC_AspectStack>(); + // Important Stuff to do first + for (final Object tRandomData : aRandomData) { + if (tRandomData instanceof SubTag) { + if (tRandomData == SubTag.INVISIBLE) { + this.mVisibleItems.set(aID, false); + continue; + } + if (tRandomData == SubTag.NO_UNIFICATION) { + GT_OreDictUnificator.addToBlacklist(rStack); + continue; + } + } + } + // now check for the rest + for (final Object tRandomData : aRandomData) { + if (tRandomData != null) { + boolean tUseOreDict = true; + if (tRandomData instanceof IItemBehaviour) { + this.addItemBehavior(this.mOffset + aID, (IItemBehaviour<BaseEuItem>) tRandomData); + tUseOreDict = false; + } + if (tRandomData instanceof IItemContainer) { + ((IItemContainer) tRandomData).set(rStack); + tUseOreDict = false; + } + if (tRandomData instanceof SubTag) { + continue; + } + if (tRandomData instanceof TC_AspectStack) { + ((TC_AspectStack) tRandomData).addToAspectList(tAspects); + continue; + } + if (tRandomData instanceof ItemData) { + if (GT_Utility.isStringValid(tRandomData)) { + GT_OreDictUnificator.registerOre(tRandomData, rStack); + } + else { + GT_OreDictUnificator.addItemData(rStack, (ItemData) tRandomData); + } + continue; + } + if (tUseOreDict) { + GT_OreDictUnificator.registerOre(tRandomData, rStack); + continue; + } + } + } + if (GregTech_API.sThaumcraftCompat != null) { + GregTech_API.sThaumcraftCompat.registerThaumcraftAspectsToItem(rStack, tAspects, false); + } + return rStack; + } + return null; } - @Override - public final Item getEmptyItem(ItemStack itemStack) { + /** + * Adds a special Item Behaviour to the Item. + * <p/> + * Note: the boolean Behaviours sometimes won't be executed if another + * boolean Behaviour returned true before. + * + * @param aMetaValue + * the Meta Value of the Item you want to add it to. [0 - 32765] + * @param aBehavior + * the Click Behavior you want to add. + * @return the Item itself for convenience in constructing. + */ + public final BaseEuItem addItemBehavior(final int aMetaValue, final IItemBehaviour<BaseEuItem> aBehavior) { + if (aMetaValue < 0 || aMetaValue >= 32766 || aBehavior == null) { + return this; + } + ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) aMetaValue); + if (tList == null) { + tList = new ArrayList<IItemBehaviour<BaseEuItem>>(1); + this.mItemBehaviors.put((short) aMetaValue, tList); + } + tList.add(aBehavior); return this; } @Override - public final double getMaxCharge(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; - return Math.abs(tStats[0]); + public final boolean canProvideEnergy(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return false; + } + return tStats[3] > 0 || aStack.stackSize == 1 && (tStats[3] == -2 || tStats[3] == -3); } @Override - public final double getTransferLimit(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; - return Math.max(tStats[1], tStats[3]); + public final boolean canUse(final ItemStack aStack, final double aAmount) { + return this.getRealCharge(aStack) >= aAmount; } @Override - public final int getTier(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); + public final double charge(final ItemStack aStack, final double aCharge, final int aTier, + final boolean aIgnoreTransferLimit, final boolean aSimulate) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null || tStats[2] > aTier + || !(tStats[3] == -1 || tStats[3] == -3 || tStats[3] < 0 && aCharge == Integer.MAX_VALUE) + || aStack.stackSize != 1) { + return 0; + } + final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE + ? Long.MAX_VALUE + : Math.min(Math.abs(tStats[0]), + tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) { + this.setCharge(aStack, tNewCharge); + } + return tNewCharge - tChargeBefore; } @Override - public final double 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; + public final void chargeFromArmor(final ItemStack aStack, final EntityLivingBase aPlayer) { + if (aPlayer == null || aPlayer.worldObj.isRemote) { + return; + } + for (int i = 1; i < 5; i++) { + final ItemStack tArmor = aPlayer.getEquipmentInSlot(i); + if (GT_ModHandler.isElectricItem(tArmor)) { + final IElectricItem tArmorItem = (IElectricItem) tArmor.getItem(); + if (tArmorItem.canProvideEnergy(tArmor) && tArmorItem.getTier(tArmor) >= this.getTier(aStack)) { + final double tCharge = ElectricItem.manager.discharge(tArmor, + this.charge(aStack, Integer.MAX_VALUE - 1, Integer.MAX_VALUE, true, true), + Integer.MAX_VALUE, true, true, false); + if (tCharge > 0) { + this.charge(aStack, tCharge, Integer.MAX_VALUE, true, false); + if (aPlayer instanceof EntityPlayer) { + final Container tContainer = ((EntityPlayer) aPlayer).openContainer; + if (tContainer != null) { + tContainer.detectAndSendChanges(); + } + } + } + } + } + } } @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; + public final double discharge(final ItemStack aStack, final double aCharge, final int aTier, + final boolean aIgnoreTransferLimit, final boolean aBatteryAlike, final boolean aSimulate) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null || tStats[2] > aTier) { + return 0; + } + if (aBatteryAlike && !this.canProvideEnergy(aStack)) { + return 0; + } if (tStats[3] > 0) { - if (aCharge < tStats[3] || aStack.stackSize < 1) return 0; - if (!aSimulate) aStack.stackSize--; + 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); + final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = Math.max(0, + tChargeBefore - (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) { + this.setCharge(aStack, tNewCharge); + } return tChargeBefore - tNewCharge; } @Override - public final double getCharge(ItemStack aStack) { - return getRealCharge(aStack); + public final double getCharge(final ItemStack aStack) { + return this.getRealCharge(aStack); } @Override - public final boolean canUse(ItemStack aStack, double aAmount) { - return getRealCharge(aStack) >= aAmount; + public final Item getChargedItem(final ItemStack itemStack) { + return this; } - @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; + @SuppressWarnings("static-method") + public short getChargedMetaData(final ItemStack aStack) { + return (short) aStack.getItemDamage(); } - @Override - public final boolean canProvideEnergy(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return false; - return tStats[3] > 0 || (aStack.stackSize == 1 && (tStats[3] == -2 || tStats[3] == -3)); + public final Long[] getElectricStats(final ItemStack aStack) { + return this.mElectricStats.get((short) aStack.getItemDamage()); } @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; + public final Item getEmptyItem(final ItemStack itemStack) { + return this; } @SuppressWarnings("static-method") - public short getChargedMetaData(ItemStack aStack) { + public short getEmptyMetaData(final ItemStack aStack) { return (short) aStack.getItemDamage(); } - @SuppressWarnings("static-method") - public short getEmptyMetaData(ItemStack aStack) { - return (short) aStack.getItemDamage(); + @Override + public final IIcon getIconFromDamage(final int aMetaData) { + if (aMetaData < 0) { + return null; + } + return aMetaData - this.mOffset < this.mIconList.length ? this.mIconList[aMetaData - this.mOffset][0] : null; } + @Override + public boolean getIsRepairable(final ItemStack aStack, final ItemStack aMaterial) { + return false; + } - 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 int getItemEnchantability() { + return 0; } @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 + public String getItemStackDisplayName(final ItemStack par1ItemStack) { + return this.itemName.get(par1ItemStack.getItemDamage() - this.mOffset).getValue(); + } @Override - public final IElectricItemManager getManager(ItemStack aStack) { + public final IElectricItemManager getManager(final ItemStack aStack) { return this; } // We are our own Manager - /** - * Sets the Furnace Burn Value for the Item. - * - * @param aMetaValue the Meta Value of the Item you want to set it to. [0 - 32765] - * @param aValue 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 EU) - * @return the Item itself for convenience in constructing. - */ - public final BaseEuItem setBurnValue(int aMetaValue, int aValue) { - if (aMetaValue < 0 || aValue < 0) return this; - if (aValue == 0) mBurnValues.remove((short) aMetaValue); - else mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); - return this; + @Override + public final double getMaxCharge(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } + return Math.abs(tStats[0]); } - /** - * @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}); + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(final ItemStack par1ItemStack) { + if (this.rarity.get(par1ItemStack.getItemDamage() - this.mOffset) != null) { + return this.rarity.get(par1ItemStack.getItemDamage() - this.mOffset).getValue(); } - return this; + return EnumRarity.common; } + public final long getRealCharge(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } + if (tStats[3] > 0) { + return (int) (long) tStats[3]; + } + final NBTTagCompound tNBT = aStack.getTagCompound(); + return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); + } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({ + "rawtypes", "unchecked" + }) @Override @SideOnly(Side.CLIENT) - public void getSubItems(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)); + public void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) { + for (int i = 0, j = this.mEnabledItems.length(); i < j; i++) { + if (this.mVisibleItems.get(i) || GT_Values.D1 && this.mEnabledItems.get(i)) { + final Long[] tStats = this.mElectricStats.get((short) (this.mOffset + i)); if (tStats != null && tStats[3] < 0) { - ItemStack tStack = new ItemStack(this, 1, mOffset + i); - setCharge(tStack, Math.abs(tStats[0])); - isItemStackUsable(tStack); + final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); + this.setCharge(tStack, Math.abs(tStats[0])); + this.isItemStackUsable(tStack); aList.add(tStack); } if (tStats == null || tStats[3] != -2) { - ItemStack tStack = new ItemStack(this, 1, mOffset + i); - isItemStackUsable(tStack); + final ItemStack tStack = new ItemStack(this, 1, this.mOffset + i); + this.isItemStackUsable(tStack); aList.add(tStack); } } + } + } + + @Override + public final int getTier(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); + } + + @Override + public final String getToolTip(final ItemStack aStack) { + return null; + } // This has its own ToolTip Handler, no need to let the IC2 Handler screw + // us up at this Point + + @Override + public final double getTransferLimit(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } + return Math.max(tStats[1], tStats[3]); + } + + /** + * Returns the unlocalized name of this item. + */ + @Override + public String getUnlocalizedName() { + return this.unlocalizedName; + } + + @Override + public boolean hasEffect(final ItemStack par1ItemStack) { + if (this.hasEffect.get(par1ItemStack.getItemDamage() - this.mOffset) != null) { + return this.hasEffect.get(par1ItemStack.getItemDamage() - this.mOffset).getValue(); + } + return false; + } + + @Override + public boolean isBookEnchantable(final ItemStack aStack, final ItemStack aBook) { + return false; + } + + public boolean isItemStackUsable(final ItemStack aStack) { + final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final IItemBehaviour<BaseEuItem> tBehavior : tList) { + if (!tBehavior.isItemStackUsable(this, aStack)) { + return false; + } + } + } + return true; } @Override @SideOnly(Side.CLIENT) - public final void registerIcons(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)); + public final void registerIcons(final IIconRegister aIconRegister) { + for (short i = 0, j = (short) this.mEnabledItems.length(); i < j; i++) { + if (this.mEnabledItems.get(i)) { + for (byte k = 1; k < this.mIconList[i].length; k++) { + this.mIconList[i][k] = aIconRegister + .registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i + "/" + k); } - mIconList[i][0] = aIconRegister.registerIcon(CORE.MODID+":" + (getUnlocalizedName() + "/" + i)); + this.mIconList[i][0] = aIconRegister + .registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i); } + } + } + + public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, + final String description) { + this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, + EnumChatFormatting.GRAY, false); + } + + public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, + final String description, final int burnTime) { + this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, + EnumChatFormatting.GRAY, false); + this.setBurnValue(id, burnTime); } - - - @Override - public final IIcon getIconFromDamage(int aMetaData) { - if (aMetaData < 0) return null; - return aMetaData - mOffset < mIconList.length ? mIconList[aMetaData - mOffset][0] : null; - } - + + public void registerItem(final int id, final String localizedName, final long euStorage, final short tier, + final String description, final EnumRarity regRarity, final EnumChatFormatting colour, + final boolean Effect) { + this.addItem(id, localizedName, EnumChatFormatting.YELLOW + "Electric", new Object[] {}); + this.setElectricStats(this.mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true); + this.rarity.add(new Pair<Integer, EnumRarity>(id, regRarity)); + this.itemName.add(new Pair<Integer, String>(id, localizedName)); + this.itemDescription.add(new Pair<Integer, String>(id, description)); + this.descColour.add(new Pair<Integer, EnumChatFormatting>(id, colour)); + this.hasEffect.add(new Pair<Integer, Boolean>(id, Effect)); + } + /** - * Sets the unlocalized name of this item to the string passed as the parameter" - */ - @Override - public Item setUnlocalizedName(String p_77655_1_){ - this.unlocalizedName = p_77655_1_; - super.setUnlocalizedName(p_77655_1_); - return this; - } - + * Sets the Furnace Burn Value for the Item. + * + * @param aMetaValue + * the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aValue + * 200 = 1 Burn Process = 500 EU, max = 32767 (that is 81917.5 + * EU) + * @return the Item itself for convenience in constructing. + */ + public final BaseEuItem setBurnValue(final int aMetaValue, final int aValue) { + if (aMetaValue < 0 || aValue < 0) { + return this; + } + if (aValue == 0) { + this.mBurnValues.remove((short) aMetaValue); + } + else { + this.mBurnValues.put((short) aMetaValue, aValue > Short.MAX_VALUE ? Short.MAX_VALUE : (short) aValue); + } + return this; + } + + public final boolean setCharge(final ItemStack aStack, long aCharge) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null || tStats[3] > 0) { + return false; + } + NBTTagCompound tNBT = aStack.getTagCompound(); + if (tNBT == null) { + tNBT = new NBTTagCompound(); + } + tNBT.removeTag("GT.ItemCharge"); + aCharge = Math.min(tStats[0] < 0 ? Math.abs(tStats[0] / 2) : aCharge, Math.abs(tStats[0])); + if (aCharge > 0) { + aStack.setItemDamage(this.getChargedMetaData(aStack)); + tNBT.setLong("GT.ItemCharge", aCharge); + } + else { + aStack.setItemDamage(this.getEmptyMetaData(aStack)); + } + if (tNBT.hasNoTags()) { + aStack.setTagCompound(null); + } + else { + aStack.setTagCompound(tNBT); + } + this.isItemStackUsable(aStack); + return true; + } + /** - * 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()); - } - + * @param aMetaValue + * the Meta Value of the Item you want to set it to. [0 - 32765] + * @param aMaxCharge + * Maximum Charge. (if this is == 0 it will remove the Electric + * Behavior) + * @param aTransferLimit + * Transfer Limit. + * @param aTier + * The electric Tier. + * @param aSpecialData + * If this Item has a Fixed Charge, like a SingleUse Battery (if + * > 0). Use -1 if you want to make this Battery chargeable (the + * use and canUse Functions will still discharge if you just use + * this) Use -2 if you want to make this Battery dischargeable. + * Use -3 if you want to make this Battery charge/discharge-able. + * @return the Item itself for convenience in constructing. + */ + public final BaseEuItem setElectricStats(final int aMetaValue, final long aMaxCharge, final long aTransferLimit, + final long aTier, final long aSpecialData, final boolean aUseAnimations) { + if (aMetaValue < 0) { + return this; + } + if (aMaxCharge == 0) { + this.mElectricStats.remove((short) aMetaValue); + } + else { + this.mElectricStats.put((short) aMetaValue, new Long[] { + aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData + }); + } + return this; + } + + /** + * Sets the unlocalized name of this item to the string passed as the + * parameter" + */ @Override - public 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; - } + public Item setUnlocalizedName(final String p_77655_1_) { + this.unlocalizedName = p_77655_1_; + super.setUnlocalizedName(p_77655_1_); + return this; + } @Override - public String getItemStackDisplayName(ItemStack par1ItemStack) { - return itemName.get(par1ItemStack.getItemDamage()-mOffset).getValue(); + public final boolean use(final ItemStack aStack, final double aAmount, final EntityLivingBase aPlayer) { + this.chargeFromArmor(aStack, aPlayer); + if (aPlayer instanceof EntityPlayer && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) { + return true; + } + final double tTransfer = this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); + if (tTransfer == aAmount) { + this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + this.chargeFromArmor(aStack, aPlayer); + return true; + } + this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + this.chargeFromArmor(aStack, aPlayer); + return false; } } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java index aa5bb3f0ea..eb61454f15 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBackpack.java @@ -16,74 +16,74 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class BaseItemBackpack extends Item{ - - protected final int colourValue; - protected final String unlocalName; - - - public BaseItemBackpack(String unlocalizedName, int colour){ - this.unlocalName = unlocalizedName; - this.setUnlocalizedName(unlocalizedName); - this.setTextureName(CORE.MODID + ":" + "itemBackpack"); - this.colourValue = colour; - GameRegistry.registerItem(this, unlocalizedName); - GT_OreDictUnificator.registerOre("storageBackpack", ItemUtils.getSimpleStack(this)); - setMaxStackSize(1); - setCreativeTab(AddToCreativeTab.tabOther); +public class BaseItemBackpack extends Item { + + protected final int colourValue; + protected final String unlocalName; + + public BaseItemBackpack(final String unlocalizedName, final int colour) { + this.unlocalName = unlocalizedName; + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + "itemBackpack"); + this.colourValue = colour; + GameRegistry.registerItem(this, unlocalizedName); + GT_OreDictUnificator.registerOre("storageBackpack", ItemUtils.getSimpleStack(this)); + this.setMaxStackSize(1); + this.setCreativeTab(AddToCreativeTab.tabOther); + } + + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colourValue == 0) { + return MathUtils.generateSingularRandomHexValue(); + } + return this.colourValue; + + } + + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + // Name Formatting. + String temp = this.unlocalName.replace("backpack", ""); + // Lets find the colour. + if (temp.toLowerCase().contains("dark")) { + temp = this.unlocalName.substring(12, this.unlocalName.length()); + temp = "Dark " + temp; + } + return temp + " Backpack"; } // Without this method, your inventory will NOT work!!! @Override - public int getMaxItemUseDuration(ItemStack stack) { + public int getMaxItemUseDuration(final ItemStack stack) { return 1; // return any value greater than zero } - - @Override - public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) - { - if (!world.isRemote) - { + + @Override + public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) { + if (!world.isRemote) { // If player not sneaking, open the inventory gui if (!player.isSneaking()) { player.openGui(GTplusplus.instance, GuiHandler.GUI3, world, 0, 0, 0); } - - // Otherwise, stealthily place some diamonds in there for a nice surprise next time you open it up :) + + // Otherwise, stealthily place some diamonds in there for a nice + // surprise next time you open it up :) else { - // Utils.LOG_INFO("Player is Sneaking, giving them sneaky diamonds."); - // new BaseInventoryBackpack(player.getHeldItem()).setInventorySlotContents(0, new ItemStack(Items.diamond,4)); + // Utils.LOG_INFO("Player is Sneaking, giving them sneaky + // diamonds."); + // new + // BaseInventoryBackpack(player.getHeldItem()).setInventorySlotContents(0, + // new ItemStack(Items.diamond,4)); } } - + return itemstack; } - - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colourValue == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return colourValue; - - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - //Name Formatting. - String temp = unlocalName.replace("backpack", ""); - //Lets find the colour. - if (temp.toLowerCase().contains("dark")){ - temp = unlocalName.substring(12, unlocalName.length()); - temp = "Dark "+ temp; - } - return (temp+" Backpack"); - } @Override @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister iconRegister) - { + public void registerIcons(final IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(CORE.MODID + ":" + "itemBackpack"); } } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java index 018f4e8e22..1a1c6fd3c9 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemBrain.java @@ -12,8 +12,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; /* - * - * + * + * Key Point: You can access the NBT compound data from the Item class (in those methods that pass an ItemStack), but the NBT compound can only be set on an ItemStack. The steps to add NBT data to an ItemStack: @@ -21,88 +21,80 @@ import net.minecraft.util.StatCollector; Create an NBTTagCompound and fill it with the appropriate data Call ItemStack#setTagCompound() method to set it. - * + * */ -public class BaseItemBrain extends Item{ +public class BaseItemBrain extends Item { // This is an array of all the types I am going to be adding. - String[] brainTypes = { "dead", "preserved", "fresh", "tasty" }; + String[] brainTypes = { + "dead", "preserved", "fresh", "tasty" + }; - // This method allows us to have different language translation keys for - // each item we add. + // This code will allow us to tell the items apart in game. You can change + @SuppressWarnings("unchecked") + // texture based on nbt data, but I won't be covering that. @Override - public String getUnlocalizedName(ItemStack stack) - { - // This makes sure that the stack has a tag compound. This is how data - // is stored on items. - if (stack.hasTagCompound()) + @SideOnly(Side.CLIENT) + public void addInformation(final ItemStack stack, final EntityPlayer player, final List tooltip, + final boolean isAdvanced) { + if (stack.hasTagCompound() && stack.getTagCompound().hasKey("brainType")) { + // StatCollector is a class which allows us to handle string + // language translation. This requires that you fill out the + // translation in you language class. + tooltip.add(StatCollector + .translateToLocal("tooltip.yourmod." + stack.getTagCompound().getString("brainType") + ".desc")); + } + else // If the brain does not have valid tag data, a default message { - // 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"); - } + tooltip.add(StatCollector.translateToLocal("tooltip.yourmod.nullbrain.desc")); } - // This will be used if the item is obtained without nbt data on it. - return "item.nullBrain"; } - // This is a fun method which allows us to run some code when our item is - // shown in a creative tab. I am going to use it to add all the brain + // shown in a creative tab. I am going to use it to add all the brain // types. @SuppressWarnings("unchecked") @Override @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs tab, List itemList) - { + public void getSubItems(final Item item, final CreativeTabs tab, final List itemList) { // This creates a loop with a counter. It will go through once for - // every listing in brainTypes, and gives us a number associated + // 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 + for (int pos = 0; pos < this.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. + final ItemStack brainStack = new ItemStack(item); + // By default, a new ItemStack does not have any nbt compound data. // We need to give it some. brainStack.setTagCompound(new NBTTagCompound()); - // Now we set the type of the item, brainType is the key, and + // 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]); + brainStack.getTagCompound().setString("brainType", this.brainTypes[pos]); // And this adds it to the itemList, which is a list of all items // in the creative tab. itemList.add(brainStack); } } - // This code will allow us to tell the items apart in game. You can change - @SuppressWarnings("unchecked") - // texture based on nbt data, but I won't be covering that. + // This method allows us to have different language translation keys for + // each item we add. @Override - @SideOnly(Side.CLIENT) - public void addInformation(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")); + public String getUnlocalizedName(final ItemStack stack) { + // This makes sure that the stack has a tag compound. This is how data + // is stored on items. + if (stack.hasTagCompound()) { + // This is the object holding all of the item data. + final NBTTagCompound itemData = stack.getTagCompound(); + // This checks to see if the item has data stored under the + // brainType key. + if (itemData.hasKey("brainType")) { + // This retrieves data from the brainType key and uses it in + // the return value + return "item." + itemData.getString("brainType"); + } } + // This will be used if the item is obtained without nbt data on it. + return "item.nullBrain"; } } - diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java index d4be10d392..f03b5ac83f 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemComponent.java @@ -16,80 +16,106 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -public class BaseItemComponent extends Item{ +public class BaseItemComponent extends Item { - public final Material componentMaterial; - public final String materialName; - public final String unlocalName; - public final ComponentTypes componentType; + public static enum ComponentTypes { + DUST("Dust", " Dust", "dust"), INGOT("Ingot", " Ingot", "ingot"), PLATE("Plate", " Plate", + "plate"), PLATEDOUBLE("PlateDouble", " Double Plate", "plateDouble"), ROD("Rod", " Rod", + "stick"), RODLONG("RodLong", " Long Rod", "stickLong"), GEAR("Gear", " Gear", "gear"), SCREW( + "Screw", " Screw", "screw"), BOLT("Bolt", " Bolt", "bolt"), ROTOR("Rotor", " Rotor", + "rotor"), RING("Ring", " Ring", "ring"), CELL("Cell", " Cell", + "cell"), NUGGET("Nugget", " Nugget", "nugget"); + + private String COMPONENT_NAME; + private String DISPLAY_NAME; + private String OREDICT_NAME; + + private ComponentTypes(final String LocalName, final String DisplayName, final String OreDictName) { + this.COMPONENT_NAME = LocalName; + this.DISPLAY_NAME = DisplayName; + this.OREDICT_NAME = OreDictName; + } + + public String getComponent() { + return this.COMPONENT_NAME; + } + + public String getName() { + return this.DISPLAY_NAME; + } + + public String getOreDictName() { + return this.OREDICT_NAME; + } - public BaseItemComponent(Material material, ComponentTypes componentType) { + } + public final Material componentMaterial; + public final String materialName; + public final String unlocalName; + + public final ComponentTypes componentType; + + public BaseItemComponent(final Material material, final ComponentTypes componentType) { this.componentMaterial = material; - this.unlocalName = "item"+componentType.COMPONENT_NAME+material.getUnlocalizedName(); + this.unlocalName = "item" + componentType.COMPONENT_NAME + material.getUnlocalizedName(); this.materialName = material.getLocalizedName(); this.componentType = componentType; this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); + this.setUnlocalizedName(this.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)); + this.setTextureName(CORE.MODID + ":" + "item" + componentType.COMPONENT_NAME); + GameRegistry.registerItem(this, this.unlocalName); + GT_OreDictUnificator.registerOre(componentType.getOreDictName() + material.getUnlocalizedName(), + ItemUtils.getSimpleStack(this)); } + @SuppressWarnings({ + "unchecked", "rawtypes" + }) @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("")){ + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")) { - if (componentType == ComponentTypes.DUST){ - list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust."); + if (this.componentType == ComponentTypes.DUST) { + list.add(EnumChatFormatting.GRAY + "A pile of " + this.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 (this.componentType == ComponentTypes.INGOT) { + list.add(EnumChatFormatting.GRAY + "A solid ingot of " + this.materialName + "."); + if (this.materialName != null && this.materialName != "" && !this.materialName.equals("") + && this.unlocalName.toLowerCase().contains("ingothot")) { + list.add(EnumChatFormatting.GRAY + "Warning: " + EnumChatFormatting.RED + "Very hot! " + + EnumChatFormatting.GRAY + " Avoid direct handling.."); } } - if (componentType == ComponentTypes.PLATE){ - list.add(EnumChatFormatting.GRAY+"A flat plate of " + materialName + "."); + if (this.componentType == ComponentTypes.PLATE) { + list.add(EnumChatFormatting.GRAY + "A flat plate of " + this.materialName + "."); } - if (componentType == ComponentTypes.PLATEDOUBLE){ - list.add(EnumChatFormatting.GRAY+"A double plate of " + materialName + "."); + if (this.componentType == ComponentTypes.PLATEDOUBLE) { + list.add(EnumChatFormatting.GRAY + "A double plate of " + this.materialName + "."); } - if (componentType == ComponentTypes.ROD){ - list.add(EnumChatFormatting.GRAY+"A 40cm Rod of " + materialName + "."); + if (this.componentType == ComponentTypes.ROD) { + list.add(EnumChatFormatting.GRAY + "A 40cm Rod of " + this.materialName + "."); } - if (componentType == ComponentTypes.RODLONG){ - list.add(EnumChatFormatting.GRAY+"A 80cm Rod of " + materialName + "."); + if (this.componentType == ComponentTypes.RODLONG) { + list.add(EnumChatFormatting.GRAY + "A 80cm Rod of " + this.materialName + "."); } - if (componentType == ComponentTypes.ROTOR){ - list.add(EnumChatFormatting.GRAY+"A Rotor made out of " + materialName + ". "); + if (this.componentType == ComponentTypes.ROTOR) { + list.add(EnumChatFormatting.GRAY + "A Rotor made out of " + this.materialName + ". "); } - if (componentType == ComponentTypes.BOLT){ - list.add(EnumChatFormatting.GRAY+"A small Bolt, constructed from " + materialName + "."); + if (this.componentType == ComponentTypes.BOLT) { + list.add(EnumChatFormatting.GRAY + "A small Bolt, constructed from " + this.materialName + "."); } - if (componentType == ComponentTypes.SCREW){ - list.add(EnumChatFormatting.GRAY+"A 8mm Screw, fabricated out of some " + materialName + "."); + if (this.componentType == ComponentTypes.SCREW) { + list.add(EnumChatFormatting.GRAY + "A 8mm Screw, fabricated out of some " + this.materialName + "."); } - if (componentType == ComponentTypes.GEAR){ - list.add(EnumChatFormatting.GRAY+"A large Gear, constructed from " + materialName + "."); + if (this.componentType == ComponentTypes.GEAR) { + list.add(EnumChatFormatting.GRAY + "A large Gear, constructed from " + this.materialName + "."); } - if (componentType == ComponentTypes.RING){ - list.add(EnumChatFormatting.GRAY+"A " + materialName + " Ring."); + if (this.componentType == ComponentTypes.RING) { + list.add(EnumChatFormatting.GRAY + "A " + this.materialName + " Ring."); } - if (componentMaterial.isRadioactive){ + if (this.componentMaterial.isRadioactive) { list.add(CORE.GT_Tooltip_Radioactive); } @@ -98,62 +124,25 @@ public class BaseItemComponent extends Item{ super.addInformation(stack, aPlayer, list, bool); } - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - return componentMaterial.getRgbAsHex(); + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return this.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 String getItemStackDisplayName(final ItemStack p_77653_1_) { + return this.componentMaterial.getLocalizedName() + this.componentType.DISPLAY_NAME; + } + public final String getMaterialName() { + return this.materialName; + } - - 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; - } - + @Override + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, + final boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(this.componentMaterial.vRadioationLevel, world, entityHolding); } } - - diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java b/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java index cc277dfc45..769baa6d3c 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemGeneric.java @@ -8,20 +8,20 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public class BaseItemGeneric extends Item -{ - public BaseItemGeneric(String unlocalizedName, CreativeTabs c, int stackSize, int maxDmg) - { - setUnlocalizedName(CORE.MODID + "_" + unlocalizedName); - setTextureName(CORE.MODID + ":" + unlocalizedName); - setCreativeTab(c); - setMaxStackSize(stackSize); - setMaxDamage(maxDmg); +public class BaseItemGeneric extends Item { + public BaseItemGeneric(final String unlocalizedName, final CreativeTabs c, final int stackSize, final int maxDmg) { + this.setUnlocalizedName(CORE.MODID + "_" + unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(c); + this.setMaxStackSize(stackSize); + this.setMaxDamage(maxDmg); } - - @SuppressWarnings({ "unchecked", "rawtypes" }) + + @SuppressWarnings({ + "unchecked", "rawtypes" + }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { super.addInformation(stack, aPlayer, list, bool); - } + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java b/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java index 8ec7d1a259..b8d89e461b 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemLoot.java @@ -13,95 +13,91 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class BaseItemLoot extends Item{ +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 static enum LootTypes { + Sword("Sword", " Longsword", "sword"), Shortsword("Sword", " Short Blade", "blade"), Helmet("Helmet", + " Medium Helm", "helmet"), Chestplate("Platebody", " Chestplate", "platebody"), Leggings("Platelegs", + " Platelegs", "platelegs"), Boots("Boots", " Boots", "boots"); + private String LOOT_TYPE; + private String DISPLAY_SUFFIX; + private String OREDICT_NAME; + + private LootTypes(final String LocalName, final String DisplayName, final String OreDictName) { + this.LOOT_TYPE = LocalName; + this.DISPLAY_SUFFIX = DisplayName; + this.OREDICT_NAME = OreDictName; + } + + public String getLootType() { + return this.LOOT_TYPE; + } + + public String getName() { + return this.DISPLAY_SUFFIX; + } + + public String getOreDictName() { + return this.OREDICT_NAME; + } + } + 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) { + public BaseItemLoot(final LootTypes lootType, final Materials material) { this.lootTypes = lootType; this.lootMaterial = material; - this.materialName = material.mDefaultLocalName; - this.unlocalName = "item"+lootType.LOOT_TYPE+this.materialName; - this.setUnlocalizedName(unlocalName); + this.materialName = material.mDefaultLocalName; + this.unlocalName = "item" + lootType.LOOT_TYPE + this.materialName; + this.setUnlocalizedName(this.unlocalName); this.setMaxStackSize(1); - this.setTextureName(CORE.MODID + ":" + "item"+lootType.LOOT_TYPE); - } - - public ItemStack generateLootStack(){ - lootQuality = Quality.getRandomQuality(); - return ItemUtils.getSimpleStack(this, 1); + this.setTextureName(CORE.MODID + ":" + "item" + lootType.LOOT_TYPE); } + @SuppressWarnings({ + "unchecked", "rawtypes" + }) @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - return (materialName+lootTypes.DISPLAY_SUFFIX); - } + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(this.lootQuality.getQuality()); - 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); - }*/ + /* + * if (componentMaterial.isRadioactive){ + * list.add(CORE.GT_Tooltip_Radioactive); } + */ super.addInformation(stack, aPlayer, list, bool); } + public ItemStack generateLootStack() { + this.lootQuality = Quality.getRandomQuality(); + return ItemUtils.getSimpleStack(this, 1); + } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - short[] temp = lootMaterial.mRGBa; + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + final short[] temp = this.lootMaterial.mRGBa; return Utils.rgbtoHexValue(temp[0], temp[1], temp[2]); } @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - //EntityUtils.applyRadiationDamageToEntity(lootQuality.vRadioationLevel, world, entityHolding); + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return this.materialName + this.lootTypes.DISPLAY_SUFFIX; } + public final String getMaterialName() { + return this.materialName; + } - - - - - - - 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; - } + @Override + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, + final boolean p_77663_5_) { + // EntityUtils.applyRadiationDamageToEntity(lootQuality.vRadioationLevel, + // world, entityHolding); } } - - diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java b/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java index cb95b92b12..cd0053cb2f 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemWithCharge.java @@ -12,63 +12,61 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -public class BaseItemWithCharge extends Item{ +public class BaseItemWithCharge extends Item { - public int int_Charge = 0; - public int int_Max_Charge = 0; - - public BaseItemWithCharge(String unlocalizedName, int constructor_Charge, int constructor_Max_Charge) { + public int int_Charge = 0; + public int int_Max_Charge = 0; + + public BaseItemWithCharge(final String unlocalizedName, final int constructor_Charge, + final int constructor_Max_Charge) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); - this.setMaxStackSize(1); + this.setMaxStackSize(1); this.setCreativeTab(AddToCreativeTab.tabMachines); this.int_Charge = constructor_Charge; this.int_Max_Charge = constructor_Max_Charge; } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - int NBT_Charge = int_Charge; - int NBT_Max_Charge = int_Max_Charge; + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + int NBT_Charge = this.int_Charge; + int NBT_Max_Charge = this.int_Max_Charge; if (stack.stackTagCompound != null) { NBT_Charge = stack.stackTagCompound.getInteger("charge_Current"); NBT_Max_Charge = stack.stackTagCompound.getInteger("charge_Max"); - String tempX = String.valueOf(NBT_Charge); - String tempY = String.valueOf(NBT_Max_Charge); - String formattedX = EnumChatFormatting.RED+tempX+EnumChatFormatting.GRAY; - String formattedY = EnumChatFormatting.DARK_RED+tempY+EnumChatFormatting.GRAY; - list.add(EnumChatFormatting.GRAY+"Charge:"+formattedX+"/"+formattedY+"."); - super.addInformation(stack, aPlayer, list, bool); - } + final String tempX = String.valueOf(NBT_Charge); + final String tempY = String.valueOf(NBT_Max_Charge); + final String formattedX = EnumChatFormatting.RED + tempX + EnumChatFormatting.GRAY; + final String formattedY = EnumChatFormatting.DARK_RED + tempY + EnumChatFormatting.GRAY; + list.add(EnumChatFormatting.GRAY + "Charge:" + formattedX + "/" + formattedY + "."); + super.addInformation(stack, aPlayer, list, bool); + } } - //Ticking and NBT Handling - /* Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and - * update it's contents. + // Ticking and NBT Handling + /* + * Called each tick as long the item is on a player inventory. Uses by maps + * to check if is on a player hand and update it's contents. + * + * public int fuelRemaining = 0; public int maximumFuel = 0; public String + * fuelType = ""; public float heat = 0; public float maxHeat = 5000; * - * public int fuelRemaining = 0; - public int maximumFuel = 0; - public String fuelType = ""; - public float heat = 0; - public float maxHeat = 5000; - * */ @Override - public void onCreated(ItemStack itemStack, World world, EntityPlayer player) { + public void onCreated(final ItemStack itemStack, final World world, final EntityPlayer player) { } @Override - public void onUpdate(ItemStack itemStack, World par2World, Entity par3Entity, int par4, boolean par5) { - - } - - @Override - public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer par3Entity) { + public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer par3Entity) { itemStack.stackTagCompound = new NBTTagCompound(); return super.onItemRightClick(itemStack, world, par3Entity); } + @Override + public void onUpdate(final ItemStack itemStack, final World par2World, final Entity par3Entity, final int par4, + final boolean par5) { + } } diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java b/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java index 5419ad9077..8533ad20e9 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemWithDamageValue.java @@ -8,21 +8,25 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -public class BaseItemWithDamageValue extends Item{ - public BaseItemWithDamageValue(String unlocalizedName) { +public class BaseItemWithDamageValue extends Item { + public BaseItemWithDamageValue(final String unlocalizedName) { this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); this.setMaxStackSize(1); this.setMaxDamage(100); } + + @SuppressWarnings({ + "unchecked", "rawtypes" + }) @Override - public void setDamage(ItemStack stack, int damage) { - super.setDamage(stack, damage); - } - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(EnumChatFormatting.GOLD+""); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(EnumChatFormatting.GOLD + ""); super.addInformation(stack, aPlayer, list, bool); - } + } + + @Override + public void setDamage(final ItemStack stack, final int damage) { + super.setDamage(stack, damage); + } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java b/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java index 27db930623..cfa871fd2b 100644 --- a/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java +++ b/src/Java/gtPlusPlus/core/item/base/BasicSpawnEgg.java @@ -1,6 +1,5 @@ package gtPlusPlus.core.item.base; - import java.util.List; import cpw.mods.fml.relauncher.Side; @@ -17,233 +16,221 @@ import net.minecraft.item.*; import net.minecraft.util.*; import net.minecraft.world.World; +public class BasicSpawnEgg extends ItemMonsterPlacer { + @SideOnly(Side.CLIENT) + private IIcon theIcon; + protected int colorBase = 0x000000; + protected int colorSpots = 0xFFFFFF; + protected String entityMODID = ""; + protected String entityToSpawnName = ""; + protected String entityToSpawnNameFull = ""; + protected EntityLiving entityToSpawn = null; + + public BasicSpawnEgg() { + super(); + } + + public BasicSpawnEgg(final String MODID, final String parEntityToSpawnName, final int parPrimaryColor, + final int parSecondaryColor) { + this.setHasSubtypes(false); + this.maxStackSize = 64; + this.setCreativeTab(AddToCreativeTab.tabOther); + this.setEntityToSpawnName(parEntityToSpawnName); + this.colorBase = parPrimaryColor; + this.colorSpots = parSecondaryColor; + this.entityMODID = MODID; + + // DEBUG + Utils.LOG_WARNING("Spawn egg constructor for " + this.entityToSpawnName); + } + + public int getColorBase() { + return this.colorBase; + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(final ItemStack par1ItemStack, final int parColorType) { + return parColorType == 0 ? this.colorBase : this.colorSpots; + } + + public int getColorSpots() { + return this.colorSpots; + } + + /** + * Gets an icon index based on an item's damage value and the given render + * pass + */ + @Override + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamageForRenderPass(final int parDamageVal, final int parRenderPass) { + return parRenderPass > 0 ? this.theIcon : super.getIconFromDamageForRenderPass(parDamageVal, parRenderPass); + } + + @Override + // Doing this override means that there is no localization for language + // unless you specifically check for localization here and convert + public String getItemStackDisplayName(final ItemStack par1ItemStack) { + return "Spawn " + this.entityToSpawnName; + } + + /** + * returns a list of items with the same ID, but different meta (eg: dye + * returns 16 items) + */ + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(final Item parItem, final CreativeTabs parTab, final List parList) { + parList.add(new ItemStack(parItem, 1, 0)); + } + + /** + * Called whenever this item is equipped and the right mouse button is + * pressed. + * + * Args: itemStack, world, entityPlayer + */ + @Override + public ItemStack onItemRightClick(final ItemStack par1ItemStack, final World par2World, + final EntityPlayer par3EntityPlayer) { + if (par2World.isRemote) { + return par1ItemStack; + } + final MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(par2World, + par3EntityPlayer, true); + + if (movingobjectposition == null) { + return par1ItemStack; + } + if (movingobjectposition.typeOfHit == MovingObjectPosition + .MovingObjectType.BLOCK) -public class BasicSpawnEgg extends ItemMonsterPlacer -{ - @SideOnly(Side.CLIENT) - private IIcon theIcon; - protected int colorBase = 0x000000; - protected int colorSpots = 0xFFFFFF; - protected String entityMODID = ""; - protected String entityToSpawnName = ""; - protected String entityToSpawnNameFull = ""; - protected EntityLiving entityToSpawn = null; - - public BasicSpawnEgg(){ - super(); - } - - public BasicSpawnEgg(String MODID, String parEntityToSpawnName, int parPrimaryColor, int parSecondaryColor){ - setHasSubtypes(false); - maxStackSize = 64; - setCreativeTab(AddToCreativeTab.tabOther); - setEntityToSpawnName(parEntityToSpawnName); - colorBase = parPrimaryColor; - colorSpots = parSecondaryColor; - entityMODID = MODID; - - // DEBUG - Utils.LOG_WARNING("Spawn egg constructor for "+entityToSpawnName); - } - - /** - * Callback for item usage. If the item does something special on right clicking, - - * he will have one of those. Return - * True if something happen and false if it don't. This is for ITEMS, not BLOCKS - */ - @Override - public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10){ - if (par3World.isRemote) - { - return true; - } - Block block = par3World.getBlock(par4, par5, par6); + { + final int i = movingobjectposition.blockX; + final int j = movingobjectposition.blockY; + final int k = movingobjectposition.blockZ; + + if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) { + return par1ItemStack; + } + + if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) { + return par1ItemStack; + } + + if (par2World.getBlock(i, j, k) instanceof BlockLiquid) { + final Entity entity = this.spawnEntity(par2World, i, j, k); + + if (entity != null) { + if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) { + ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName()); + } + + if (!par3EntityPlayer.capabilities.isCreativeMode) { + --par1ItemStack.stackSize; + } + } + } + } + + return par1ItemStack; + } + + /** + * Callback for item usage. If the item does something special on right + * clicking, + * + * he will have one of those. Return True if something happen and false if + * it don't. This is for ITEMS, not BLOCKS + */ + @Override + public boolean onItemUse(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final World par3World, + int par4, int par5, int par6, final int par7, final float par8, final float par9, final float par10) { + if (par3World.isRemote) { + return true; + } + final Block block = par3World.getBlock(par4, par5, par6); par4 += Facing.offsetsXForSide[par7]; par5 += Facing.offsetsYForSide[par7]; par6 += Facing.offsetsZForSide[par7]; double d0 = 0.0D; - if (par7 == 1 && block.getRenderType() == 11) - { - d0 = 0.5D; + if (par7 == 1 && block.getRenderType() == 11) { + d0 = 0.5D; } - Entity entity = spawnEntity(par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D); + final Entity entity = this.spawnEntity(par3World, par4 + 0.5D, par5 + d0, par6 + 0.5D); - if (entity != null) - { - if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) - { - ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); - } - - if (!par2EntityPlayer.capabilities.isCreativeMode) - { - --par1ItemStack.stackSize; - } - } + if (entity != null) { + if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) { + ((EntityLiving) entity).setCustomNameTag(par1ItemStack.getDisplayName()); + } - return true; - } - - /** - * Called whenever this item is equipped and the right mouse button is pressed. - - *Args: itemStack, world, entityPlayer - */ - @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){ - if (par2World.isRemote) - { - return par1ItemStack; - } - MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, true); - - if (movingobjectposition == null) - { - return par1ItemStack; + if (!par2EntityPlayer.capabilities.isCreativeMode) { + --par1ItemStack.stackSize; + } } - if (movingobjectposition.typeOfHit == MovingObjectPosition - - .MovingObjectType.BLOCK) + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister par1IconRegister) { + super.registerIcons(par1IconRegister); + this.theIcon = par1IconRegister.registerIcon(this.getIconString() + "_overlay"); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } + + public void setColors(final int parColorBase, final int parColorSpots) { + this.colorBase = parColorBase; + this.colorSpots = parColorSpots; + } + + public void setEntityToSpawnName(final String parEntityToSpawnName) { + this.entityToSpawnName = parEntityToSpawnName; + this.entityToSpawnNameFull = this.entityMODID + "." + this.entityToSpawnName; + } + + /** + * Spawns the creature specified by the egg's type in the location specified + * by + * + * the last three parameters. Parameters: world, entityID, x, y, z. + */ + public Entity spawnEntity(final World parWorld, final double parX, final double parY, final double parZ) { + + if (!parWorld.isRemote) // never spawn entity on client side { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!par2World.canMineBlock(par3EntityPlayer, i, j, k)) - { - return par1ItemStack; - } - - if (!par3EntityPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, par1ItemStack)) - { - return par1ItemStack; - } - - if (par2World.getBlock(i, j, k) instanceof BlockLiquid) - { - Entity entity = spawnEntity(par2World, i, j, k); - - if (entity != null) - { - if (entity instanceof EntityLivingBase && par1ItemStack.hasDisplayName()) - { - ((EntityLiving)entity).setCustomNameTag(par1ItemStack.getDisplayName()); - } - - if (!par3EntityPlayer.capabilities.isCreativeMode) - { - --par1ItemStack.stackSize; - } - } - } + this.entityToSpawnNameFull = this.entityMODID + "." + this.entityToSpawnName; + if (EntityList.stringToClassMapping.containsKey(this.entityToSpawnNameFull)) { + this.entityToSpawn = (EntityLiving) EntityList + + .createEntityByName(this.entityToSpawnNameFull, parWorld); + this.entityToSpawn.setLocationAndAngles(parX, parY, parZ, + + MathHelper.wrapAngleTo180_float(parWorld.rand.nextFloat() + + * 360.0F), + 0.0F); + parWorld.spawnEntityInWorld(this.entityToSpawn); + this.entityToSpawn.onSpawnWithEgg((IEntityLivingData) null); + this.entityToSpawn.playLivingSound(); + } + else { + // DEBUG + Utils.LOG_WARNING("Entity not found " + this.entityToSpawnName); + } } - return par1ItemStack; - } - - /** - * Spawns the creature specified by the egg's type in the location specified by - - * the last three parameters. - * Parameters: world, entityID, x, y, z. - */ - public Entity spawnEntity(World parWorld, double parX, double parY, double parZ){ - - if (!parWorld.isRemote) // never spawn entity on client side - { - entityToSpawnNameFull = entityMODID+"."+entityToSpawnName; - if (EntityList.stringToClassMapping.containsKey(entityToSpawnNameFull)) - { - entityToSpawn = (EntityLiving) EntityList - - .createEntityByName(entityToSpawnNameFull, parWorld); - entityToSpawn.setLocationAndAngles(parX, parY, parZ, - - MathHelper.wrapAngleTo180_float(parWorld.rand.nextFloat() - - * 360.0F), 0.0F); - parWorld.spawnEntityInWorld(entityToSpawn); - entityToSpawn.onSpawnWithEgg((IEntityLivingData)null); - entityToSpawn.playLivingSound(); - } - else - { - //DEBUG - Utils.LOG_WARNING("Entity not found "+entityToSpawnName); - } - } - - return entityToSpawn; - } - - - /** - * returns a list of items with the same ID, but different meta (eg: dye returns 16 items) - */ - @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item parItem, CreativeTabs parTab, List parList){ - parList.add(new ItemStack(parItem, 1, 0)); - } - - @Override - @SideOnly(Side.CLIENT) - public int getColorFromItemStack(ItemStack par1ItemStack, int parColorType){ - return (parColorType == 0) ? colorBase : colorSpots; - } - - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses(){ - return true; - } - - @Override - // Doing this override means that there is no localization for language - // unless you specifically check for localization here and convert - public String getItemStackDisplayName(ItemStack par1ItemStack){ - return "Spawn "+entityToSpawnName; - } - - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister){ - super.registerIcons(par1IconRegister); - theIcon = par1IconRegister.registerIcon(getIconString() + "_overlay"); - } - - /** - * Gets an icon index based on an item's damage value and the given render pass - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamageForRenderPass(int parDamageVal, int parRenderPass){ - return parRenderPass > 0 ? theIcon : super.getIconFromDamageForRenderPass(parDamageVal, parRenderPass); - } - - public void setColors(int parColorBase, int parColorSpots){ - colorBase = parColorBase; - colorSpots = parColorSpots; - } - - public int getColorBase(){ - return colorBase; - } - - public int getColorSpots(){ - return colorSpots; - } - - public void setEntityToSpawnName(String parEntityToSpawnName){ - entityToSpawnName = parEntityToSpawnName; - entityToSpawnNameFull = entityMODID+"."+entityToSpawnName; - } + return this.entityToSpawn; + } } - diff --git a/src/Java/gtPlusPlus/core/item/base/CoreItem.java b/src/Java/gtPlusPlus/core/item/base/CoreItem.java index 1e282f43b6..aa83b6857d 100644 --- a/src/Java/gtPlusPlus/core/item/base/CoreItem.java +++ b/src/Java/gtPlusPlus/core/item/base/CoreItem.java @@ -11,83 +11,80 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; import net.minecraft.util.EnumChatFormatting; -public class CoreItem extends Item -{ +public class CoreItem extends Item { - private final EnumRarity rarity; - private final EnumChatFormatting descColour; - private final String itemDescription; - private final boolean hasEffect; + private final EnumRarity rarity; + private final EnumChatFormatting descColour; + private final String itemDescription; + private final boolean hasEffect; - //0 + // 0 /* * Name, Tab - 64 Stack, 0 Dmg */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab) - { - this(unlocalizedName, creativeTab, 64, 0); //Calls 3 + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab) { + this(unlocalizedName, creativeTab, 64, 0); // Calls 3 } - //1 + + // 1 /* * Name, Tab, Stack - 0 Dmg */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize) - { - this(unlocalizedName, creativeTab, stackSize, 0); //Calls 3 + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize) { + this(unlocalizedName, creativeTab, stackSize, 0); // Calls 3 } - //2 - /* - * Name, Tab, Stack, Description - 0 Dmg - */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, String description) - { - this(unlocalizedName, creativeTab, stackSize, 0, description); //Calls 4 - } - //3 + + // 3 /* * Name, Tab, Stack, Dmg - Description */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg) - { - this(unlocalizedName, creativeTab, stackSize, maxDmg, ""); //Calls 4 + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, + final int maxDmg) { + this(unlocalizedName, creativeTab, stackSize, maxDmg, ""); // Calls 4 } - //4 //Not Rare + basic tooltip + + // 4 //Not Rare + basic tooltip /* * Name, Tab, Stack, Dmg, Description */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description) - { - this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, EnumChatFormatting.GRAY, false); //Calls 4.5 + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, + final String description) { + this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, EnumChatFormatting.GRAY, + false); // Calls 4.5 } - //4.5 + + // 4.5 /* * Name, Tab, Stack, Dmg, Description, Text Colour - Common */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumChatFormatting colour) - { - this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, colour, false); //Calls 5 + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, + final String description, final EnumChatFormatting colour) { + this(unlocalizedName, creativeTab, stackSize, maxDmg, description, EnumRarity.common, colour, false); // Calls + // 5 } - //4.75 + // 4.75 /* * Name, Tab, Stack, Dmg, Description, Rarity - Gray text */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumRarity rarity) - { - this(unlocalizedName, creativeTab, stackSize, maxDmg, description, rarity, EnumChatFormatting.GRAY, false); //Calls 5 + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, + final String description, final EnumRarity rarity) { + this(unlocalizedName, creativeTab, stackSize, maxDmg, description, rarity, EnumChatFormatting.GRAY, false); // Calls + // 5 } - //5 + // 5 /* * Name, Tab, Stack, Dmg, Description, Rarity, Text Colour, Effect */ - public CoreItem(String unlocalizedName, CreativeTabs creativeTab, int stackSize, int maxDmg, String description, EnumRarity regRarity, EnumChatFormatting colour, boolean Effect) - { - setUnlocalizedName(unlocalizedName); - setTextureName(CORE.MODID + ":" + unlocalizedName); - setCreativeTab(creativeTab); - setMaxStackSize(stackSize); - setMaxDamage(maxDmg); + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, final int maxDmg, + final String description, final EnumRarity regRarity, final EnumChatFormatting colour, + final boolean Effect) { + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.setCreativeTab(creativeTab); + this.setMaxStackSize(stackSize); + this.setMaxDamage(maxDmg); this.rarity = regRarity; this.itemDescription = description; this.descColour = colour; @@ -95,21 +92,33 @@ public class CoreItem extends Item GameRegistry.registerItem(this, unlocalizedName); } - @SuppressWarnings({ "unchecked", "rawtypes" }) + // 2 + /* + * Name, Tab, Stack, Description - 0 Dmg + */ + public CoreItem(final String unlocalizedName, final CreativeTabs creativeTab, final int stackSize, + final String description) { + this(unlocalizedName, creativeTab, stackSize, 0, description); // Calls + // 4 + } + + @SuppressWarnings({ + "unchecked", "rawtypes" + }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add(descColour+itemDescription); - //super.addInformation(stack, aPlayer, list, bool); - } + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(this.descColour + this.itemDescription); + // super.addInformation(stack, aPlayer, list, bool); + } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ - return rarity; + public EnumRarity getRarity(final ItemStack par1ItemStack) { + return this.rarity; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ - return hasEffect; + public boolean hasEffect(final ItemStack par1ItemStack) { + return this.hasEffect; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java index 6292c5cde6..8d4d70ea9a 100644 --- a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java +++ b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java @@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.bolts; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -public class BaseItemBolt extends BaseItemComponent{ +public class BaseItemBolt extends BaseItemComponent { - public BaseItemBolt(Material material) { + public BaseItemBolt(final Material material) { super(material, BaseItemComponent.ComponentTypes.BOLT); } } diff --git a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java index 18a158af3e..9736d3281d 100644 --- a/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java +++ b/src/Java/gtPlusPlus/core/item/base/cell/BaseItemCell.java @@ -8,35 +8,34 @@ import gtPlusPlus.core.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; -public class BaseItemCell extends BaseItemComponent{ - - private IIcon base; - private IIcon overlay; - ComponentTypes Cell = ComponentTypes.CELL; - - public BaseItemCell(Material material) { - super(material, BaseItemComponent.ComponentTypes.CELL); - } +public class BaseItemCell extends BaseItemComponent { - @Override - @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses(){ - return true; - } + private IIcon base; + private IIcon overlay; + ComponentTypes Cell = ComponentTypes.CELL; - @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"); + public BaseItemCell(final Material material) { + super(material, BaseItemComponent.ComponentTypes.CELL); } - @Override - public IIcon getIconFromDamageForRenderPass(int damage, int pass) { - if(pass == 0) { + public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { + if (pass == 0) { return this.base; } return this.overlay; } + @Override + public void registerIcons(final IIconRegister i) { + this.base = i.registerIcon(CORE.MODID + ":" + "item" + this.Cell.getComponent()); + this.overlay = i.registerIcon(CORE.MODID + ":" + "item" + this.Cell.getComponent() + "_Overlay"); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } + } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java index 8f425e09d5..58f1076dbb 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java @@ -1,13 +1,12 @@ package gtPlusPlus.core.item.base.dusts; -import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; - import java.util.List; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; @@ -21,25 +20,30 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -public class BaseItemDust extends Item{ +public class BaseItemDust extends Item { + + protected int colour; + protected String materialName; + protected String pileType; + String name = ""; + private final int mTier; + private final Material dustInfo; + private String oredictName; - protected int colour; - protected String materialName; - protected String pileType; - String name = ""; - private int mTier; - private Material dustInfo; - private String oredictName; + protected final int sRadiation; - public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, int sRadioactivity) { - setUnlocalizedName(unlocalizedName); + public BaseItemDust(final String unlocalizedName, final String materialName, final Material matInfo, + final int colour, final String pileSize, final int tier, final int sRadioactivity) { this.setUnlocalizedName(unlocalizedName); - this.setMaxStackSize(64); - if (pileSize == "dust" || pileSize == "Dust"){ - this.setTextureName(CORE.MODID + ":" + "dust");} - else{ - this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);} - this.setCreativeTab(tabMisc); + this.setUnlocalizedName(unlocalizedName); + this.setMaxStackSize(64); + if (pileSize == "dust" || pileSize == "Dust") { + this.setTextureName(CORE.MODID + ":" + "dust"); + } + else { + this.setTextureName(CORE.MODID + ":" + "dust" + pileSize); + } + this.setCreativeTab(AddToCreativeTab.tabMisc); this.colour = colour; this.mTier = tier; this.materialName = materialName; @@ -48,215 +52,215 @@ public class BaseItemDust extends Item{ GameRegistry.registerItem(this, unlocalizedName); String temp = ""; - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: " + this.getUnlocalizedName()); + if (this.getUnlocalizedName().contains("item.")) { + temp = this.getUnlocalizedName().replace("item.", ""); + Utils.LOG_WARNING("Generating OreDict Name: " + temp); } else { - temp = getUnlocalizedName(); + temp = this.getUnlocalizedName(); } - if (temp.contains("DustTiny")){ + if (temp.contains("DustTiny")) { temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Utils.LOG_WARNING("Generating OreDict Name: " + temp); } - else if (temp.contains("DustSmall")){ + else if (temp.contains("DustSmall")) { temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Utils.LOG_WARNING("Generating OreDict Name: " + temp); } else { temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); - } - if (temp != null && temp != ""){ - oredictName = temp; + Utils.LOG_WARNING("Generating OreDict Name: " + temp); + } + if (temp != null && temp != "") { + this.oredictName = temp; GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); } - addFurnaceRecipe(); - addMacerationRecipe(); + this.addFurnaceRecipe(); + this.addMacerationRecipe(); } - @Override - public String getItemStackDisplayName(ItemStack iStack) { + private void addBlastFurnaceRecipe(final ItemStack input1, final ItemStack input2, final ItemStack output1, + final ItemStack output2, final int tempRequired) { + // Special Cases + /* + * if + * (input1.getUnlocalizedName().toLowerCase().contains("tantalloy61")){ + * Utils.LOG_INFO( + * "Adding Special handler for Staballoy-61 in the Blast Furnace"); + * input2 = + * UtilsItems.getItemStackOfAmountFromOreDict("dustTantalloy60", 2); if + * (input2 == null){ Utils.LOG_INFO("invalid itemstack."); } else { + * Utils.LOG_INFO("Found "+input2.getDisplayName()); } } + */ + GT_Values.RA.addBlastRecipe(input1, input2, GT_Values.NF, GT_Values.NF, output1, output2, 250 * this.mTier * 20, + this.mTier * 64, tempRequired); - if (getUnlocalizedName().contains("DustTiny")){ - name = "Tiny Pile of "+materialName + " Dust"; - } - else if (getUnlocalizedName().contains("DustSmall")){ - name = "Small Pile of "+materialName + " Dust"; + } + + private void addFurnaceRecipe() { + + String temp = ""; + if (this.getUnlocalizedName().contains("item.")) { + temp = this.getUnlocalizedName().replace("item.", ""); } else { - name = materialName + " Dust"; + temp = this.getUnlocalizedName(); } - return name; - } + if (temp.contains("DustTiny") || temp.contains("DustSmall")) { + return; + } + temp = temp.replace("itemDust", "ingot"); + if (temp != null && temp != "") { - protected final int sRadiation; - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + if (this.dustInfo.requiresBlastFurnace()) { + Utils.LOG_WARNING("Adding recipe for Hot " + this.materialName + " Ingots in a Blast furnace."); + final String tempIngot = temp.replace("ingot", "ingotHot"); + final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); + Utils.LOG_WARNING("This will produce " + tempOutputStack.getDisplayName() + " Debug: " + tempIngot); + if (null != tempOutputStack) { + this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, + 350 * this.mTier); + } + return; + } + Utils.LOG_WARNING("Adding recipe for " + this.materialName + " Ingots in a furnace."); + final ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); + Utils.LOG_WARNING("This will produce an ingot of " + tempOutputStack.getDisplayName() + " Debug: " + temp); + if (null != tempOutputStack) { + if (this.mTier < 5 || !this.dustInfo.requiresBlastFurnace()) { + if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(ItemUtils.getSimpleStack(this), + tempOutputStack)) { + Utils.LOG_WARNING("Successfully added a furnace recipe for " + this.materialName); + } + else { + Utils.LOG_WARNING("Failed to add a furnace recipe for " + this.materialName); + } + } + else if (this.mTier >= 5 || this.dustInfo.requiresBlastFurnace()) { + Utils.LOG_WARNING("Adding recipe for " + this.materialName + " Ingots in a Blast furnace."); + Utils.LOG_WARNING("This will produce " + tempOutputStack.getDisplayName()); + if (null != tempOutputStack) { + this.addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, + 350 * this.mTier); + } + return; + } + } + + } } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - //if (pileType != null && materialName != null && pileType != "" && materialName != "" && !pileType.equals("") && !materialName.equals("")){ - if (getUnlocalizedName().contains("DustTiny")){ - list.add(EnumChatFormatting.GRAY+"A tiny pile of " + materialName + " dust."); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + // if (pileType != null && materialName != null && pileType != "" && + // materialName != "" && !pileType.equals("") && + // !materialName.equals("")){ + if (this.getUnlocalizedName().contains("DustTiny")) { + list.add(EnumChatFormatting.GRAY + "A tiny pile of " + this.materialName + " dust."); } - else if (getUnlocalizedName().contains("DustSmall")){ - list.add(EnumChatFormatting.GRAY+"A small pile of " + materialName + " dust."); + else if (this.getUnlocalizedName().contains("DustSmall")) { + list.add(EnumChatFormatting.GRAY + "A small pile of " + this.materialName + " dust."); } else { - list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust."); + list.add(EnumChatFormatting.GRAY + "A pile of " + this.materialName + " dust."); } - if (sRadiation > 0){ + if (this.sRadiation > 0) { list.add(CORE.GT_Tooltip_Radioactive); } - if (dustInfo != null){ - list.add(dustInfo.vChemicalFormula); + if (this.dustInfo != null) { + list.add(this.dustInfo.vChemicalFormula); } - //} + // } super.addInformation(stack, aPlayer, list, bool); } - public final String getMaterialName() { - return materialName; - } + private void addMacerationRecipe() { + Utils.LOG_WARNING("Adding recipe for " + this.materialName + " Dusts"); - @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return colour; - - } - - private void addMacerationRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Dusts"); - - String tempIngot = getUnlocalizedName().replace("item.itemDust", "ingot"); - String tempDust = getUnlocalizedName().replace("item.itemDust", "dust"); + String tempIngot = this.getUnlocalizedName().replace("item.itemDust", "ingot"); + final String tempDust = this.getUnlocalizedName().replace("item.itemDust", "dust"); ItemStack tempInputStack; ItemStack tempOutputStack; - if (getUnlocalizedName().contains("DustSmall") || getUnlocalizedName().contains("DustTiny")){ + if (this.getUnlocalizedName().contains("DustSmall") || this.getUnlocalizedName().contains("DustTiny")) { return; } - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); - if (getUnlocalizedName().contains("item.")){ - tempIngot = getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot); + Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: " + this.getUnlocalizedName()); + if (this.getUnlocalizedName().contains("item.")) { + tempIngot = this.getUnlocalizedName().replace("item.", ""); + Utils.LOG_WARNING("Generating OreDict Name: " + tempIngot); } else { - tempIngot = getUnlocalizedName(); + tempIngot = this.getUnlocalizedName(); } tempIngot = tempIngot.replace("itemDust", "ingot"); - Utils.LOG_WARNING("Generating OreDict Name: "+tempIngot); - ItemStack[] outputStacks = {dustInfo.getDust(1)}; - if (tempIngot != null && tempIngot != ""){ + Utils.LOG_WARNING("Generating OreDict Name: " + tempIngot); + final ItemStack[] outputStacks = { + this.dustInfo.getDust(1) + }; + if (tempIngot != null && tempIngot != "") { 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){ - if (outputStacks.length == 1){ + final int chance = this.mTier * 10 / MathUtils.randInt(10, 20); + if (outputStacks.length != 0) { + if (outputStacks.length == 1) { tempStackOutput2 = null; } else { - if (!outputStacks[1].getUnlocalizedName().toLowerCase().contains("aaa_broken")){ + if (!outputStacks[1].getUnlocalizedName().toLowerCase().contains("aaa_broken")) { tempStackOutput2 = outputStacks[1]; tempOutputStack = outputStacks[0]; } else { tempStackOutput2 = null; } - } + } } else { tempStackOutput2 = null; } - if (null != tempOutputStack && null != tempInputStack){ - GT_ModHandler.addPulverisationRecipe(tempInputStack, tempOutputStack.splitStack(1), tempStackOutput2, chance); + if (null != tempOutputStack && null != tempInputStack) { + GT_ModHandler.addPulverisationRecipe(tempInputStack, tempOutputStack.splitStack(1), tempStackOutput2, + chance); } } } - private void addFurnaceRecipe(){ - - String temp = ""; - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); - } - else { - temp = getUnlocalizedName(); - } - if (temp.contains("DustTiny") || temp.contains("DustSmall")){ - return; + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0) { + return MathUtils.generateSingularRandomHexValue(); } - temp = temp.replace("itemDust", "ingot"); - if (temp != null && temp != ""){ - - if (dustInfo.requiresBlastFurnace()){ - Utils.LOG_WARNING("Adding recipe for Hot "+materialName+" Ingots in a Blast furnace."); - String tempIngot = temp.replace("ingot", "ingotHot"); - ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(tempIngot, 1); - Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName() + " Debug: "+tempIngot); - if (null != tempOutputStack){ - addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*mTier); - } - return; - } - Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a furnace."); - ItemStack tempOutputStack = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); - Utils.LOG_WARNING("This will produce an ingot of "+tempOutputStack.getDisplayName() + " Debug: "+temp); - if (null != tempOutputStack){ - if (mTier < 5 || !dustInfo.requiresBlastFurnace()){ - if (CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(ItemUtils.getSimpleStack(this), tempOutputStack)){ - Utils.LOG_WARNING("Successfully added a furnace recipe for "+materialName); - } - else { - Utils.LOG_WARNING("Failed to add a furnace recipe for "+materialName); - } - } - else if (mTier >= 5 || dustInfo.requiresBlastFurnace()){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a Blast furnace."); - Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName()); - if (null != tempOutputStack){ - addBlastFurnaceRecipe(ItemUtils.getSimpleStack(this), null, tempOutputStack, null, 350*mTier); - } - return; - } - } + return this.colour; - } } - private void addBlastFurnaceRecipe(ItemStack input1, ItemStack input2, ItemStack output1, ItemStack output2, int tempRequired){ - //Special Cases - /*if (input1.getUnlocalizedName().toLowerCase().contains("tantalloy61")){ - Utils.LOG_INFO("Adding Special handler for Staballoy-61 in the Blast Furnace"); - input2 = UtilsItems.getItemStackOfAmountFromOreDict("dustTantalloy60", 2); - if (input2 == null){ - Utils.LOG_INFO("invalid itemstack."); - } - else { - Utils.LOG_INFO("Found "+input2.getDisplayName()); - } - }*/ - GT_Values.RA.addBlastRecipe( - input1, - input2, - GT_Values.NF, GT_Values.NF, - output1, - output2, - 250*mTier*20, - mTier*64, - tempRequired); + @Override + public String getItemStackDisplayName(final ItemStack iStack) { + if (this.getUnlocalizedName().contains("DustTiny")) { + this.name = "Tiny Pile of " + this.materialName + " Dust"; + } + else if (this.getUnlocalizedName().contains("DustSmall")) { + this.name = "Small Pile of " + this.materialName + " Dust"; + } + else { + this.name = this.materialName + " Dust"; + } + return this.name; + } + public final String getMaterialName() { + return this.materialName; + } + @Override + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, + final boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding); } } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java index 54aa3e331f..7ab194ba49 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustAbstract.java @@ -8,34 +8,35 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -public abstract class BaseItemDustAbstract extends Item{ - - protected int colour = 0; - protected String materialName; - protected String pileType; - - public BaseItemDustAbstract(String unlocalizedName, String materialName, int colour, String pileSize) { +public abstract class BaseItemDustAbstract extends Item { + + protected int colour = 0; + protected String materialName; + protected String pileType; + + public BaseItemDustAbstract(final String unlocalizedName, final String materialName, final int colour, + final String pileSize) { this.setUnlocalizedName(unlocalizedName); - this.setMaxStackSize(64); - if (pileSize == "dust" || pileSize == "Dust"){ - this.setTextureName(CORE.MODID + ":" + "dust"); + this.setMaxStackSize(64); + if (pileSize == "dust" || pileSize == "Dust") { + this.setTextureName(CORE.MODID + ":" + "dust"); } - else{ - this.setTextureName(CORE.MODID + ":" + "dust"+pileSize); + else { + this.setTextureName(CORE.MODID + ":" + "dust" + pileSize); } this.setMaxStackSize(64); this.colour = colour; - this.materialName = materialName; - setUnlocalizedName(unlocalizedName); + this.materialName = materialName; + this.setUnlocalizedName(unlocalizedName); GameRegistry.registerItem(this, unlocalizedName); } @Override public abstract void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool); - public abstract String getMaterialName(); - @Override public abstract int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF); - + + public abstract String getMaterialName(); + } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java index e81e4b26b5..24b721ff0e 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDustUnique.java @@ -1,11 +1,10 @@ package gtPlusPlus.core.item.base.dusts; -import static gtPlusPlus.core.creative.AddToCreativeTab.tabMisc; - import java.util.List; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.entity.EntityUtils; @@ -18,104 +17,111 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -public class BaseItemDustUnique extends Item{ +public class BaseItemDustUnique extends Item { + + protected int colour; + protected String materialName; + protected String pileType; + String name = ""; - protected int colour; - protected String materialName; - protected String pileType; - String name = ""; + protected final int sRadiation; - public BaseItemDustUnique(String unlocalizedName, String materialName, int colour, String pileSize) { - setUnlocalizedName(unlocalizedName); + public BaseItemDustUnique(final String unlocalizedName, final String materialName, final int colour, + final String pileSize) { this.setUnlocalizedName(unlocalizedName); - this.setMaxStackSize(64); - if (pileSize == "dust" || pileSize == "Dust"){ - this.setTextureName(CORE.MODID + ":" + "dust");} - else{ - this.setTextureName(CORE.MODID + ":" + "dust"+pileSize);} - this.setCreativeTab(tabMisc); + this.setUnlocalizedName(unlocalizedName); + this.setMaxStackSize(64); + if (pileSize == "dust" || pileSize == "Dust") { + this.setTextureName(CORE.MODID + ":" + "dust"); + } + else { + this.setTextureName(CORE.MODID + ":" + "dust" + pileSize); + } + this.setCreativeTab(AddToCreativeTab.tabMisc); this.colour = colour; this.materialName = materialName; this.sRadiation = ItemUtils.getRadioactivityLevel(materialName); GameRegistry.registerItem(this, unlocalizedName); String temp = ""; - Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: "+getUnlocalizedName()); - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: " + this.getUnlocalizedName()); + if (this.getUnlocalizedName().contains("item.")) { + temp = this.getUnlocalizedName().replace("item.", ""); + Utils.LOG_WARNING("Generating OreDict Name: " + temp); } else { - temp = getUnlocalizedName(); + temp = this.getUnlocalizedName(); } - if (temp.contains("DustTiny")){ + if (temp.contains("DustTiny")) { temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Utils.LOG_WARNING("Generating OreDict Name: " + temp); } - else if (temp.contains("DustSmall")){ + else if (temp.contains("DustSmall")) { temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + Utils.LOG_WARNING("Generating OreDict Name: " + temp); } else { temp = temp.replace("itemD", "d"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); - } - if (temp != null && temp != ""){ + Utils.LOG_WARNING("Generating OreDict Name: " + temp); + } + if (temp != null && temp != "") { GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); } } @Override - public String getItemStackDisplayName(ItemStack iStack) { - - if (getUnlocalizedName().contains("DustTiny")){ - name = "Tiny Pile of "+materialName + " Dust"; + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + // if (pileType != null && materialName != null && pileType != "" && + // materialName != "" && !pileType.equals("") && + // !materialName.equals("")){ + if (this.getUnlocalizedName().contains("DustTiny")) { + list.add(EnumChatFormatting.GRAY + "A tiny pile of " + this.materialName + " dust."); } - else if (getUnlocalizedName().contains("DustSmall")){ - name = "Small Pile of "+materialName + " Dust"; + else if (this.getUnlocalizedName().contains("DustSmall")) { + list.add(EnumChatFormatting.GRAY + "A small pile of " + this.materialName + " dust."); } else { - name = materialName + " Dust"; + list.add(EnumChatFormatting.GRAY + "A pile of " + this.materialName + " dust."); } - return name; + if (this.sRadiation > 0) { + list.add(CORE.GT_Tooltip_Radioactive); + } + // } + super.addInformation(stack, aPlayer, list, bool); } - protected final int sRadiation; @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0) { + return MathUtils.generateSingularRandomHexValue(); + } + return this.colour; + } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - //if (pileType != null && materialName != null && pileType != "" && materialName != "" && !pileType.equals("") && !materialName.equals("")){ - if (getUnlocalizedName().contains("DustTiny")){ - list.add(EnumChatFormatting.GRAY+"A tiny pile of " + materialName + " dust."); + public String getItemStackDisplayName(final ItemStack iStack) { + + if (this.getUnlocalizedName().contains("DustTiny")) { + this.name = "Tiny Pile of " + this.materialName + " Dust"; } - else if (getUnlocalizedName().contains("DustSmall")){ - list.add(EnumChatFormatting.GRAY+"A small pile of " + materialName + " dust."); + else if (this.getUnlocalizedName().contains("DustSmall")) { + this.name = "Small Pile of " + this.materialName + " Dust"; } else { - list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust."); + this.name = this.materialName + " Dust"; } - if (sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } - //} - super.addInformation(stack, aPlayer, list, bool); + return this.name; } public final String getMaterialName() { - return materialName; + return this.materialName; } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return colour; - + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, + final boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding); } } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java index a32d990fa2..d60aff043f 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemCentidust.java @@ -11,45 +11,46 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -public class BaseItemCentidust extends Item{ +public class BaseItemCentidust extends Item { - final Material dustMaterial; - final String materialName; - final String unlocalName; + final Material dustMaterial; + final String materialName; + final String unlocalName; - public BaseItemCentidust(Material material) { + public BaseItemCentidust(final Material material) { this.dustMaterial = material; - this.unlocalName = "itemCentidust"+material.getUnlocalizedName(); + this.unlocalName = "itemCentidust" + material.getUnlocalizedName(); this.materialName = material.getLocalizedName(); this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); + this.setUnlocalizedName(this.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 + this.setTextureName(CORE.MODID + ":" + "itemCentidust"); // TODO + GameRegistry.registerItem(this, this.unlocalName); + // GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), + // UtilsItems.getSimpleStack(this)); //TODO } @Override - public String getItemStackDisplayName(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."); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")) { + list.add(EnumChatFormatting.GRAY + "1% of a " + this.materialName + " dust pile."); } super.addInformation(stack, aPlayer, list, bool); } - public final String getMaterialName() { - return materialName; + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return this.dustMaterial.getRgbAsHex(); } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - return dustMaterial.getRgbAsHex(); + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + + return this.materialName + " Centidust"; + } + + public final String getMaterialName() { + return this.materialName; } } diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java index 3371274f29..3b81d46de2 100644 --- a/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java +++ b/src/Java/gtPlusPlus/core/item/base/dusts/decimal/BaseItemDecidust.java @@ -11,45 +11,46 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -public class BaseItemDecidust extends Item{ +public class BaseItemDecidust extends Item { - final Material dustMaterial; - final String materialName; - final String unlocalName; + final Material dustMaterial; + final String materialName; + final String unlocalName; - public BaseItemDecidust(Material material) { + public BaseItemDecidust(final Material material) { this.dustMaterial = material; - this.unlocalName = "itemDecidust"+material.getUnlocalizedName(); + this.unlocalName = "itemDecidust" + material.getUnlocalizedName(); this.materialName = material.getLocalizedName(); this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName(unlocalName); + this.setUnlocalizedName(this.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 + this.setTextureName(CORE.MODID + ":" + "itemDecidust"); // TODO + GameRegistry.registerItem(this, this.unlocalName); + // GT_OreDictUnificator.registerOre(unlocalName.replace("itemR", "r"), + // UtilsItems.getSimpleStack(this)); //TODO } @Override - public String getItemStackDisplayName(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."); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")) { + list.add(EnumChatFormatting.GRAY + "10% of a " + this.materialName + " dust pile."); } super.addInformation(stack, aPlayer, list, bool); } - public final String getMaterialName() { - return materialName; + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return this.dustMaterial.getRgbAsHex(); } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - return dustMaterial.getRgbAsHex(); + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + + return this.materialName + " Decidust"; + } + + public final String getMaterialName() { + return this.materialName; } } diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java index c80fe33e23..ba97e34c08 100644 --- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java +++ b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemFood.java @@ -11,10 +11,11 @@ import net.minecraft.world.World; public class BaseItemFood extends ItemFood { - private PotionEffect[] effects; - protected String localName; + private final PotionEffect[] effects; + protected String localName; - public BaseItemFood(String unlocalizedName, String localizedName, int healAmount, float saturationModifier, boolean wolvesFavorite, PotionEffect... effects) { + public BaseItemFood(final String unlocalizedName, final String localizedName, final int healAmount, + final float saturationModifier, final boolean wolvesFavorite, final PotionEffect... effects) { super(healAmount, saturationModifier, wolvesFavorite); this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName.replace("Hot", "")); @@ -25,23 +26,21 @@ public class BaseItemFood extends ItemFood { } @Override - protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { - super.onFoodEaten(stack, world, player); + public String getItemStackDisplayName(final ItemStack p_77653_1_) { - for (int i = 0; i < effects.length; i ++) { - if (!world.isRemote && effects[i] != null && effects[i].getPotionID() > 0) - player.addPotionEffect(new PotionEffect(this.effects[i].getPotionID(), - this.effects[i].getDuration(), this.effects[i].getAmplifier(), - this.effects[i].getIsAmbient() - ) - ); - } + return "A Serving of " + this.localName; } - + @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { + protected void onFoodEaten(final ItemStack stack, final World world, final EntityPlayer player) { + super.onFoodEaten(stack, world, player); - return ("A Serving of "+localName); + for (int i = 0; i < this.effects.length; i++) { + if (!world.isRemote && this.effects[i] != null && this.effects[i].getPotionID() > 0) { + player.addPotionEffect(new PotionEffect(this.effects[i].getPotionID(), this.effects[i].getDuration(), + this.effects[i].getAmplifier(), this.effects[i].getIsAmbient())); + } + } } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java index af2bce9c95..d20cad018e 100644 --- a/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java +++ b/src/Java/gtPlusPlus/core/item/base/foods/BaseItemHotFood.java @@ -13,15 +13,16 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -public class BaseItemHotFood extends BaseItemFood{ +public class BaseItemHotFood extends BaseItemFood { - protected String materialName; - protected String unlocalName; - protected int cooldownTime; - protected Item output; + protected String materialName; + protected String unlocalName; + protected int cooldownTime; + protected Item output; - public BaseItemHotFood(String unlocalizedName, int healAmount, float healSaturation, String foodName, int timeToCoolInSeconds, Item cooledFood) { - super(unlocalizedName, "Hot "+foodName, healAmount, healSaturation, false); + public BaseItemHotFood(final String unlocalizedName, final int healAmount, final float healSaturation, + final String foodName, final int timeToCoolInSeconds, final Item cooledFood) { + super(unlocalizedName, "Hot " + foodName, healAmount, healSaturation, false); this.unlocalName = unlocalizedName; this.cooldownTime = timeToCoolInSeconds * 20; this.materialName = foodName; @@ -30,48 +31,53 @@ public class BaseItemHotFood extends BaseItemFood{ } @Override - public ItemStack onEaten(ItemStack iStack, World world, EntityPlayer player) { - return super.onEaten(iStack, world, player); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")) { + list.add(EnumChatFormatting.GRAY + "Warning: " + EnumChatFormatting.RED + "Very hot!" + + EnumChatFormatting.GRAY + " Avoid direct handling.."); + list.add(EnumChatFormatting.GRAY + "This food has " + (this.cooldownTime - stack.getItemDamage()) / 20 + + " seconds left, until it is cool."); + } + super.addInformation(stack, aPlayer, list, bool); } @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - //Utils.LOG_INFO("Item Damage: "+iStack.getItemDamage()+" Max Damage: "+iStack.getMaxDamage()); - if (!world.isRemote){ - if(iStack.getItemDamage() == cooldownTime) { - if (entityHolding instanceof EntityPlayer){ - Utils.LOG_INFO("Foods Done."); - ((EntityPlayer) entityHolding).inventory.addItemStackToInventory(ItemUtils.getSimpleStack(output)); - ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); - } - }else if(iStack.getItemDamage() < cooldownTime){ - iStack.setItemDamage(iStack.getItemDamage() + 1); - } - if(MathUtils.divideXintoY(iStack.getItemDamage(), 150)){ - entityHolding.attackEntityFrom(DamageSource.onFire, 1); - } + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return Utils.rgbtoHexValue(230, 96, 96); - - } - super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); } - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot!"+EnumChatFormatting.GRAY+" Avoid direct handling.."); - list.add(EnumChatFormatting.GRAY+"This food has "+((cooldownTime-(int) stack.getItemDamage())/20)+" seconds left, until it is cool."); - } - super.addInformation(stack, aPlayer, list, bool); + public final String getMaterialName() { + return this.materialName; } - public final String getMaterialName() { - return materialName; + @Override + public ItemStack onEaten(final ItemStack iStack, final World world, final EntityPlayer player) { + return super.onEaten(iStack, world, player); } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - return Utils.rgbtoHexValue(230, 96, 96); + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, + final boolean p_77663_5_) { + // Utils.LOG_INFO("Item Damage: "+iStack.getItemDamage()+" Max Damage: + // "+iStack.getMaxDamage()); + if (!world.isRemote) { + if (iStack.getItemDamage() == this.cooldownTime) { + if (entityHolding instanceof EntityPlayer) { + Utils.LOG_INFO("Foods Done."); + ((EntityPlayer) entityHolding).inventory + .addItemStackToInventory(ItemUtils.getSimpleStack(this.output)); + ((EntityPlayer) entityHolding).inventory.consumeInventoryItem(this); + } + } + else if (iStack.getItemDamage() < this.cooldownTime) { + iStack.setItemDamage(iStack.getItemDamage() + 1); + } + if (MathUtils.divideXintoY(iStack.getItemDamage(), 150)) { + entityHolding.attackEntityFrom(DamageSource.onFire, 1); + } + } + super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); } } diff --git a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java index 7c4fe89568..c74e90401f 100644 --- a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java +++ b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java @@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.gears; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -public class BaseItemGear extends BaseItemComponent{ +public class BaseItemGear extends BaseItemComponent { - public BaseItemGear(Material material) { - super(material, BaseItemComponent.ComponentTypes.GEAR); + public BaseItemGear(final Material material) { + super(material, BaseItemComponent.ComponentTypes.GEAR); } } diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java index cf63e4d708..a41fe9a0e9 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngot.java @@ -18,14 +18,17 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -public class BaseItemIngot extends Item{ +public class BaseItemIngot extends Item { - protected int colour; - protected String materialName; - protected String unlocalName; + protected int colour; + protected String materialName; + protected String unlocalName; - public BaseItemIngot(String unlocalizedName, String materialName, int colour, int sRadioactivity) { - setUnlocalizedName(unlocalizedName); + protected final int sRadiation; + + public BaseItemIngot(final String unlocalizedName, final String materialName, final int colour, + final int sRadioactivity) { + this.setUnlocalizedName(unlocalizedName); this.setCreativeTab(AddToCreativeTab.tabMisc); this.setUnlocalizedName(unlocalizedName); this.unlocalName = unlocalizedName; @@ -37,82 +40,83 @@ public class BaseItemIngot extends Item{ this.sRadiation = sRadioactivity; GameRegistry.registerItem(this, unlocalizedName); String temp = ""; - if (unlocalName.contains("itemIngot")){ - temp = unlocalName.replace("itemI", "i"); + if (this.unlocalName.contains("itemIngot")) { + temp = this.unlocalName.replace("itemI", "i"); } - else if (unlocalName.contains("itemHotIngot")){ - temp = unlocalName.replace("itemHotIngot", "ingotHot"); + else if (this.unlocalName.contains("itemHotIngot")) { + temp = this.unlocalName.replace("itemHotIngot", "ingotHot"); } - if (temp != null && temp != ""){ + if (temp != null && temp != "") { GT_OreDictUnificator.registerOre(temp, ItemUtils.getSimpleStack(this)); - } - generateCompressorRecipe(); - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - - return (materialName+ " Ingot"); + } + this.generateCompressorRecipe(); } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("") && !unlocalName.contains("HotIngot")){ - list.add(EnumChatFormatting.GRAY+"A solid ingot of " + materialName + "."); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.materialName != null && this.materialName != "" && !this.materialName.equals("") + && !this.unlocalName.contains("HotIngot")) { + list.add(EnumChatFormatting.GRAY + "A solid ingot of " + this.materialName + "."); } - else if (materialName != null && materialName != "" && !materialName.equals("") && unlocalName.toLowerCase().contains("ingothot")){ - list.add(EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.RED+"Very hot! "+EnumChatFormatting.GRAY+" Avoid direct handling.."); + else if (this.materialName != null && this.materialName != "" && !this.materialName.equals("") + && this.unlocalName.toLowerCase().contains("ingothot")) { + list.add(EnumChatFormatting.GRAY + "Warning: " + EnumChatFormatting.RED + "Very hot! " + + EnumChatFormatting.GRAY + " Avoid direct handling.."); } - if (sRadiation > 0){ + if (this.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; - + super.addInformation(stack, aPlayer, list, bool); } - private void generateCompressorRecipe(){ - if (unlocalName.contains("itemIngot")){ - ItemStack tempStack = ItemUtils.getSimpleStack(this, 9); + private void generateCompressorRecipe() { + if (this.unlocalName.contains("itemIngot")) { + final 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()); - if (getUnlocalizedName().contains("item.")){ - temp = getUnlocalizedName().replace("item.", ""); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); + String temp = this.getUnlocalizedName().replace("item.itemIngot", "block"); + Utils.LOG_WARNING("Unlocalized name for OreDict nameGen: " + this.getUnlocalizedName()); + if (this.getUnlocalizedName().contains("item.")) { + temp = this.getUnlocalizedName().replace("item.", ""); + Utils.LOG_WARNING("Generating OreDict Name: " + temp); } temp = temp.replace("itemIngot", "block"); - Utils.LOG_WARNING("Generating OreDict Name: "+temp); - if (temp != null && temp != ""){ + Utils.LOG_WARNING("Generating OreDict Name: " + temp); + if (temp != null && temp != "") { tempOutput = ItemUtils.getItemStackOfAmountFromOreDict(temp, 1); - if (tempOutput != null){ + if (tempOutput != null) { GT_ModHandler.addCompressionRecipe(tempStack, tempOutput); } - + } } - else if (unlocalName.contains("itemHotIngot")){ + else if (this.unlocalName.contains("itemHotIngot")) { return; } - } - - protected final int sRadiation; - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0) { + return MathUtils.generateSingularRandomHexValue(); } + return this.colour; + + } + + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + + return this.materialName + " Ingot"; + } + + public final String getMaterialName() { + return this.materialName; + } + + @Override + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, + final boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding); + } } diff --git a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java index c6dc0f942a..5f43c513af 100644 --- a/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java +++ b/src/Java/gtPlusPlus/core/item/base/ingots/BaseItemIngotHot.java @@ -13,60 +13,61 @@ import net.minecraft.util.DamageSource; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -public class BaseItemIngotHot extends BaseItemIngot{ +public class BaseItemIngotHot extends BaseItemIngot { - private ItemStack outputIngot; - private int tickCounter = 0; - private int tickCounterMax = 200; - private int mTier; + private final ItemStack outputIngot; + private int tickCounter = 0; + private final int tickCounterMax = 200; + private final int mTier; - public BaseItemIngotHot(String unlocalizedName, String materialName, ItemStack coldIngot, int tier) { + public BaseItemIngotHot(final String unlocalizedName, final String materialName, final ItemStack coldIngot, + final int tier) { super(unlocalizedName, materialName, Utils.rgbtoHexValue(225, 225, 225), 0); this.setTextureName(CORE.MODID + ":" + "itemIngotHot"); this.outputIngot = coldIngot; this.mTier = tier; - generateRecipe(); - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - - return ("Hot "+materialName+ " Ingot"); + this.generateRecipe(); } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (materialName != null && materialName != "" && !materialName.equals("")){ - list.add(EnumChatFormatting.GRAY+"A "+EnumChatFormatting.RED+"burning hot"+EnumChatFormatting.GRAY+" ingot of " + materialName + "."); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.materialName != null && this.materialName != "" && !this.materialName.equals("")) { + list.add(EnumChatFormatting.GRAY + "A " + EnumChatFormatting.RED + "burning hot" + EnumChatFormatting.GRAY + + " ingot of " + this.materialName + "."); } super.addInformation(stack, aPlayer, list, bool); } + private void generateRecipe() { + Utils.LOG_WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of " + this.materialName + "."); + GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), this.outputIngot.copy(), 60 * this.mTier); + + } + @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { return Utils.rgbtoHexValue(225, 225, 225); } - private void generateRecipe(){ - Utils.LOG_WARNING("Adding Vacuum Freezer recipe for a Hot Ingot of "+materialName+"."); - GT_Values.RA.addVacuumFreezerRecipe(ItemUtils.getSimpleStack(this), outputIngot.copy(), 60*mTier); + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { - - } + return "Hot " + this.materialName + " Ingot"; + } @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - if (!world.isRemote){ - if(tickCounter < tickCounterMax){ - tickCounter++; - } - else if(tickCounter == tickCounterMax){ + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, + final boolean p_77663_5_) { + if (!world.isRemote) { + if (this.tickCounter < this.tickCounterMax) { + this.tickCounter++; + } + else if (this.tickCounter == this.tickCounterMax) { entityHolding.attackEntityFrom(DamageSource.onFire, 1); - tickCounter = 0; + this.tickCounter = 0; } super.onUpdate(iStack, world, entityHolding, p_77663_4_, p_77663_5_); } } - } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java index 488f9a6f60..1ad2ab0f24 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBase.java @@ -7,16 +7,15 @@ import net.minecraft.item.ItemStack; public class ItemBlockBase extends ItemBlock { - public ItemBlockBase(Block block) { - super(block); - this.setCreativeTab(AddToCreativeTab.tabBlock); - } + public ItemBlockBase(final Block block) { + super(block); + this.setCreativeTab(AddToCreativeTab.tabBlock); + } + + @Override + public int getColorFromItemStack(final ItemStack p_82790_1_, final int p_82790_2_) { + + return super.getColorFromItemStack(p_82790_1_, p_82790_2_); + } - @Override - public int getColorFromItemStack(ItemStack p_82790_1_, int p_82790_2_) { - - return super.getColorFromItemStack(p_82790_1_, p_82790_2_); - } - - }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java index 9285d6a7e3..373305dc25 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockFluid.java @@ -12,66 +12,71 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -public class ItemBlockFluid extends ItemBlock{ +public class ItemBlockFluid extends ItemBlock { - protected final int blockColour; - protected final int sRadiation; - protected Material thisFluid; - final BlockFluidBase baseBlock; - String name; + protected final int blockColour; + protected final int sRadiation; + protected Material thisFluid; + final BlockFluidBase baseBlock; + String name; - public ItemBlockFluid(Block block) { + public ItemBlockFluid(final Block block) { super(block); this.baseBlock = (BlockFluidBase) block; - this.blockColour = baseBlock.getRenderColor(1); - this.thisFluid = baseBlock.getFluidMaterial(); - this.sRadiation=ItemUtils.getRadioactivityLevel(baseBlock.getUnlocalizedName()); - this.name = baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); - //GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), UtilsItems.getSimpleStack(this)); - } - - public final Material setFluidMaterial(Material M){ - return thisFluid=M; + this.blockColour = this.baseBlock.getRenderColor(1); + this.thisFluid = this.baseBlock.getFluidMaterial(); + this.sRadiation = ItemUtils.getRadioactivityLevel(this.baseBlock.getUnlocalizedName()); + this.name = this.baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "") + .replace("block", "").replace(".", ""); + // GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", + // "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", + // "").replace(" ", "").replace("FrameBox", ""), + // UtilsItems.getSimpleStack(this)); } - public int getRenderColor(int aMeta) { - return blockColour; - } - @Override - public String getItemStackDisplayName(ItemStack iStack) { - if (thisFluid != null){ - this.name = "Molten "+thisFluid.getLocalizedName(); - return name; + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add("Temperature: " + MathUtils.celsiusToKelvin(this.thisFluid.getMeltingPointC()) + "K"); + if (this.sRadiation > 0) { + list.add(CORE.GT_Tooltip_Radioactive); } - this.name = "Molten "+baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "").replace("name", "").replace("block", "").replace(".", ""); - return name; + super.addInformation(stack, aPlayer, list, bool); } - + @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (blockColour == 0){ + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.blockColour == 0) { return MathUtils.generateSingularRandomHexValue(); } - return blockColour; + return this.blockColour; } @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - list.add("Temperature: "+MathUtils.celsiusToKelvin(thisFluid.getMeltingPointC())+"K"); - if (sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); + public String getItemStackDisplayName(final ItemStack iStack) { + if (this.thisFluid != null) { + this.name = "Molten " + this.thisFluid.getLocalizedName(); + return this.name; } - super.addInformation(stack, aPlayer, list, bool); + this.name = "Molten " + this.baseBlock.getLocalizedName().replace("tile", "").replace("fluid", "") + .replace("name", "").replace("block", "").replace(".", ""); + return this.name; } public String GetProperName() { - String tempIngot; + String tempIngot; - tempIngot = "Molten "+baseBlock.getLocalizedName(); + tempIngot = "Molten " + this.baseBlock.getLocalizedName(); return tempIngot; } + public int getRenderColor(final int aMeta) { + return this.blockColour; + } + + public final Material setFluidMaterial(final Material M) { + return this.thisFluid = M; + } + } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java index 91ae97d4d3..2fe88ff3c2 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtBlock.java @@ -14,39 +14,45 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class ItemBlockGtBlock extends ItemBlock{ +public class ItemBlockGtBlock extends ItemBlock { - protected final int blockColour; - protected final int sRadiation; - - public ItemBlockGtBlock(Block block) { + protected final int blockColour; + protected final int sRadiation; + + public ItemBlockGtBlock(final Block block) { super(block); - BlockBaseModular baseBlock = (BlockBaseModular) block; + final BlockBaseModular baseBlock = (BlockBaseModular) block; this.blockColour = baseBlock.getRenderColor(0); - if (block.getLocalizedName().toLowerCase().contains("uranium") || block.getLocalizedName().toLowerCase().contains("plutonium") || block.getLocalizedName().toLowerCase().contains("thorium")){ - sRadiation = 2; + if (block.getLocalizedName().toLowerCase().contains("uranium") + || block.getLocalizedName().toLowerCase().contains("plutonium") + || block.getLocalizedName().toLowerCase().contains("thorium")) { + this.sRadiation = 2; } else { - sRadiation = 0; + this.sRadiation = 0; } - GT_OreDictUnificator.registerOre("block"+block.getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "").replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), ItemUtils.getSimpleStack(this)); + GT_OreDictUnificator.registerOre( + "block" + block.getUnlocalizedName().replace("tile.block", "").replace("tile.", "").replace("of", "") + .replace("Of", "").replace("Block", "").replace("-", "").replace("_", "").replace(" ", ""), + ItemUtils.getSimpleStack(this)); } - public int getRenderColor(int aMeta) { - return blockColour; - } - - @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (sRadiation > 0){ - list.add(CORE.GT_Tooltip_Radioactive); - } + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.sRadiation > 0) { + list.add(CORE.GT_Tooltip_Radioactive); + } super.addInformation(stack, aPlayer, list, bool); } - - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - EntityUtils.applyRadiationDamageToEntity(sRadiation, world, entityHolding); - } + + public int getRenderColor(final int aMeta) { + return this.blockColour; + } + + @Override + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, + final boolean p_77663_5_) { + EntityUtils.applyRadiationDamageToEntity(this.sRadiation, world, entityHolding); + } } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java index 9d442e3102..6151e4818d 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockGtFrameBox.java @@ -6,19 +6,22 @@ import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; -public class ItemBlockGtFrameBox extends ItemBlock{ +public class ItemBlockGtFrameBox extends ItemBlock { protected int blockColour; - - public ItemBlockGtFrameBox(Block block) { + + public ItemBlockGtFrameBox(final Block block) { super(block); - BlockBaseModular baseBlock = (BlockBaseModular) block; + final BlockBaseModular baseBlock = (BlockBaseModular) block; this.blockColour = baseBlock.getRenderColor(1); - GT_OreDictUnificator.registerOre("frameGt"+block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "").replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), ItemUtils.getSimpleStack(this)); + GT_OreDictUnificator.registerOre( + "frameGt" + block.getUnlocalizedName().replace("tile.", "").replace("tile.BlockGtFrame", "") + .replace("-", "").replace("_", "").replace(" ", "").replace("FrameBox", ""), + ItemUtils.getSimpleStack(this)); } - public int getRenderColor(int aMeta) { - return blockColour; - } + public int getRenderColor(final int aMeta) { + return this.blockColour; + } } diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java index 73fcbc2ab6..6436012e4d 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java @@ -9,35 +9,35 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class ItemBlockTileEntity extends ItemBlock{ +public class ItemBlockTileEntity extends ItemBlock { String[] description; - - public ItemBlockTileEntity(Block block) { + + public ItemBlockTileEntity(final 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]); - } - } - - + + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + for (int i = 0; i < this.description.length; i++) { + if (!this.description[i].equals("")) { + list.add(this.description[i]); + } + } + super.addInformation(stack, aPlayer, list, bool); } - - @Override - public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) { - + + @Override + public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, + final boolean p_77663_5_) { + + } + + public void setDecription(final String[] description) { + for (int i = 0; i < description.length; i++) { + this.description[i] = description[i]; } - - public void setDecription(String[] description){ - for (int i =0; i< description.length; i++){ - this.description[i] = description[i]; - } - } + } } diff --git a/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java b/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java index d4f7ac02a6..5e20f3c714 100644 --- a/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java +++ b/src/Java/gtPlusPlus/core/item/base/nugget/BaseItemNugget.java @@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.nugget; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -public class BaseItemNugget extends BaseItemComponent{ +public class BaseItemNugget extends BaseItemComponent { - public BaseItemNugget(Material material) { - super(material, BaseItemComponent.ComponentTypes.NUGGET); + public BaseItemNugget(final 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 3d1153eb6a..a2b4ce4d28 100644 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java +++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java @@ -4,16 +4,17 @@ import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.materials.MaterialUtils; -public class BaseItemPlate extends BaseItemComponent{ +public class BaseItemPlate extends BaseItemComponent { - public BaseItemPlate(Material material) { + public BaseItemPlate(final Material material) { super(material, BaseItemComponent.ComponentTypes.PLATE); } - - 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)); - } - + public BaseItemPlate(final String unlocalizedName, final String materialName, final short[] colour, final int tier, + final int sRadioactivity) { + this(MaterialUtils.generateQuickMaterial(materialName, new short[] { + colour[0], colour[1], colour[2], 0 + }, sRadioactivity)); + } } diff --git a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java index ce8bbe8191..41b067d3fd 100644 --- a/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java +++ b/src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java @@ -4,15 +4,15 @@ import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; import net.minecraft.item.ItemStack; -public class BaseItemPlateDouble extends BaseItemComponent{ +public class BaseItemPlateDouble extends BaseItemComponent { - public BaseItemPlateDouble(Material material) { - super(material, BaseItemComponent.ComponentTypes.PLATEDOUBLE); + public BaseItemPlateDouble(final Material material) { + super(material, BaseItemComponent.ComponentTypes.PLATEDOUBLE); this.setMaxStackSize(32); } @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - return ("Double "+materialName+ " Plate"); + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return "Double " + this.materialName + " Plate"; } } diff --git a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java index 6ad3509876..436b1809fc 100644 --- a/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java +++ b/src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java @@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.rings; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -public class BaseItemRing extends BaseItemComponent{ +public class BaseItemRing extends BaseItemComponent { - public BaseItemRing(Material material) { + public BaseItemRing(final Material material) { super(material, BaseItemComponent.ComponentTypes.RING); } } diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java index 2e4acd6ccb..b1eb28f4d5 100644 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java +++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java @@ -6,26 +6,21 @@ import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import net.minecraft.item.ItemStack; -public class BaseItemRod extends BaseItemComponent{ +public class BaseItemRod extends BaseItemComponent { - public BaseItemRod(Material material) { - super(material, BaseItemComponent.ComponentTypes.ROD); - addExtruderRecipe(); + public BaseItemRod(final Material material) { + super(material, BaseItemComponent.ComponentTypes.ROD); + this.addExtruderRecipe(); } + private void addExtruderRecipe() { + Utils.LOG_WARNING("Adding cutter recipe for " + this.materialName + " Rods"); - private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding cutter recipe for "+materialName+" Rods"); + final ItemStack stackStick = this.componentMaterial.getRod(1); + final ItemStack stackBolt = this.componentMaterial.getBolt(4); - ItemStack stackStick = componentMaterial.getRod(1); - ItemStack stackBolt = componentMaterial.getBolt(4); - - GT_Values.RA.addCutterRecipe( - stackStick, - stackBolt, - null, - (int) Math.max(componentMaterial.getMass() * 2L, 1L), - 4); + GT_Values.RA.addCutterRecipe(stackStick, stackBolt, null, + (int) Math.max(this.componentMaterial.getMass() * 2L, 1L), 4); } } diff --git a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java index 882dc8b2bf..df69bf5a8d 100644 --- a/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java +++ b/src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java @@ -7,41 +7,32 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; -public class BaseItemRodLong extends BaseItemComponent{ +public class BaseItemRodLong extends BaseItemComponent { - public BaseItemRodLong(Material material) { + public BaseItemRodLong(final Material material) { super(material, BaseItemComponent.ComponentTypes.RODLONG); - addExtruderRecipe(); - } - - @Override - public String getItemStackDisplayName(ItemStack p_77653_1_) { - return ("Long "+materialName+ " Rod"); + this.addExtruderRecipe(); } - private void addExtruderRecipe(){ - Utils.LOG_WARNING("Adding recipe for Long "+materialName+" Rods"); + private void addExtruderRecipe() { + Utils.LOG_WARNING("Adding recipe for Long " + this.materialName + " Rods"); - String tempStick = unlocalName.replace("itemRodLong", "stick"); - String tempStickLong = unlocalName.replace("itemRodLong", "stickLong"); - ItemStack stackStick = ItemUtils.getItemStackOfAmountFromOreDict(tempStick, 1); - ItemStack stackLong = ItemUtils.getItemStackOfAmountFromOreDict(tempStickLong, 1); + final String tempStick = this.unlocalName.replace("itemRodLong", "stick"); + final String tempStickLong = this.unlocalName.replace("itemRodLong", "stickLong"); + final ItemStack stackStick = ItemUtils.getItemStackOfAmountFromOreDict(tempStick, 1); + final ItemStack stackLong = ItemUtils.getItemStackOfAmountFromOreDict(tempStickLong, 1); - ItemStack temp = stackStick; + final ItemStack temp = stackStick; temp.stackSize = 2; - GT_Values.RA.addForgeHammerRecipe( - temp, - stackLong, - (int) Math.max(componentMaterial.getMass(), 1L), - 16); - - GT_Values.RA.addCutterRecipe( - stackLong, - temp, - null, - (int) Math.max(componentMaterial.getMass(), 1L), - 4); + GT_Values.RA.addForgeHammerRecipe(temp, stackLong, (int) Math.max(this.componentMaterial.getMass(), 1L), 16); + + GT_Values.RA.addCutterRecipe(stackLong, temp, null, (int) Math.max(this.componentMaterial.getMass(), 1L), 4); + } + + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return "Long " + this.materialName + " Rod"; } } diff --git a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java index f993cc64b2..46270623c9 100644 --- a/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java +++ b/src/Java/gtPlusPlus/core/item/base/rotors/BaseItemRotor.java @@ -3,9 +3,9 @@ package gtPlusPlus.core.item.base.rotors; import gtPlusPlus.core.item.base.BaseItemComponent; import gtPlusPlus.core.material.Material; -public class BaseItemRotor extends BaseItemComponent{ +public class BaseItemRotor extends BaseItemComponent { - public BaseItemRotor(Material material) { + public BaseItemRotor(final Material material) { super(material, BaseItemComponent.ComponentTypes.ROTOR); } } diff --git a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java index 93aa5b7526..11b365d1e3 100644 --- a/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java +++ b/src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java @@ -7,24 +7,21 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.item.ItemStack; -public class BaseItemScrew extends BaseItemComponent{ +public class BaseItemScrew extends BaseItemComponent { - public BaseItemScrew(Material material) { + public BaseItemScrew(final Material material) { super(material, BaseItemComponent.ComponentTypes.SCREW); - addLatheRecipe(); + this.addLatheRecipe(); } - private void addLatheRecipe(){ - Utils.LOG_WARNING("Adding recipe for "+materialName+" Screws"); - ItemStack boltStack = ItemUtils.getItemStackOfAmountFromOreDict(unlocalName.replace("itemScrew", "bolt"), 1); - if (null != boltStack){ - GT_Values.RA.addLatheRecipe( - boltStack, - ItemUtils.getSimpleStack(this), - null, - (int) Math.max(componentMaterial.getMass() / 8L, 1L), - 4); - } + private void addLatheRecipe() { + Utils.LOG_WARNING("Adding recipe for " + this.materialName + " Screws"); + final ItemStack boltStack = ItemUtils + .getItemStackOfAmountFromOreDict(this.unlocalName.replace("itemScrew", "bolt"), 1); + if (null != boltStack) { + GT_Values.RA.addLatheRecipe(boltStack, ItemUtils.getSimpleStack(this), null, + (int) Math.max(this.componentMaterial.getMass() / 8L, 1L), 4); + } } } |