repaired leaves cutting
This commit is contained in:
parent
1c36640cb0
commit
207d201785
@ -3,14 +3,15 @@ package de.jottyfan.minecraft.quickiefabric.tools;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.terraformersmc.terraform.leaves.block.ExtendedLeavesBlock;
|
||||
|
||||
import de.jottyfan.minecraft.quickiefabric.help.ClassHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.item.AxeItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ToolMaterial;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -34,13 +35,22 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable {
|
||||
return this.miningSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* check if the block is a leaves block
|
||||
*
|
||||
* @param blockIn the block
|
||||
* @return true or false
|
||||
*/
|
||||
private boolean isLeavesBlock(BlockState blockIn) {
|
||||
boolean vanillaLeaves = blockIn.getBlock() instanceof LeavesBlock;
|
||||
boolean terrestriaLeaves = blockIn.getBlock() instanceof ExtendedLeavesBlock;
|
||||
boolean blockTagLeaves = blockIn.isIn(BlockTags.LEAVES);
|
||||
return vanillaLeaves || terrestriaLeaves || blockTagLeaves;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBreakNeighbors(BlockState blockIn) {
|
||||
Class<?> c = blockIn.getBlock().getClass();
|
||||
return super.isSuitableFor(blockIn)
|
||||
|| blockIn.getBlock() instanceof LeavesBlock // works the old way
|
||||
|| ClassHelper.isInstanceOf(c, "LeavesBlock") // doesn't work, but why?
|
||||
|| ClassHelper.isInstanceOf(c, "ExtendedLeavesBlock"); // from terrestria
|
||||
return super.isSuitableFor(blockIn) || isLeavesBlock(blockIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user