diff --git a/src/main/scala/net/machinemuse/powersuits/powermodule/tool/AxeModule.java b/src/main/scala/net/machinemuse/powersuits/powermodule/tool/AxeModule.java index cce67c4..dea839e 100644 --- a/src/main/scala/net/machinemuse/powersuits/powermodule/tool/AxeModule.java +++ b/src/main/scala/net/machinemuse/powersuits/powermodule/tool/AxeModule.java @@ -1,5 +1,6 @@ package net.machinemuse.powersuits.powermodule.tool; +import com.google.common.collect.Sets; import net.machinemuse.api.IModularItem; import net.machinemuse.api.ModuleManager; import net.machinemuse.api.moduletrigger.IBlockBreakingModule; @@ -10,19 +11,21 @@ import net.machinemuse.utils.ElectricItemUtils; import net.machinemuse.utils.MuseCommonStrings; import net.machinemuse.utils.MuseItemUtils; import net.minecraft.block.Block; +import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; - import java.util.List; +import java.util.Set; public class AxeModule extends PowerModuleBase implements IBlockBreakingModule, IToggleableModule { public static final String MODULE_AXE = "Axe"; public static final String AXE_ENERGY_CONSUMPTION = "Axe Energy Consumption"; public static final String AXE_HARVEST_SPEED = "Axe Harvest Speed"; public static final String AXE_SEARCH_RADIUS = "Axe Search Radius"; + private static final Set HarvestableMaterials = Sets.newHashSet(new Material[]{Material.wood, Material.vine, Material.plants, Material.cactus, Material.gourd}); public AxeModule(List validItems) { super(validItems); @@ -62,7 +65,7 @@ public class AxeModule extends PowerModuleBase implements IBlockBreakingModule, @Override public boolean canHarvestBlock(ItemStack stack, Block block, int meta, EntityPlayer player) { - if (Items.iron_axe.canHarvestBlock(block, stack)) { + if (Items.iron_axe.canHarvestBlock(block, stack) || HarvestableMaterials.contains(block.getMaterial())) { if (ElectricItemUtils.getPlayerEnergy(player) > ModuleManager.computeModularProperty(stack, AXE_ENERGY_CONSUMPTION)) { return true; } diff --git a/src/main/scala/net/machinemuse/powersuits/powermodule/tool/DiamondPickUpgradeModule.java b/src/main/scala/net/machinemuse/powersuits/powermodule/tool/DiamondPickUpgradeModule.java index 12037ef..a0a6ddd 100644 --- a/src/main/scala/net/machinemuse/powersuits/powermodule/tool/DiamondPickUpgradeModule.java +++ b/src/main/scala/net/machinemuse/powersuits/powermodule/tool/DiamondPickUpgradeModule.java @@ -78,4 +78,4 @@ public class DiamondPickUpgradeModule extends PowerModuleBase implements IBlockB event.newSpeed = (float) ModuleManager.computeModularProperty(event.entityPlayer.getCurrentEquippedItem(), PickaxeModule.PICKAXE_HARVEST_SPEED); } -} +} \ No newline at end of file diff --git a/src/main/scala/net/machinemuse/powersuits/powermodule/tool/PickaxeModule.java b/src/main/scala/net/machinemuse/powersuits/powermodule/tool/PickaxeModule.java index 7ba6cee..ecb3ce9 100644 --- a/src/main/scala/net/machinemuse/powersuits/powermodule/tool/PickaxeModule.java +++ b/src/main/scala/net/machinemuse/powersuits/powermodule/tool/PickaxeModule.java @@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; import java.util.List; @@ -22,6 +23,7 @@ public class PickaxeModule extends PowerModuleBase implements IBlockBreakingModu public static final String MODULE_PICKAXE = "Pickaxe"; public static final String PICKAXE_HARVEST_SPEED = "Pickaxe Harvest Speed"; public static final String PICKAXE_ENERGY_CONSUMPTION = "Pickaxe Energy Consumption"; + public static final ItemStack ironShovel = new ItemStack(Items.iron_shovel); public PickaxeModule(List validItems) { super(validItems); @@ -86,4 +88,4 @@ public class PickaxeModule extends PowerModuleBase implements IBlockBreakingModu } return false; } -} +} \ No newline at end of file diff --git a/src/main/scala/net/machinemuse/powersuits/powermodule/tool/ShovelModule.java b/src/main/scala/net/machinemuse/powersuits/powermodule/tool/ShovelModule.java index 497e4b5..7a575aa 100644 --- a/src/main/scala/net/machinemuse/powersuits/powermodule/tool/ShovelModule.java +++ b/src/main/scala/net/machinemuse/powersuits/powermodule/tool/ShovelModule.java @@ -1,5 +1,6 @@ package net.machinemuse.powersuits.powermodule.tool; +import com.google.common.collect.Sets; import net.machinemuse.api.IModularItem; import net.machinemuse.api.ModuleManager; import net.machinemuse.api.moduletrigger.IBlockBreakingModule; @@ -10,18 +11,30 @@ import net.machinemuse.utils.ElectricItemUtils; import net.machinemuse.utils.MuseCommonStrings; import net.machinemuse.utils.MuseItemUtils; import net.minecraft.block.Block; +import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed; +import java.util.Arrays; import java.util.List; +import java.util.Set; public class ShovelModule extends PowerModuleBase implements IBlockBreakingModule, IToggleableModule { public static final String MODULE_SHOVEL = "Shovel"; public static final String SHOVEL_HARVEST_SPEED = "Shovel Harvest Speed"; public static final String SHOVEL_ENERGY_CONSUMPTION = "Shovel Energy Consumption"; + public static final ItemStack ironShovel = new ItemStack(Items.iron_shovel); + public static final ItemStack diamond_shovel = new ItemStack(Items.diamond_shovel); + private static final Set HarvestableMaterials = Sets.newHashSet(new Material[]{Material.sand, + Material.ground, + Material.snow, + Material.craftedSnow, + Material.snow, + Material.grass, + Material.clay}); public ShovelModule(List validItems) { super(validItems); @@ -59,7 +72,7 @@ public class ShovelModule extends PowerModuleBase implements IBlockBreakingModul @Override public boolean canHarvestBlock(ItemStack stack, Block block, int meta, EntityPlayer player) { - if (Items.iron_shovel.canHarvestBlock(block, stack)) { + if ((Items.iron_shovel.canHarvestBlock(block, stack)) || HarvestableMaterials.contains(block.getMaterial())) { if (ElectricItemUtils.getPlayerEnergy(player) > ModuleManager.computeModularProperty(stack, SHOVEL_ENERGY_CONSUMPTION)) { return true; }