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.BlockModelProvider;
|
||||||
import ru.bclib.interfaces.RenderLayerProvider;
|
import ru.bclib.interfaces.RenderLayerProvider;
|
||||||
import ru.bclib.interfaces.TagProvider;
|
import ru.bclib.interfaces.TagProvider;
|
||||||
|
import ru.bclib.items.tool.BaseShearsItem;
|
||||||
import ru.bclib.util.MHelper;
|
import ru.bclib.util.MHelper;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -36,7 +37,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
||||||
return FabricBlockSettings
|
return FabricBlockSettings
|
||||||
.copyOf(Blocks.OAK_LEAVES)
|
.copyOf(Blocks.OAK_LEAVES)
|
||||||
.mapColor(color)
|
.mapColor(color)
|
||||||
.requiresTool()
|
//.requiresTool()
|
||||||
.allowsSpawning((state, world, pos, type) -> false)
|
.allowsSpawning((state, world, pos, type) -> false)
|
||||||
.suffocates((state, world, pos) -> false)
|
.suffocates((state, world, pos) -> false)
|
||||||
.blockVision((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) {
|
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||||
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
|
||||||
if (tool != null) {
|
if (tool != null) {
|
||||||
if (tool.isCorrectToolForDrops(state) || EnchantmentHelper.getItemEnchantmentLevel(
|
if (BaseShearsItem.isShear(tool) || EnchantmentHelper.getItemEnchantmentLevel(
|
||||||
Enchantments.SILK_TOUCH,
|
Enchantments.SILK_TOUCH,
|
||||||
tool
|
tool
|
||||||
) > 0) {
|
) > 0) {
|
||||||
|
@ -95,7 +96,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
||||||
@Override
|
@Override
|
||||||
public void addTags(List<Named<Block>> blockTags, List<Named<Item>> itemTags) {
|
public void addTags(List<Named<Block>> blockTags, List<Named<Item>> itemTags) {
|
||||||
blockTags.add(FabricMineableTags.SHEARS_MINEABLE);
|
blockTags.add(FabricMineableTags.SHEARS_MINEABLE);
|
||||||
blockTags.add(TagAPI.MINEABLE_HOE);
|
//blockTags.add(TagAPI.MINEABLE_HOE);
|
||||||
blockTags.add(BlockTags.LEAVES);
|
blockTags.add(BlockTags.LEAVES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,10 @@ public class BaseShearsItem extends ShearsItem {
|
||||||
super(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){
|
public static boolean isShear(ItemStack itemStack, Item item){
|
||||||
if (item == Items.SHEARS){
|
if (item == Items.SHEARS){
|
||||||
return itemStack.is(item) | itemStack.is(TagAPI.ITEM_COMMON_SHEARS) || itemStack.is(TagAPI.ITEM_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