Fix tooltip not always working + crafting task not sending update on processable change
This commit is contained in:
@@ -75,6 +75,10 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
this.tookFluids = tookFluids;
|
this.tookFluids = tookFluids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public INetworkMaster getNetwork() {
|
||||||
|
return network;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calculate() {
|
public void calculate() {
|
||||||
IItemStackList networkList = network.getItemStorageCache().getList().copy();
|
IItemStackList networkList = network.getItemStorageCache().getList().copy();
|
||||||
@@ -159,7 +163,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pattern.isProcessing()) {
|
if (pattern.isProcessing()) {
|
||||||
toProcess.add(new Processable(pattern));
|
toProcess.add(new Processable(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missing.isEmpty()) {
|
if (missing.isEmpty()) {
|
||||||
@@ -212,8 +216,10 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
toTakeFluids.add(fluidInItem.copy());
|
toTakeFluids.add(fluidInItem.copy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,6 +289,7 @@ public class CraftingTask implements ICraftingTask {
|
|||||||
|
|
||||||
if (ItemHandlerHelper.insertItem(inventory, toInsert, true) == null) {
|
if (ItemHandlerHelper.insertItem(inventory, toInsert, true) == null) {
|
||||||
ItemHandlerHelper.insertItem(inventory, toInsert, false);
|
ItemHandlerHelper.insertItem(inventory, toInsert, false);
|
||||||
|
|
||||||
took.remove(tookStack, toInsert.stackSize, true);
|
took.remove(tookStack, toInsert.stackSize, true);
|
||||||
|
|
||||||
network.sendCraftingMonitorUpdate();
|
network.sendCraftingMonitorUpdate();
|
||||||
|
|||||||
@@ -14,13 +14,15 @@ public class Processable implements IProcessable {
|
|||||||
private static final String NBT_SATISFIED = "Satisfied_%d";
|
private static final String NBT_SATISFIED = "Satisfied_%d";
|
||||||
private static final String NBT_TO_INSERT = "ToInsert";
|
private static final String NBT_TO_INSERT = "ToInsert";
|
||||||
|
|
||||||
|
private CraftingTask task;
|
||||||
private ICraftingPattern pattern;
|
private ICraftingPattern pattern;
|
||||||
private IItemStackList toInsert = API.instance().createItemStackList();
|
private IItemStackList toInsert = API.instance().createItemStackList();
|
||||||
private boolean satisfied[];
|
private boolean satisfied[];
|
||||||
private boolean startedProcessing;
|
private boolean startedProcessing;
|
||||||
|
|
||||||
public Processable(ICraftingPattern pattern) {
|
public Processable(CraftingTask task) {
|
||||||
this.pattern = pattern;
|
this.task = task;
|
||||||
|
this.pattern = task.getPattern();
|
||||||
this.satisfied = new boolean[pattern.getOutputs().size()];
|
this.satisfied = new boolean[pattern.getOutputs().size()];
|
||||||
|
|
||||||
for (ItemStack input : pattern.getInputs()) {
|
for (ItemStack input : pattern.getInputs()) {
|
||||||
@@ -58,12 +60,15 @@ public class Processable implements IProcessable {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canStartProcessing(IItemStackList list) {
|
public boolean canStartProcessing(IItemStackList list) {
|
||||||
list = list.copy(); // So we can edit the list
|
list = list.copy(); // So we can edit the list
|
||||||
|
|
||||||
for (ItemStack stack : toInsert.getStacks()) {
|
for (ItemStack stack : toInsert.getStacks()) {
|
||||||
ItemStack actualStack = list.get(stack, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT | (pattern.isOredict() ? IComparer.COMPARE_OREDICT : 0));
|
ItemStack actualStack = list.get(stack, IComparer.COMPARE_DAMAGE | IComparer.COMPARE_NBT | (pattern.isOredict() ? IComparer.COMPARE_OREDICT : 0));
|
||||||
|
|
||||||
if (actualStack == null || actualStack.stackSize == 0 || !list.remove(actualStack, true)) {
|
if (actualStack == null || actualStack.stackSize == 0 || !list.remove(actualStack, true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +107,8 @@ public class Processable implements IProcessable {
|
|||||||
if (API.instance().getComparer().isEqualNoQuantity(stack, item)) {
|
if (API.instance().getComparer().isEqualNoQuantity(stack, item)) {
|
||||||
satisfied[i] = true;
|
satisfied[i] = true;
|
||||||
|
|
||||||
|
task.getNetwork().sendCraftingMonitorUpdate();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,10 +118,10 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
if (item == itemSelected) {
|
if (item == itemSelected) {
|
||||||
itemSelectedX = x;
|
itemSelectedX = x;
|
||||||
itemSelectedY = y;
|
itemSelectedY = y;
|
||||||
|
}
|
||||||
|
|
||||||
if (inBounds(itemSelectedX, itemSelectedY, ITEM_WIDTH, ITEM_HEIGHT, mouseX, mouseY)) {
|
if (inBounds(x, y, ITEM_WIDTH, ITEM_HEIGHT, mouseX, mouseY)) {
|
||||||
itemSelectedTooltip = element.getTooltip();
|
itemSelectedTooltip = element.getTooltip();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
element.draw(x, y, drawers);
|
element.draw(x, y, drawers);
|
||||||
|
|||||||
Reference in New Issue
Block a user