diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/item')
5 files changed, 521 insertions, 29 deletions
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index fd7d005e55..27488794bc 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -21,6 +21,7 @@ import gtPlusPlus.core.item.general.fuelrods.FuelRod_Base; import gtPlusPlus.core.item.init.ItemsFoods; import gtPlusPlus.core.item.tool.misc.SandstoneHammer; import gtPlusPlus.core.item.tool.staballoy.MultiPickaxeBase; +import gtPlusPlus.core.item.tool.staballoy.MultiSpadeBase; import gtPlusPlus.core.item.tool.staballoy.StaballoyAxe; import gtPlusPlus.core.item.tool.staballoy.StaballoyPickaxe; import gtPlusPlus.core.lib.CORE; @@ -109,6 +110,7 @@ public final class ModItems { public static Item itemPersonalHealingDevice; public static MultiPickaxeBase MP_GTMATERIAL; + public static MultiSpadeBase MS_GTMATERIAL; public static ItemStack FluidCell; @@ -231,8 +233,15 @@ public final class ModItems { boolean gtStyleTools = LoadedMods.Gregtech; + + Materials[] rm = Materials.values(); + for (Materials m : rm){ + MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, m); + MS_GTMATERIAL = UtilsItems.generateMultiShovel(gtStyleTools, m); + } + - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Wood); + /*MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Wood); MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Cobblestone); MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Iron); MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.WroughtIron); @@ -277,7 +286,7 @@ public final class ModItems { MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.BlueSteel); MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Neodymium); MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.Desh); - MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.ElectrumFlux); + MP_GTMATERIAL = UtilsItems.generateMultiPick(gtStyleTools, Materials.ElectrumFlux);*/ //EnderIO Resources if (LoadedMods.EnderIO || LOAD_ALL_CONTENT){ diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java index 60353f2d1b..2978579d0b 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java @@ -37,6 +37,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ protected ItemStack thisPickaxe = null; protected final int colour; protected final String materialName; + public boolean isValid = true; public MultiPickaxeBase(String unlocalizedName, ToolMaterial material, int materialDurability, int colour) { super(Utils.sanitizeString(unlocalizedName), material); @@ -46,12 +47,15 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ this.setMaxStackSize(1); this.setMaxDamage(materialDurability); this.colour = colour; - this.materialName = material.name(); - GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); + this.materialName = material.name(); this.setCreativeTab(AddToCreativeTab.tabTools); - try {addRecipe();} catch (Throwable e){} + try {isValid = addRecipe();} catch (Throwable e){} + if (colour != 0 && isValid){ + GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); + } + } - + /* * * @@ -61,25 +65,35 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ * * */ - - private void addRecipe(){ + + private boolean addRecipe(){ String plateDense = "plateDense"+materialName; String rodLong = "stickLong"+materialName; String toolHammer = "craftingToolHardHammer"; String toolWrench = "craftingToolWrench"; String toolFile = "craftingToolFile"; String toolScrewDriver = "craftingToolScrewdriver"; + + if (null == UtilsItems.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ + return false; + } + if (null == UtilsItems.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){ + return false; + } + UtilsRecipe.recipeBuilder( plateDense, plateDense, plateDense, toolFile, rodLong, toolHammer, toolWrench, rodLong, toolScrewDriver, UtilsItems.getSimpleStack(this)); + + return true; } - + public final String getMaterialName() { return materialName; } - + @Override public String getItemStackDisplayName(ItemStack iStack) { @@ -113,7 +127,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ return colour; } - + @SuppressWarnings("static-method") private float calculateDurabilityLoss(World world, int X, int Y, int Z){ float bDurabilityLoss = 0; @@ -127,7 +141,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ bHardness = removalist.getBlockHardness(world, X, Y, Z)*100; Utils.LOG_WARNING("Hardness: "+bHardness); - bDurabilityLoss = bHardness; + bDurabilityLoss = 100; //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss); correctTool = canPickaxeBlock(removalist, world); @@ -154,21 +168,21 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ Utils.LOG_WARNING(block.toString()); String removalTool = ""; removalTool = block.getHarvestTool(1); - + if (removalTool.equals("pickaxe") || UtilsMining.getBlockType(block)){ if (canPickaxeBlock(block, world)){ if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ - + if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-dur)){ - - block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); - world.setBlockToAir(X, Y, Z); - + + block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); + world.setBlockToAir(X, Y, Z); + } else { return; } - + } } else { @@ -179,13 +193,15 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ } } - - - @Override + public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){ - item.damageItem(damage*100, localPlayer); + item.damageItem(damage, localPlayer); } - + + public void setItemDamage(ItemStack item, int damage){ + item.setItemDamage(damage-1); + } + @Override @SideOnly(Side.CLIENT) diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java new file mode 100644 index 0000000000..972ba0ca12 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java @@ -0,0 +1,115 @@ +package gtPlusPlus.core.item.tool.staballoy; + +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.item.UtilsItems; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.recipe.UtilsRecipe; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class MultiSpadeBase extends StaballoySpade{ + + /* (non-Javadoc) + * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) + */ + @Override + public double getDurabilityForDisplay(ItemStack stack) { + if (super.getDurabilityForDisplay(stack) > 0){ + return super.getDurabilityForDisplay(stack);} + return 0; + } + + protected Boolean FACING_HORIZONTAL = true; + protected String FACING = "north"; + protected EntityPlayer localPlayer; + protected String lookingDirection; + protected World localWorld; + protected ItemStack thisPickaxe = null; + protected final int colour; + protected final String materialName; + public boolean isValid = true; + + public MultiSpadeBase(String unlocalizedName, ToolMaterial material, int materialDurability, int colour) { + super(Utils.sanitizeString(unlocalizedName), material); + this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName)); + this.setTextureName(CORE.MODID + ":" + "itemShovel"); + this.FACING_HORIZONTAL=true; + this.setMaxStackSize(1); + this.setMaxDamage(materialDurability); + this.colour = colour; + this.materialName = material.name(); + this.setCreativeTab(AddToCreativeTab.tabTools); + try {isValid = addRecipe();} catch (Throwable e){} + if (colour != 0 && isValid){ + GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); + } + } + + private boolean addRecipe(){ + String plateDense = "plateDense"+materialName; + String rodLong = "stickLong"+materialName; + String toolHammer = "craftingToolHardHammer"; + String toolWrench = "craftingToolWrench"; + String toolFile = "craftingToolFile"; + String toolScrewDriver = "craftingToolScrewdriver"; + + if (null == UtilsItems.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ + return false; + } + if (null == UtilsItems.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){ + return false; + } + + UtilsRecipe.recipeBuilder( + toolFile, plateDense, toolHammer, + null, rodLong, null, + toolWrench, rodLong, toolScrewDriver, + UtilsItems.getSimpleStack(this)); + + return true; + } + + public final String getMaterialName() { + return materialName; + } + + @Override + public String getItemStackDisplayName(ItemStack iStack) { + + String name; + if (getUnlocalizedName().toLowerCase().contains("wood")){ + name = "Wooden"; + } + else { + name = materialName; + } + return "Big "+name+" Spade"; + } + + @Override + public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + if (colour == 0){ + return MathUtils.generateSingularRandomHexValue(); + } + return colour; + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(ItemStack par1ItemStack){ + return EnumRarity.uncommon; + } + + @Override + public boolean hasEffect(ItemStack par1ItemStack){ + return false; + } + +} diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java index d20ad259e7..46e727edd1 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java @@ -99,7 +99,7 @@ public class StaballoyPickaxe extends ItemPickaxe{ } } - return bDurabilityLoss; + return 100; } public Boolean canPickaxeBlock(Block currentBlock, World currentWorld){ @@ -158,16 +158,48 @@ public class StaballoyPickaxe extends ItemPickaxe{ } //int heldItemDurability = heldItem.getDamage(1); - Utils.LOG_WARNING("Total Loss: "+(int)DURABILITY_LOSS); + Utils.LOG_INFO("Total Loss: "+(int)DURABILITY_LOSS); //heldItem.setDamage(heldStack, DURABILITY_LOSS); //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack)); - if (heldItem.getItemDamage() <= (heldItem.getMaxDamage()-DURABILITY_LOSS)){ - damageItem(heldItem, (int) DURABILITY_LOSS, localPlayer); + Utils.LOG_INFO("1x: "+(heldItem.getItemDamage())); + int itemdmg = heldItem.getItemDamage(); + int maxdmg = heldItem.getMaxDamage(); + int dodmg = (int)DURABILITY_LOSS; + int durNow = (int) maxdmg-itemdmg; + int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); + + Utils.LOG_INFO( + "Current Damage: " + itemdmg + + " Max Damage: " + maxdmg + + " Durability to be lost: " + dodmg + + " Current Durability: " + durNow + + " Remaining Durability: " + durLeft + ); + + + //Break Tool + if ((durNow-dodmg) <= (900) && itemdmg != 0){ + //TODO break tool + Utils.LOG_INFO("Breaking Tool"); + heldItem.stackSize = 0; } + //Do Damage else { - damageItem(heldItem, heldItem.getMaxDamage()-heldItem.getItemDamage(), localPlayer); + //setItemDamage(heldItem, durLeft); + Utils.LOG_INFO(""+(durNow-durLeft)); + damageItem(heldItem, (durNow-durLeft)-1, localPlayer); + } + + + /*if (heldItem.getItemDamage() <= ((heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)){ + Utils.LOG_INFO("2: "+DURABILITY_LOSS+" 3: "+((heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)); + setItemDamage(heldItem, (int) (heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage())-DURABILITY_LOSS)); } + else { + Utils.LOG_INFO("3: "+( heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage()))); + setItemDamage(heldItem, heldItem.getMaxDamage()-(heldItem.getMaxDamage()-heldItem.getItemDamage())); + }*/ //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); DURABILITY_LOSS = 0; @@ -177,6 +209,10 @@ public class StaballoyPickaxe extends ItemPickaxe{ public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){ item.damageItem(damage, localPlayer); } + + public void setItemDamage(ItemStack item, int damage){ + item.setItemDamage(damage-1); + } //Should clear up blocks quicker if I chain it. public void removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){ diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java new file mode 100644 index 0000000000..79eac5816b --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java @@ -0,0 +1,316 @@ +package gtPlusPlus.core.item.tool.staballoy; + +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.player.UtilsMining; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemSpade; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class StaballoySpade extends ItemSpade{ + + /* (non-Javadoc) + * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) + */ + @Override + public double getDurabilityForDisplay(ItemStack stack) { + if (super.getDurabilityForDisplay(stack) > 0){ + return super.getDurabilityForDisplay(stack);} + return 0; + } + + protected Boolean FACING_HORIZONTAL = true; + protected String FACING = "north"; + protected EntityPlayer localPlayer; + protected String lookingDirection; + protected World localWorld; + public ItemStack thisPickaxe = null; + + /* + * + * + * + * Methods + * + * + * + */ + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer aPlayer) { + localPlayer = aPlayer; + localWorld = world; + thisPickaxe = stack; + return super.onItemRightClick(stack, world, aPlayer); + } + + + + @Override + public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int X, int Y, int Z, EntityLivingBase entity) { + //super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); + localWorld = world; + thisPickaxe = stack; + //checkFacing(world); + if (!world.isRemote){ + GetDestroyOrientation(lookingDirection, world, X, Y, Z, stack); + } + + return super.onBlockDestroyed(stack, world, block, X, Y, Z, entity); + } + + public Boolean canPickaxeBlock(Block currentBlock, World currentWorld){ + String correctTool = ""; + if (!currentWorld.isRemote){ + try { + correctTool = currentBlock.getHarvestTool(0); + //Utils.LOG_WARNING(correctTool); + + Utils.LOG_INFO("Tool for Block: "+correctTool+" | Current block: "+currentBlock.getLocalizedName()); + if (UtilsMining.getBlockType(currentBlock) || correctTool.equals("shovel")){ + return true;} + } catch (NullPointerException e){ + return false;} + } + return false; + } + + private void GetDestroyOrientation(String FACING, World world, int X, int Y, int Z, ItemStack heldItem){ + localWorld = world; + float DURABILITY_LOSS = 0; + if (!world.isRemote){ + + if (FACING.equals("below") || FACING.equals("above")){ + DURABILITY_LOSS = 0; + for(int i = -1; i < 2; i++) { + for(int j = -1; j < 2; j++) { + DURABILITY_LOSS = (DURABILITY_LOSS + removeBlockAndDropAsItem(world, X + i, Y, Z + j, heldItem)); + } + } + } + + else if (FACING.equals("facingEast") || FACING.equals("facingWest")){ + DURABILITY_LOSS = 0; + for(int i = -1; i < 2; i++) { + for(int j = -1; j < 2; j++) { + DURABILITY_LOSS = (DURABILITY_LOSS + removeBlockAndDropAsItem(world, X , Y + i, Z + j, heldItem)); + } + } + } + + else if (FACING.equals("facingNorth") || FACING.equals("facingSouth")){ + DURABILITY_LOSS = 0; + for(int i = -1; i < 2; i++) { + for(int j = -1; j < 2; j++) { + DURABILITY_LOSS = (DURABILITY_LOSS + removeBlockAndDropAsItem(world, X + j, Y + i, Z, heldItem)); + } + } + } + + //int heldItemDurability = heldItem.getDamage(1); + Utils.LOG_INFO("Total Loss: "+(int)DURABILITY_LOSS); + //heldItem.setDamage(heldStack, DURABILITY_LOSS); + //Utils.LOG_WARNING("|GID|Durability: "+heldItem.getItemDamage()); + //Utils.LOG_WARNING("Durability: "+heldStack.getDamage(heldStack)); + Utils.LOG_INFO("1x: "+(heldItem.getItemDamage())); + int itemdmg = heldItem.getItemDamage(); + int maxdmg = heldItem.getMaxDamage(); + int dodmg = (int)DURABILITY_LOSS; + int durNow = (int) maxdmg-itemdmg; + int durLeft = (int) ((maxdmg-itemdmg)-DURABILITY_LOSS); + + Utils.LOG_INFO( + "Current Damage: " + itemdmg + + " Max Damage: " + maxdmg + + " Durability to be lost: " + dodmg + + " Current Durability: " + durNow + + " Remaining Durability: " + durLeft + ); + + + //Break Tool + if ((durNow-dodmg) <= (900) && itemdmg != 0){ + //TODO break tool + Utils.LOG_INFO("Breaking Tool"); + heldItem.stackSize = 0; + } + //Do Damage + else { + //setItemDamage(heldItem, durLeft); + Utils.LOG_INFO(""+(durNow-durLeft)); + damageItem(heldItem, (durNow-durLeft)-1, localPlayer); + } + DURABILITY_LOSS = 0; + + } + } + + public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){ + item.damageItem(damage, localPlayer); + } + + public void setItemDamage(ItemStack item, int damage){ + item.setItemDamage(damage-1); + } + + //Should clear up blocks quicker if I chain it. + public int removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){ + localWorld = world; + Utils.LOG_INFO("Trying to drop/remove a block."); + try { + Block block = world.getBlock(X, Y, Z); + Utils.LOG_WARNING(block.toString()); + String removalTool = ""; + removalTool = block.getHarvestTool(0); + if (removalTool != null){ + if (removalTool.equals("shovel")){ + if (canPickaxeBlock(block, world)){ + if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ + + int itemdmg = heldItem.getItemDamage(); + int maxdmg = heldItem.getMaxDamage(); + int dodmg = (int)100; + int durNow = (int) maxdmg-itemdmg; + int durLeft = (int) ((maxdmg-itemdmg)-100); + + if ((durNow-dodmg) <= (900) && itemdmg != 0){ + //Do Nothing, Tool is useless. + return 0; + } + block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0); + world.setBlockToAir(X, Y, Z); + Utils.LOG_INFO("Adding 100 damage to item."); + return 100; + } + Utils.LOG_INFO("Incorrect Tool for mining this block. Wrong Block Water/lava/bedrock/blacklist"); + return 0; + } + Utils.LOG_INFO("Incorrect Tool for mining this block. Cannot Shovel this block type."); + return 0; + } + Utils.LOG_INFO("Incorrect Tool for mining this block. Blocks mining tool is now Shovel."); + return 0; + } + Utils.LOG_INFO("Either the block was air or it declares an invalid mining tool."); + return 0; + } catch (NullPointerException e){ + Utils.LOG_INFO("Something Broke"); + e.printStackTrace(); + return 0; + } + } + + public boolean checkFacing(World world){ + localWorld = world; + if (localPlayer != null){ + int direction = MathHelper.floor_double((double)((localPlayer.rotationYaw * 4F) / 360F) + 0.5D) & 3; + //Utils.LOG_WARNING("Player - F: "+direction); + //Utils.LOG_WARNING("Player - getLookVec(): "+localPlayer.getLookVec().yCoord); + + /*if (localPlayer.getLookVec().yCoord > 0){ + localPlayer.getLookVec().yCoord; + }*/ + + MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(world, (EntityPlayer) localPlayer, false); + if (movingobjectposition != null){ + int sideHit = movingobjectposition.sideHit; + String playerStandingPosition = ""; + if (movingobjectposition != null) { + //System.out.println("Side Hit: "+movingobjectposition.sideHit); + } + + if (sideHit == 0){ + playerStandingPosition = "above"; + FACING_HORIZONTAL = false; + } + else if (sideHit == 1){ + playerStandingPosition = "below"; + FACING_HORIZONTAL = false; + } + else if (sideHit == 2){ + playerStandingPosition = "facingSouth"; + FACING_HORIZONTAL = true; + } + else if (sideHit == 3){ + playerStandingPosition = "facingNorth"; + FACING_HORIZONTAL = true; + } + else if (sideHit == 4){ + playerStandingPosition = "facingEast"; + FACING_HORIZONTAL = true; + } + else if (sideHit == 5){ + playerStandingPosition = "facingWest"; + FACING_HORIZONTAL = true; + } + lookingDirection = playerStandingPosition; + + if (direction == 0){ + FACING = "south"; + } + else if (direction == 1){ + FACING = "west"; + } + else if (direction == 2){ + FACING = "north"; + } + else if (direction == 3){ + FACING = "east"; + } + } + + + return true; + } + return false; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + thisPickaxe = stack; + list.add(EnumChatFormatting.GOLD+"Spades a 3x3 area in the direction you are facing."); + super.addInformation(stack, aPlayer, list, bool); + } + + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(ItemStack par1ItemStack){ + return EnumRarity.rare; + } + + @Override + public boolean hasEffect(ItemStack par1ItemStack){ + return true; + } + + + @Override + public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer aPlayer) { + thisPickaxe = itemstack; + localPlayer = aPlayer; + checkFacing(localPlayer.worldObj); + return super.onBlockStartBreak(itemstack, X, Y, Z, aPlayer); + } + public StaballoySpade(String unlocalizedName, ToolMaterial material) { + super(material); + this.setUnlocalizedName(unlocalizedName); + this.setTextureName(CORE.MODID + ":" + unlocalizedName); + this.FACING_HORIZONTAL=true; + this.setMaxStackSize(1); + this.setMaxDamage(3200); + } +} |