aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours
diff options
context:
space:
mode:
authordraknyte1 <draknyte1@hotmail.com>2016-11-04 15:23:26 +1000
committerdraknyte1 <draknyte1@hotmail.com>2016-11-04 15:23:26 +1000
commit0669f5eb9d5029a8b94ec552171b0837605f7747 (patch)
tree6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours
parent3654052fb63a571c5eaca7f20714b87c17f7e966 (diff)
downloadGT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz
GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2
GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java76
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java194
2 files changed, 145 insertions, 125 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java
index b247a6a157..14828fd3a3 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Choocher.java
@@ -10,58 +10,64 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-public class Behaviour_Choocher
-extends Behaviour_None {
- private boolean isWrench = true;
- private final Behaviour_Wrench wrench = new Behaviour_Wrench(150);
- private final Behaviour_Prospecting_Ex prospecting = new Behaviour_Prospecting_Ex(10, 1250);
- private String mTooltip1 = GT_LanguageManager.addStringLocalization("gt.behaviour.choochering1", "Current tool mode: ");
- private String mTooltip2 = GT_LanguageManager.addStringLocalization("gt.behaviour.choochering2", "Change tool mode using Shift+Rightclick.");
- private final String mTooltipH = GT_LanguageManager.addStringLocalization("gt.behaviour.prospectingEx", "Usable for Prospecting large areas.");
- private final String mTooltipW = GT_LanguageManager.addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick.");
+public class Behaviour_Choocher extends Behaviour_None {
+ private boolean isWrench = true;
+ private final Behaviour_Wrench wrench = new Behaviour_Wrench(150);
+ private final Behaviour_Prospecting_Ex prospecting = new Behaviour_Prospecting_Ex(10, 1250);
+ private final String mTooltip1 = GT_LanguageManager
+ .addStringLocalization("gt.behaviour.choochering1", "Current tool mode: ");
+ private final String mTooltip2 = GT_LanguageManager
+ .addStringLocalization("gt.behaviour.choochering2", "Change tool mode using Shift+Rightclick.");
+ private final String mTooltipH = GT_LanguageManager
+ .addStringLocalization("gt.behaviour.prospectingEx", "Usable for Prospecting large areas.");
+ private final String mTooltipW = GT_LanguageManager
+ .addStringLocalization("gt.behaviour.wrench", "Rotates Blocks on Rightclick.");
public Behaviour_Choocher() {
}
@Override
- public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) {
+ public List<String> getAdditionalToolTips(final GT_MetaBase_Item aItem, final List<String> aList,
+ final ItemStack aStack) {
+
+ if (this.isWrench) {
+ aList.add(this.mTooltip1 + "Wrench");
+ aList.add(this.mTooltipW);
+ }
+ else {
+ aList.add(this.mTooltip1 + "Prospecting");
+ aList.add(this.mTooltipH);
+ }
+ aList.add(this.mTooltip2);
+
+ return aList;
+ }
+
+ @Override
+ 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;
}
- if (aPlayer.isSneaking()){
- if (isWrench){
- isWrench = false;
+ if (aPlayer.isSneaking()) {
+ if (this.isWrench) {
+ this.isWrench = false;
return false;
}
- isWrench = true;
+ this.isWrench = true;
return false;
}
- else if (!aPlayer.isSneaking()){
- if (isWrench){
- wrench.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aSide, aSide, aSide, aSide, hitZ, hitZ, hitZ);
+ else if (!aPlayer.isSneaking()) {
+ if (this.isWrench) {
+ this.wrench.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aSide, aSide, aSide, aSide, hitZ, hitZ,
+ hitZ);
return false;
}
- prospecting.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ);
+ this.prospecting.onItemUseFirst(aItem, aStack, aPlayer, aWorld, aX, aY, aZ, aSide, hitX, hitY, hitZ);
return false;
}
return false;
}
-
- @Override
- public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
-
-
- if (isWrench){
- aList.add(this.mTooltip1+"Wrench");
- aList.add(this.mTooltipW);
- }
- else {
- aList.add(this.mTooltip1+"Prospecting");
- aList.add(this.mTooltipH);
- }
- aList.add(this.mTooltip2);
-
- return aList;
- }
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java
index 70eaec83d8..b996618ed2 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Prospecting_Ex.java
@@ -20,99 +20,113 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.IFluidBlock;
-public class Behaviour_Prospecting_Ex
- extends Behaviour_Prospecting {
- private final int mVanillaCosts;
- private final int mEUCosts;
+public class Behaviour_Prospecting_Ex extends Behaviour_Prospecting {
+ private final int mVanillaCosts;
+ private final int mEUCosts;
- public Behaviour_Prospecting_Ex(int aVanillaCosts, int aEUCosts) {
- super(aVanillaCosts, aEUCosts);
- this.mVanillaCosts = aVanillaCosts;
- this.mEUCosts = aEUCosts;
- }
+ public Behaviour_Prospecting_Ex(final int aVanillaCosts, final int aEUCosts) {
+ super(aVanillaCosts, aEUCosts);
+ this.mVanillaCosts = aVanillaCosts;
+ this.mEUCosts = aEUCosts;
+ }
- public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) {
- if (aWorld.isRemote) {
- return false;
- }
- Block aBlock = aWorld.getBlock(aX, aY, aZ);
- if (aBlock == null) {
- return false;
- }
- byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ);
+ @Override
+ 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;
+ }
+ final Block aBlock = aWorld.getBlock(aX, aY, aZ);
+ if (aBlock == null) {
+ return false;
+ }
+ final byte aMeta = (byte) aWorld.getBlockMetadata(aX, aY, aZ);
+ 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.");
+ GT_Utility.sendSoundToPlayers(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)
+ || aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)
+ || aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)
+ || aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone)
+ || aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.dirt)
+ || aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.grass)) {
+ 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);
+ int tX = aX;
+ int tY = aY;
+ int tZ = aZ;
+ int tMetaID = 0;
+ final int tQuality = (aItem instanceof GT_MetaGenerated_Tool
+ ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0) * 3;
- 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.");
- GT_Utility.sendSoundToPlayers(aWorld, (String) 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)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.netherrack)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.end_stone)) || (aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.dirt)) ||(aBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.grass)) ) {
- if (GT_ModHandler.damageOrDechargeItem(aStack, this.mVanillaCosts, this.mEUCosts, aPlayer)) {
- GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(Integer.valueOf(1)), 1.0F, -1.0F, aX, aY, aZ);
- int tX = aX;
- int tY = aY;
- int tZ = aZ;
- int tMetaID = 0;
- int tQuality = ((aItem instanceof GT_MetaGenerated_Tool) ? ((GT_MetaGenerated_Tool) aItem).getHarvestLevel(aStack, "") : 0)*3;
+ int i = 0;
+ for (final int j = 6 + tQuality; i < j; i++) {
+ tX -= ForgeDirection.getOrientation(aSide).offsetX;
+ tY -= ForgeDirection.getOrientation(aSide).offsetY;
+ tZ -= ForgeDirection.getOrientation(aSide).offsetZ;
- int i = 0;
- for (int j = 6 + tQuality; i < j; i++) {
- tX -= ForgeDirection.getOrientation(aSide).offsetX;
- tY -= ForgeDirection.getOrientation(aSide).offsetY;
- tZ -= ForgeDirection.getOrientation(aSide).offsetZ;
-
- Block tBlock = aWorld.getBlock(tX, tY, tZ);
- if ((tBlock == Blocks.lava) || (tBlock == Blocks.flowing_lava)) {
- GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Block.");
- break;
- }
- if ((tBlock == Blocks.water) || (tBlock == Blocks.flowing_water) || ((tBlock instanceof IFluidBlock))) {
- GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Block.");
- break;
- }
- if ((tBlock == Blocks.monster_egg) || (!GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ))) {
- GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Block.");
- break;
- }
- if (tBlock != aBlock) {
- if (i >= 4) {
- break;
- }
- GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Block.");
- break;
- }
- }
- Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide);
- i = 0;
- for (int j = 9 + 2 * tQuality; i < j; i++) {
- tX = aX - 4 - tQuality + tRandom.nextInt(j);
- tY = aY - 4 - tQuality + tRandom.nextInt(j);
- tZ = aZ - 4 - tQuality + tRandom.nextInt(j);
- Block tBlock = aWorld.getBlock(tX, tY, tZ);
- if ((tBlock instanceof GT_Block_Ores)) {
- TileEntity tTileEntity = aWorld.getTileEntity(tX, tY, tZ);
- if ((tTileEntity instanceof GT_TileEntity_Ores)) {
- 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.");
- 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"))) {
- GT_Utility.sendChatToPlayer(aPlayer, "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore.");
- return true;
- }
- }
- }
- GT_Utility.sendChatToPlayer(aPlayer, "No Ores found.");
- }
- return true;
- }
- return false;
- }
+ final Block tBlock = aWorld.getBlock(tX, tY, tZ);
+ if (tBlock == Blocks.lava || tBlock == Blocks.flowing_lava) {
+ GT_Utility.sendChatToPlayer(aPlayer, "There is Lava behind this Block.");
+ break;
+ }
+ if (tBlock == Blocks.water || tBlock == Blocks.flowing_water || tBlock instanceof IFluidBlock) {
+ GT_Utility.sendChatToPlayer(aPlayer, "There is a Liquid behind this Block.");
+ break;
+ }
+ if (tBlock == Blocks.monster_egg || !GT_Utility.hasBlockHitBox(aWorld, tX, tY, tZ)) {
+ GT_Utility.sendChatToPlayer(aPlayer, "There is an Air Pocket behind this Block.");
+ break;
+ }
+ if (tBlock != aBlock) {
+ if (i >= 4) {
+ break;
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, "Material is changing behind this Block.");
+ break;
+ }
+ }
+ final Random tRandom = new Random(aX ^ aY ^ aZ ^ aSide);
+ i = 0;
+ for (final int j = 9 + 2 * tQuality; i < j; i++) {
+ tX = aX - 4 - tQuality + tRandom.nextInt(j);
+ tY = aY - 4 - tQuality + tRandom.nextInt(j);
+ tZ = aZ - 4 - tQuality + tRandom.nextInt(j);
+ final Block tBlock = aWorld.getBlock(tX, tY, tZ);
+ 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];
+ if (tMaterial != null && tMaterial != Materials._NULL) {
+ GT_Utility.sendChatToPlayer(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")) {
+ GT_Utility.sendChatToPlayer(aPlayer,
+ "Found traces of " + tAssotiation.mMaterial.mMaterial.mDefaultLocalName + " Ore.");
+ return true;
+ }
+ }
+ }
+ GT_Utility.sendChatToPlayer(aPlayer, "No Ores found.");
+ }
+ return true;
+ }
+ return false;
+ }
}