removed dependency to terrestria which caused a crash on missing the mod

This commit is contained in:
Jottyfan
2024-01-19 23:50:45 +01:00
parent 7f97cd7060
commit 3e5f657092
4 changed files with 11 additions and 19 deletions

View File

@ -3,7 +3,6 @@ package de.jottyfan.minecraft.quickiefabric.tools;
import java.util.List;
import com.google.common.collect.Lists;
import com.terraformersmc.terraform.leaves.block.ExtendedLeavesBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -43,7 +42,15 @@ public class ToolRangeableAxe extends AxeItem implements ToolRangeable {
*/
private boolean isLeavesBlock(BlockState blockIn) {
boolean vanillaLeaves = blockIn.getBlock() instanceof LeavesBlock;
boolean terrestriaLeaves = blockIn.getBlock() instanceof ExtendedLeavesBlock;
boolean terrestriaLeaves = false;
try {
Class<?> extendedLeavesBlock = Class.forName("com.terraformersmc.terraform.leaves.block.ExtendedLeavesBlock");
terrestriaLeaves = extendedLeavesBlock.isInstance(blockIn.getBlock());
} catch (ClassNotFoundException e) {
// no terrestria mod available, so ignore this
// using this approach instead of the instanceof functionality, we don't need to refer to terrestria
// and omit a crash on installations that do not have or want terrestria available
}
boolean blockTagLeaves = blockIn.isIn(BlockTags.LEAVES);
return vanillaLeaves || terrestriaLeaves || blockTagLeaves;
}

View File

@ -3,7 +3,7 @@
"placement": [
{
"type": "minecraft:count",
"count": 25
"count": 12
},
{
"type": "minecraft:in_square"