Skip to content

Fix client crash when rendering a facade on a cable with a null model… - #1691

Open
mashen456 wants to merge 1 commit into
CyclopsMC:master-26-ltsfrom
mashen456:fix/cable-facade-npe-modelbaker-null
Open

Fix client crash when rendering a facade on a cable with a null model…#1691
mashen456 wants to merge 1 commit into
CyclopsMC:master-26-ltsfrom
mashen456:fix/cable-facade-npe-modelbaker-null

Conversation

@mashen456

Copy link
Copy Markdown

… baker

CableModelBase.MODEL_BAKER is populated lazily when the cable item model is baked (ItemModelCable.Unbaked#bake). Under deferred/lazy model baking, e.g. ModernFix's dynamic_resources, it may still be null when a chunk section containing a facade is first meshed, causing a NullPointerException in FaceBakery#bakeQuad (ModelBaker.interner()).

Guard against this in addFacadeQuad by skipping the facade quad while the baker is unavailable; it renders once the item model has been baked.

… baker

CableModelBase.MODEL_BAKER is populated lazily when the cable item model is
baked (ItemModelCable.Unbaked#bake). Under deferred/lazy model baking, e.g.
ModernFix's dynamic_resources, it may still be null when a chunk section
containing a facade is first meshed, causing a NullPointerException in
FaceBakery#bakeQuad (ModelBaker.interner()).

Guard against this in addFacadeQuad by skipping the facade quad while the
baker is unavailable; it renders once the item model has been baked.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

// Under deferred/lazy model baking (e.g. ModernFix's dynamic_resources) that may not have happened yet when a
// chunk section containing a facade is first meshed, leaving MODEL_BAKER null and crashing FaceBakery#bakeQuad.
// Skip the facade quad in that case instead of crashing; it will render once the item model has been baked.
if (MODEL_BAKER == null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is not a solution, since this will just make facades invisible.

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.

3 participants