Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ public List<ItemStack> getRequiredItems(

if (!BlockUtils.isAnySolid(world.getBlockState(pos.below())))
{
BlockState supportBlockState = placementContext.getSolidBlockForPos(pos, placementContext.getBluePrint().getRawBlockStateFunction());
final Blueprint blueprint = placementContext.getBluePrint();

BlockState supportBlockState = placementContext.getSolidBlockForPos(pos, blueprint == null ? ignored -> null : blueprint.getRawBlockStateFunction());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What crashes here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NPE when getBlueprint() returns null. I can get a stack trace next time I am at the computer...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why the blueprint is null when the block below is non solid like string. I think the actual error might be upstream then.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the top of the stack trace: java.lang.NullPointerException: Cannot invoke "com.ldtteam.structurize.blueprints.v1.Blueprint.getRawBlockStateFunction()" because the return value of "com.ldtteam.structurize.placement.IPlacementContext.getBluePrint()" is null
at com.ldtteam.structurize.placement.handlers.placement.PlacementHandlers$FallingBlockPlacementHandler.getRequiredItems(PlacementHandlers.java:353) ~[main/:?] {re:classloading}
at com.ldtteam.structurize.client.gui.WindowScan.updateResources(WindowScan.java:511) ~[main/:?] {re:classloading}
at com.ldtteam.structurize.client.gui.WindowScan.showResClicked(WindowScan.java:234) ~[main/:?] {re:classloading}
at com.ldtteam.structurize.client.gui.AbstractWindowSkeleton.lambda$registerButton$0(AbstractWindowSkeleton.java:49) ~[main/:?] {re:classloading}
at com.ldtteam.structurize.client.gui.AbstractWindowSkeleton.onButtonClicked(AbstractWindowSkeleton.java:76) ~[main/:?] {re:classloading}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is an upstream problem, as WindowScan passes a SimplePlacementContext to be used (in my test, at least) and that always returns a null blueprint.

if (canHandle(world, pos, supportBlockState))
{
Log.getLogger().warn("Unable to use: " + supportBlockState + " as support for a falling block, it is either a falling black itself or made fallable");
Expand Down