diff options
| author | Draknyte1 <Draknyte1@hotmail.com> | 2017-03-04 12:58:47 +1000 |
|---|---|---|
| committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-03-04 12:58:47 +1000 |
| commit | ae21012d216df71f31aed6fbc9d76215fc24ceed (patch) | |
| tree | cc89accbe6ce5c04b72ed3c5e46b2a185f88be6a /src/Java/gtPlusPlus/core/item/base | |
| parent | ba89972a22a316030f8c3bd99974f915b1d7aefc (diff) | |
| download | GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.tar.gz GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.tar.bz2 GT5-Unofficial-ae21012d216df71f31aed6fbc9d76215fc24ceed.zip | |
+ New texture for the slow builders ring.
+ Added the Alkalus Disk.
$ Fixed Frame Box Assembler Recipes.
$ Fixed Missing 7Li material.
$ Fixed Tiered Tanks not showing their capacity in the tooltip.
$ Fixed tooltips for alloys containing Bronze or Steel.
$ Fixed Clay Pipe Extruder Recipes.
- Removed a handful of Plasma cells for misc. materials.
% Changed the Industrial Coke Oven's tooltip, to better describe the input/output requirements.
% Cleaned up The Entire Project.
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/base')
39 files changed, 1445 insertions, 1264 deletions
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java index 21e09d2d19..8f8d0eed72 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseEuItem.java @@ -2,8 +2,15 @@ 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; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.SubTag; import gregtech.api.enums.TC_Aspects.TC_AspectStack; import gregtech.api.interfaces.IItemBehaviour; import gregtech.api.interfaces.IItemContainer; @@ -13,9 +20,6 @@ import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.array.Pair; import ic2.api.item.*; - -import java.util.*; - import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; @@ -25,272 +29,318 @@ import net.minecraft.item.*; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricItemManager { /* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */ - private final HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>> mItemBehaviors = new HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>>(); + private final HashMap<Short, ArrayList<IItemBehaviour<BaseEuItem>>> mItemBehaviors = new HashMap<>(); public final short mOffset, mItemAmount; public final BitSet mEnabledItems; public final BitSet mVisibleItems; public final IIcon[][] mIconList; - /** The unlocalized name of this item. */ - private String unlocalizedName; - - private 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>(); + /** The unlocalized name of this item. */ + private String unlocalizedName; + + private final ArrayList<Pair<Integer, EnumRarity>> rarity = new ArrayList<>(); + private final ArrayList<Pair<Integer, EnumChatFormatting>> descColour = new ArrayList<>(); + private final ArrayList<Pair<Integer, String>> itemName = new ArrayList<>(); + private final ArrayList<Pair<Integer, String>> itemDescription = new ArrayList<>(); + private final ArrayList<Pair<Integer, Boolean>> hasEffect = new ArrayList<>(); + + public final HashMap<Short, Long[]> mElectricStats = new HashMap<>(); + public final HashMap<Short, Short> mBurnValues = new HashMap<>(); public BaseEuItem() { - this("MU-metaitem.02", AddToCreativeTab.tabOther, (short) 1000, (short) 31766); - } - - public BaseEuItem(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); + this("MU-metaitem.02", AddToCreativeTab.tabOther, (short) 1000, (short) 31766); + } + + public BaseEuItem(final String unlocalizedName, final CreativeTabs creativeTab, final short aOffset, final short aItemAmount) { + this.mEnabledItems = new BitSet(aItemAmount); + this.mVisibleItems = new BitSet(aItemAmount); + this.mOffset = (short) Math.min(32766, aOffset); + this.mItemAmount = (short) Math.min(aItemAmount, 32766 - this.mOffset); + this.mIconList = new IIcon[aItemAmount][1]; + this.setHasSubtypes(true); + this.setMaxDamage(0); + this.setUnlocalizedName(unlocalizedName); + this.setCreativeTab(creativeTab); + this.setMaxStackSize(1); GameRegistry.registerItem(this, unlocalizedName); - } - - - public void registerItem(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)); - } + } + + + public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, final String description) { + this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false); + } + + public void registerItem(final int id, final String localizedName, final long euStorage, final int tier, final String description, final int burnTime) { + this.registerItem(id, localizedName, euStorage, (short) tier, description, EnumRarity.common, EnumChatFormatting.GRAY, false); + this.setBurnValue(id, burnTime); + } + + + public void registerItem(final int id, final String localizedName, final long euStorage, final short tier, final String description, final EnumRarity regRarity, final EnumChatFormatting colour, final boolean Effect) { + this.addItem(id, localizedName, EnumChatFormatting.YELLOW+"Electric", new Object[]{}); + this.setElectricStats(this.mOffset + id, euStorage, GT_Values.V[tier], tier, -3L, true); + this.rarity.add(new Pair<>(id, regRarity)); + this.itemName.add(new Pair<>(id, localizedName)); + this.itemDescription.add(new Pair<>(id, description)); + this.descColour.add(new Pair<>(id, colour)); + this.hasEffect.add(new Pair<>(id, Effect)); + } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ - if (rarity.get(par1ItemStack.getItemDamage()-mOffset) != null) - return rarity.get(par1ItemStack.getItemDamage()-mOffset).getValue(); + public EnumRarity getRarity(final ItemStack par1ItemStack){ + if (this.rarity.get(par1ItemStack.getItemDamage()-this.mOffset) != null) { + return this.rarity.get(par1ItemStack.getItemDamage()-this.mOffset).getValue(); + } return EnumRarity.common; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ - if (hasEffect.get(par1ItemStack.getItemDamage()-mOffset) != null) - return hasEffect.get(par1ItemStack.getItemDamage()-mOffset).getValue(); + public boolean hasEffect(final ItemStack par1ItemStack){ + if (this.hasEffect.get(par1ItemStack.getItemDamage()-this.mOffset) != null) { + return this.hasEffect.get(par1ItemStack.getItemDamage()-this.mOffset).getValue(); + } return false; } - + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public final void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + public final void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList, final 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); - } - - + if ((this.descColour.get(aStack.getItemDamage()-this.mOffset) != null) && (this.itemDescription.get(aStack.getItemDamage()-this.mOffset) != null)) { + aList.add(this.descColour.get(aStack.getItemDamage()-this.mOffset).getValue()+this.itemDescription.get(aStack.getItemDamage()-this.mOffset).getValue()); + } + final String tKey = this.getUnlocalizedName(aStack) + ".tooltip", tString = GT_LanguageManager.getTranslation(tKey); + if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) { + aList.add(tString); + } + final Long[] tStats = this.getElectricStats(aStack); + if (tStats != null) { + if (tStats[3] > 0) { + aList.add(EnumChatFormatting.AQUA + "Contains " + GT_Utility.formatNumbers(tStats[3]) + " EU Tier: " + (tStats[2] >= 0 ? tStats[2] : 0) + EnumChatFormatting.GRAY); + } else { + final long tCharge = this.getRealCharge(aStack); + if ((tStats[3] == -2) && (tCharge <= 0)) { + aList.add(EnumChatFormatting.AQUA + "Empty. You should recycle it properly." + EnumChatFormatting.GRAY); + } else { + aList.add(EnumChatFormatting.AQUA + "" + GT_Utility.formatNumbers(tCharge) + " / " + GT_Utility.formatNumbers(Math.abs(tStats[0])) + " EU - Voltage: " + V[(int) (tStats[2] >= 0 ? tStats[2] < V.length ? tStats[2] : V.length - 1 : 1)] + EnumChatFormatting.GRAY); + } + } + } + final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final IItemBehaviour<BaseEuItem> tBehavior : tList) { + aList = tBehavior.getAdditionalToolTips(this, aList, aStack); + } + } + } + + @Override - public final Item getChargedItem(ItemStack itemStack) { + public final Item getChargedItem(final ItemStack itemStack) { return this; } @Override - public final Item getEmptyItem(ItemStack itemStack) { + public final Item getEmptyItem(final ItemStack itemStack) { return this; } @Override - public final double getMaxCharge(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; + public final double getMaxCharge(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } return Math.abs(tStats[0]); } @Override - public final double getTransferLimit(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return 0; + public final double getTransferLimit(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } return Math.max(tStats[1], tStats[3]); } @Override - public final int getTier(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); + public final int getTier(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); return (int) (tStats == null ? Integer.MAX_VALUE : tStats[2]); } @Override - public final double charge(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) + 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; - 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); + } + final long tChargeBefore = this.getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + if (!aSimulate) { + this.setCharge(aStack, tNewCharge); + } return tNewCharge - tChargeBefore; } @Override - public final double discharge(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 boolean canUse(final ItemStack aStack, final double aAmount) { + return this.getRealCharge(aStack) >= aAmount; } @Override - public final boolean use(ItemStack aStack, double aAmount, EntityLivingBase aPlayer) { - chargeFromArmor(aStack, aPlayer); - if (aPlayer instanceof EntityPlayer && ((EntityPlayer) aPlayer).capabilities.isCreativeMode) return true; - double tTransfer = discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, true); + 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) { - discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - chargeFromArmor(aStack, aPlayer); + this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + this.chargeFromArmor(aStack, aPlayer); return true; } - discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); - chargeFromArmor(aStack, aPlayer); + this.discharge(aStack, aAmount, Integer.MAX_VALUE, true, false, false); + this.chargeFromArmor(aStack, aPlayer); return false; } @Override - public final boolean canProvideEnergy(ItemStack aStack) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null) return false; - return tStats[3] > 0 || (aStack.stackSize == 1 && (tStats[3] == -2 || tStats[3] == -3)); + public final boolean canProvideEnergy(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return false; + } + return (tStats[3] > 0) || ((aStack.stackSize == 1) && ((tStats[3] == -2) || (tStats[3] == -3))); } @Override - public final void chargeFromArmor(ItemStack aStack, EntityLivingBase aPlayer) { - if (aPlayer == null || aPlayer.worldObj.isRemote) return; + public final void chargeFromArmor(final ItemStack aStack, final EntityLivingBase aPlayer) { + if ((aPlayer == null) || aPlayer.worldObj.isRemote) { + return; + } for (int i = 1; i < 5; i++) { - ItemStack tArmor = aPlayer.getEquipmentInSlot(i); + final 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); + 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) { - charge(aStack, tCharge, Integer.MAX_VALUE, true, false); + this.charge(aStack, tCharge, Integer.MAX_VALUE, true, false); if (aPlayer instanceof EntityPlayer) { - Container tContainer = ((EntityPlayer) aPlayer).openContainer; - if (tContainer != null) tContainer.detectAndSendChanges(); + final 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(); + public final long getRealCharge(final ItemStack aStack) { + final Long[] tStats = this.getElectricStats(aStack); + if (tStats == null) { + return 0; + } + if (tStats[3] > 0) { + return (int) (long) tStats[3]; + } + final NBTTagCompound tNBT = aStack.getTagCompound(); return tNBT == null ? 0 : tNBT.getLong("GT.ItemCharge"); - } + } - public final boolean setCharge(ItemStack aStack, long aCharge) { - Long[] tStats = getElectricStats(aStack); - if (tStats == null || tStats[3] > 0) return false; + 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(); + 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)); + aStack.setItemDamage(this.getChargedMetaData(aStack)); tNBT.setLong("GT.ItemCharge", aCharge); } else { - aStack.setItemDamage(getEmptyMetaData(aStack)); + aStack.setItemDamage(this.getEmptyMetaData(aStack)); + } + if (tNBT.hasNoTags()) { + aStack.setTagCompound(null); + } else { + aStack.setTagCompound(tNBT); } - if (tNBT.hasNoTags()) aStack.setTagCompound(null); - else aStack.setTagCompound(tNBT); - isItemStackUsable(aStack); + this.isItemStackUsable(aStack); return true; } @SuppressWarnings("static-method") - public short getChargedMetaData(ItemStack aStack) { + public short getChargedMetaData(final ItemStack aStack) { return (short) aStack.getItemDamage(); } @SuppressWarnings("static-method") - public short getEmptyMetaData(ItemStack aStack) { + public short getEmptyMetaData(final ItemStack aStack) { return (short) aStack.getItemDamage(); } - public boolean isItemStackUsable(ItemStack aStack) { - ArrayList<IItemBehaviour<BaseEuItem>> tList = mItemBehaviors.get((short) getDamage(aStack)); - if (tList != null) for (IItemBehaviour<BaseEuItem> tBehavior : tList) - if (!tBehavior.isItemStackUsable(this, aStack)) return false; + public boolean isItemStackUsable(final ItemStack aStack) { + final ArrayList<IItemBehaviour<BaseEuItem>> tList = this.mItemBehaviors.get((short) this.getDamage(aStack)); + if (tList != null) { + for (final IItemBehaviour<BaseEuItem> tBehavior : tList) { + if (!tBehavior.isItemStackUsable(this, aStack)) { + return false; + } + } + } return true; } @Override - public final String getToolTip(ItemStack aStack) { + public final String getToolTip(final ItemStack aStack) { return null; } // This has its own ToolTip Handler, no need to let the IC2 Handler screw us up at this Point @Override - public final IElectricItemManager getManager(ItemStack aStack) { + public final IElectricItemManager getManager(final ItemStack aStack) { return this; } // We are our own Manager @@ -301,10 +351,15 @@ public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricI * @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); + 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; } @@ -319,11 +374,14 @@ public class BaseEuItem extends Item implements ISpecialElectricItem, IElectricI * 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}); + 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); + |
