Chainsaw breaks leaves faster. Closes #2860
This commit is contained in:
parent
2f1413dfba
commit
b7e131870a
2 changed files with 15 additions and 10 deletions
|
@ -44,7 +44,7 @@ import techreborn.init.TRBlockEntities;
|
|||
import techreborn.init.TRContent;
|
||||
import techreborn.utils.RecipeUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import java.util.Optional;
|
||||
|
||||
public class IronFurnaceBlockEntity extends AbstractIronMachineBlockEntity implements BuiltScreenHandlerProvider {
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.enchantment.EnchantmentHelper;
|
|||
import net.minecraft.enchantment.Enchantments;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.tag.BlockTags;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -58,6 +59,10 @@ public class ChainsawItem extends AxeItem implements RcEnergyItem {
|
|||
this.referenceTool = referenceTool;
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
// AxeItem
|
||||
@Override
|
||||
public float getMiningSpeedMultiplier(ItemStack stack, BlockState state) {
|
||||
|
@ -69,6 +74,15 @@ public class ChainsawItem extends AxeItem implements RcEnergyItem {
|
|||
|
||||
// MiningToolItem
|
||||
@Override
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
// Fix for #2860
|
||||
if (state.isIn(BlockTags.LEAVES)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return referenceTool.isSuitableFor(state);
|
||||
}
|
||||
@Override
|
||||
public boolean postMine(ItemStack stack, World worldIn, BlockState blockIn, BlockPos pos, LivingEntity entityLiving) {
|
||||
if (worldIn.getRandom().nextInt(EnchantmentHelper.getLevel(Enchantments.UNBREAKING, stack) + 1) == 0) {
|
||||
tryUseEnergy(stack, cost);
|
||||
|
@ -106,11 +120,6 @@ public class ChainsawItem extends AxeItem implements RcEnergyItem {
|
|||
InitUtils.initPoweredItems(this, stacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSuitableFor(BlockState state) {
|
||||
return referenceTool.isSuitableFor(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemBarStep(ItemStack stack) {
|
||||
return ItemUtils.getPowerForDurabilityBar(stack);
|
||||
|
@ -141,8 +150,4 @@ public class ChainsawItem extends AxeItem implements RcEnergyItem {
|
|||
public long getEnergyMaxOutput() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getCost() {
|
||||
return cost;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue