Skip to content

Commit

Permalink
fix: Schematicannon request wrong blocks (Creators-of-Create#5830)
Browse files Browse the repository at this point in the history
* fix: schematics request tall grass block which is unobtainable (Creators-of-Create#5814)

* fix: give large ferns the same treatment

* remove unused imports

* comments

* fix requirement for farmers delight rich soil
  • Loading branch information
IThundxr authored Mar 22, 2024
1 parent efb3cf4 commit d66170c
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit d66170c

Please sign in to comment.