Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schematicannon should not require tall grass in item form #5814

Closed
hlysine opened this issue Nov 28, 2023 · 2 comments
Closed

Schematicannon should not require tall grass in item form #5814

hlysine opened this issue Nov 28, 2023 · 2 comments
Labels
type: bug Issue where something isn't working

Comments

@hlysine
Copy link

hlysine commented Nov 28, 2023

Describe the Bug

image

Currently, if the build contains 2-block tall grass, the schematicannon prints that as a requirement directly. However, tall grass is not obtainable in item form in survival, so it should request for 2 pieces of short grass or short grass + bonemeal instead.

Reproduction Steps

  1. Build something with tall grass in it.
  2. Save it as a schematic.
  3. Load it into the schematicannon.
  4. Fail to build it in survival because tall grass cannot be obtained.

Expected Result

The schematicannon should request items that are obtainable in survival mode.

Screenshots and Videos

No response

Crash Report or Log

No response

Operating System

Windows 11

Mod Version

0.5.1f

Minecraft Version

1.20.1

Forge Version

47.2.5

Other Mods

No response

Additional Context

No response

@hlysine hlysine added the type: bug Issue where something isn't working label Nov 28, 2023
@molefool
Copy link

It seems normal for the blueprint to contain blocks that cannot be printed, and the additional work set up for this seems a bit cumbersome. This is not just a matter of grass. So the type should be "suggestion", not "error"!

@hlysine
Copy link
Author

hlysine commented Nov 29, 2023

It is reasonable for creative-only blocks to be listed as-is because you are not supposed to build them in survival anyway. But items like large fern and tall grass are easily buildable in survival but not obtainable as items, so they are a different story.

There is already special handling in place for similar items like dirt path and farmland, so I think the same should be expected for large fern and tall grass.

The fix is not cumbersome at all. It is just a few lines in this section:

private static ItemRequirement defaultOf(BlockState state, BlockEntity be) {
Block block = state.getBlock();
if (block == Blocks.AIR)
return NONE;
Item item = block.asItem();
if (item == Items.AIR)
return INVALID;
// double slab needs two items
if (state.hasProperty(BlockStateProperties.SLAB_TYPE)
&& state.getValue(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE)
return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, 2));
if (block instanceof TurtleEggBlock)
return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(TurtleEggBlock.EGGS)
.intValue()));
if (block instanceof SeaPickleBlock)
return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(SeaPickleBlock.PICKLES)
.intValue()));
if (block instanceof SnowLayerBlock)
return new ItemRequirement(ItemUseType.CONSUME, new ItemStack(item, state.getValue(SnowLayerBlock.LAYERS)
.intValue()));
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));
return new ItemRequirement(ItemUseType.CONSUME, item);
}

zelophed pushed a commit that referenced this issue Mar 22, 2024
* 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
@IThundxr IThundxr closed this as completed Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Issue where something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants