aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/api/items
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-28 19:32:44 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-28 19:32:44 -0800
commit55f64675b42ac8d3c557cc850f78664bee006f6f (patch)
tree2afd26dd3d5e6f763119bc192b57c66a1a075922 /src/main/java/gtPlusPlus/xmod/gregtech/api/items
parent0f5dfd01b877b6a1019e0671b88d07974aae68c0 (diff)
downloadGT5-Unofficial-55f64675b42ac8d3c557cc850f78664bee006f6f.tar.gz
GT5-Unofficial-55f64675b42ac8d3c557cc850f78664bee006f6f.tar.bz2
GT5-Unofficial-55f64675b42ac8d3c557cc850f78664bee006f6f.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/items')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java60
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java69
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java207
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java58
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java267
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java167
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java91
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java74
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java192
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java160
10 files changed, 643 insertions, 702 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java
index b9e402a2f6..3eefd1c314 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_Generic_Item.java
@@ -1,17 +1,7 @@
package gtPlusPlus.xmod.gregtech.api.items;
-import cpw.mods.fml.common.registry.GameRegistry;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-import gregtech.api.enums.SubTag;
-import gregtech.api.interfaces.IProjectileItem;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
import java.util.List;
+
import net.minecraft.block.BlockDispenser;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.dispenser.*;
@@ -25,10 +15,23 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.SubTag;
+import gregtech.api.interfaces.IProjectileItem;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+
/**
* Extended by most Items, also used as a fallback Item, to prevent the accidental deletion when Errors occur.
*/
public class Gregtech_Generic_Item extends Item implements IProjectileItem {
+
private final String mName, mTooltip;
protected IIcon mIcon;
@@ -36,17 +39,16 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem {
this(aUnlocalized, aEnglish, aEnglishTooltip, true);
}
- public Gregtech_Generic_Item(
- final String aUnlocalized,
- final String aEnglish,
- final String aEnglishTooltip,
+ public Gregtech_Generic_Item(final String aUnlocalized, final String aEnglish, final String aEnglishTooltip,
final boolean aWriteToolTipIntoLangFile) {
super();
this.mName = aUnlocalized;
GT_LanguageManager.addStringLocalization(this.mName + ".name", aEnglish);
if (GT_Utility.isStringValid(aEnglishTooltip)) {
GT_LanguageManager.addStringLocalization(
- this.mTooltip = this.mName + ".tooltip_main", aEnglishTooltip, aWriteToolTipIntoLangFile);
+ this.mTooltip = this.mName + ".tooltip_main",
+ aEnglishTooltip,
+ aWriteToolTipIntoLangFile);
} else {
this.mTooltip = null;
}
@@ -77,8 +79,8 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem {
}
@Override
- public boolean doesSneakBypassUse(
- final World aWorld, final int aX, final int aY, final int aZ, final EntityPlayer aPlayer) {
+ public boolean doesSneakBypassUse(final World aWorld, final int aX, final int aY, final int aZ,
+ final EntityPlayer aPlayer) {
return true;
}
@@ -92,8 +94,8 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem {
}
@Override
- public void addInformation(
- final ItemStack aStack, final EntityPlayer aPlayer, final List aList, final boolean aF3_H) {
+ public void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, final List aList,
+ final boolean aF3_H) {
if ((this.getMaxDamage() > 0) && !this.getHasSubtypes()) {
aList.add((aStack.getMaxDamage() - this.getDamage(aStack)) + " / " + aStack.getMaxDamage());
}
@@ -128,23 +130,14 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem {
}
@Override
- public EntityArrow getProjectile(
- final SubTag aProjectileType,
- final ItemStack aStack,
- final World aWorld,
- final double aX,
- final double aY,
- final double aZ) {
+ public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld,
+ final double aX, final double aY, final double aZ) {
return null;
}
@Override
- public EntityArrow getProjectile(
- final SubTag aProjectileType,
- final ItemStack aStack,
- final World aWorld,
- final EntityLivingBase aEntity,
- final float aSpeed) {
+ public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld,
+ final EntityLivingBase aEntity, final float aSpeed) {
return null;
}
@@ -164,6 +157,7 @@ public class Gregtech_Generic_Item extends Item implements IProjectileItem {
}
public static class GT_Item_Dispense extends BehaviorProjectileDispense {
+
@Override
public ItemStack dispenseStack(final IBlockSource aSource, final ItemStack aStack) {
return ((Gregtech_Generic_Item) aStack.getItem()).onDispense(aSource, aStack);
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java
index 3daf2d3f31..aa4f6fb45f 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem.java
@@ -2,6 +2,17 @@ package gtPlusPlus.xmod.gregtech.api.items;
import static gregtech.api.enums.GT_Values.D1;
+import java.util.*;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.EnumAction;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
@@ -18,20 +29,12 @@ import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour;
-import java.util.*;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.EnumAction;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.IIcon;
-import net.minecraft.world.World;
public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base {
+
/**
- * All instances of this Item Class are listed here.
- * This gets used to register the Renderer to all Items of this Type, if useStandardMetaItemRenderer() returns true.
+ * All instances of this Item Class are listed here. This gets used to register the Renderer to all Items of this
+ * Type, if useStandardMetaItemRenderer() returns true.
* <p/>
* You can also use the unlocalized Name gotten from getUnlocalizedName() as Key if you want to get a specific Item.
*/
@@ -110,7 +113,8 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base {
if (tRandomData instanceof Interface_ItemBehaviour) {
this.addItemBehavior(
- this.mOffset + aID, (Interface_ItemBehaviour<Gregtech_MetaItem_Base>) tRandomData);
+ this.mOffset + aID,
+ (Interface_ItemBehaviour<Gregtech_MetaItem_Base>) tRandomData);
tUseOreDict = false;
}
if (tRandomData instanceof IItemContainer) {
@@ -170,19 +174,14 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base {
* @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.
+ * @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 Gregtech_MetaItem setElectricStats(
- final int aMetaValue,
- final long aMaxCharge,
- final long aTransferLimit,
- final long aTier,
- final long aSpecialData,
- final boolean aUseAnimations) {
+ public final Gregtech_MetaItem setElectricStats(final int aMetaValue, final long aMaxCharge,
+ final long aTransferLimit, final long aTier, final long aSpecialData, final boolean aUseAnimations) {
if ((aMetaValue < 0) || (aMetaValue >= (this.mOffset + this.mEnabledItems.length()))) {
return this;
}
@@ -191,7 +190,7 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base {
} else {
this.mElectricStats.put(
(short) aMetaValue,
- new Long[] {aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData});
+ new Long[] { aMaxCharge, Math.max(0, aTransferLimit), Math.max(-1, aTier), aSpecialData });
if ((aMetaValue >= this.mOffset) && aUseAnimations) {
this.mIconList[aMetaValue - this.mOffset] = Arrays.copyOf(
this.mIconList[aMetaValue - this.mOffset],
@@ -206,21 +205,21 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base {
* @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.
+ * @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 Gregtech_MetaItem setFluidContainerStats(
- final int aMetaValue, final long aCapacity, final long aStacksize) {
+ public final Gregtech_MetaItem setFluidContainerStats(final int aMetaValue, final long aCapacity,
+ final long aStacksize) {
if ((aMetaValue < 0) || (aMetaValue >= (this.mOffset + this.mEnabledItems.length()))) {
return this;
}
if (aCapacity < 0) {
this.mElectricStats.remove((short) aMetaValue);
} else {
- this.mFluidContainerStats.put((short) aMetaValue, new Long[] {aCapacity, Math.max(1, aStacksize)});
+ this.mFluidContainerStats.put((short) aMetaValue, new Long[] { aCapacity, Math.max(1, aStacksize) });
}
return this;
}
@@ -298,11 +297,11 @@ public abstract class Gregtech_MetaItem extends Gregtech_MetaItem_Base {
for (short i = 0, j = (short) this.mEnabledItems.length(); i < j; i++) {
if (this.mEnabledItems.get(i)) {
for (byte k = 1; k < this.mIconList[i].length; k++) {
- this.mIconList[i][k] = aIconRegister.registerIcon(
- CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i + "/" + k);
+ this.mIconList[i][k] = aIconRegister
+ .registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i + "/" + k);
}
- this.mIconList[i][0] =
- aIconRegister.registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i);
+ this.mIconList[i][0] = aIconRegister
+ .registerIcon(CORE.MODID + ":" + this.getUnlocalizedName() + "/" + i);
}
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java
index a961b28cf7..6ed72a8803 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_Base.java
@@ -2,14 +2,10 @@ package gtPlusPlus.xmod.gregtech.api.items;
import static gregtech.api.enums.GT_Values.*;
-import gregtech.api.enums.SubTag;
-import gregtech.api.util.*;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour;
-import ic2.api.item.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+
import net.minecraft.dispenser.IBlockSource;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -24,11 +20,17 @@ import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
+import gregtech.api.enums.SubTag;
+import gregtech.api.util.*;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour;
+import ic2.api.item.*;
+
public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
implements ISpecialElectricItem, IElectricItemManager, IFluidContainerItem {
+
/* ---------- CONSTRUCTOR AND MEMBER VARIABLES ---------- */
- private final HashMap<Short, ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>>> mItemBehaviors =
- new HashMap<>();
+ private final HashMap<Short, ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>>> mItemBehaviors = new HashMap<>();
/**
* Creates the Item using these Parameters.
@@ -51,8 +53,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
* @param aBehavior the Click Behavior you want to add.
* @return the Item itself for convenience in constructing.
*/
- public final Gregtech_MetaItem_Base addItemBehavior(
- final int aMetaValue, final Interface_ItemBehaviour<Gregtech_MetaItem_Base> aBehavior) {
+ public final Gregtech_MetaItem_Base addItemBehavior(final int aMetaValue,
+ final Interface_ItemBehaviour<Gregtech_MetaItem_Base> aBehavior) {
if ((aMetaValue < 0) || (aMetaValue >= 32766) || (aBehavior == null)) {
return this;
}
@@ -71,8 +73,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
@Override
public boolean hasProjectile(final SubTag aProjectileType, final ItemStack aStack) {
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
if (tBehavior.hasProjectile(this, aProjectileType, aStack)) {
@@ -84,15 +86,10 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
}
@Override
- public EntityArrow getProjectile(
- final SubTag aProjectileType,
- final ItemStack aStack,
- final World aWorld,
- final double aX,
- final double aY,
- final double aZ) {
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld,
+ final double aX, final double aY, final double aZ) {
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
final EntityArrow rArrow = tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aX, aY, aZ);
@@ -105,18 +102,14 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
}
@Override
- public EntityArrow getProjectile(
- final SubTag aProjectileType,
- final ItemStack aStack,
- final World aWorld,
- final EntityLivingBase aEntity,
- final float aSpeed) {
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ public EntityArrow getProjectile(final SubTag aProjectileType, final ItemStack aStack, final World aWorld,
+ final EntityLivingBase aEntity, final float aSpeed) {
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
- final EntityArrow rArrow =
- tBehavior.getProjectile(this, aProjectileType, aStack, aWorld, aEntity, aSpeed);
+ final EntityArrow rArrow = tBehavior
+ .getProjectile(this, aProjectileType, aStack, aWorld, aEntity, aSpeed);
if (rArrow != null) {
return rArrow;
}
@@ -127,8 +120,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
@Override
public ItemStack onDispense(final IBlockSource aSource, final ItemStack aStack) {
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
if (tBehavior.canDispense(this, aSource, aStack)) {
@@ -141,8 +134,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
@Override
public boolean isItemStackUsable(final ItemStack aStack) {
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
if (!tBehavior.isItemStackUsable(this, aStack)) {
@@ -157,8 +150,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
public boolean onLeftClickEntity(final ItemStack aStack, final EntityPlayer aPlayer, final Entity aEntity) {
this.use(aStack, 0, aPlayer);
this.isItemStackUsable(aStack);
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
try {
@@ -183,21 +176,12 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
}
@Override
- public boolean onItemUse(
- final ItemStack aStack,
- final EntityPlayer aPlayer,
- final World aWorld,
- final int aX,
- final int aY,
- final int aZ,
- final int aSide,
- final float hitX,
- final float hitY,
- final float hitZ) {
+ public boolean onItemUse(final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX,
+ final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) {
this.use(aStack, 0, aPlayer);
this.isItemStackUsable(aStack);
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
try {
@@ -222,21 +206,12 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
}
@Override
- public boolean onItemUseFirst(
- final ItemStack aStack,
- final EntityPlayer aPlayer,
- final World aWorld,
- final int aX,
- final int aY,
- final int aZ,
- final int aSide,
- final float hitX,
- final float hitY,
- final float hitZ) {
+ public boolean onItemUseFirst(final ItemStack aStack, final EntityPlayer aPlayer, final World aWorld, final int aX,
+ final int aY, final int aZ, final int aSide, final float hitX, final float hitY, final float hitZ) {
this.use(aStack, 0, aPlayer);
this.isItemStackUsable(aStack);
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
try {
@@ -264,8 +239,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
public ItemStack onItemRightClick(ItemStack aStack, final World aWorld, final EntityPlayer aPlayer) {
this.use(aStack, 0, aPlayer);
this.isItemStackUsable(aStack);
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
try {
@@ -281,8 +256,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
}
@Override
- public final void addInformation(
- final ItemStack aStack, final EntityPlayer aPlayer, List aList, final boolean aF3_H) {
+ public final void addInformation(final ItemStack aStack, final EntityPlayer aPlayer, List aList,
+ final boolean aF3_H) {
final String tKey = this.getUnlocalizedName(aStack) + ".tooltip",
tString = GT_LanguageManager.getTranslation(tKey);
if (GT_Utility.isStringValid(tString) && !tKey.equals(tString)) {
@@ -292,18 +267,27 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
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);
+ 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);
+ 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);
+ 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);
}
}
}
@@ -311,16 +295,17 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
tStats = this.getFluidContainerStats(aStack);
if ((tStats != null) && (tStats[0] > 0)) {
final FluidStack tFluid = this.getFluidContent(aStack);
- aList.add(EnumChatFormatting.BLUE
- + ((tFluid == null ? "No Fluids Contained" : GT_Utility.getFluidName(tFluid, true)))
- + EnumChatFormatting.GRAY);
- aList.add(EnumChatFormatting.BLUE
- + ((tFluid == null ? 0 : tFluid.amount) + "L / " + tStats[0] + "L")
- + EnumChatFormatting.GRAY);
+ aList.add(
+ EnumChatFormatting.BLUE
+ + ((tFluid == null ? "No Fluids Contained" : GT_Utility.getFluidName(tFluid, true)))
+ + EnumChatFormatting.GRAY);
+ aList.add(
+ EnumChatFormatting.BLUE + ((tFluid == null ? 0 : tFluid.amount) + "L / " + tStats[0] + "L")
+ + EnumChatFormatting.GRAY);
}
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
aList = tBehavior.getAdditionalToolTips(this, aList, aStack);
@@ -331,14 +316,10 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
}
@Override
- public void onUpdate(
- final ItemStack aStack,
- final World aWorld,
- final Entity aPlayer,
- final int aTimer,
+ public void onUpdate(final ItemStack aStack, final World aWorld, final Entity aPlayer, final int aTimer,
final boolean aIsInHand) {
- final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList =
- this.mItemBehaviors.get((short) this.getDamage(aStack));
+ final ArrayList<Interface_ItemBehaviour<Gregtech_MetaItem_Base>> tList = this.mItemBehaviors
+ .get((short) this.getDamage(aStack));
if (tList != null) {
for (final Interface_ItemBehaviour<Gregtech_MetaItem_Base> tBehavior : tList) {
tBehavior.onUpdate(this, aStack, aWorld, aPlayer, aTimer, aIsInHand);
@@ -374,29 +355,19 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
}
@Override
- public final double charge(
- final ItemStack aStack,
- final double aCharge,
- final int aTier,
- final boolean aIgnoreTransferLimit,
- final boolean aSimulate) {
+ 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)
+ 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)));
+ 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);
}
@@ -404,13 +375,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
}
@Override
- public final double discharge(
- final ItemStack aStack,
- final double aCharge,
- final int aTier,
- final boolean aIgnoreTransferLimit,
- final boolean aBatteryAlike,
- final boolean aSimulate) {
+ 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;
@@ -427,14 +393,8 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
}
return tStats[3];
}
- final long tChargeBefore = this.getRealCharge(aStack),
- tNewCharge =
- Math.max(
- 0,
- tChargeBefore
- - (aIgnoreTransferLimit
- ? (long) aCharge
- : Math.min(tStats[1], (long) aCharge)));
+ 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);
}
@@ -570,8 +530,7 @@ public abstract class Gregtech_MetaItem_Base extends Gregtech_Generic_Item
}
final Long[] tStats = this.getFluidContainerStats(aStack);
- if ((tStats == null)
- || (tStats[0] <= 0)
+ if ((tStats == null) || (tStats[0] <= 0)
|| (aFluid == null)
|| (aFluid.getFluid().getID() <= 0)
|| (aFluid.amount <= 0)) {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java
index a7f7cae271..c87b46e696 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaItem_X32.java
@@ -1,5 +1,13 @@
package gtPlusPlus.xmod.gregtech.api.items;
+import java.util.Arrays;
+import java.util.List;
+
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.IIcon;
+
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.GregTech_API;
@@ -12,24 +20,21 @@ import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.math.MathUtils;
-import java.util.Arrays;
-import java.util.List;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.IIcon;
/**
* @author Gregorius Techneticies
* <p/>
* One Item for everything!
* <p/>
- * This brilliant Item Class is used for automatically generating all possible variations of Material Items, like Dusts, Ingots, Gems, Plates and similar.
- * It saves me a ton of work, when adding Items, because I always have to make a new Item SubType for each OreDict Prefix, when adding a new Material.
+ * This brilliant Item Class is used for automatically generating all possible variations of Material It