|
7 | 7 | import appeng.api.storage.data.IAEItemStack; |
8 | 8 | import appeng.helpers.NonNullArrayIterator; |
9 | 9 | import appeng.util.InventoryAdaptor; |
| 10 | +import com.glodblock.github.common.tile.TileFluidLevelMaintainer; |
10 | 11 | import com.google.common.collect.ImmutableSet; |
11 | 12 | import net.minecraft.item.ItemStack; |
12 | 13 | import net.minecraft.nbt.NBTTagCompound; |
@@ -63,34 +64,39 @@ public boolean handleCrafting(int x, long itemToCraft, IAEItemStack ais, Invento |
63 | 64 |
|
64 | 65 | if (remaining.isEmpty()) { |
65 | 66 | ais.setCachedItemStack(inputStack); |
66 | | - Future<ICraftingJob> craftingJob = this.getJob(x); |
| 67 | + Future<ICraftingJob> jobCalculation = this.getJob(x); |
67 | 68 |
|
68 | 69 | if (this.getLink(x) != null) { |
69 | 70 | return false; |
70 | 71 | } |
71 | 72 |
|
72 | | - if (craftingJob == null && this.getLink(x) == null) { |
| 73 | + if (jobCalculation == null && this.getLink(x) == null) { |
73 | 74 | IAEItemStack aisC = ais.copy(); |
74 | 75 | aisC.setStackSize(itemToCraft); |
75 | 76 | this.setJob(x, cg.beginCraftingJob(w, g, mySrc, aisC, null)); |
76 | | - craftingJob = this.getJob(x); |
| 77 | + jobCalculation = this.getJob(x); |
77 | 78 | } |
78 | 79 |
|
79 | | - if (craftingJob == null) { |
| 80 | + if (jobCalculation == null) { |
80 | 81 | return false; |
81 | 82 | } |
82 | 83 |
|
83 | 84 | try { |
84 | | - ICraftingJob job = craftingJob.get(); |
85 | | - |
86 | | - if (job != null) { |
87 | | - ICraftingLink link = cg.submitJob(job, this.owner, null, false, mySrc); |
88 | | - this.setJob(x, null); |
89 | | - if (link != null) { |
90 | | - this.setLink(x, link); |
91 | | - return true; |
| 85 | + if (jobCalculation.isDone()) { |
| 86 | + ICraftingJob job = jobCalculation.get(); |
| 87 | + |
| 88 | + if (job != null) { |
| 89 | + ICraftingLink link = cg.submitJob(job, this.owner, null, false, mySrc); |
| 90 | + this.setJob(x, null); |
| 91 | + if (link != null) { |
| 92 | + this.setLink(x, link); |
| 93 | + return true; |
| 94 | + } |
92 | 95 | } |
93 | 96 | } |
| 97 | + else { |
| 98 | + ((TileFluidLevelMaintainer)this.owner).forceNextTick = true; |
| 99 | + } |
94 | 100 | } catch (InterruptedException | ExecutionException ignored) { |
95 | 101 | } |
96 | 102 | } else { |
|
0 commit comments