Skip to content

Commit

Permalink
Fix FacadeRecipe out of bound crashes (#7954)
Browse files Browse the repository at this point in the history
Explicitly check that the CraftingInput is exactly 3x3 in size before
accessing any slots inside.

Fixes #7951.
  • Loading branch information
Mithi83 committed Jun 21, 2024
1 parent 10ffd79 commit 2db74c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/appeng/recipes/game/FacadeRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public boolean matches(CraftingInput inv, Level level) {
}

private ItemStack getOutput(CraftingInput inv, boolean createFacade) {
if (inv.getItem(0).isEmpty() && inv.getItem(2).isEmpty() && inv.getItem(6).isEmpty()
&& inv.getItem(8).isEmpty()) {
if (inv.width() == 3 && inv.height() == 3 && inv.getItem(0).isEmpty() && inv.getItem(2).isEmpty()
&& inv.getItem(6).isEmpty() && inv.getItem(8).isEmpty()) {
if (this.anchor.isSameAs(inv.getItem(1)) && this.anchor.isSameAs(inv.getItem(3))
&& this.anchor.isSameAs(inv.getItem(5)) && this.anchor.isSameAs(inv.getItem(7))) {
final ItemStack facades = this.facade.createFacadeForItem(inv.getItem(4), !createFacade);
Expand Down

0 comments on commit 2db74c6

Please sign in to comment.