Skip to content

Commit

Permalink
Guard against item BakedModels using incorrect RenderTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Technici4n committed Jan 4, 2025
1 parent 05084dc commit f7e1a61
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@
}
}

@@ -116,6 +_,15 @@
}

public void setupBlockModel(BakedModel p_386829_, RenderType p_387529_) {
+ // Neo: Guard against models using the wrong render type, in particular chunk render types.
+ if (p_387529_.format != com.mojang.blaze3d.vertex.DefaultVertexFormat.NEW_ENTITY) {
+ throw new IllegalArgumentException("""
+ Attempting to render an item BakedModel with an invalid RenderType: %s.
+ Only the NEW_ENTITY vertex format is supported.
+ Chunk render types are not supported, and the equivalent render types from the Sheets class should be used.
+ Model: %s.
+ """.formatted(p_386829_, p_386829_));
+ }
this.model = p_386829_;
this.renderType = p_387529_;
}
@@ -149,6 +_,9 @@

void render(PoseStack p_387607_, MultiBufferSource p_386763_, int p_387589_, int p_388775_) {
Expand Down

0 comments on commit f7e1a61

Please sign in to comment.