From ac3ce4d8cba9a27450357b92ddfe6c5d4817ac13 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 16 Dec 2018 18:25:02 +0100 Subject: [PATCH] (hopefully) allow non-saplings in the tree ritual, closes #20 --- .../de/ellpeck/naturesaura/blocks/multi/Multiblocks.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java index 7fed0cb2..706f31f2 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java @@ -10,6 +10,7 @@ import net.minecraft.block.BlockSapling; import net.minecraft.block.BlockStoneBrick; import net.minecraft.block.BlockStoneBrick.EnumType; import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; public final class Multiblocks { @@ -35,7 +36,13 @@ public final class Multiblocks { (world, start, offset, pos, state, c) -> world != null || state.getBlock() == ModBlocks.WOOD_STAND), 'G', ModBlocks.GOLD_POWDER, '0', new Matcher(Blocks.SAPLING.getDefaultState(), - (world, start, offset, pos, state, c) -> state.getBlock() instanceof BlockSapling || state.getBlock() instanceof BlockLog), + (world, start, offset, pos, state, c) -> { + if (state.getBlock() instanceof BlockSapling || state.getBlock() instanceof BlockLog) + return true; + ItemStack stack = state.getBlock().getItem(world, pos, state); + return !stack.isEmpty() && NaturesAuraAPI.TREE_RITUAL_RECIPES.values().stream().anyMatch(recipe -> recipe.saplingType.apply(stack)); + } + ), ' ', Matcher.wildcard()); public static final IMultiblock POTION_GENERATOR = NaturesAuraAPI.instance().createMultiblock( new ResourceLocation(NaturesAura.MOD_ID, "potion_generator"),