Skip to content

fix a couple edge case crashes#24

Closed
maxpowa wants to merge 1 commit into
AlexIIL:0.4.x-mc1.16.xfrom
maxpowa:fix-crashes
Closed

fix a couple edge case crashes#24
maxpowa wants to merge 1 commit into
AlexIIL:0.4.x-mc1.16.xfrom
maxpowa:fix-crashes

Conversation

@maxpowa
Copy link
Copy Markdown

@maxpowa maxpowa commented Feb 13, 2021

getCollisionShape may crash when walking on multipart blocks, not sure what interaction specifically was causing it but I have attached a sample crash report.

getOutlineShape was crashing when a Staff Of Building was held near a multipart block. Adding the instance check seems to resolve it without adversely impacting hitbox behavior. I have also attached that crash report.

crash-2021-02-09_21.23.46-client.txt
crash-2021-02-10_21.15.27-client.txt

@AlexIIL
Copy link
Copy Markdown
Owner

AlexIIL commented Feb 17, 2021

The second crash should probably be fixed by passing the BlockView down the call chain, since LMP only uses it to get the BlockEntity. I'm fixing this locally, although I'll push my changes soon.

I'm not sure why baritone is passing null for the world, as it's not marked as nullable in vanilla code. Adding null checks here would imply adding null checks everywhere else too, which would be a massive pain. (In addition baritone is a cheat mod, so I'm not really interested in supporting it).

@AlexIIL
Copy link
Copy Markdown
Owner

AlexIIL commented Feb 17, 2021

Upon closer inspection it looks like the way that LMP detects if block outlines are being drawn is a bit broken with other mods, so I'll need to change that to work better as well.

@maxpowa
Copy link
Copy Markdown
Author

maxpowa commented Feb 17, 2021

I'm not sure why baritone is passing null for the world, as it's not marked as nullable in vanilla code. Adding null checks here would imply adding null checks everywhere else too, which would be a massive pain. (In addition baritone is a cheat mod, so I'm not really interested in supporting it).

Look at me not even reading the stacktrace and totally missing that baritone was causing it 🤦 Makes sense why I couldn't reproduce it and it was specific to one player on the server...

Upon closer inspection it looks like the way that LMP detects if block outlines are being drawn is a bit broken with other mods, so I'll need to change that to work better as well.

Sounds good!

AlexIIL added a commit that referenced this pull request Feb 22, 2021
Player-visible changes:

* Added hit particles and sounds.
* [#24] Fixed a crash where LMP wrongly casted a BlockView to a World
when it shouldn't have.

Developer changes:

* Added AbstractPart.getClosestBlockState().
    * This is used for playing/spawning hit and break sounds/particles,
and calculating the break speed of the part by default.
    * This defaults to dirt, however it is *highly* recommended that
subclasses either override getClosestBlockState(), or all of the methods
that use it by default.
* Deprecated various methods that take a World argument and replace them
with BlockView instead:
    * IBlockMultipart.getPartOutlineShape() -> getPartOutline()
    * IBlockMultipart.getTargetedMultipart() -> getMultipartTarget()
AlexIIL added a commit that referenced this pull request Feb 23, 2021
Player-visible changes:

* Added hit particles and sounds.
* [#24] Fixed a crash where LMP wrongly casted a BlockView to a World
when it shouldn't have.

Developer changes:

* Added AbstractPart.getClosestBlockState().
    * This is used for playing/spawning hit and break sounds/particles,
and calculating the break speed of the part by default.
    * This defaults to dirt, however it is *highly* recommended that
subclasses either override getClosestBlockState(), or all of the methods
that use it by default.
* Deprecated various methods that take a World argument and replace them
with BlockView instead:
    * IBlockMultipart.getPartOutlineShape() -> getPartOutline()
    * IBlockMultipart.getTargetedMultipart() -> getMultipartTarget()
@AlexIIL
Copy link
Copy Markdown
Owner

AlexIIL commented Feb 23, 2021

Ok, this should now be fixed and released in 0.4.6

@AlexIIL
Copy link
Copy Markdown
Owner

AlexIIL commented Feb 27, 2021

...and actually usable in 0.4.7, as I messed up the 0.4.6 release. Sorry.

Please comment if you find this to not be the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants