From ce2c49226486d10cbfce7e216e0582ab1a14d393 Mon Sep 17 00:00:00 2001 From: paulevsGitch Date: Thu, 19 Nov 2020 11:48:22 +0300 Subject: [PATCH] More leaves fixes --- src/main/java/ru/betterend/blocks/basis/BlockLeaves.java | 9 ++++++--- src/main/java/ru/betterend/registry/EndBlocks.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/ru/betterend/blocks/basis/BlockLeaves.java b/src/main/java/ru/betterend/blocks/basis/BlockLeaves.java index 94a7c43b..a00e8f35 100644 --- a/src/main/java/ru/betterend/blocks/basis/BlockLeaves.java +++ b/src/main/java/ru/betterend/blocks/basis/BlockLeaves.java @@ -7,6 +7,7 @@ import java.util.List; import com.google.common.collect.Lists; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; +import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -33,7 +34,8 @@ public class BlockLeaves extends LeavesBlock implements BlockPatterned, IRenderT .allowsSpawning((state, world, pos, type) -> { return false; }) .suffocates((state, world, pos) -> { return false; }) .blockVision((state, world, pos) -> { return false; }) - .materialColor(color)); + .materialColor(color) + .breakByTool(FabricToolTags.SHEARS)); this.sapling = sapling; } @@ -43,7 +45,8 @@ public class BlockLeaves extends LeavesBlock implements BlockPatterned, IRenderT .suffocates((state, world, pos) -> { return false; }) .blockVision((state, world, pos) -> { return false; }) .materialColor(color) - .luminance(light)); + .luminance(light) + .breakByTool(FabricToolTags.SHEARS)); this.sapling = sapling; } @@ -73,7 +76,7 @@ public class BlockLeaves extends LeavesBlock implements BlockPatterned, IRenderT public List getDroppedStacks(BlockState state, LootContext.Builder builder) { ItemStack tool = builder.get(LootContextParameters.TOOL); if (tool != null) { - if (tool.isEffectiveOn(state) || EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, tool) > 0) { + if (tool.getItem().isIn(FabricToolTags.SHEARS) || tool.isEffectiveOn(state) || EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, tool) > 0) { return Collections.singletonList(new ItemStack(this)); } int fortune = EnchantmentHelper.getLevel(Enchantments.FORTUNE, tool); diff --git a/src/main/java/ru/betterend/registry/EndBlocks.java b/src/main/java/ru/betterend/registry/EndBlocks.java index 637bad44..a8544312 100644 --- a/src/main/java/ru/betterend/registry/EndBlocks.java +++ b/src/main/java/ru/betterend/registry/EndBlocks.java @@ -114,7 +114,7 @@ public class EndBlocks { public static final WoodenMaterial LACUGROVE = new WoodenMaterial("lacugrove", MaterialColor.BROWN, MaterialColor.YELLOW); public static final Block DRAGON_TREE_SAPLING = registerBlock("dragon_tree_sapling", new BlockDragonTreeSapling()); - public static final Block DRAGON_TREE_LEAVES = registerBlock("dragon_tree_leaves", new BlockLeaves(LACUGROVE_SAPLING, MaterialColor.MAGENTA)); + public static final Block DRAGON_TREE_LEAVES = registerBlock("dragon_tree_leaves", new BlockLeaves(DRAGON_TREE_SAPLING, MaterialColor.MAGENTA)); public static final WoodenMaterial DRAGON_TREE = new WoodenMaterial("dragon_tree", MaterialColor.BLACK, MaterialColor.MAGENTA); public static final Block TENANEA_SAPLING = registerBlock("tenanea_sapling", new BlockTenaneaSapling());