More leaves fixes

This commit is contained in:
paulevsGitch 2020-11-19 11:48:22 +03:00
parent 6d46769eda
commit ce2c492264
2 changed files with 7 additions and 4 deletions

View file

@ -7,6 +7,7 @@ import java.util.List;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; 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.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@ -33,7 +34,8 @@ public class BlockLeaves extends LeavesBlock implements BlockPatterned, IRenderT
.allowsSpawning((state, world, pos, type) -> { return false; }) .allowsSpawning((state, world, pos, type) -> { return false; })
.suffocates((state, world, pos) -> { return false; }) .suffocates((state, world, pos) -> { return false; })
.blockVision((state, world, pos) -> { return false; }) .blockVision((state, world, pos) -> { return false; })
.materialColor(color)); .materialColor(color)
.breakByTool(FabricToolTags.SHEARS));
this.sapling = sapling; this.sapling = sapling;
} }
@ -43,7 +45,8 @@ public class BlockLeaves extends LeavesBlock implements BlockPatterned, IRenderT
.suffocates((state, world, pos) -> { return false; }) .suffocates((state, world, pos) -> { return false; })
.blockVision((state, world, pos) -> { return false; }) .blockVision((state, world, pos) -> { return false; })
.materialColor(color) .materialColor(color)
.luminance(light)); .luminance(light)
.breakByTool(FabricToolTags.SHEARS));
this.sapling = sapling; this.sapling = sapling;
} }
@ -73,7 +76,7 @@ public class BlockLeaves extends LeavesBlock implements BlockPatterned, IRenderT
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
ItemStack tool = builder.get(LootContextParameters.TOOL); ItemStack tool = builder.get(LootContextParameters.TOOL);
if (tool != null) { 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)); return Collections.singletonList(new ItemStack(this));
} }
int fortune = EnchantmentHelper.getLevel(Enchantments.FORTUNE, tool); int fortune = EnchantmentHelper.getLevel(Enchantments.FORTUNE, tool);

View file

@ -114,7 +114,7 @@ public class EndBlocks {
public static final WoodenMaterial LACUGROVE = new WoodenMaterial("lacugrove", MaterialColor.BROWN, MaterialColor.YELLOW); 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_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 WoodenMaterial DRAGON_TREE = new WoodenMaterial("dragon_tree", MaterialColor.BLACK, MaterialColor.MAGENTA);
public static final Block TENANEA_SAPLING = registerBlock("tenanea_sapling", new BlockTenaneaSapling()); public static final Block TENANEA_SAPLING = registerBlock("tenanea_sapling", new BlockTenaneaSapling());