aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/item/tool
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/core/item/tool
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/core/item/tool')
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java64
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java258
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java128
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java491
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyPickaxe.java509
-rw-r--r--src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoySpade.java466
6 files changed, 1036 insertions, 880 deletions
diff --git a/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java b/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java
index 9155c155db..7e00895b32 100644
--- a/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java
+++ b/src/Java/gtPlusPlus/core/item/tool/misc/SandstoneHammer.java
@@ -11,53 +11,44 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
-public class SandstoneHammer extends BaseItemWithDamageValue{
+public class SandstoneHammer extends BaseItemWithDamageValue {
- /* (non-Javadoc)
- * @see net.minecraft.item.Item#getColorFromItemStack(net.minecraft.item.ItemStack, int)
- */
- @Override
- public int getColorFromItemStack(ItemStack stack, 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);
this.setMaxDamage(2500);
}
- @SuppressWarnings({ "unchecked", "rawtypes" })
+ @SuppressWarnings({
+ "unchecked", "rawtypes"
+ })
@Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
- list.add(EnumChatFormatting.GRAY+"Allows you to craft sand from cobble, or sandstone from sand.");
+ 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;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.minecraft.item.Item#getColorFromItemStack(net.minecraft.item.
+ * ItemStack, int)
+ */
@Override
- public boolean getShareTag()
- {
- return true;
- }
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ // Figure Out Damage
- @Override
- public boolean hasContainerItem(ItemStack itemStack)
- {
- return true;
+ return super.getColorFromItemStack(stack, HEX_OxFFFFFF);
}
+
@Override
- public ItemStack getContainerItem(ItemStack itemStack)
- {
+ public ItemStack getContainerItem(final ItemStack itemStack) {
itemStack.setItemDamage(itemStack.getItemDamage() + 8);
return itemStack;
@@ -65,14 +56,23 @@ 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){
- return false;
+ public boolean getShareTag() {
+ return true;
+ }
+
+ @Override
+ public boolean hasContainerItem(final ItemStack itemStack) {
+ return true;
}
+ @Override
+ 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 19f6d42de8..b9736136bb 100644
--- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java
+++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiPickaxeBase.java
@@ -17,163 +17,189 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-public class MultiPickaxeBase extends StaballoyPickaxe{
-
- /* (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 MultiPickaxeBase(String unlocalizedName, ToolMaterial material, int materialDurability, int colour) {
+public class MultiPickaxeBase extends StaballoyPickaxe {
+
+ 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 MultiPickaxeBase(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 + ":" + "itemPickaxe");
- this.FACING_HORIZONTAL=true;
+ this.FACING_HORIZONTAL = true;
this.setMaxStackSize(1);
this.setMaxDamage(materialDurability);
this.colour = colour;
- this.materialName = material.name();
+ this.materialName = material.name();
this.setCreativeTab(AddToCreativeTab.tabTools);
- try {isValid = addRecipe();} catch (Throwable e){}
- if (colour != 0 && isValid){
- GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName));
+ try {
+ this.isValid = this.addRecipe();
+ }
+ catch (final Throwable e) {
+ }
+ if (colour != 0 && this.isValid) {
+ GameRegistry.registerItem(this, Utils.sanitizeString(unlocalizedName));
}
}
- /*
- *
- *
- *
- * Methods
- *
- *
- *
- */
-
- private boolean addRecipe(){
- String plateDense = "plateDense"+materialName;
- String rodLong = "stickLong"+materialName;
- String toolHammer = "craftingToolHardHammer";
- String toolWrench = "craftingToolWrench";
- String toolFile = "craftingToolFile";
- String toolScrewDriver = "craftingToolScrewdriver";
+ private boolean addRecipe() {
+ final String plateDense = "plateDense" + this.materialName;
+ final String rodLong = "stickLong" + this.materialName;
+ final String toolHammer = "craftingToolHardHammer";
+ final String toolWrench = "craftingToolWrench";
+ final String toolFile = "craftingToolFile";
+ final String toolScrewDriver = "craftingToolScrewdriver";
- if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)) {
return false;
}
- if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)) {
return false;
}
- RecipeUtils.recipeBuilder(
- plateDense, plateDense, plateDense,
- toolFile, rodLong, toolHammer,
- toolWrench, rodLong, toolScrewDriver,
- ItemUtils.getSimpleStack(this));
+ RecipeUtils.recipeBuilder(plateDense, plateDense, plateDense, toolFile, rodLong, toolHammer, toolWrench,
+ rodLong, toolScrewDriver, ItemUtils.getSimpleStack(this));
return true;
}
- public final String getMaterialName() {
- return materialName;
+ /*
+ *
+ *
+ *
+ * Methods
+ *
+ *
+ *
+ */
+
+ @SuppressWarnings("static-method")
+ 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) {
+ try {
+ final Block removalist = world.getBlock(X, Y, Z);
+ // Utils.LOG_WARNING(removalist.toString());
+
+ bHardness = removalist.getBlockHardness(world, X, Y, Z) * 100;
+ Utils.LOG_WARNING("Hardness: " + bHardness);
+
+ bDurabilityLoss = 100;
+ // Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss);
+
+ correctTool = this.canPickaxeBlock(removalist, world);
+ Utils.LOG_WARNING("" + correctTool);
+
+ if (!correctTool) {
+ return 0;
+ }
+
+ }
+ catch (final NullPointerException e) {
+
+ }
+ }
+ return bDurabilityLoss;
+ }
+
+ @Override
+ public void damageItem(final ItemStack item, final int damage, final EntityPlayer localPlayer) {
+ item.damageItem(damage, localPlayer);
+ }
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ if (this.colour == 0) {
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return this.colour;
+
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.
+ * ItemStack)
+ */
@Override
- public String getItemStackDisplayName(ItemStack iStack) {
+ public double getDurabilityForDisplay(final ItemStack stack) {
+ if (super.getDurabilityForDisplay(stack) > 0) {
+ return super.getDurabilityForDisplay(stack);
+ }
+ return 0;
+ }
+
+ @Override
+ public String getItemStackDisplayName(final ItemStack iStack) {
String name;
- if (getUnlocalizedName().toLowerCase().contains("wood")){
+ if (this.getUnlocalizedName().toLowerCase().contains("wood")) {
name = "Wooden";
}
- else if (getUnlocalizedName().toLowerCase().contains("cobblestone")){
+ else if (this.getUnlocalizedName().toLowerCase().contains("cobblestone")) {
name = "Cobblestone";
}
- else if (getUnlocalizedName().toLowerCase().contains("iron")){
+ else if (this.getUnlocalizedName().toLowerCase().contains("iron")) {
name = "Iron";
}
- else if (getUnlocalizedName().toLowerCase().contains("gold")){
+ else if (this.getUnlocalizedName().toLowerCase().contains("gold")) {
name = "Gold";
}
- else if (getUnlocalizedName().toLowerCase().contains("diamond")){
+ else if (this.getUnlocalizedName().toLowerCase().contains("diamond")) {
name = "Diamond";
}
else {
- name = materialName;
+ name = this.materialName;
}
- return name+" Multipickaxe";
+ return name + " Multipickaxe";
}
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (colour == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return colour;
-
+ public final String getMaterialName() {
+ return this.materialName;
}
- @SuppressWarnings("static-method")
- private float calculateDurabilityLoss(World world, int X, int Y, int Z){
- float bDurabilityLoss = 0;
- Boolean correctTool = false;
- float bHardness = 0;
- if (!world.isRemote){
- try {
- Block removalist = world.getBlock(X, Y, Z);
- //Utils.LOG_WARNING(removalist.toString());
-
- bHardness = removalist.getBlockHardness(world, X, Y, Z)*100;
- Utils.LOG_WARNING("Hardness: "+bHardness);
-
- bDurabilityLoss = 100;
- //Utils.LOG_WARNING("Durability Loss: "+bDurabilityLoss);
-
- correctTool = canPickaxeBlock(removalist, world);
- Utils.LOG_WARNING(""+correctTool);
-
- if (!correctTool){
- return 0;
- }
-
- } catch (NullPointerException e){
+ @Override
+ @SideOnly(Side.CLIENT)
+ public EnumRarity getRarity(final ItemStack par1ItemStack) {
+ return EnumRarity.uncommon;
+ }
- }
- }
- return bDurabilityLoss;
+ @Override
+ public boolean hasEffect(final ItemStack par1ItemStack) {
+ return false;
}
- //Should clear up blocks quicker if I chain it.
+ // Should clear up blocks quicker if I chain it.
@Override
- public void removeBlockAndDropAsItem(World world, int X, int Y, int Z, ItemStack heldItem){
- localWorld = world;
+ public void removeBlockAndDropAsItem(final World world, final int X, final int Y, final int Z,
+ final ItemStack heldItem) {
+ this.localWorld = world;
try {
- Block block = world.getBlock(X, Y, Z);
- float dur = calculateDurabilityLoss(world, X, Y, Z);
+ final Block block = world.getBlock(X, Y, Z);
+ final float dur = this.calculateDurabilityLoss(world, X, Y, Z);
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 (removalTool.equals("pickaxe") || UtilsMining.getBlockType(block)) {
+ if (this.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)){
+ if (heldItem.getItemDamage() <= heldItem.getMaxDamage() - dur) {
block.dropBlockAsItem(world, X, Y, Z, world.getBlockMetadata(X, Y, Z), 0);
world.setBlockToAir(X, Y, Z);
@@ -189,29 +215,15 @@ public class MultiPickaxeBase extends StaballoyPickaxe{
Utils.LOG_WARNING("Incorrect Tool for mining this block.");
}
}
- } catch (NullPointerException e){
-
}
- }
-
- public void damageItem(ItemStack item, int damage, EntityPlayer localPlayer){
- item.damageItem(damage, localPlayer);
- }
-
- public void setItemDamage(ItemStack item, int damage){
- item.setItemDamage(damage-1);
- }
+ catch (final NullPointerException e) {
-
- @Override
- @SideOnly(Side.CLIENT)
- public EnumRarity getRarity(ItemStack par1ItemStack){
- return EnumRarity.uncommon;
+ }
}
@Override
- public boolean hasEffect(ItemStack par1ItemStack){
- return false;
+ public void setItemDamage(final ItemStack item, final int damage) {
+ item.setItemDamage(damage - 1);
}
}
diff --git a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java
index 116820f06e..0c7eba48e8 100644
--- a/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java
+++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/MultiSpadeBase.java
@@ -14,101 +14,107 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
-public class MultiSpadeBase extends StaballoySpade{
+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 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) {
+ 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(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");
- this.FACING_HORIZONTAL=true;
+ 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));
+ try {
+ this.isValid = this.addRecipe();
+ }
+ catch (final Throwable e) {
+ }
+ if (colour != 0 && this.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 == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)){
+
+ private boolean addRecipe() {
+ final String plateDense = "plateDense" + this.materialName;
+ final String rodLong = "stickLong" + this.materialName;
+ final String toolHammer = "craftingToolHardHammer";
+ final String toolWrench = "craftingToolWrench";
+ final String toolFile = "craftingToolFile";
+ final String toolScrewDriver = "craftingToolScrewdriver";
+
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(rodLong, 1)) {
return false;
}
- if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)){
+ if (null == ItemUtils.getItemStackOfAmountFromOreDictNoBroken(plateDense, 1)) {
return false;
- }
-
- RecipeUtils.recipeBuilder(
- toolFile, plateDense, toolHammer,
- null, rodLong, null,
- toolWrench, rodLong, toolScrewDriver,
- ItemUtils.getSimpleStack(this));
-
+ }
+
+ RecipeUtils.recipeBuilder(toolFile, plateDense, toolHammer, null, rodLong, null, toolWrench, rodLong,
+ toolScrewDriver, ItemUtils.getSimpleStack(this));
+
return true;
}
-
- public final String getMaterialName() {
- return materialName;
+
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) {
+ if (this.colour == 0) {
+ return MathUtils.generateSingularRandomHexValue();
+ }
+ return this.colour;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see net.minecraft.item.Item#getDurabilityForDisplay(net.minecraft.item.
+ * ItemStack)
+ */
+ @Override
+ public double getDurabilityForDisplay(final ItemStack stack) {
+ if (super.getDurabilityForDisplay(stack) > 0) {
+ return super.getDurabilityForDisplay(stack);
+ }
+ return 0;
}
-
+
@Override
- public String getItemStackDisplayName(ItemStack iStack) {
+ public String getItemStackDisplayName(final ItemStack iStack) {
String name;
- if (getUnlocalizedName().toLowerCase().contains("wood")){
+ if (this.getUnlocalizedName().toLowerCase().contains("wood")) {
name = "Wooden";
}
else {
- name = materialName;
+ name = this.materialName;
}
- return "Big "+name+" Spade";
+ return "Big " + name + " Spade";
}
- @Override
- public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (colour == 0){
- return MathUtils.generateSingularRandomHexValue();
- }
- return colour;
- }
+ public final String getMaterialName() {
+ return this.materialName;
+ }
@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 f38c0db834..16852b5090 100644
--- a/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java
+++ b/src/Java/gtPlusPlus/core/item/tool/staballoy/StaballoyAxe.java
@@ -14,248 +14,353 @@ import net.minecraft.item.*;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-public class StaballoyAxe extends ItemAxe{
+public class StaballoyAxe extends ItemAxe {
public String mat;
- public StaballoyAxe(String unlocalizedName, ToolMaterial material) {
+ // EXPLODE TREE
+ byte[] tre = new byte[32000];
+
+ byte unchecked = 0;
+ byte needcheck = 1;
+ byte ignore = 2;
+ byte harvest = 3;
+ 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;
- return true;
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
+
+ @SuppressWarnings({
+ "unchecked", "rawtypes"
+ })
@Override
- public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, 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.");
+ 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 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;
-
- //LoonTools.log("Found uncuttable "+bit.getClass().getSimpleName());
+
+ private 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) {
+ 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);
+ */
+ final EntityItem entityitem = new EntityItem(wld, x + 0.5, y + 0.5, z + 0.5, stk);
+ entityitem.delayBeforeCanPickup = 10;
+ wld.spawnEntityInWorld(entityitem);
+ }
+ else {
+ bit.harvestBlock(wld, plr, x, y, z, met);
+ }
+ wld.setBlockToAir(x, y, z);
+ }
+
+ public 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) {
- 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);
- 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;
- //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;
- }else{
- if (!canIgnore(bit)) return 2;
+
+ 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;
+ 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;
+ 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 (!this.setcheck(x + xb, y + yb, z + zb)) {
+ return 3;
+ }
+ }
+ }
+ }
+ }
+ else {
+ if (!this.canIgnore(bit)) {
+ return 2;
+ }
}
}
return f;
}
-
- public int checkTree(World par1World,int xo,int yo,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 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;
- }
-
- 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;
- if (r==2) return 2;
- if (r==1) f=true;
+
+ 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;
+ 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;
+ 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 (!this.setcheck(x + xb, y + yb, z + zb)) {
+ return 3;
+ }
+ }
}
- }
- return 1;
- }
-
- private int check2(World par1World, int x, int y, int z, int xo, int yo,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);
- if (bit instanceof BlockLog){
- f=1;
- tre[o]=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;
- }else if (bit instanceof BlockLeavesBase){
- }else{
- if (!canIgnore(bit)) return 2;
+ }
+ }
+ else if (bit instanceof BlockLeavesBase) {
+ }
+ else {
+ if (!this.canIgnore(bit)) {
+ return 2;
+ }
}
}
return f;
}
- public int checkTree2(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 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;
+ for (f = true; f == true;) {
+ f = false;
+ for (int y = 0; y < 80; y++) {
+ for (int z = 0; z < 20; z++) {
+ for (int x = 0; x < 20; x++) {
+ 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 x=19;x>=0;x--){
- int r=check2(par1World,x,y,z,xo,yo,zo);
- if (r==2) 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 x = 19; x >= 0; x--) {
+ 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;
+ }
}
+ }
+ }
}
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++)
- 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);
-
- 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);
+
+ 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 x = 0; x < 20; x++) {
+ 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;
}
}
}
- }
+ }
- private void breakMushroom(World wld, Block bit, EntityPlayer plr, boolean silk, int x, int y, int z, int met) {
- if (silk){
- 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);
- entityitem.delayBeforeCanPickup = 10;
- wld.spawnEntityInWorld(entityitem);
- }else{
- bit.harvestBlock(wld, plr, x, y, z, met);
- }
- 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++)
- 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);
- if (bit instanceof BlockHugeMushroom){
- breakMushroom(par1World, bit, plr, silk, x+xo, y+yo, z+zo,met);
- }else{
- bit.harvestBlock(par1World, plr, x+xo, y+yo, z+zo,met);
- par1World.setBlockToAir(x+xo, y+yo, z+zo);
+ for (int y = 79; y >= 0; y--) {
+