Fixed sapling drops for base leaves (paulevsGitch/BetterNether#496)
This commit is contained in:
parent
be3876f8a6
commit
5aa06315d4
2 changed files with 10 additions and 5 deletions
|
@ -23,6 +23,7 @@ import ru.bclib.client.render.BCLRenderLayer;
|
|||
import ru.bclib.interfaces.BlockModelProvider;
|
||||
import ru.bclib.interfaces.RenderLayerProvider;
|
||||
import ru.bclib.interfaces.TagProvider;
|
||||
import ru.bclib.items.tool.BaseShearsItem;
|
||||
import ru.bclib.util.MHelper;
|
||||
|
||||
import java.util.Collections;
|
||||
|
@ -31,12 +32,12 @@ import java.util.function.Consumer;
|
|||
|
||||
public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, RenderLayerProvider, TagProvider {
|
||||
protected final Block sapling;
|
||||
|
||||
|
||||
private static FabricBlockSettings makeLeaves(MaterialColor color) {
|
||||
return FabricBlockSettings
|
||||
.copyOf(Blocks.OAK_LEAVES)
|
||||
.mapColor(color)
|
||||
.requiresTool()
|
||||
//.requiresTool()
|
||||
.allowsSpawning((state, world, pos, type) -> false)
|
||||
.suffocates((state, world, pos) -> false)
|
||||
.blockVision((state, world, pos) -> false);
|
||||
|
@ -72,7 +73,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||
if (tool != null) {
|
||||
if (tool.isCorrectToolForDrops(state) || EnchantmentHelper.getItemEnchantmentLevel(
|
||||
if (BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
|
||||
Enchantments.SILK_TOUCH,
|
||||
tool
|
||||
) > 0) {
|
||||
|
@ -95,7 +96,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
|||
@Override
|
||||
public void addTags(List<Named<Block>> blockTags, List<Named<Item>> itemTags) {
|
||||
blockTags.add(FabricMineableTags.SHEARS_MINEABLE);
|
||||
blockTags.add(TagAPI.MINEABLE_HOE);
|
||||
//blockTags.add(TagAPI.MINEABLE_HOE);
|
||||
blockTags.add(BlockTags.LEAVES);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,11 @@ public class BaseShearsItem extends ShearsItem {
|
|||
public BaseShearsItem(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
|
||||
public static boolean isShear(ItemStack tool){
|
||||
return tool.is(Items.SHEARS) | tool.is(TagAPI.ITEM_COMMON_SHEARS) || tool.is(TagAPI.ITEM_SHEARS);
|
||||
}
|
||||
|
||||
public static boolean isShear(ItemStack itemStack, Item item){
|
||||
if (item == Items.SHEARS){
|
||||
return itemStack.is(item) | itemStack.is(TagAPI.ITEM_COMMON_SHEARS) || itemStack.is(TagAPI.ITEM_SHEARS);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue