diff --git a/src/main/java/refinedstorage/gui/GuiCraftingMonitor.java b/src/main/java/refinedstorage/gui/GuiCraftingMonitor.java index 35312396c..deed419af 100755 --- a/src/main/java/refinedstorage/gui/GuiCraftingMonitor.java +++ b/src/main/java/refinedstorage/gui/GuiCraftingMonitor.java @@ -104,7 +104,9 @@ public class GuiCraftingMonitor extends GuiBase { itemSelectedY = y; } - x += 16F / (float) task.getDepth(); + if (task.getDepth() > 0) { + x += 16F - ((float) (task.getChildren() - task.getDepth()) / (float) task.getChildren() * 16F); + } drawItem(x + 2, y + 1, task.getOutput()); diff --git a/src/main/java/refinedstorage/tile/ClientCraftingTask.java b/src/main/java/refinedstorage/tile/ClientCraftingTask.java index 23bde8ce6..21a6870b3 100755 --- a/src/main/java/refinedstorage/tile/ClientCraftingTask.java +++ b/src/main/java/refinedstorage/tile/ClientCraftingTask.java @@ -10,17 +10,19 @@ public class ClientCraftingTask { private int id; private String status; private int depth; + private int children; private int progress; // Used server-side while sending private List outputs; private ClientCraftingTask child; - public ClientCraftingTask(ItemStack output, int id, String status, int depth, int progress) { + public ClientCraftingTask(ItemStack output, int id, String status, int depth, int children, int progress) { this.output = output; this.id = id; this.status = status; this.depth = depth; + this.children = children; this.progress = progress; } @@ -55,6 +57,10 @@ public class ClientCraftingTask { return depth; } + public int getChildren() { + return children; + } + public int getProgress() { return progress; } diff --git a/src/main/java/refinedstorage/tile/data/RefinedStorageSerializers.java b/src/main/java/refinedstorage/tile/data/RefinedStorageSerializers.java index 6fceb56a5..78c168b18 100755 --- a/src/main/java/refinedstorage/tile/data/RefinedStorageSerializers.java +++ b/src/main/java/refinedstorage/tile/data/RefinedStorageSerializers.java @@ -52,13 +52,25 @@ public final class RefinedStorageSerializers { buf.writeInt(tasks.size()); for (ClientCraftingTask task : tasks) { - writeTask(buf, task); + int children = 0; + + ClientCraftingTask child = task.getChild(); + + while (child != null) { + children++; + + child = child.getChild(); + } + + writeTask(buf, task, children); } } - private void writeTask(PacketBuffer buf, ClientCraftingTask task) { + private void writeTask(PacketBuffer buf, ClientCraftingTask task, int children) { ByteBufUtils.writeUTF8String(buf, task.getStatus()); + buf.writeInt(children); + buf.writeInt(task.getProgress()); buf.writeInt(task.getOutputs().size()); @@ -70,7 +82,7 @@ public final class RefinedStorageSerializers { buf.writeBoolean(task.getChild() != null); if (task.getChild() != null) { - writeTask(buf, task.getChild()); + writeTask(buf, task.getChild(), children); } } @@ -90,12 +102,14 @@ public final class RefinedStorageSerializers { private void readTask(PacketBuffer buf, int i, int depth, List tasks) { String status = ByteBufUtils.readUTF8String(buf); + int children = buf.readInt(); + int progress = buf.readInt(); int outputs = buf.readInt(); for (int j = 0; j < outputs; ++j) { - tasks.add(new ClientCraftingTask(ByteBufUtils.readItemStack(buf), i, status, depth, progress)); + tasks.add(new ClientCraftingTask(ByteBufUtils.readItemStack(buf), i, status, depth, children, progress)); } if (buf.readBoolean()) {