Skip to content

Commit fcabe0e

Browse files
Fix Quantum Compressor caching a bad recipe and getting stuck (#14)
Fixes #7 - Invalidate cached itemstack and state after failed recipe completion
1 parent 8f7d694 commit fcabe0e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/com/blakebr0/extendedcrafting/tile/TileCompressor.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@ public void update() {
6161
boolean mark = false;
6262

6363
if (!this.getWorld().isRemote) {
64-
CompressorRecipe recipe = this.getRecipe();
64+
CompressorRecipe recipe = null;
6565
ItemStack output = this.getStackInSlot(0);
6666
ItemStack input = this.getStackInSlot(1);
6767

6868
if (!input.isEmpty()) {
6969
if (this.materialStack.isEmpty()) {
7070
this.materialStack = input.copy();
7171
mark = true;
72+
//Retrieve new recipe upon non-null item detected
73+
recipe = getRecipe();
7274
}
7375

7476
if (!this.inputLimit || (recipe != null && this.materialCount < recipe.getInputCount())) {
@@ -83,6 +85,11 @@ public void update() {
8385
mark = true;
8486
}
8587
}
88+
//Invalidate the cached item and marked state on unsuccessful recipe retrieval
89+
else if(mark) {
90+
this.materialStack = ItemStack.EMPTY;
91+
mark = false;
92+
}
8693
}
8794

8895
if (recipe != null && this.getEnergy().getEnergyStored() > 0) {

0 commit comments

Comments
 (0)