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 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.
* <p/>
- * As you can see, up to 32766 Items can be generated using this Class. And the last 766 Items can be custom defined, just to save space and MetaData.
+ * As you can see, up to 32766 Items can be generated using this Class. And the last 766 Items can be custom
+ * defined, just to save space and MetaData.
* <p/>
- * These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike Item.
+ * These Items can also have special RightClick abilities, electric Charge or even be set to become a Food alike
+ * Item.
*/
public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem {
@@ -57,7 +62,8 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem {
if (this.doesMaterialAllowGeneration(tPrefix, tMaterial)) {
final ItemStack tStack = new ItemStack(this, 1, i);
GT_LanguageManager.addStringLocalization(
- this.getUnlocalizedName(tStack) + ".name", this.getDefaultLocalization(tPrefix, tMaterial, i));
+ this.getUnlocalizedName(tStack) + ".name",
+ this.getDefaultLocalization(tPrefix, tMaterial, i));
GT_LanguageManager.addStringLocalization(
this.getUnlocalizedName(tStack) + ".tooltip",
tMaterial.getToolTip(tPrefix.mMaterialAmount / GT_Values.M));
@@ -67,8 +73,7 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem {
GT_OreDictUnificator.registerOre(tPrefix.get(tMaterial), tStack);
}
if (((tPrefix == OrePrefixes.stick) || (tPrefix == OrePrefixes.wireFine))
- && ((tMaterial == Materials.Lead)
- || (tMaterial == Materials.Tin)
+ && ((tMaterial == Materials.Lead) || (tMaterial == Materials.Tin)
|| (tMaterial == Materials.SolderingAlloy))) {
GregTech_API.sSolderingMetalList.add(tStack);
}
@@ -118,19 +123,20 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem {
*/
public final IIconContainer getIconContainer(final int aMetaData, final Materials aMaterial) {
return (this.mGeneratedPrefixList[aMetaData / 1000] != null)
- && (this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0)
- ? aMaterial.mIconSet.mTextures[this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex]
- : null;
+ && (this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex >= 0)
+ ? aMaterial.mIconSet.mTextures[this.mGeneratedPrefixList[aMetaData / 1000].mTextureIndex]
+ : null;
}
/**
* @param aPrefix always != null
* @param aMaterial always != null
- * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny Dusts or Crushed Ores as well.
+ * @param aDoShowAllItems this is the Configuration Setting of the User, if he wants to see all the Stuff like Tiny
+ * Dusts or Crushed Ores as well.
* @return if this Item should be visible in NEI or Creative
*/
- public boolean doesShowInCreative(
- final OrePrefixes aPrefix, final Materials aMaterial, final boolean aDoShowAllItems) {
+ public boolean doesShowInCreative(final OrePrefixes aPrefix, final Materials aMaterial,
+ final boolean aDoShowAllItems) {
return true;
}
@@ -153,8 +159,7 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem {
@Override
public final IIconContainer getIconContainer(final int aMetaData) {
- return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null
- ? null
+ return GregTech_API.sGeneratedMaterials[aMetaData % 1000] == null ? null
: this.getIconContainer(aMetaData, GregTech_API.sGeneratedMaterials[aMetaData % 1000]);
}
@@ -163,7 +168,8 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem {
public final void getSubItems(final Item var1, final CreativeTabs aCreativeTab, final List aList) {
for (int i = 0; i < 32000; i++) {
if (this.doesMaterialAllowGeneration(
- this.mGeneratedPrefixList[i / 1000], GregTech_API.sGeneratedMaterials[i % 1000])
+ this.mGeneratedPrefixList[i / 1000],
+ GregTech_API.sGeneratedMaterials[i % 1000])
&& this.doesShowInCreative(
this.mGeneratedPrefixList[i / 1000],
GregTech_API.sGeneratedMaterials[i % 1000],
@@ -199,8 +205,8 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem {
public int getItemStackLimit(final ItemStack aStack) {
final int tDamage = this.getDamage(aStack);
if ((tDamage < 32000) && (this.mGeneratedPrefixList[tDamage / 1000] != null)) {
- return Math.min(
- super.getItemStackLimit(aStack), this.mGeneratedPrefixList[tDamage / 1000].mDefaultStackSize);
+ return Math
+ .min(super.getItemStackLimit(aStack), this.mGeneratedPrefixList[tDamage / 1000].mDefaultStackSize);
}
return super.getItemStackLimit(aStack);
}
@@ -236,7 +242,9 @@ public abstract class Gregtech_MetaItem_X32 extends Gregtech_MetaItem {
HEX_OxFFFFFF = 0xffb300;
} else if (stack.getDisplayName().contains("MAX")) {
HEX_OxFFFFFF = Utils.rgbtoHexValue(
- MathUtils.randInt(220, 250), MathUtils.randInt(221, 251), MathUtils.randInt(220, 250));
+ MathUtils.randInt(220, 250),
+ MathUtils.randInt(221, 251),
+ MathUtils.randInt(220, 250));
} else {
HEX_OxFFFFFF = 0xffffff;
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java
index 7cb79a4ad6..11a4c02fbb 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/Gregtech_MetaTool.java
@@ -1,21 +1,12 @@
package gtPlusPlus.xmod.gregtech.api.items;
-import buildcraft.api.tools.IToolWrench;
-import cpw.mods.fml.common.Optional;
-import gregtech.api.enchants.Enchantment_Radioactivity;
-import gregtech.api.enums.Materials;
-import gregtech.api.interfaces.IDamagableItem;
-import gregtech.api.interfaces.IToolStats;
-import gregtech.api.items.GT_MetaGenerated_Tool;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
+
import mods.railcraft.api.core.items.IToolCrowbar;
+
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -34,21 +25,33 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.event.world.BlockEvent;
+import buildcraft.api.tools.IToolWrench;
+import cpw.mods.fml.common.Optional;
+import gregtech.api.enchants.Enchantment_Radioactivity;
+import gregtech.api.enums.Materials;
+import gregtech.api.interfaces.IDamagableItem;
+import gregtech.api.interfaces.IToolStats;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats;
+
/**
* This is an example on how you can create a Tool ItemStack, in this case a Bismuth Wrench:
- * GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(16, 1, Materials.Bismuth, Materials.Bismuth, null);
+ * GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(16, 1, Materials.Bismuth, Materials.Bismuth,
+ * null);
*/
-@Optional.InterfaceList({
- @Optional.Interface(iface = "forestry.api.arboriculture.IToolGrafter", modid = "Forestry"),
- @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = "Railcraft"),
- @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft"),
- @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO")
-})
+@Optional.InterfaceList({ @Optional.Interface(iface = "forestry.api.arboriculture.IToolGrafter", modid = "Forestry"),
+ @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = "Railcraft"),
+ @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft"),
+ @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO") })
public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
implements IDamagableItem, IToolCrowbar, IToolWrench {
+
/**
- * 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.
*/
@@ -75,35 +78,26 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
* Called by the Block Harvesting Event within the GT_Proxy
*/
@Override
- public void onHarvestBlockEvent(
- final ArrayList<ItemStack> aDrops,
- final ItemStack aStack,
- final EntityPlayer aPlayer,
- final Block aBlock,
- final int aX,
- final int aY,
- final int aZ,
- final byte aMetaData,
- final int aFortune,
- final boolean aSilkTouch,
+ public void onHarvestBlockEvent(final ArrayList<ItemStack> aDrops, final ItemStack aStack,
+ final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ,
+ final byte aMetaData, final int aFortune, final boolean aSilkTouch,
final BlockEvent.HarvestDropsEvent aEvent) {
final IToolStats tStats = this.getToolStats(aStack);
if (this.isItemStackUsable(aStack) && (this.getDigSpeed(aStack, aBlock, aMetaData) > 0.0F)) {
this.doDamage(
aStack,
tStats.convertBlockDrops(
- aDrops,
- aStack,
- aPlayer,
- aBlock,
- aX,
- aY,
- aZ,
- aMetaData,
- aFortune,
- aSilkTouch,
- aEvent)
- * tStats.getToolDamagePerDropConversion());
+ aDrops,
+ aStack,
+ aPlayer,
+ aBlock,
+ aX,
+ aY,
+ aZ,
+ aMetaData,
+ aFortune,
+ aSilkTouch,
+ aEvent) * tStats.getToolDamagePerDropConversion());
}
}
@@ -118,23 +112,23 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
return true;
}
if (aEntity.canAttackWithItem() && !aEntity.hitByEntity(aPlayer)) {
- final float tMagicDamage = tStats.getMagicDamageAgainstEntity(
- aEntity instanceof EntityLivingBase
- ? EnchantmentHelper.getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity)
- : 0.0F,
- aEntity,
- aStack,
- aPlayer);
+ final float tMagicDamage = tStats
+ .getMagicDamageAgainstEntity(
+ aEntity instanceof EntityLivingBase
+ ? EnchantmentHelper
+ .getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity)
+ : 0.0F,
+ aEntity,
+ aStack,
+ aPlayer);
float tDamage = tStats.getNormalDamageAgainstEntity(
- (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage)
- .getAttributeValue()
+ (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue()
+ this.getToolCombatDamage(aStack),
aEntity,
aStack,
aPlayer);
if ((tDamage + tMagicDamage) > 0.0F) {
- final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F)
- && !aPlayer.onGround
+ final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F) && !aPlayer.onGround
&& !aPlayer.isOnLadder()
&& !aPlayer.isInWater()
&& !aPlayer.isPotionActive(Potion.blindness)
@@ -148,10 +142,9 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
if (aEntity instanceof EntityLivingBase) {
aEntity.setFire(EnchantmentHelper.getFireAspectModifier(aPlayer) * 4);
}
- final int tKnockcack = (aPlayer.isSprinting() ? 1 : 0)
- + (aEntity instanceof EntityLivingBase
- ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity)
- : 0);
+ final int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) + (aEntity instanceof EntityLivingBase
+ ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity)
+ : 0);
if (tKnockcack > 0) {
aEntity.addVelocity(
-MathHelper.sin((aPlayer.rotationYaw * (float) Math.PI) / 180.0F) * tKnockcack * 0.5F,
@@ -178,8 +171,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
if (aEntity instanceof EntityLivingBase) {
aPlayer.addStat(StatList.damageDealtStat, Math.round(tDamage * 10.0F));
}
- aEntity.hurtResistantTime =
- Math.max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity));
+ aEntity.hurtResistantTime = Math
+ .max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity));
aPlayer.addExhaustion(0.3F);
this.doDamage(aStack, tStats.getToolDamagePerEntityAttack());
}
@@ -208,29 +201,39 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
final int tOffset = this.getElectricStats(aStack) != null ? 2 : 1;
if (tStats != null) {
final String name = aStack.getUnlocalizedName();
- if (name.equals("gt.metatool.01.170")
- || name.equals("gt.metatool.01.172")
+ if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172")
|| name.equals("gt.metatool.01.174")
|| name.equals("gt.metatool.01.176")) {
aList.add(
tOffset + 0,
- EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN
- + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + "Durability: "
+ + EnumChatFormatting.GREEN
+ + (tMaxDamage - getToolDamage(aStack))
+ + " / "
+ + tMaxDamage
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 1,
- EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl "
- + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName
+ + EnumChatFormatting.YELLOW
+ + " lvl "
+ + this.getHarvestLevel(aStack, "")
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 2,
- EnumChatFormatting.WHITE + "Turbine Efficency: " + EnumChatFormatting.BLUE
- + (50.0F + (10.0F * this.getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + "Turbine Efficency: "
+ + EnumChatFormatting.BLUE
+ + (50.0F + (10.0F * this.getToolCombatDamage(aStack)))
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 3,
- EnumChatFormatting.WHITE + "Optimal Steam flow: " + EnumChatFormatting.LIGHT_PURPLE
+ EnumChatFormatting.WHITE + "Optimal Steam flow: "
+ + EnumChatFormatting.LIGHT_PURPLE
+ Math.max(
Float.MIN_NORMAL,
tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000)
- + EnumChatFormatting.GRAY + "L/sec");
+ + EnumChatFormatting.GRAY
+ + "L/sec");
aList.add(
tOffset + 3,
EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): "
@@ -238,7 +241,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
+ Math.max(
Float.MIN_NORMAL,
tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 25)
- + EnumChatFormatting.GRAY + "EU/t");
+ + EnumChatFormatting.GRAY
+ + "EU/t");
aList.add(
tOffset + 3,
EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): "
@@ -246,24 +250,35 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
+ Math.max(
Float.MIN_NORMAL,
tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000)
- + EnumChatFormatting.GRAY + "EU/t");
+ + EnumChatFormatting.GRAY
+ + "EU/t");
} else {
aList.add(
tOffset + 0,
- EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN
- + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + "Durability: "
+ + EnumChatFormatting.GREEN
+ + (tMaxDamage - getToolDamage(aStack))
+ + " / "
+ + tMaxDamage
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 1,
- EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl "
- + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName
+ + EnumChatFormatting.YELLOW
+ + " lvl "
+ + this.getHarvestLevel(aStack, "")
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 2,
- EnumChatFormatting.WHITE + "Attack Damage: " + EnumChatFormatting.BLUE
- + this.getToolCombatDamage(aStack) + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + "Attack Damage: "
+ + EnumChatFormatting.BLUE
+ + this.getToolCombatDamage(aStack)
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 3,
- EnumChatFormatting.WHITE + "Mining Speed: " + EnumChatFormatting.LIGHT_PURPLE
+ EnumChatFormatting.WHITE + "Mining Speed: "
+ + EnumChatFormatting.LIGHT_PURPLE
+ Math.max(
Float.MIN_NORMAL,
tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed)
@@ -280,29 +295,39 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
final int tOffset = this.getElectricStats(aStack) != null ? 2 : 1;
if (tStats != null) {
final String name = aStack.getUnlocalizedName();
- if (name.equals("gt.metatool.01.170")
- || name.equals("gt.metatool.01.172")
+ if (name.equals("gt.metatool.01.170") || name.equals("gt.metatool.01.172")
|| name.equals("gt.metatool.01.174")
|| name.equals("gt.metatool.01.176")) {
aList.add(
tOffset + 0,
- EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN
- + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + "Durability: "
+ + EnumChatFormatting.GREEN
+ + (tMaxDamage - getToolDamage(aStack))
+ + " / "
+ + tMaxDamage
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 1,
- EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl "
- + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName
+ + EnumChatFormatting.YELLOW
+ + " lvl "
+ + this.getHarvestLevel(aStack, "")
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 2,
- EnumChatFormatting.WHITE + "Turbine Efficency: " + EnumChatFormatting.BLUE
- + (50.0F + (10.0F * this.getToolCombatDamage(aStack))) + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + "Turbine Efficency: "
+ + EnumChatFormatting.BLUE
+ + (50.0F + (10.0F * this.getToolCombatDamage(aStack)))
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 3,
- EnumChatFormatting.WHITE + "Optimal Steam flow: " + EnumChatFormatting.LIGHT_PURPLE
+ EnumChatFormatting.WHITE + "Optimal Steam flow: "
+ + EnumChatFormatting.LIGHT_PURPLE
+ Math.max(
Float.MIN_NORMAL,
tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000)
- + EnumChatFormatting.GRAY + "L/sec");
+ + EnumChatFormatting.GRAY
+ + "L/sec");
aList.add(
tOffset + 3,
EnumChatFormatting.WHITE + "Optimal Gas flow(EU burnvalue per tick): "
@@ -310,7 +335,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
+ Math.max(
Float.MIN_NORMAL,
tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 50)
- + EnumChatFormatting.GRAY + "EU/t");
+ + EnumChatFormatting.GRAY
+ + "EU/t");
aList.add(
tOffset + 3,
EnumChatFormatting.WHITE + "Optimal Plasma flow(Plasma energyvalue per tick): "
@@ -318,24 +344,35 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
+ Math.max(
Float.MIN_NORMAL,
tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed * 1000)
- + EnumChatFormatting.GRAY + "EU/t");
+ + EnumChatFormatting.GRAY
+ + "EU/t");
} else {
aList.add(
tOffset + 0,
- EnumChatFormatting.WHITE + "Durability: " + EnumChatFormatting.GREEN
- + (tMaxDamage - getToolDamage(aStack)) + " / " + tMaxDamage + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + "Durability: "
+ + EnumChatFormatting.GREEN
+ + (tMaxDamage - getToolDamage(aStack))
+ + " / "
+ + tMaxDamage
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 1,
- EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName + EnumChatFormatting.YELLOW + " lvl "
- + this.getHarvestLevel(aStack, "") + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + tMaterial.mDefaultLocalName
+ + EnumChatFormatting.YELLOW
+ + " lvl "
+ + this.getHarvestLevel(aStack, "")
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 2,
- EnumChatFormatting.WHITE + "Attack Damage: " + EnumChatFormatting.BLUE
- + this.getToolCombatDamage(aStack) + EnumChatFormatting.GRAY);
+ EnumChatFormatting.WHITE + "Attack Damage: "
+ + EnumChatFormatting.BLUE
+ + this.getToolCombatDamage(aStack)
+ + EnumChatFormatting.GRAY);
aList.add(
tOffset + 3,
- EnumChatFormatting.WHITE + "Mining Speed: " + EnumChatFormatting.LIGHT_PURPLE
+ EnumChatFormatting.WHITE + "Mining Speed: "
+ + EnumChatFormatting.LIGHT_PURPLE
+ Math.max(
Float.MIN_NORMAL,
tStats.getSpeedMultiplier() * getPrimaryMaterial(aStack).mToolSpeed)
@@ -362,7 +399,9 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
aList.add(
tOffset + 3,
- EnumChatFormatting.RED + "Heat: " + aNBT.getInteger("Heat") + " K"
+ EnumChatFormatting.RED + "Heat: "
+ + aNBT.getInteger("Heat")
+ + " K"
+ EnumChatFormatting.GRAY);
}
}
@@ -381,12 +420,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
if (aNBT != null) {
aNBT = aNBT.getCompoundTag("GT.ToolStats");
if ((aNBT != null) && aNBT.getBoolean("Electric")) {
- return new Long[] {
- aNBT.getLong("MaxCharge"),
- aNBT.getLong("Voltage"),
- aNBT.getLong("Tier"),
- aNBT.getLong("SpecialData")
- };
+ return new Long[] { aNBT.getLong("MaxCharge"), aNBT.getLong("Voltage"), aNBT.getLong("Tier"),
+ aNBT.getLong("SpecialData") };
}
}
return new Long[] {};
@@ -416,14 +451,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
}
@Override
- public boolean onBlockDestroyed(
- final ItemStack aStack,
- final World aWorld,
- final Block aBlock,
- final int aX,
- final int aY,
- final int aZ,
- final EntityLivingBase aPlayer) {
+ public boolean onBlockDestroyed(final ItemStack aStack, final World aWorld, final Block aBlock, final int aX,
+ final int aY, final int aZ, final EntityLivingBase aPlayer) {
if (!this.isItemStackUsable(aStack)) {
return false;
}
@@ -432,8 +461,9 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
return false;
}
GT_Utility.doSoundAtClient(tStats.getMiningSound(), 1, 1.0F);
- this.doDamage(aStack, (int)
- Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak()));
+ this.doDamage(
+ aStack,
+ (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak()));
return this.getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F;
}
@@ -466,8 +496,8 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
}
@Override
- public boolean canWhack(
- final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, final int aZ) {
+ public boolean canWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY,
+ final int aZ) {
if (!this.isItemStackUsable(aStack)) {
return false;
}
@@ -596,8 +626,7 @@ public abstract class Gregtech_MetaTool extends GT_MetaGenerated_Tool
}
}
for (final Entry<Integer, Integer> tEntry : tMap.entrySet()) {
- if ((tEntry.getKey() == 33)
- || ((tEntry.getKey() == 20) && (tEntry.getValue() > 2))
+ if ((tEntry.getKey() == 33) || ((tEntry.getKey() == 20) && (tEntry.getValue() > 2))
|| (tEntry.getKey() == Enchantment_Radioactivity.INSTANCE.effectId)) {
tResult.put(tEntry.getKey(), tEntry.getValue());
} else {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java
index c9f337d47b..77b407109e 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/tools/GT_MetaGenTool.java
@@ -1,17 +1,10 @@
package gtPlusPlus.xmod.gregtech.api.items.tools;
-import gregtech.api.GregTech_API;
-import gregtech.api.enchants.Enchantment_Radioactivity;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.TC_Aspects.TC_AspectStack;
-import gregtech.api.interfaces.IToolStats;
-import gregtech.api.items.GT_MetaGenerated_Tool;
-import gregtech.api.util.*;
-import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
+
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
@@ -29,14 +22,25 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.event.world.BlockEvent;
+import gregtech.api.GregTech_API;
+import gregtech.api.enchants.Enchantment_Radioactivity;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.TC_Aspects.TC_AspectStack;
+import gregtech.api.interfaces.IToolStats;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.util.*;
+import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ToolStats;
+
/**
* This is an example on how you can create a Tool ItemStack, in this case a Bismuth Wrench:
- * GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(16, 1, Materials.Bismuth, Materials.Bismuth, null);
+ * GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(16, 1, Materials.Bismuth, Materials.Bismuth,
+ * null);
*/
public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
+
/**
- * 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.
*/
@@ -86,18 +90,17 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
/**
* This adds a Custom Item to the ending Range.
*
- * @param aID The Id of the assigned Tool Class [0 - 32765] (only even Numbers allowed! Uneven ID's are empty electric Items)
+ * @param aID The Id of the assigned Tool Class [0 - 32765] (only even Numbers allowed! Uneven
+ * ID's are empty electric Items)
* @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 aToolTip The Default ToolTip of the created Item, you can also insert null for having no
+ * ToolTip
* @param aToolStats The Food Value of this Item. Can be null as well.
- * @param aOreDictNamesAndAspects The OreDict Names you want to give the Item. Also used to assign Thaumcraft Aspects.
+ * @param aOreDictNamesAndAspects The OreDict Names you want to give the Item. Also used to assign Thaumcraft
+ * Aspects.
* @return An ItemStack containing the newly created Item, but without specific Stats.
*/
- public final ItemStack addToolEx(
- final int aID,
- final String aEnglish,
- String aToolTip,
- final IToolStats aToolStats,
+ public final ItemStack addToolEx(final int aID, final String aEnglish, String aToolTip, final IToolStats aToolStats,
final Object... aOreDictNamesAndAspects) {
if (aToolTip == null) {
aToolTip = "";
@@ -106,9 +109,11 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + aID + ".name", aEnglish);
GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + "." + aID + ".tooltip", aToolTip);
GT_LanguageManager.addStringLocalization(
- this.getUnlocalizedName() + "." + (aID + 1) + ".name", aEnglish + " (Empty)");
+ this.getUnlocalizedName() + "." + (aID + 1) + ".name",
+ aEnglish + " (Empty)");
GT_LanguageManager.addStringLocalization(
- this.getUnlocalizedName() + "." + (aID + 1) + ".tooltip", "You need to recharge it");
+ this.getUnlocalizedName() + "." + (aID + 1) + ".tooltip",
+ "You need to recharge it");
this.mToolStats.put((short) aID, aToolStats);
this.mToolStats.put((short) (aID + 1), aToolStats);
aToolStats.onStatsAddedToTool(this, aID);
@@ -138,12 +143,8 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
* @param aSecondaryMaterial Secondary (Rod/Handle) Material of this Tool
* @param aElectricArray The Electric Stats of this Tool (or null if not electric)
*/
- public final ItemStack getToolWithStatsEx(
- final int aToolID,
- final int aAmount,
- final Materials aPrimaryMaterial,
- final Materials aSecondaryMaterial,
- final long[] aElectricArray) {
+ public final ItemStack getToolWithStatsEx(final int aToolID, final int aAmount, final Materials aPrimaryMaterial,
+ final Materials aSecondaryMaterial, final long[] aElectricArray) {
final ItemStack rStack = new ItemStack(this, aAmount, aToolID);
final IToolStats tToolStats = this.getToolStats(rStack);
if (tToolStats != null) {
@@ -177,35 +178,26 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
* Called by the Block Harvesting Event within the GT_Proxy
*/
@Override
- public void onHarvestBlockEvent(
- final ArrayList<ItemStack> aDrops,
- final ItemStack aStack,
- final EntityPlayer aPlayer,
- final Block aBlock,
- final int aX,
- final int aY,
- final int aZ,
- final byte aMetaData,
- final int aFortune,
- final boolean aSilkTouch,
+ public void onHarvestBlockEvent(final ArrayList<ItemStack> aDrops, final ItemStack aStack,
+ final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ,
+ final byte aMetaData, final int aFortune, final boolean aSilkTouch,
final BlockEvent.HarvestDropsEvent aEvent) {
final IToolStats tStats = this.getToolStats(aStack);
if (this.isItemStackUsable(aStack) && (this.getDigSpeed(aStack, aBlock, aMetaData) > 0.0F)) {
this.doDamage(
aStack,
tStats.convertBlockDrops(
- aDrops,
- aStack,
- aPlayer,
- aBlock,
- aX,
- aY,
- aZ,
- aMetaData,
- aFortune,
- aSilkTouch,
- aEvent)
- * tStats.getToolDamagePerDropConversion());
+ aDrops,
+ aStack,
+ aPlayer,
+ aBlock,
+ aX,
+ aY,
+ aZ,
+ aMetaData,
+ aFortune,
+ aSilkTouch,
+ aEvent) * tStats.getToolDamagePerDropConversion());
}
}
@@ -220,23 +212,23 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
return true;
}
if (aEntity.canAttackWithItem() && !aEntity.hitByEntity(aPlayer)) {
- final float tMagicDamage = tStats.getMagicDamageAgainstEntity(
- aEntity instanceof EntityLivingBase
- ? EnchantmentHelper.getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity)
- : 0.0F,
- aEntity,
- aStack,
- aPlayer);
+ final float tMagicDamage = tStats
+ .getMagicDamageAgainstEntity(
+ aEntity instanceof EntityLivingBase
+ ? EnchantmentHelper
+ .getEnchantmentModifierLiving(aPlayer, (EntityLivingBase) aEntity)
+ : 0.0F,
+ aEntity,
+ aStack,
+ aPlayer);
float tDamage = tStats.getNormalDamageAgainstEntity(
- (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage)
- .getAttributeValue()
+ (float) aPlayer.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue()
+ this.getToolCombatDamage(aStack),
aEntity,
aStack,
aPlayer);
if ((tDamage + tMagicDamage) > 0.0F) {
- final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F)
- && !aPlayer.onGround
+ final boolean tCriticalHit = (aPlayer.fallDistance > 0.0F) && !aPlayer.onGround
&& !aPlayer.isOnLadder()
&& !aPlayer.isInWater()
&& !aPlayer.isPotionActive(Potion.blindness)
@@ -250,10 +242,9 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
if (aEntity instanceof EntityLivingBase) {
aEntity.setFire(EnchantmentHelper.getFireAspectModifier(aPlayer) * 4);
}
- final int tKnockcack = (aPlayer.isSprinting() ? 1 : 0)
- + (aEntity instanceof EntityLivingBase
- ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity)
- : 0);
+ final int tKnockcack = (aPlayer.isSprinting() ? 1 : 0) + (aEntity instanceof EntityLivingBase
+ ? EnchantmentHelper.getKnockbackModifier(aPlayer, (EntityLivingBase) aEntity)
+ : 0);
if (tKnockcack > 0) {
aEntity.addVelocity(
-MathHelper.sin((aPlayer.rotationYaw * (float) Math.PI) / 180.0F) * tKnockcack * 0.5F,
@@ -280,8 +271,8 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
if (aEntity instanceof EntityLivingBase) {
aPlayer.addStat(StatList.damageDealtStat, Math.round(tDamage * 10.0F));
}
- aEntity.hurtResistantTime =
- Math.max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity));
+ aEntity.hurtResistantTime = Math
+ .max(1, tStats.getHurtResistanceTime(aEntity.hurtResistantTime, aEntity));
aPlayer.addExhaustion(0.3F);
this.doDamage(aStack, tStats.getToolDamagePerEntityAttack());
}
@@ -313,12 +304,8 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
if (aNBT != null) {
aNBT = aNBT.getCompoundTag("GT.ToolStats");
if ((aNBT != null) && aNBT.getBoolean("Electric")) {
- return new Long[] {
- aNBT.getLong("MaxCharge"),
- aNBT.getLong("Voltage"),
- aNBT.getLong("Tier"),
- aNBT.getLong("SpecialData")
- };
+ return new Long[] { aNBT.getLong("MaxCharge"), aNBT.getLong("Voltage"), aNBT.getLong("Tier"),
+ aNBT.getLong("SpecialData") };
}
}
return null;
@@ -348,14 +335,8 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
}
@Override
- public boolean onBlockDestroyed(
- final ItemStack aStack,
- final World aWorld,
- final Block aBlock,
- final int aX,
- final int aY,
- final int aZ,
- final EntityLivingBase aPlayer) {
+ public boolean onBlockDestroyed(final ItemStack aStack, final World aWorld, final Block aBlock, final int aX,
+ final int aY, final int aZ, final EntityLivingBase aPlayer) {
if (!this.isItemStackUsable(aStack)) {
return false;
}
@@ -364,8 +345,9 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
return false;
}
GT_Utility.doSoundAtClient(tStats.getMiningSound(), 1, 1.0F);
- this.doDamage(aStack, (int)
- Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak()));
+ this.doDamage(
+ aStack,
+ (int) Math.max(1, aBlock.getBlockHardness(aWorld, aX, aY, aZ) * tStats.getToolDamagePerBlockBreak()));
return this.getDigSpeed(aStack, aBlock, aWorld.getBlockMetadata(aX, aY, aZ)) > 0.0F;
}
@@ -398,22 +380,16 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
}
@Override
- public float getSaplingModifier(
- final ItemStack aStack,
- final World aWorld,
- final EntityPlayer aPlayer,
- final int aX,
- final int aY,
- final int aZ) {
+ public float getSaplingModifier(final ItemStack aStack, final World aWorld, final EntityPlayer aPlayer,
+ final int aX, final int aY, final int aZ) {
final IToolStats tStats = this.getToolStats(aStack);
- return (tStats != null) && tStats.isGrafter()
- ? Math.min(100.0F, (1 + this.getHarvestLevel(aStack, "")) * 20.0F)
+ return (tStats != null) && tStats.isGrafter() ? Math.min(100.0F, (1 + this.getHarvestLevel(aStack, "")) * 20.0F)
: 0.0F;
}
@Override
- public boolean canWhack(
- final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY, final int aZ) {
+ public boolean canWhack(final EntityPlayer aPlayer, final ItemStack aStack, final int aX, final int aY,
+ final int aZ) {
if (!this.isItemStackUsable(aStack)) {
return false;
}
@@ -562,8 +538,7 @@ public abstract class GT_MetaGenTool extends GT_MetaGenerated_Tool {
}
}
for (final Entry<Integer, Integer> tEntry : tMap.entrySet()) {
- if ((tEntry.getKey() == 33)
- || ((tEntry.getKey() == 20) && (tEntry.getValue() > 2))
+ if ((tEntry.getKey() == 33) || ((tEntry.getKey() == 20) && (tEntry.getValue() > 2))
|| (tEntry.getKey() == Enchantment_Radioactivity.INSTANCE.effectId)) {
tResult.put(tEntry.getKey(), tEntry.getValue());
} else {
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java
index e57f2009e7..463b6d9f7f 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Base.java
@@ -1,9 +1,7 @@
package gtPlusPlus.xmod.gregtech.api.items.types;
-import gregtech.api.enums.SubTag;
-import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour;
-import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base;
import java.util.List;
+
import net.minecraft.block.BlockDispenser;
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
import net.minecraft.dispenser.IBlockSource;
@@ -16,71 +14,47 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
+import gregtech.api.enums.SubTag;
+import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_ItemBehaviour;
+import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaItem_Base;
+
public class ToolType_Base implements Interface_ItemBehaviour<Gregtech_MetaItem_Base> {
+
@Override
- public boolean onLeftClickEntity(
- final Gregtech_MetaItem_Base aItem,
- final ItemStack aStack,
- final EntityPlayer aPlayer,
- final Entity aEntity) {
+ public boolean onLeftClickEntity(final Gregtech_MetaItem_Base aItem, final ItemStack aStack,
+ final EntityPlayer aPlayer, final Entity aEntity) {
return false;
}
@Override
- public boolean onItemUse(
- final Gregtech_MetaItem_Base aItem,
- 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 Gregtech_MetaItem_Base aItem, 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) {
return false;
}
@Override
- public boolean onItemUseFirst(
- final Gregtech_MetaItem_Base aItem,
- 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 Gregtech_MetaItem_Base aItem, 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) {
return false;
}
@Override
- public ItemStack onItemRightClick(
- final Gregtech_MetaItem_Base aItem,
- final ItemStack aStack,
- final World aWorld,
+ public ItemStack onItemRightClick(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final World aWorld,
final EntityPlayer aPlayer) {
return aStack;
}
@Override
- public List<String> getAdditionalToolTips(
- final Gregtech_MetaItem_Base aItem, final List<String> aList, final ItemStack aStack) {
+ public List<String> getAdditionalToolTips(final Gregtech_MetaItem_Base aItem, final List<String> aList,
+ final ItemStack aStack) {
return aList;
}
@Override
- public void onUpdate(
- final Gregtech_MetaItem_Base aItem,
- final ItemStack aStack,
- final World aWorld,
- final Entity aPlayer,
- final int aTimer,
- final boolean aIsInHand) {}
+ public void onUpdate(final Gregtech_MetaItem_Base aItem, final ItemStack aStack, final World aWorld,
+ final Entity aPlayer, final int aTimer, final boolean aIsInHand) {}
@Override
public boolean isItemStackUsable(final Gregtech_MetaItem_Base aItem, final ItemStack aStack) {
@@ -93,8 +67,8 @@ public class ToolType_Base implements Interface_ItemBehaviour<Gregtech_MetaItem_
}
@Override
- public ItemStack onDispense(
- final Gregtech_MetaItem_Base aItem, final IBlockSource aSource, final ItemStack aStack) {
+ public ItemStack onDispense(final Gregtech_MetaItem_Base aItem, final IBlockSource aSource,
+ final ItemStack aStack) {
final EnumFacing enumfacing = BlockDispenser.func_149937_b(aSource.getBlockMetadata());
final IPosition iposition = BlockDispenser.func_149939_a(aSource);
final ItemStack itemstack1 = aStack.splitStack(1);
@@ -103,31 +77,20 @@ public class ToolType_Base implements Interface_ItemBehaviour<Gregtech_MetaItem_
}
@Override
- public boolean hasProjectile(
- final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType, final ItemStack aStack) {
+ public boolean hasProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType,
+ final ItemStack aStack) {
return false;
}
@Override
- public EntityArrow getProjectile(
- final Gregtech_MetaItem_Base aItem,
- final SubTag aProjectileType,
- final ItemStack aStack,
- final World aWorld,
- final double aX,
- final double aY,
- final double aZ) {
+ public EntityArrow getProjectile(final Gregtech_MetaItem_Base aItem, 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 Gregtech_MetaItem_Base aItem,
- final SubTag aProjectileType,
- final ItemStack aStack,
- final World aWorld,
- final EntityLivingBase aEntity,
- final float aSpeed) {
+ public EntityArrow getProjectile(final Gregtech_MetaItem_Base aItem, final SubTag aProjectileType,
+ final ItemStack aStack, final World aWorld, final EntityLivingBase aEntity, final float aSpeed) {
return null;
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java
index 49063c43c2..6ed462d31f 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_HardHammer.java
@@ -1,15 +1,8 @@
package gtPlusPlus.xmod.gregtech.api.items.types;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Materials;
-import gregtech.api.items.GT_MetaBase_Item;
-import gregtech.api.items.GT_MetaGenerated_Tool;
-import gregtech.api.objects.ItemData;
-import gregtech.api.util.*;
-import gregtech.common.blocks.GT_Block_Ores;
-import gregtech.common.blocks.GT_TileEntity_Ores;
import java.util.List;
import java.util.Random;
+
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -19,29 +12,30 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.IFluidBlock;
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.objects.ItemData;
+import gregtech.api.util.*;
+import gregtech.common.blocks.GT_Block_Ores;
+import gregtech.common.blocks.GT_TileEntity_Ores;
+
public class ToolType_HardHammer extends ToolType_Base {
+
private final int mVanillaCosts;
private final int mEUCosts;
- private final String mTooltip =
- GT_LanguageManager.addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting");
+ private final String mTooltip = GT_LanguageManager
+ .addStringLocalization("gt.behaviour.prospecting", "Usable for Prospecting");
public ToolType_HardHammer(final int aVanillaCosts, final int aEUCosts) {
this.mVanillaCosts = aVanillaCosts;
this.mEUCosts = aEUCosts;
}
- public boolean onItemUseFirst(
- final GT_MetaBase_Item aItem,
- 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 GT_MetaBase_Item aItem, 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) {
if (aWorld.isRemote) {
return false;
}
@@ -54,9 +48,16 @@ public class ToolType_HardHammer extends ToolType_Base {
ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(aBlock, 1, aMeta));
if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) {
GT_Utility.sendChatToPlayer(
- aPlayer, "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore.");
+ aPlayer,
+ "This is " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore.");
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(1)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
return true;
}
if ((aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone))
@@ -65,7 +66,13 @@ public class ToolType_HardHammer extends ToolType_Base {
|| (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone))) {
if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) {
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(1)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
int tX = aX;
int tY = aY;
int tZ = aZ;
@@ -85,8 +92,7 @@ public class ToolType_HardHammer extends ToolType_Base {
GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Rock.");
break;
}
- if ((tBlock == Blocks.water)
- || (tBlock == Blocks.flowing_water)
+ if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water)
|| ((tBlock instanceof IFluidBlock))) {
GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Rock.");
break;
@@ -113,19 +119,19 @@ public class ToolType_HardHammer extends ToolType_Base {
if ((tBlock instanceof GT_Block_Ores)) {
final TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ);
if ((tTileEntity instanceof GT_TileEntity_Ores)) {
- final Materials tMaterial = GregTech_API.sGeneratedMaterials[
- (((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)];
+ final Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData
+ % 1000)];
if ((tMaterial != null) && (tMaterial != Materials._NULL)) {
GT_Utility.sendChatToPlayer(
- aPlayer, "Found traces of " + tMaterial.mDefaultLocalName + " Ore.");
+ aPlayer,
+ "Found traces of " + tMaterial.mDefaultLocalName + " Ore.");
return true;
}
}
} else {
tMetaID = aWorld.getBlockMetadata(tX, tY, tZ);
tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID));
- if ((tAssotiation != null)
- && (tAssotiation.mPrefix.toString().startsWith("ore"))) {
+ if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) {
GT_Utility.sendChatToPlayer(
aPlayer,
"Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore.");
@@ -140,8 +146,8 @@ public class ToolType_HardHammer extends ToolType_Base {
return false;
}
- public List<String> getAdditionalToolTips(
- final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) {
+ public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList,
+ final ItemStack aStack) {
aList.add(this.mTooltip);
return aList;
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java
index f1dd3b391d..1504b45d8e 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Pump.java
@@ -1,36 +1,30 @@
package gtPlusPlus.xmod.gregtech.api.items.types;
-import gregtech.api.items.GT_MetaBase_Item;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_Utility;
import java.util.List;
+
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_Utility;
+
public class ToolType_Pump extends ToolType_Base {
+
private final int mCosts;
- private final String mTooltip = GT_LanguageManager.addStringLocalization(
- "gt.behaviour.pump", "Sucks in Machine Input Fluid tank contents on Rightclick");
+ private final String mTooltip = GT_LanguageManager
+ .addStringLocalization("gt.behaviour.pump", "Sucks in Machine Input Fluid tank contents on Rightclick");
public ToolType_Pump(final int aCosts) {
this.mCosts = aCosts;
}
- public boolean onItemUseFirst(
- final GT_MetaBase_Item aItem,
- 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 GT_MetaBase_Item aItem, 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) {
if (aWorld.isRemote) {
return false;
}
@@ -41,110 +35,72 @@ public class ToolType_Pump extends ToolType_Base {
final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ);
final byte aTargetSide = GT_Utility.determineWrenchingSide((byte) aSide, hitX, hitY, hitZ);
final TileEntity aTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- /*try {
- if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable))) {
- if (((IWrenchable) aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) {
- if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
- ((IWrenchable) aTileEntity).setFacing(aTargetSide);
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- if (((IWrenchable) aTileEntity).wrenchCanRemove(aPlayer)) {
- final int tDamage = ((IWrenchable) aTileEntity).getWrenchDropRate() < 1.0F ? 10 : 3;
- if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, tDamage * this.mCosts))) {
- ItemStack tOutput = ((IWrenchable) aTileEntity).getWrenchDrop(aPlayer);
- for (final ItemStack tStack : aBlock.getDrops(aWorld, aX, aY, aZ, aMeta, 0)) {
- if (tOutput == null) {
- aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tStack));
- } else {
- aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, tOutput));
- tOutput = null;
- }
- }
- aWorld.setBlockToAir(aX, aY, aZ);
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- return true;
- }
- } catch (final Throwable e) {
- }
- if ((aBlock == Blocks.log) || (aBlock == Blocks.log2) || (aBlock == Blocks.hay_block)) {
- if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
- aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 4) % 12, 3);
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- if ((aBlock == Blocks.powered_repeater) || (aBlock == Blocks.unpowered_repeater)) {
- if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
- aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3);
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- if ((aBlock == Blocks.powered_comparator) || (aBlock == Blocks.unpowered_comparator)) {
- if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
- aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3);
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- if ((aBlock == Blocks.crafting_table) || (aBlock == Blocks.bookshelf)) {
- if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
- aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, aMeta)));
- aWorld.setBlockToAir(aX, aY, aZ);
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- if (aMeta == aTargetSide) {
- if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.trapped_chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.hopper)) {
- if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
- aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, 0)));
- aWorld.setBlockToAir(aX, aY, aZ);
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- } else {
- if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper)) {
- if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
- aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3);
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.trapped_chest)) {
- if ((aTargetSide > 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
- aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3);
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- if (aBlock == Blocks.hopper) {
- if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
- aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3);
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }
- return true;
- }
- }
- if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, aZ)).contains(ForgeDirection.getOrientation(aTargetSide))) &&
- ((aPlayer.capabilities.isCreativeMode) || (!GT_ModHandler.isElectricItem(aStack)) || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) &&
- (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) {
- if (!aPlayer.capabilities.isCreativeMode) {
- ((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts);
- }
- GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
- }*/
+ /*
+ * try { if ((aTileEntity != null) && ((aTileEntity instanceof IWrenchable))) { if (((IWrenchable)
+ * aTileEntity).wrenchCanSetFacing(aPlayer, aTargetSide)) { if ((aPlayer.capabilities.isCreativeMode) ||
+ * (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { ((IWrenchable)
+ * aTileEntity).setFacing(aTargetSide); GT_Utility.sendSoundToPlayers(aWorld,
+ * GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } if
+ * (((IWrenchable) aTileEntity).wrenchCanRemove(aPlayer)) { final int tDamage = ((IWrenchable)
+ * aTileEntity).getWrenchDropRate() < 1.0F ? 10 : 3; if ((aPlayer.capabilities.isCreativeMode) ||
+ * (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, tDamage * this.mCosts))) { ItemStack tOutput =
+ * ((IWrenchable) aTileEntity).getWrenchDrop(aPlayer); for (final ItemStack tStack : aBlock.getDrops(aWorld, aX,
+ * aY, aZ, aMeta, 0)) { if (tOutput == null) { aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY +
+ * 0.5D, aZ + 0.5D, tStack)); } else { aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ
+ * + 0.5D, tOutput)); tOutput = null; } } aWorld.setBlockToAir(aX, aY, aZ);
+ * GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY,
+ * aZ); } return true; } return true; } } catch (final Throwable e) { } if ((aBlock == Blocks.log) || (aBlock ==
+ * Blocks.log2) || (aBlock == Blocks.hay_block)) { if ((aPlayer.capabilities.isCreativeMode) ||
+ * (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) { aWorld.setBlockMetadataWithNotify(aX, aY,
+ * aZ, (aMeta + 4) % 12, 3); GT_Utility.sendSoundToPlayers(aWorld,
+ * GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } if ((aBlock ==
+ * Blocks.powered_repeater) || (aBlock == Blocks.unpowered_repeater)) { if
+ * ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
+ * aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3);
+ * GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY,
+ * aZ); } return true; } if ((aBlock == Blocks.powered_comparator) || (aBlock == Blocks.unpowered_comparator)) {
+ * if ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))
+ * { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3);
+ * GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY,
+ * aZ); } return true; } if ((aBlock == Blocks.crafting_table) || (aBlock == Blocks.bookshelf)) { if
+ * ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
+ * aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1,
+ * aMeta))); aWorld.setBlockToAir(aX, aY, aZ); GT_Utility.sendSoundToPlayers(aWorld,
+ * GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } if (aMeta ==
+ * aTargetSide) { if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock == Blocks.piston)
+ * || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock == Blocks.dropper) || (aBlock
+ * == Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock ==
+ * Blocks.trapped_chest) || (aBlock == Blocks.ender_chest) || (aBlock == Blocks.hopper)) { if
+ * ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
+ * aWorld.spawnEntityInWorld(new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1,
+ * 0))); aWorld.setBlockToAir(aX, aY, aZ); GT_Utility.sendSoundToPlayers(aWorld,
+ * GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } } else { if
+ * ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston) || (aBlock == Blocks.dispenser) || (aBlock ==
+ * Blocks.dropper)) { if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool)
+ * aItem).doDamage(aStack, this.mCosts)))) { aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3);
+ * GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY,
+ * aZ); } return true; } if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin) || (aBlock ==
+ * Blocks.furnace) || (aBlock == Blocks.lit_furnace) || (aBlock == Blocks.chest) || (aBlock ==
+ * Blocks.ender_chest) || (aBlock == Blocks.trapped_chest)) { if ((aTargetSide > 1) &&
+ * ((aPlayer.capabilities.isCreativeMode) || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
+ * aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3); GT_Utility.sendSoundToPlayers(aWorld,
+ * GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ); } return true; } if (aBlock ==
+ * Blocks.hopper) { if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode) ||
+ * (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) { aWorld.setBlockMetadataWithNotify(aX, aY,
+ * aZ, aTargetSide, 3); GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ * 1.0F, -1.0F, aX, aY, aZ); } return true; } } if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY,
+ * aZ)).contains(ForgeDirection.getOrientation(aTargetSide))) && ((aPlayer.capabilities.isCreativeMode) ||
+ * (!GT_ModHandler.isElectricItem(aStack)) || (GT_ModHandler.canUseElectricItem(aStack, this.mCosts))) &&
+ * (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) { if
+ * (!aPlayer.capabilities.isCreativeMode) { ((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts); }
+ * GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY,
+ * aZ); }
+ */
return false;
}
- public List<String> getAdditionalToolTips(
- final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) {
+ public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList,
+ final ItemStack aStack) {
aList.add(this.mTooltip);
return aList;
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java
index 6c12663bb6..acd48785f4 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/items/types/ToolType_Wrench.java
@@ -1,14 +1,8 @@
package gtPlusPlus.xmod.gregtech.api.items.types;
-import gregtech.api.GregTech_API;
-import gregtech.api.items.GT_MetaBase_Item;
-import gregtech.api.items.GT_MetaGenerated_Tool;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Utility;
-import ic2.api.tile.IWrenchable;
import java.util.Arrays;
import java.util.List;
+
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
@@ -18,27 +12,27 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
+import gregtech.api.GregTech_API;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.api.util.GT_LanguageManager;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import ic2.api.tile.IWrenchable;
+
public class ToolType_Wrench extends ToolType_Base {
+
private final int mCosts;
- private final String mTooltip =
- GT_LanguageManager.addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick");
+ private final String mTooltip = GT_LanguageManager
+ .addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick");
public ToolType_Wrench(final int aCosts) {
this.mCosts = aCosts;
}
- public boolean onItemUseFirst(
- final GT_MetaBase_Item aItem,
- 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 GT_MetaBase_Item aItem, 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) {
if (aWorld.isRemote) {
return false;
}
@@ -56,7 +50,13 @@ public class ToolType_Wrench extends ToolType_Base {
|| (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
((IWrenchable) aTileEntity).setFacing(aTargetSide);
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return true;
}
@@ -77,20 +77,31 @@ public class ToolType_Wrench extends ToolType_Base {
}
aWorld.setBlockToAir(aX, aY, aZ);
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return true;
}
return true;
}
- } catch (final Throwable e) {
- }
+ } catch (final Throwable e) {}
if ((aBlock == Blocks.log) || (aBlock == Blocks.log2) || (aBlock == Blocks.hay_block)) {
if ((aPlayer.capabilities.isCreativeMode)
|| (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
aWorld.setBlockMetadataWithNotify(aX, aY, aZ, (aMeta + 4) % 12, 3);
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return true;
}
@@ -99,7 +110,13 @@ public class ToolType_Wrench extends ToolType_Base {
|| (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3);
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return true;
}
@@ -108,7 +125,13 @@ public class ToolType_Wrench extends ToolType_Base {
|| (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts))) {
aWorld.setBlockMetadataWithNotify(aX, aY, aZ, ((aMeta / 4) * 4) + (((aMeta % 4) + 1) % 4), 3);
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return true;
}
@@ -119,13 +142,18 @@ public class ToolType_Wrench extends ToolType_Base {
new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, aMeta)));
aWorld.setBlockToAir(aX, aY, aZ);
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return true;
}
if (aMeta == aTargetSide) {
- if ((aBlock == Blocks.pumpkin)
- || (aBlock == Blocks.lit_pumpkin)
+ if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin)
|| (aBlock == Blocks.piston)
|| (aBlock == Blocks.sticky_piston)
|| (aBlock == Blocks.dispenser)
@@ -142,68 +170,92 @@ public class ToolType_Wrench extends ToolType_Base {
new EntityItem(aWorld, aX + 0.5D, aY + 0.5D, aZ + 0.5D, new ItemStack(aBlock, 1, 0)));
aWorld.setBlockToAir(aX, aY, aZ);
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return true;
}
} else {
- if ((aBlock == Blocks.piston)
- || (aBlock == Blocks.sticky_piston)
+ if ((aBlock == Blocks.piston) || (aBlock == Blocks.sticky_piston)
|| (aBlock == Blocks.dispenser)
|| (aBlock == Blocks.dropper)) {
- if ((aMeta < 6)
- && ((aPlayer.capabilities.isCreativeMode)
- || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
+ if ((aMeta < 6) && ((aPlayer.capabilities.isCreativeMode)
+ || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3);
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return true;
}
- if ((aBlock == Blocks.pumpkin)
- || (aBlock == Blocks.lit_pumpkin)
+ if ((aBlock == Blocks.pumpkin) || (aBlock == Blocks.lit_pumpkin)
|| (aBlock == Blocks.furnace)
|| (aBlock == Blocks.lit_furnace)
|| (aBlock == Blocks.chest)
|| (aBlock == Blocks.ender_chest)
|| (aBlock == Blocks.trapped_chest)) {
- if ((aTargetSide > 1)
- && ((aPlayer.capabilities.isCreativeMode)
- || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
+ if ((aTargetSide > 1) && ((aPlayer.capabilities.isCreativeMode)
+ || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3);
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return true;
}
if (aBlock == Blocks.hopper) {
- if ((aTargetSide != 1)
- && ((aPlayer.capabilities.isCreativeMode)
- || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
+ if ((aTargetSide != 1) && ((aPlayer.capabilities.isCreativeMode)
+ || (((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts)))) {
aWorld.setBlockMetadataWithNotify(aX, aY, aZ, aTargetSide, 3);
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return true;
}
}
if ((Arrays.asList(aBlock.getValidRotations(aWorld, aX, aY, aZ))
- .contains(ForgeDirection.getOrientation(aTargetSide)))
- && ((aPlayer.capabilities.isCreativeMode)
- || (!GT_ModHandler.isElectricItem(aStack))
+ .contains(ForgeDirection.getOrientation(aTargetSide)))
+ && ((aPlayer.capabilities.isCreativeMode) || (!GT_ModHandler.isElectricItem(aStack))
|| (GT_ModHandler.canUseElectricItem(aStack, this.mCosts)))
&& (aBlock.rotateBlock(aWorld, aX, aY, aZ, ForgeDirection.getOrientation(aTargetSide)))) {
if (!aPlayer.capabilities.isCreativeMode) {
((GT_MetaGenerated_Tool) aItem).doDamage(aStack, this.mCosts);
}
GT_Utility.sendSoundToPlayers(
- aWorld, GregTech_API.sSoundList.get(Integer.valueOf(100)), 1.0F, -1.0F, aX, aY, aZ);
+ aWorld,
+ GregTech_API.sSoundList.get(Integer.valueOf(100)),
+ 1.0F,
+ -1.0F,
+ aX,
+ aY,
+ aZ);
}
return false;
}
- public List<String> getAdditionalToolTips(
- final GT_MetaBase_Item aItem, final List<String> aList, final ItemStack aStack) {
+ public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList,
+ final ItemStack aStack) {
aList.add(this.mTooltip);
return aList;
}