diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core/item/tool')
6 files changed, 524 insertions, 447 deletions
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java b/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java index 108ac4b83d..b78f81aa98 100644 --- a/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java +++ b/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java @@ -1,16 +1,15 @@ package gtPlusPlus.core.item.tool.misc; -import gtPlusPlus.core.item.base.BaseItemWithDamageValue; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.item.base.BaseItemWithDamageValue; +import gtPlusPlus.core.lib.CORE; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class SandstoneHammer extends BaseItemWithDamageValue{ @@ -18,14 +17,14 @@ public class SandstoneHammer extends BaseItemWithDamageValue{ * @see net.minecraft.item.Item#getColorFromItemStack(net.minecraft.item.ItemStack, int) */ @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { //Figure Out Damage return super.getColorFromItemStack(stack, HEX_OxFFFFFF); } - public SandstoneHammer(String unlocalizedName) { + public SandstoneHammer(final String unlocalizedName) { super(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); this.setMaxStackSize(1); @@ -34,13 +33,13 @@ public class SandstoneHammer extends BaseItemWithDamageValue{ @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GRAY+"Allows you to craft sand from cobble, or sandstone from sand."); super.addInformation(stack, aPlayer, list, bool); - } + } @Override - public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack) + public boolean doesContainerItemLeaveCraftingGrid(final ItemStack itemStack) { return false; } @@ -52,12 +51,12 @@ public class SandstoneHammer extends BaseItemWithDamageValue{ } @Override - public boolean hasContainerItem(ItemStack itemStack) + public boolean hasContainerItem(final ItemStack itemStack) { return true; } @Override - public ItemStack getContainerItem(ItemStack itemStack) + public ItemStack getContainerItem(final ItemStack itemStack) { itemStack.setItemDamage(itemStack.getItemDamage() + 8); @@ -66,12 +65,12 @@ public class SandstoneHammer extends BaseItemWithDamageValue{ @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.uncommon; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return false; } diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java index 55584faf2d..6499dc696b 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java @@ -1,5 +1,10 @@ package gtPlusPlus.core.item.tool.staballoy; +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -14,19 +19,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; import net.minecraft.world.World; -import java.util.List; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - public class MultiPickaxeBase extends StaballoyPickaxe{ /* (non-Javadoc) * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) */ @Override - public double getDurabilityForDisplay(ItemStack stack) { + public double getDurabilityForDisplay(final ItemStack stack) { if (super.getDurabilityForDisplay(stack) > 0){ return super.getDurabilityForDisplay(stack);} return 0; @@ -38,7 +37,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ public boolean isValid = true; private final Pair<?, ?> enchantment; - public MultiPickaxeBase(String unlocalizedName, ToolMaterial material, int materialDurability, int colour, Object enchant) { + public MultiPickaxeBase(final String unlocalizedName, final ToolMaterial material, final int materialDurability, final int colour, final Object enchant) { super(Utils.sanitizeString(unlocalizedName), material); this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName)); //this.setTextureName(CORE.MODID + ":" + "itemPickaxe"); @@ -50,13 +49,13 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ this.materialName = material.name(); this.displayName = unlocalizedName; this.setCreativeTab(AddToCreativeTab.tabTools); - miningLevel = material.getHarvestLevel(); - - - + this.miningLevel = material.getHarvestLevel(); + + + if (enchant != null){ if (enchant instanceof Pair){ - this.enchantment = (Pair<?, ?>) enchant; + this.enchantment = (Pair<?, ?>) enchant; } else { this.enchantment = null; @@ -65,38 +64,38 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ else { this.enchantment = null; } - - try {isValid = addRecipe();} catch (Throwable e){} - if (colour != 0 && isValid && materialDurability > 10000){ + + try {this.isValid = this.addRecipe();} catch (final Throwable e){} + if ((colour != 0) && this.isValid && (materialDurability > 10000)){ if (GameRegistry.findItem(CORE.MODID, Utils.sanitizeString(unlocalizedName)) == null){ - GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); - } + GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); + } } } /* - * - * - * - * Methods - * - * - * + * + * + * + * Methods + * + * + * */ private boolean addRecipe(){ - - String cleanName = Utils.sanitizeString(materialName); - - String plateDense = "plateDense"+cleanName; - String plateDouble = "plateDouble"+cleanName; - String rodLong = "stickLong"+cleanName; - String toolHammer = "craftingToolHardHammer"; - String toolWrench = "craftingToolWrench"; - String toolFile = "craftingToolFile"; - String toolScrewDriver = "craftingToolScrewdriver"; - + + final String cleanName = Utils.sanitizeString(this.materialName); + + final String plateDense = "plateDense"+cleanName; + final String plateDouble = "plateDouble"+cleanName; + final String rodLong = "stickLong"+cleanName; + final String toolHammer = "craftingToolHardHammer"; + final String toolWrench = "craftingToolWrench"; + final String toolFile = "craftingToolFile"; + final String toolScrewDriver = "craftingToolScrewdriver"; + if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ Utils.LOG_WARNING("stickLong of "+cleanName+" does not exist."); return false; @@ -127,12 +126,12 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ } public final String getMaterialName() { - return materialName; + return this.materialName; } @Override - public String getItemStackDisplayName(ItemStack iStack) { - return displayName; + public String getItemStackDisplayName(final ItemStack iStack) { + return this.displayName; /*String name; if (getUnlocalizedName().toLowerCase().contains("wood")){ name = "Wooden"; @@ -155,22 +154,22 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0){ return MathUtils.generateSingularRandomHexValue(); } - return colour; + return this.colour; } @SuppressWarnings("static-method") - private float calculateDurabilityLoss(World world, int X, int Y, int Z){ + private float calculateDurabilityLoss(final World world, final int X, final int Y, final int Z){ float bDurabilityLoss = 0; Boolean correctTool = false; float bHardness = 0; - if (!world.isRemote){ + if (!world.isRemote){ try { - Block removalist = world.getBlock(X, Y, Z); + final Block removalist = world.getBlock(X, Y, Z); //Utils.LOG_WARNING(removalist.toString()); bHardness = removalist.getBlockHardness(world, X, Y, Z)*100; @@ -179,14 +178,14 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ bDurabilityLoss = 100; //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss); - correctTool = canPickaxeBlock(removalist, world, new int[]{X,Y,Z}); + correctTool = this.canPickaxeBlock(removalist, world, new int[]{X,Y,Z}); Utils.LOG_WARNING(""+correctTool); if (!correctTool){ return 0; } - } catch (NullPointerException e){ + } catch (final NullPointerException e){ } } @@ -204,7 +203,7 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ String removalTool = ""; removalTool = block.getHarvestTool(1); - if (removalTool.equals("pickaxe") || UtilsMining.getBlockType(block, world, new int[]{X,Y,Z}, miningLevel)){ + if (removalTool.equals("pickaxe") || UtilsMining.getBlockType(block, world, new int[]{X,Y,Z}, miningLevel)){ if (canPickaxeBlock(block, world, new int[]{X,Y,Z})){ if((block != Blocks.bedrock) && (block.getBlockHardness(world, X, Y, Z) != -1) && (block.getBlockHardness(world, X, Y, Z) <= 100) && (block != Blocks.water) && (block != Blocks.lava)){ @@ -229,70 +228,72 @@ public class MultiPickaxeBase extends StaballoyPickaxe{ } }*/ - public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){ + @Override + public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer){ item.damageItem(damage, localPlayer); } - public void setItemDamage(ItemStack item, int damage){ + @Override + public void setItemDamage(final ItemStack item, final int damage){ item.setItemDamage(damage-1); } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.uncommon; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return false; } @Override - public void onCreated(ItemStack mThisItem, World mWorld, EntityPlayer mPlayer) { + public void onCreated(final ItemStack mThisItem, final World mWorld, final EntityPlayer mPlayer) { Enchantment enchant = null; int enchantmentLevel = 0; - Pair<?, ?> Y = this.enchantment; + final Pair<?, ?> Y = this.enchantment; if (Y != null){ if (Y.getKey() != null){ - enchant = (Enchantment) ((Pair<?, ?>) this.enchantment).getKey(); + enchant = (Enchantment) ((Pair<?, ?>) this.enchantment).getKey(); } if (Y.getValue() != null){ - enchantmentLevel = (byte) ((Pair<?, ?>) this.enchantment).getValue(); + enchantmentLevel = (byte) ((Pair<?, ?>) this.enchantment).getValue(); } } - ItemStack itemToEnchant = mThisItem; - if (enchant != null && enchantmentLevel != 0 && enchantmentLevel >= 1){ + final ItemStack itemToEnchant = mThisItem; + if ((enchant != null) && (enchantmentLevel != 0) && (enchantmentLevel >= 1)){ itemToEnchant.addEnchantment(enchant, enchantmentLevel); } super.onCreated(itemToEnchant, mWorld, mPlayer); } @Override - public void getSubItems(Item mItem, CreativeTabs mCreativeTab, List mList) { + public void getSubItems(final Item mItem, final CreativeTabs mCreativeTab, final List mList) { Enchantment enchant = null; int enchantmentLevel = 0; - Pair<?, ?> Y = this.enchantment; + final Pair<?, ?> Y = this.enchantment; if (Y != null){ if (Y.getKey() != null){ - enchant = (Enchantment) ((Pair<?, ?>) this.enchantment).getKey(); + enchant = (Enchantment) ((Pair<?, ?>) this.enchantment).getKey(); } if (Y.getValue() != null){ - enchantmentLevel = (byte) ((Pair<?, ?>) this.enchantment).getValue(); + enchantmentLevel = (byte) ((Pair<?, ?>) this.enchantment).getValue(); } } - - Item thisItem = mItem; - ItemStack itemToEnchant = ItemUtils.getSimpleStack(thisItem); - if (enchant != null && enchantmentLevel != 0 && enchantmentLevel >= 1){ + + final Item thisItem = mItem; + final ItemStack itemToEnchant = ItemUtils.getSimpleStack(thisItem); + if ((enchant != null) && (enchantmentLevel != 0) && (enchantmentLevel >= 1)){ itemToEnchant.addEnchantment(enchant, enchantmentLevel); mList.add(itemToEnchant); } else { - mList.add(new ItemStack(thisItem, 1, 0)); + mList.add(new ItemStack(thisItem, 1, 0)); } - + } } diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java index 627108f509..175c212a6c 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java @@ -1,5 +1,8 @@ package gtPlusPlus.core.item.tool.staballoy; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; @@ -8,9 +11,6 @@ import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.recipe.RecipeUtils; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class MultiSpadeBase extends StaballoySpade{ @@ -18,7 +18,7 @@ public class MultiSpadeBase extends StaballoySpade{ * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.ItemStack) */ @Override - public double getDurabilityForDisplay(ItemStack stack) { + public double getDurabilityForDisplay(final ItemStack stack) { if (super.getDurabilityForDisplay(stack) > 0){ return super.getDurabilityForDisplay(stack);} return 0; @@ -29,7 +29,7 @@ public class MultiSpadeBase extends StaballoySpade{ protected final String displayName; public boolean isValid = true; - public MultiSpadeBase(String unlocalizedName, ToolMaterial material, int materialDurability, int colour) { + public MultiSpadeBase(final String unlocalizedName, final ToolMaterial material, final int materialDurability, final int colour) { super(Utils.sanitizeString(unlocalizedName), material); this.setUnlocalizedName(Utils.sanitizeString(unlocalizedName)); //this.setTextureName(CORE.MODID + ":" + "itemShovel"); @@ -41,23 +41,23 @@ public class MultiSpadeBase extends StaballoySpade{ this.materialName = material.name(); this.displayName = unlocalizedName; this.setCreativeTab(AddToCreativeTab.tabTools); - try {isValid = addRecipe();} catch (Throwable e){} - if (colour != 0 && isValid){ + try {this.isValid = this.addRecipe();} catch (final Throwable e){} + if ((colour != 0) && this.isValid){ if (GameRegistry.findItem(CORE.MODID, Utils.sanitizeString(unlocalizedName)) == null){ - GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); + GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName)); } } } private boolean addRecipe(){ - String cleanName = Utils.sanitizeString(materialName); - String plateDense = "plateDense"+cleanName; - String plateDouble = "plateDouble"+cleanName; - String rodLong = "stickLong"+cleanName; - String toolHammer = "craftingToolHardHammer"; - String toolWrench = "craftingToolWrench"; - String toolFile = "craftingToolFile"; - String toolScrewDriver = "craftingToolScrewdriver"; + final String cleanName = Utils.sanitizeString(this.materialName); + final String plateDense = "plateDense"+cleanName; + final String plateDouble = "plateDouble"+cleanName; + final String rodLong = "stickLong"+cleanName; + final String toolHammer = "craftingToolHardHammer"; + final String toolWrench = "craftingToolWrench"; + final String toolFile = "craftingToolFile"; + final String toolScrewDriver = "craftingToolScrewdriver"; if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){ return false; @@ -73,7 +73,7 @@ public class MultiSpadeBase extends StaballoySpade{ return true; } return false; - } + } RecipeUtils.recipeBuilder( toolFile, plateDense, toolHammer, @@ -85,12 +85,12 @@ public class MultiSpadeBase extends StaballoySpade{ } public final String getMaterialName() { - return materialName; + return this.materialName; } @Override - public String getItemStackDisplayName(ItemStack iStack) { - return displayName; + public String getItemStackDisplayName(final ItemStack iStack) { + return this.displayName; /*String name; if (getUnlocalizedName().toLowerCase().contains("wood")){ name = "Wooden"; @@ -101,21 +101,21 @@ public class MultiSpadeBase extends StaballoySpade{ } @Override - public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) { - if (colour == 0){ + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + if (this.colour == 0){ return MathUtils.generateSingularRandomHexValue(); } - return colour; - } + return this.colour; + } @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.uncommon; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return false; } diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java index 301671fc24..7ec396a8b1 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java @@ -1,9 +1,10 @@ package gtPlusPlus.core.item.tool.staballoy; -import gtPlusPlus.core.lib.CORE; - import java.util.List; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.lib.CORE; import net.minecraft.block.*; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.EntityLivingBase; @@ -12,179 +13,249 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class StaballoyAxe extends ItemAxe{ public String mat; - public StaballoyAxe(String unlocalizedName, ToolMaterial material) { + public StaballoyAxe(final String unlocalizedName, final ToolMaterial material) { super(material); this.setUnlocalizedName(unlocalizedName); this.setTextureName(CORE.MODID + ":" + unlocalizedName); } - + // EXPLODE TREE byte[] tre= new byte[32000]; byte unchecked=0; byte needcheck=1; byte ignore =2; byte harvest =3; - - private boolean setcheck(int x, int y, int z) { - if(x<0 || x>19 || z<0 || z>19 || y<0 || y>79) return false; - int o=x+z*20+y*400; - if (tre[o]==unchecked) tre[o]=needcheck; + + private boolean setcheck(final int x, final int y, final int z) { + if((x<0) || (x>19) || (z<0) || (z>19) || (y<0) || (y>79)) { + return false; + } + final int o=x+(z*20)+(y*400); + if (this.tre[o]==this.unchecked) { + this.tre[o]=this.needcheck; + } return true; } - + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { list.add(EnumChatFormatting.GOLD+"Fells entire trees in a single swipe!.."); list.add(EnumChatFormatting.GRAY+"Ask Alkalus for new trees to be supported."); super.addInformation(stack, aPlayer, list, bool); } - - public static boolean canIgnore(Block bit){ - if (bit instanceof BlockAir)return true; - if (bit instanceof BlockGrass)return true; - if (bit instanceof BlockSand)return true; - if (bit instanceof BlockDirt)return true; - if (bit instanceof BlockCocoa)return true; - if (bit instanceof BlockVine)return true; - if (bit instanceof BlockMushroom)return true; - if (bit instanceof BlockSnow)return true; - if (bit instanceof BlockSnowBlock)return true; - if (bit instanceof BlockFlower)return true; - if (bit instanceof BlockTallGrass)return true; - if (bit instanceof BlockDoublePlant)return true; - + + public static boolean canIgnore(final Block bit){ + if (bit instanceof BlockAir) { + return true; + } + if (bit instanceof BlockGrass) { + return true; + } + if (bit instanceof BlockSand) { + return true; + } + if (bit instanceof BlockDirt) { + return true; + } + if (bit instanceof BlockCocoa) { + return true; + } + if (bit instanceof BlockVine) { + return true; + } + if (bit instanceof BlockMushroom) { + return true; + } + if (bit instanceof BlockSnow) { + return true; + } + if (bit instanceof BlockSnowBlock) { + return true; + } + if (bit instanceof BlockFlower) { + return true; + } + if (bit instanceof BlockTallGrass) { + return true; + } + if (bit instanceof BlockDoublePlant) { + return true; + } + //LoonTools.log("Found uncuttable "+bit.getClass().getSimpleName()); return false; } - - private int check(World par1World, int x, int y, int z, int xo, int yo,int zo) { + + private int check(final World par1World, final int x, final int y, final int z, final int xo, final int yo,final int zo) { int f=0; - int o=x+z*20+y*400; - if (tre[o]==needcheck){ - tre[o]=ignore; - Block bit = par1World.getBlock(x+xo, y+yo, z+zo); + final int o=x+(z*20)+(y*400); + if (this.tre[o]==this.needcheck){ + this.tre[o]=this.ignore; + final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); if ((bit instanceof BlockLog)||(bit instanceof BlockLeavesBase)||(bit instanceof BlockHugeMushroom) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ f=1; - tre[o]=harvest; + this.tre[o]=this.harvest; //if (bit instanceof BlockLog){ // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" "); //} - for(int xb=-1;xb<2;xb++) - for(int yb=-1;yb<2;yb++) - for(int zb=-1;zb<2;zb++) - if (!setcheck(x+xb,y+yb,z+zb))return 3; + for(int xb=-1;xb<2;xb++) { + for(int yb=-1;yb<2;yb++) { + for(int zb=-1;zb<2;zb++) { + if (!this.setcheck(x+xb,y+yb,z+zb)) { + return 3; + } + } + } + } }else{ - if (!canIgnore(bit)) return 2; + if (!canIgnore(bit)) { + return 2; + } } } return f; } - - public int checkTree(World par1World,int xo,int yo,int zo){ + + public int checkTree(final World par1World,final int xo,final int yo,final int zo){ boolean f; for (f=true;f==true;){ f=false; - for (int y=0;y<80;y++) - for(int z=0;z<20;z++) + for (int y=0;y<80;y++) { + for(int z=0;z<20;z++) { for(int x=0;x<20;x++){ - int r=check(par1World,x,y,z,xo,yo,zo); - if (r==3) return 3; - if (r==2) return 2; - if (r==1) f=true; + final int r=this.check(par1World,x,y,z,xo,yo,zo); + if (r==3) { + return 3; + } + if (r==2) { + return 2; + } + if (r==1) { + f=true; + } } - - for (int y=79;y>=0;y--) - for(int z=19;z>=0;z--) + } + } + + for (int y=79;y>=0;y--) { + for(int z=19;z>=0;z--) { for(int x=19;x>=0;x--){ - int r=check(par1World,x,y,z,xo,yo,zo); - if (r==2) return 3; + final int r=this.check(par1World,x,y,z,xo,yo,zo); + if (r==2) { + return 3; + } //if (r==2) return 2; - if (r==1) f=true; + if (r==1) { + f=true; + } } + } + } } return 1; } - - private int check2(World par1World, int x, int y, int z, int xo, int yo,int zo) { + + private int check2(final World par1World, final int x, final int y, final int z, final int xo, final int yo,final int zo) { int f=0; - int o=x+z*20+y*400; - if (tre[o]==needcheck){ - tre[o]=ignore; - Block bit = par1World.getBlock(x+xo, y+yo, z+zo); + final int o=x+(z*20)+(y*400); + if (this.tre[o]==this.needcheck){ + this.tre[o]=this.ignore; + final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); if (bit instanceof BlockLog){ f=1; - tre[o]=harvest; + this.tre[o]=this.harvest; //if (bit instanceof BlockLog){ // LoonTools.log("^ Found log @ "+x+xo+" "+y+yo+" "+z+zo+" "); //} - for(int xb=-1;xb<2;xb++) - for(int yb=-1;yb<2;yb++) - for(int zb=-1;zb<2;zb++) - if (!setcheck(x+xb,y+yb,z+zb))return 3; + for(int xb=-1;xb<2;xb++) { + for(int yb=-1;yb<2;yb++) { + for(int zb=-1;zb<2;zb++) { + if (!this.setcheck(x+xb,y+yb,z+zb)) { + return 3; + } + } + } + } }else if (bit instanceof BlockLeavesBase){ }else{ - if (!canIgnore(bit)) return 2; + if (!canIgnore(bit)) { + return 2; + } } } return f; } - public int checkTree2(World par1World,int xo,int yo,int zo){ + public int checkTree2(final World par1World,final int xo,final int yo,final int zo){ boolean f; for (f=true;f==true;){ f=false; - for (int y=0;y<80;y++) - for(int z=0;z<20;z++) + for (int y=0;y<80;y++) { + for(int z=0;z<20;z++) { for(int x=0;x<20;x++){ - int r=check2(par1World,x,y,z,xo,yo,zo); - if (r==3) return 3; - if (r==2) return 2; - if (r==1) f=true; + final int r=this.check2(par1World,x,y,z,xo,yo,zo); + if (r==3) { + return 3; + } + if (r==2) { + return 2; + } + if (r==1) { + f=true; + } } - - for (int y=79;y>=0;y--) - for(int z=19;z>=0;z--) + } + } + + for (int y=79;y>=0;y--) { + for(int z=19;z>=0;z--) { for(int x=19;x>=0;x--){ - int r=check2(par1World,x,y,z,xo,yo,zo); - if (r==2) return 3; + final int r=this.check2(par1World,x,y,z,xo,yo,zo); + if (r==2) { + return 3; + } //if (r==2) return 2; - if (r==1) f=true; + if (r==1) { + f=true; + } } + } + } } return 1; } - - public void exploadTree(World par1World,int xo,int yo,int zo, EntityPlayer plr){ - for (int y=0;y<80;y++) - for(int z=0;z<20;z++) + + public void exploadTree(final World par1World,final int xo,final int yo,final int zo, final EntityPlayer plr){ + for (int y=0;y<80;y++) { + for(int z=0;z<20;z++) { for(int x=0;x<20;x++){ - int o=x+z*20+y*400; - if (tre[o]==harvest){ - Block bit = par1World.getBlock(x+xo, y+yo, z+zo); - int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); - + final int o=x+(z*20)+(y*400); + if (this.tre[o]==this.harvest){ + final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); + final int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); + if ((bit instanceof BlockLog)||(bit instanceof BlockLeavesBase) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ bit.harvestBlock(par1World, plr, x+xo, y+yo, z+zo,met); par1World.setBlockToAir(x+xo, y+yo, z+zo); } } } + } + } } - private static void breakMushroom(World wld, Block bit, EntityPlayer plr, boolean silk, int x, int y, int z, int met) { + private static void breakMushroom(final World wld, final Block bit, final EntityPlayer plr, final boolean silk, final int x, final int y, final int z, final int met) { if (silk){ - ItemStack stk = null; //TODO + final ItemStack stk = null; //TODO /*if (bit==Blocks.brown_mushroom_block) stk = new ItemStack(LoonToolItems.brown_mushroom_block,1,met); else if (bit==Blocks.red_mushroom_block) stk = new ItemStack(LoonToolItems.red_mushroom_block,1,met); else stk = new ItemStack(bit,1,met);*/ - EntityItem entityitem = new EntityItem(wld, x+0.5, y+0.5, z+0.5, stk); + final EntityItem entityitem = new EntityItem(wld, x+0.5, y+0.5, z+0.5, stk); entityitem.delayBeforeCanPickup = 10; wld.spawnEntityInWorld(entityitem); }else{ @@ -192,15 +263,15 @@ public class StaballoyAxe extends ItemAxe{ } wld.setBlockToAir(x, y, z); } - - public void exploadMushroom(World par1World,int xo,int yo,int zo, EntityPlayer plr, boolean silk){ - for (int y=0;y<80;y++) - for(int z=0;z<20;z++) + + public void exploadMushroom(final World par1World,final int xo,final int yo,final int zo, final EntityPlayer plr, final boolean silk){ + for (int y=0;y<80;y++) { + for(int z=0;z<20;z++) { for(int x=0;x<20;x++){ - int o=x+z*20+y*400; - if (tre[o]==harvest){ - Block bit = par1World.getBlock(x+xo, y+yo, z+zo); - int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); + final int o=x+(z*20)+(y*400); + if (this.tre[o]==this.harvest){ + final Block bit = par1World.getBlock(x+xo, y+yo, z+zo); + final int met = par1World.getBlockMetadata(x+xo, y+yo, z+zo); if (bit instanceof BlockHugeMushroom){ breakMushroom(par1World, bit, plr, silk, x+xo, y+yo, z+zo,met); }else{ @@ -209,54 +280,62 @@ public class StaballoyAxe extends ItemAxe{ } } } + } + } } - + @Override - public boolean onBlockDestroyed(ItemStack itm, World wld,Block blk, int x, int y,int z, EntityLivingBase plr) { + public boolean onBlockDestroyed(final ItemStack itm, final World wld,final Block blk, final int x, final int y,final int z, final EntityLivingBase plr) { if (!wld.isRemote){ - Block bit = wld.getBlock(x, y, z); - boolean silk=EnchantmentHelper.getSilkTouchModifier(plr); + final Block bit = wld.getBlock(x, y, z); + final boolean silk=EnchantmentHelper.getSilkTouchModifier(plr); if ((bit instanceof BlockHugeMushroom)){ - for (int n=0;n<32000;n++) tre[n]=unchecked; - int met = wld.getBlockMetadata(x, y, z); + for (int n=0;n<32000;n++) { + this.tre[n]=this.unchecked; + } + final int met = wld.getBlockMetadata(x, y, z); breakMushroom(wld, bit, (EntityPlayer) plr, silk, x, y, z,met); wld.setBlockToAir(x,y,z); - tre[2210]=needcheck; - if (checkTree(wld,x-10,y-4,z-10)==1){ - exploadMushroom(wld,x-10,y-4,z-10,(EntityPlayer) plr,silk); + this.tre[2210]=this.needcheck; + if (this.checkTree(wld,x-10,y-4,z-10)==1){ + this.exploadMushroom(wld,x-10,y-4,z-10,(EntityPlayer) plr,silk); } } - - if (bit instanceof BlockLog || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ + + if ((bit instanceof BlockLog) || (bit.getUnlocalizedName().toLowerCase().contains("log")) || (bit.getUnlocalizedName().toLowerCase().contains("wood"))){ //LoonTools.log("cutting tree @ "+x+" "+y+" "+z+" "); - for (int n=0;n<32000;n++) tre[n]=unchecked; - int met = wld.getBlockMetadata(x, y, z); + for (int n=0;n<32000;n++) { + this.tre[n]=this.unchecked; + } + final int met = wld.getBlockMetadata(x, y, z); bit.harvestBlock(wld, (EntityPlayer) plr, x, y, z,met); wld.setBlockToAir(x,y,z); - tre[2210]=needcheck; - if (checkTree(wld,x-10,y-4,z-10)==1){ - exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); + this.tre[2210]=this.needcheck; + if (this.checkTree(wld,x-10,y-4,z-10)==1){ + this.exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); }else{ - for (int n=0;n<32000;n++) tre[n]=unchecked; - tre[2210]=needcheck; - if (checkTree2(wld,x-10,y-4,z-10)==1){ - exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); + for (int n=0;n<32000;n++) { + this.tre[n]=this.unchecked; + } + this.tre[2210]=this.needcheck; + if (this.checkTree2(wld,x-10,y-4,z-10)==1){ + this.exploadTree(wld,x-10,y-4,z-10,(EntityPlayer) plr); } } } } return super.onBlockDestroyed(itm, wld, blk, x, y, z, plr); } - + @Override @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ + public EnumRarity getRarity(final ItemStack par1ItemStack){ return EnumRarity.rare; } @Override - public boolean hasEffect(ItemStack par1ItemStack){ + public boolean hasEffect(final ItemStack par1ItemStack){ return true; } }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java index 81943536ae..64a53a4eb7 100644 --- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java +++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java @@ -1,11 +1,12 @@ package gtPlusPlus.core.item.tool.staballoy; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; |
