From d66170c8fed5d02ad46f44fd0e66685be88a3170 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Fri, 22 Mar 2024 09:45:41 -0400 Subject: [PATCH] fix: Schematicannon request wrong blocks (#5830) * fix: schematics request tall grass block which is unobtainable (#5814) * fix: give large ferns the same treatment * remove unused imports * comments * fix requirement for farmers delight rich soil --- .../schematics/requirement/ItemRequirement.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/simibubi/create/content/schematics/requirement/ItemRequirement.java b/src/main/java/com/simibubi/create/content/schematics/requirement/ItemRequirement.java index 6b07940dc2..eb2045b62c 100644 --- a/src/main/java/com/simibubi/create/content/schematics/requirement/ItemRequirement.java +++ b/src/main/java/com/simibubi/create/content/schematics/requirement/ItemRequirement.java @@ -6,8 +6,10 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import com.simibubi.create.foundation.data.recipe.Mods; import com.simibubi.create.foundation.utility.NBTProcessors; +import net.minecraft.core.Registry; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.decoration.ArmorStand; import net.minecraft.world.entity.decoration.ItemFrame; @@ -94,10 +96,19 @@ private static ItemRequirement defaultOf(BlockState state, BlockEntity be) { if (block instanceof SnowLayerBlock) return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(SnowLayerBlock.LAYERS) .intValue())); + // FD's rich soil extends FarmBlock so this is to make sure the cost is correct (it should be rich soil not dirt) + if (block == Registry.BLOCK.get(Mods.FD.asResource("rich_soil_farmland"))) + return new ItemRequirement(ItemUseType.CONSUME, Registry.ITEM.get(Mods.FD.asResource("rich_soil"))); if (block instanceof FarmBlock || block instanceof DirtPathBlock) return new ItemRequirement(ItemUseType.CONSUME, Items.DIRT); if (block instanceof AbstractBannerBlock && be instanceof BannerBlockEntity bannerBE) return new ItemRequirement(new StrictNbtStackRequirement(bannerBE.getItem(), ItemUseType.CONSUME)); + // Tall grass doesnt exist as a block so use 2 grass blades + if (block == Blocks.TALL_GRASS) + return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(Items.GRASS, 2)); + // Large ferns don't exist as blocks so use 2 ferns instead + if (block == Blocks.LARGE_FERN) + return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(Items.FERN, 2)); return new ItemRequirement(ItemUseType.CONSUME, item); }