Repository navigation
NPE fix (gravity over non-solid) - #862
Conversation
| BlockState supportBlockState = placementContext.getSolidBlockForPos(pos, placementContext.getBluePrint().getRawBlockStateFunction()); | ||
| final Blueprint blueprint = placementContext.getBluePrint(); | ||
|
|
||
| BlockState supportBlockState = placementContext.getSolidBlockForPos(pos, blueprint == null ? ignored -> null : blueprint.getRawBlockStateFunction()); |
There was a problem hiding this comment.
NPE when getBlueprint() returns null. I can get a stack trace next time I am at the computer...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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}
There was a problem hiding this comment.
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.
Closes None
Changes proposed in this pull request
Can be reproduced by a simple placeholder under string under sand, highlighting that structure, then pressing the "Show Resources" button & removing the sand.
Testing
Review please