diff --git a/src/main/java/techreborn/events/BlockBreakHandler.java b/src/main/java/techreborn/events/BlockBreakHandler.java index 818482e96..85ca2dd2c 100644 --- a/src/main/java/techreborn/events/BlockBreakHandler.java +++ b/src/main/java/techreborn/events/BlockBreakHandler.java @@ -92,10 +92,10 @@ public class BlockBreakHandler { @SubscribeEvent public void getBreakSpeedEvent(PlayerEvent.BreakSpeed event){ - if(event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem() == ModItems.ADVANCED_CHAINSAW){ + if(event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem() == ModItems.ADVANCED_CHAINSAW && event.getOriginalSpeed() > 1.0f){ BlockPos pos = event.getPos(); World worldIn = event.getEntityPlayer().world; - float speed = 2F; + float speed = 20F; int blocks = 0; for (int i = 1; i < 10; i++) { BlockPos nextPos = pos.up(i); @@ -104,7 +104,7 @@ public class BlockBreakHandler { blocks ++; } } - event.setNewSpeed(speed * blocks); + event.setNewSpeed(speed / blocks); } } } diff --git a/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java b/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java index afa7b4aab..d8ce82866 100644 --- a/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemAdvancedChainsaw.java @@ -50,10 +50,10 @@ public class ItemAdvancedChainsaw extends ItemChainsaw { public ItemAdvancedChainsaw() { super(ToolMaterial.DIAMOND, "techreborn.advancedChainsaw", ConfigTechReborn.AdvancedChainsawCharge, - 4.0F); + 1.0F); this.cost = 250; } - + @SideOnly(Side.CLIENT) @Override public void getSubItems(CreativeTabs par2CreativeTabs, NonNullList itemList) { @@ -81,11 +81,6 @@ public class ItemAdvancedChainsaw extends ItemChainsaw { return super.onBlockDestroyed(stack, worldIn, blockIn, pos, entityLiving); } - @Override - public float getDestroySpeed(ItemStack stack, IBlockState state) { - return super.getDestroySpeed(stack, state); - } - @Override public boolean canHarvestBlock(IBlockState blockIn) { return Items.DIAMOND_AXE.canHarvestBlock(blockIn); diff --git a/src/main/java/techreborn/items/tools/ItemChainsaw.java b/src/main/java/techreborn/items/tools/ItemChainsaw.java index 004be5ede..65348eef0 100644 --- a/src/main/java/techreborn/items/tools/ItemChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemChainsaw.java @@ -53,6 +53,7 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt public int maxCharge = 1; public int cost = 250; + public float poweredSpeed = 20F; public float unpoweredSpeed = 2.0F; public double transferLimit = 100; public boolean isBreaking = false; @@ -60,12 +61,11 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt public ItemChainsaw(ToolMaterial material, String unlocalizedName, int energyCapacity, float unpoweredSpeed) { super(material); - efficiency = 20F; setCreativeTab(TechRebornCreativeTab.instance); setMaxStackSize(1); setUnlocalizedName(unlocalizedName); this.maxCharge = energyCapacity; - this.unpoweredSpeed = unpoweredSpeed; + this.efficiency = unpoweredSpeed; this.addPropertyOverride(new ResourceLocation("techreborn:animated"), new IItemPropertyGetter() { @Override @@ -82,6 +82,16 @@ public class ItemChainsaw extends ItemAxe implements IEnergyItemInfo, IEnergyInt } }); } + + @Override + public float getDestroySpeed(ItemStack stack, IBlockState state) { + if (PoweredItem.canUseEnergy(cost, stack) && state.getBlock().isToolEffective("axe", state)) { + return this.poweredSpeed; + } + else { + return super.getDestroySpeed(stack, state); + } + } @Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState blockIn, BlockPos pos, diff --git a/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java b/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java index 15fc5b059..b0656d0f1 100644 --- a/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemDiamondChainsaw.java @@ -39,7 +39,7 @@ public class ItemDiamondChainsaw extends ItemChainsaw { public ItemDiamondChainsaw() { super(ToolMaterial.DIAMOND, "techreborn.diamondChainsaw", ConfigTechReborn.DiamondChainsawCharge, - 2.5F); + 1.0F); this.cost = 250; } diff --git a/src/main/java/techreborn/items/tools/ItemSteelChainsaw.java b/src/main/java/techreborn/items/tools/ItemSteelChainsaw.java index 5d47b4dab..4a39ad7c1 100644 --- a/src/main/java/techreborn/items/tools/ItemSteelChainsaw.java +++ b/src/main/java/techreborn/items/tools/ItemSteelChainsaw.java @@ -39,7 +39,7 @@ public class ItemSteelChainsaw extends ItemChainsaw { public ItemSteelChainsaw() { super(ToolMaterial.IRON, "techreborn.ironChainsaw", ConfigTechReborn.IronChainsawCharge, - 2.0F); + 0.5F); this.cost = 50; }