Skip to content

Commit

Permalink
fix: improve pattern encoder GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
leytilera committed Jan 28, 2023
1 parent 55eec4d commit 8f69574
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/appeng/tile/legacy/TilePatternEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public void invChanged(int slot, InvOperation op) {
ItemStack is = Platform.findMatchingRecipeOutput(ci, this.worldObj);
if (is != null) {
this.storage.setInventorySlotContents(9, is);
} else {
this.storage.setInventorySlotContents(9, null);
}
}

Expand All @@ -74,7 +76,7 @@ public void invChanged(int slot, InvOperation op) {

public void encodePattern() {
ItemStack fish = this.storage.getStackInSlot(11);
if (this.storage.getStackInSlot(9) != null) {
if (this.storage.getStackInSlot(9) != null && !this.craftingGridEmpty()) {
if (fish == null) {
fish = this.storage.decrStackSize(10, 1);
}
Expand Down Expand Up @@ -310,4 +312,14 @@ public void getDrops(
}
}
}

public boolean craftingGridEmpty() {
for(int i = 0; i < 9; i++) {
ItemStack stack = this.storage.getStackInSlot(i);
if (stack != null) {
return false;
}
}
return true;
}
}

0 comments on commit 8f69574

Please sign in to comment.