Revert "Crafting monitor improvements WIP"
This reverts commit 8274896ef9.
This commit is contained in:
@@ -3,6 +3,7 @@ package refinedstorage.autocrafting.task;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.common.util.Constants;
|
import net.minecraftforge.common.util.Constants;
|
||||||
import refinedstorage.RefinedStorageUtils;
|
import refinedstorage.RefinedStorageUtils;
|
||||||
import refinedstorage.autocrafting.CraftingPattern;
|
import refinedstorage.autocrafting.CraftingPattern;
|
||||||
@@ -132,43 +133,49 @@ public class BasicCraftingTask implements ICraftingTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Object> getInfo() {
|
public String getInfo() {
|
||||||
List<Object> items = new ArrayList<Object>();
|
|
||||||
|
|
||||||
if (!updatedOnce) {
|
if (!updatedOnce) {
|
||||||
items.add("T=gui.refinedstorage:crafting_monitor.not_started_yet");
|
return "{not_started_yet}";
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean areItemsCrafting = false;
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
builder.append(TextFormatting.YELLOW).append("{missing_items}").append(TextFormatting.RESET).append("\n");
|
||||||
|
|
||||||
|
int missingItems = 0;
|
||||||
|
|
||||||
for (int i = 0; i < pattern.getInputs().length; ++i) {
|
for (int i = 0; i < pattern.getInputs().length; ++i) {
|
||||||
|
ItemStack input = pattern.getInputs()[i];
|
||||||
|
|
||||||
|
if (checked[i] && !satisfied[i] && !childTasks[i]) {
|
||||||
|
builder.append("- ").append(input.getDisplayName()).append("\n");
|
||||||
|
|
||||||
|
missingItems++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (missingItems == 0) {
|
||||||
|
builder.append(TextFormatting.GRAY).append(TextFormatting.ITALIC).append("{none}").append(TextFormatting.RESET).append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.append(TextFormatting.YELLOW).append("{items_crafting}").append(TextFormatting.RESET).append("\n");
|
||||||
|
|
||||||
|
int itemsCrafting = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < pattern.getInputs().length; ++i) {
|
||||||
|
ItemStack input = pattern.getInputs()[i];
|
||||||
|
|
||||||
if (!satisfied[i] && childTasks[i]) {
|
if (!satisfied[i] && childTasks[i]) {
|
||||||
if (!areItemsCrafting) {
|
builder.append("- ").append(input.getUnlocalizedName()).append(".name").append("\n");
|
||||||
items.add("T=gui.refinedstorage:crafting_monitor.items_crafting");
|
|
||||||
|
|
||||||
areItemsCrafting = true;
|
itemsCrafting++;
|
||||||
}
|
|
||||||
|
|
||||||
items.add(pattern.getInputs()[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasItemsInQueue = false;
|
if (itemsCrafting == 0) {
|
||||||
|
builder.append(TextFormatting.GRAY).append(TextFormatting.ITALIC).append("{none}").append(TextFormatting.RESET).append("\n");
|
||||||
for (int i = 0; i < pattern.getInputs().length; ++i) {
|
|
||||||
if (!satisfied[i] && !childTasks[i]) {
|
|
||||||
if (!hasItemsInQueue) {
|
|
||||||
items.add("T=gui.refinedstorage:crafting_monitor.items_in_queue");
|
|
||||||
|
|
||||||
hasItemsInQueue = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
items.add(pattern.getInputs()[i]);
|
return builder.toString();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return items;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import refinedstorage.autocrafting.CraftingPattern;
|
import refinedstorage.autocrafting.CraftingPattern;
|
||||||
import refinedstorage.tile.controller.TileController;
|
import refinedstorage.tile.controller.TileController;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface ICraftingTask {
|
public interface ICraftingTask {
|
||||||
CraftingPattern getPattern();
|
CraftingPattern getPattern();
|
||||||
|
|
||||||
@@ -17,5 +15,5 @@ public interface ICraftingTask {
|
|||||||
|
|
||||||
void writeToNBT(NBTTagCompound tag);
|
void writeToNBT(NBTTagCompound tag);
|
||||||
|
|
||||||
List<Object> getInfo();
|
String getInfo();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package refinedstorage.autocrafting.task;
|
|||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.ItemHandlerHelper;
|
import net.minecraftforge.items.ItemHandlerHelper;
|
||||||
import refinedstorage.RefinedStorageUtils;
|
import refinedstorage.RefinedStorageUtils;
|
||||||
@@ -9,9 +10,6 @@ import refinedstorage.autocrafting.CraftingPattern;
|
|||||||
import refinedstorage.tile.TileCrafter;
|
import refinedstorage.tile.TileCrafter;
|
||||||
import refinedstorage.tile.controller.TileController;
|
import refinedstorage.tile.controller.TileController;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ProcessingCraftingTask implements ICraftingTask {
|
public class ProcessingCraftingTask implements ICraftingTask {
|
||||||
public static final int ID = 1;
|
public static final int ID = 1;
|
||||||
|
|
||||||
@@ -127,13 +125,9 @@ public class ProcessingCraftingTask implements ICraftingTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Object> getInfo() {
|
public String getInfo() {
|
||||||
List<Object> items = new ArrayList<Object>();
|
if (!updatedOnce) {
|
||||||
|
return "{not_started_yet}";
|
||||||
return items;
|
|
||||||
|
|
||||||
/*if (!updatedOnce) {
|
|
||||||
return Arrays.asList("{not_started_yet}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
@@ -192,6 +186,6 @@ public class ProcessingCraftingTask implements ICraftingTask {
|
|||||||
builder.append(TextFormatting.GRAY).append(TextFormatting.ITALIC).append("{none}").append(TextFormatting.RESET).append("\n");
|
builder.append(TextFormatting.GRAY).append(TextFormatting.ITALIC).append("{none}").append(TextFormatting.RESET).append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return builder.toString();*/
|
return builder.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ package refinedstorage.gui;
|
|||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import refinedstorage.RefinedStorage;
|
import refinedstorage.RefinedStorage;
|
||||||
import refinedstorage.RefinedStorageUtils;
|
import refinedstorage.RefinedStorageUtils;
|
||||||
import refinedstorage.container.ContainerCraftingMonitor;
|
import refinedstorage.container.ContainerCraftingMonitor;
|
||||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||||
import refinedstorage.network.MessageCraftingMonitorCancel;
|
import refinedstorage.network.MessageCraftingMonitorCancel;
|
||||||
import refinedstorage.network.MessageCraftingMonitorSelect;
|
|
||||||
import refinedstorage.tile.TileCraftingMonitor;
|
import refinedstorage.tile.TileCraftingMonitor;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class GuiCraftingMonitor extends GuiBase {
|
public class GuiCraftingMonitor extends GuiBase {
|
||||||
public static final int VISIBLE_ROWS = 3;
|
public static final int VISIBLE_ROWS = 3;
|
||||||
@@ -25,13 +25,16 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
private GuiButton cancelButton;
|
private GuiButton cancelButton;
|
||||||
private GuiButton cancelAllButton;
|
private GuiButton cancelAllButton;
|
||||||
|
|
||||||
private int selectionX = Integer.MAX_VALUE;
|
private int itemSelected = -1;
|
||||||
private int selectionY = Integer.MAX_VALUE;
|
|
||||||
|
private boolean renderItemSelection;
|
||||||
|
private int renderItemSelectionX;
|
||||||
|
private int renderItemSelectionY;
|
||||||
|
|
||||||
private Scrollbar scrollbar = new Scrollbar(157, 20, 12, 89);
|
private Scrollbar scrollbar = new Scrollbar(157, 20, 12, 89);
|
||||||
|
|
||||||
public GuiCraftingMonitor(ContainerCraftingMonitor container, TileCraftingMonitor craftingMonitor) {
|
public GuiCraftingMonitor(ContainerCraftingMonitor container, TileCraftingMonitor craftingMonitor) {
|
||||||
super(container, 256, 230);
|
super(container, 176, 230);
|
||||||
|
|
||||||
this.craftingMonitor = craftingMonitor;
|
this.craftingMonitor = craftingMonitor;
|
||||||
}
|
}
|
||||||
@@ -62,7 +65,11 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
scrollbar.setCanScroll(getRows() > VISIBLE_ROWS);
|
scrollbar.setCanScroll(getRows() > VISIBLE_ROWS);
|
||||||
scrollbar.setScrollDelta((float) scrollbar.getScrollbarHeight() / (float) getRows());
|
scrollbar.setScrollDelta((float) scrollbar.getScrollbarHeight() / (float) getRows());
|
||||||
|
|
||||||
cancelButton.enabled = craftingMonitor.hasSelection();
|
if (itemSelected >= craftingMonitor.getTasks().size()) {
|
||||||
|
itemSelected = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelButton.enabled = itemSelected != -1;
|
||||||
cancelAllButton.enabled = craftingMonitor.getTasks().size() > 0;
|
cancelAllButton.enabled = craftingMonitor.getTasks().size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,11 +79,11 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
|
|
||||||
drawTexture(x, y, 0, 0, width, height);
|
drawTexture(x, y, 0, 0, width, height);
|
||||||
|
|
||||||
scrollbar.draw(this);
|
if (renderItemSelection) {
|
||||||
|
drawTexture(x + renderItemSelectionX, y + renderItemSelectionY, 178, 0, ITEM_WIDTH, ITEM_HEIGHT);
|
||||||
if (craftingMonitor.hasSelection()) {
|
|
||||||
drawRect(x + selectionX, y + selectionY, x + selectionX + ITEM_WIDTH - 1, y + selectionY + ITEM_HEIGHT - 1, 0xFFCCCCCC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scrollbar.draw(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -87,15 +94,20 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
int x = 8;
|
int x = 8;
|
||||||
int y = 20;
|
int y = 20;
|
||||||
|
|
||||||
int id = getOffset() * 2;
|
int item = getOffset() * 2;
|
||||||
|
|
||||||
RenderHelper.enableGUIStandardItemLighting();
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
|
||||||
|
List<String> infoLines = null;
|
||||||
|
|
||||||
|
renderItemSelection = false;
|
||||||
|
|
||||||
for (int i = 0; i < 6; ++i) {
|
for (int i = 0; i < 6; ++i) {
|
||||||
if (id < craftingMonitor.getTasks().size()) {
|
if (item < craftingMonitor.getTasks().size()) {
|
||||||
if (id == craftingMonitor.getSelected()) {
|
if (item == itemSelected) {
|
||||||
selectionX = x;
|
renderItemSelection = true;
|
||||||
selectionY = y;
|
renderItemSelectionX = x;
|
||||||
|
renderItemSelectionY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileCraftingMonitor.ClientSideCraftingTask task = craftingMonitor.getTasks().get(i);
|
TileCraftingMonitor.ClientSideCraftingTask task = craftingMonitor.getTasks().get(i);
|
||||||
@@ -107,13 +119,29 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.scale(scale, scale, 1);
|
GlStateManager.scale(scale, scale, 1);
|
||||||
|
|
||||||
drawString(
|
drawString(RefinedStorageUtils.calculateOffsetOnScale(x + 5, scale), RefinedStorageUtils.calculateOffsetOnScale(y + 4, scale), task.output.getDisplayName());
|
||||||
RefinedStorageUtils.calculateOffsetOnScale(x + 5, scale),
|
|
||||||
RefinedStorageUtils.calculateOffsetOnScale(y + 4, scale),
|
|
||||||
task.output.getDisplayName()
|
|
||||||
);
|
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
|
if (inBounds(x + 5, y + 10, 16, 16, mouseX, mouseY)) {
|
||||||
|
infoLines = Arrays.asList(task.info.split("\n"));
|
||||||
|
|
||||||
|
// @todo use utils method for this
|
||||||
|
for (int j = 0; j < infoLines.size(); ++j) {
|
||||||
|
String line = infoLines.get(j);
|
||||||
|
|
||||||
|
if (line.startsWith("- ")) {
|
||||||
|
infoLines.set(j, "- " + t(line.substring(2)));
|
||||||
|
} else {
|
||||||
|
infoLines.set(j, line
|
||||||
|
.replace("{missing_items}", t("gui.refinedstorage:crafting_monitor.missing_items"))
|
||||||
|
.replace("{items_crafting}", t("gui.refinedstorage:crafting_monitor.items_crafting"))
|
||||||
|
.replace("{items_processing}", t("gui.refinedstorage:crafting_monitor.items_processing"))
|
||||||
|
.replace("{not_started_yet}", t("gui.refinedstorage:crafting_monitor.not_started_yet"))
|
||||||
|
.replace("{none}", t("gui.none")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 1 || i == 3) {
|
if (i == 1 || i == 3) {
|
||||||
@@ -123,46 +151,11 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
x += ITEM_WIDTH;
|
x += ITEM_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
id++;
|
item++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (craftingMonitor.hasSelection()) {
|
if (infoLines != null) {
|
||||||
float scale = 0.5f;
|
drawTooltip(mouseX, mouseY, infoLines);
|
||||||
|
|
||||||
x = 179;
|
|
||||||
y = 24;
|
|
||||||
|
|
||||||
for (Object item : craftingMonitor.getInfo()) {
|
|
||||||
if (item instanceof String) {
|
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
GlStateManager.scale(scale, scale, 1);
|
|
||||||
|
|
||||||
String text = (String) item;
|
|
||||||
|
|
||||||
drawString(
|
|
||||||
RefinedStorageUtils.calculateOffsetOnScale(x, scale),
|
|
||||||
RefinedStorageUtils.calculateOffsetOnScale(y, scale),
|
|
||||||
text.startsWith("T=") ? t(text.substring(2)) : text
|
|
||||||
);
|
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
} else if (item instanceof ItemStack) {
|
|
||||||
drawItem(x, y, (ItemStack) item);
|
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
|
||||||
GlStateManager.scale(scale, scale, 1);
|
|
||||||
|
|
||||||
drawString(
|
|
||||||
RefinedStorageUtils.calculateOffsetOnScale(x + 20, scale),
|
|
||||||
RefinedStorageUtils.calculateOffsetOnScale(y + 6, scale),
|
|
||||||
((ItemStack) item).getDisplayName()
|
|
||||||
);
|
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
y += item instanceof String ? 7 : 16;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,8 +173,8 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
protected void actionPerformed(GuiButton button) throws IOException {
|
protected void actionPerformed(GuiButton button) throws IOException {
|
||||||
super.actionPerformed(button);
|
super.actionPerformed(button);
|
||||||
|
|
||||||
if (button == cancelButton && craftingMonitor.hasSelection()) {
|
if (button == cancelButton && itemSelected != -1) {
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, craftingMonitor.getTasks().get(craftingMonitor.getSelected()).id));
|
RefinedStorage.NETWORK.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, craftingMonitor.getTasks().get(itemSelected).id));
|
||||||
} else if (button == cancelAllButton && craftingMonitor.getTasks().size() > 0) {
|
} else if (button == cancelAllButton && craftingMonitor.getTasks().size() > 0) {
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, -1));
|
RefinedStorage.NETWORK.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, -1));
|
||||||
}
|
}
|
||||||
@@ -191,33 +184,23 @@ public class GuiCraftingMonitor extends GuiBase {
|
|||||||
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
|
||||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||||
|
|
||||||
boolean resetSelection = !inBounds(174, 19, 77, 91, mouseX - guiLeft, mouseY - guiTop);
|
|
||||||
|
|
||||||
if (mouseButton == 0 && inBounds(8, 20, 144, 90, mouseX - guiLeft, mouseY - guiTop)) {
|
if (mouseButton == 0 && inBounds(8, 20, 144, 90, mouseX - guiLeft, mouseY - guiTop)) {
|
||||||
int id = getOffset() * 2;
|
itemSelected = -1;
|
||||||
|
|
||||||
|
int item = getOffset() * 2;
|
||||||
|
|
||||||
for (int y = 0; y < 3; ++y) {
|
for (int y = 0; y < 3; ++y) {
|
||||||
for (int x = 0; x < 2; ++x) {
|
for (int x = 0; x < 2; ++x) {
|
||||||
int ix = 8 + (x * ITEM_WIDTH);
|
int ix = 8 + (x * ITEM_WIDTH);
|
||||||
int iy = 20 + (y * ITEM_HEIGHT);
|
int iy = 20 + (y * ITEM_HEIGHT);
|
||||||
|
|
||||||
if (inBounds(ix, iy, ITEM_WIDTH, ITEM_HEIGHT, mouseX - guiLeft, mouseY - guiTop) && id < craftingMonitor.getTasks().size()) {
|
if (inBounds(ix, iy, ITEM_WIDTH, ITEM_HEIGHT, mouseX - guiLeft, mouseY - guiTop) && item < craftingMonitor.getTasks().size()) {
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageCraftingMonitorSelect(craftingMonitor, craftingMonitor.getTasks().get(id).id));
|
itemSelected = item;
|
||||||
|
|
||||||
craftingMonitor.setSelected(id);
|
|
||||||
|
|
||||||
resetSelection = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
id++;
|
item++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resetSelection) {
|
|
||||||
RefinedStorage.NETWORK.sendToServer(new MessageCraftingMonitorSelect(craftingMonitor, -1));
|
|
||||||
|
|
||||||
craftingMonitor.setSelected(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
package refinedstorage.network;
|
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
|
||||||
import refinedstorage.tile.TileCraftingMonitor;
|
|
||||||
|
|
||||||
public class MessageCraftingMonitorSelect extends MessageHandlerPlayerToServer<MessageCraftingMonitorSelect> implements IMessage {
|
|
||||||
private int x;
|
|
||||||
private int y;
|
|
||||||
private int z;
|
|
||||||
private int id;
|
|
||||||
|
|
||||||
public MessageCraftingMonitorSelect() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public MessageCraftingMonitorSelect(TileCraftingMonitor craftingMonitor, int id) {
|
|
||||||
this.x = craftingMonitor.getPos().getX();
|
|
||||||
this.y = craftingMonitor.getPos().getY();
|
|
||||||
this.z = craftingMonitor.getPos().getZ();
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fromBytes(ByteBuf buf) {
|
|
||||||
x = buf.readInt();
|
|
||||||
y = buf.readInt();
|
|
||||||
z = buf.readInt();
|
|
||||||
id = buf.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void toBytes(ByteBuf buf) {
|
|
||||||
buf.writeInt(x);
|
|
||||||
buf.writeInt(y);
|
|
||||||
buf.writeInt(z);
|
|
||||||
buf.writeInt(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(MessageCraftingMonitorSelect message, EntityPlayerMP player) {
|
|
||||||
TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.x, message.y, message.z));
|
|
||||||
|
|
||||||
if (tile instanceof TileCraftingMonitor) {
|
|
||||||
((TileCraftingMonitor) tile).setSelected(message.id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -63,7 +63,6 @@ public class CommonProxy {
|
|||||||
RefinedStorage.NETWORK.registerMessage(MessageGridPatternCreate.class, MessageGridPatternCreate.class, id++, Side.SERVER);
|
RefinedStorage.NETWORK.registerMessage(MessageGridPatternCreate.class, MessageGridPatternCreate.class, id++, Side.SERVER);
|
||||||
RefinedStorage.NETWORK.registerMessage(MessageCraftingMonitorCancel.class, MessageCraftingMonitorCancel.class, id++, Side.SERVER);
|
RefinedStorage.NETWORK.registerMessage(MessageCraftingMonitorCancel.class, MessageCraftingMonitorCancel.class, id++, Side.SERVER);
|
||||||
RefinedStorage.NETWORK.registerMessage(MessageGridItems.class, MessageGridItems.class, id++, Side.CLIENT);
|
RefinedStorage.NETWORK.registerMessage(MessageGridItems.class, MessageGridItems.class, id++, Side.CLIENT);
|
||||||
RefinedStorage.NETWORK.registerMessage(MessageCraftingMonitorSelect.class, MessageCraftingMonitorSelect.class, id++, Side.SERVER);
|
|
||||||
|
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(RefinedStorage.INSTANCE, new GuiHandler());
|
NetworkRegistry.INSTANCE.registerGuiHandler(RefinedStorage.INSTANCE, new GuiHandler());
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import java.util.List;
|
|||||||
|
|
||||||
public class TileCraftingMonitor extends TileMachine {
|
public class TileCraftingMonitor extends TileMachine {
|
||||||
private List<ClientSideCraftingTask> tasks = new ArrayList<ClientSideCraftingTask>();
|
private List<ClientSideCraftingTask> tasks = new ArrayList<ClientSideCraftingTask>();
|
||||||
private int selected = -1;
|
|
||||||
private List<Object> info = new ArrayList<Object>();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getEnergyUsage() {
|
public int getEnergyUsage() {
|
||||||
@@ -33,6 +31,8 @@ public class TileCraftingMonitor extends TileMachine {
|
|||||||
buf.writeInt(controller.getCraftingTasks().size());
|
buf.writeInt(controller.getCraftingTasks().size());
|
||||||
|
|
||||||
for (ICraftingTask task : controller.getCraftingTasks()) {
|
for (ICraftingTask task : controller.getCraftingTasks()) {
|
||||||
|
ByteBufUtils.writeUTF8String(buf, task.getInfo());
|
||||||
|
|
||||||
buf.writeInt(task.getPattern().getOutputs().length);
|
buf.writeInt(task.getPattern().getOutputs().length);
|
||||||
|
|
||||||
for (ItemStack output : task.getPattern().getOutputs()) {
|
for (ItemStack output : task.getPattern().getOutputs()) {
|
||||||
@@ -42,18 +42,6 @@ public class TileCraftingMonitor extends TileMachine {
|
|||||||
} else {
|
} else {
|
||||||
buf.writeInt(0);
|
buf.writeInt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.writeInt(info.size());
|
|
||||||
|
|
||||||
for (Object item : info) {
|
|
||||||
if (item instanceof String) {
|
|
||||||
buf.writeInt(0);
|
|
||||||
ByteBufUtils.writeUTF8String(buf, (String) item);
|
|
||||||
} else if (item instanceof ItemStack) {
|
|
||||||
buf.writeInt(1);
|
|
||||||
ByteBufUtils.writeItemStack(buf, (ItemStack) item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -65,62 +53,24 @@ public class TileCraftingMonitor extends TileMachine {
|
|||||||
List<ClientSideCraftingTask> newTasks = new ArrayList<ClientSideCraftingTask>();
|
List<ClientSideCraftingTask> newTasks = new ArrayList<ClientSideCraftingTask>();
|
||||||
|
|
||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
|
String info = ByteBufUtils.readUTF8String(buf);
|
||||||
|
|
||||||
int outputs = buf.readInt();
|
int outputs = buf.readInt();
|
||||||
|
|
||||||
for (int j = 0; j < outputs; ++j) {
|
for (int j = 0; j < outputs; ++j) {
|
||||||
newTasks.add(new ClientSideCraftingTask(ByteBufUtils.readItemStack(buf), i));
|
newTasks.add(new ClientSideCraftingTask(ByteBufUtils.readItemStack(buf), i, info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.reverse(newTasks);
|
Collections.reverse(newTasks);
|
||||||
|
|
||||||
tasks = newTasks;
|
tasks = newTasks;
|
||||||
|
|
||||||
List<Object> newInfo = new ArrayList<Object>();
|
|
||||||
|
|
||||||
size = buf.readInt();
|
|
||||||
|
|
||||||
for (int i = 0; i < size; ++i) {
|
|
||||||
int type = buf.readInt();
|
|
||||||
|
|
||||||
if (type == 0) {
|
|
||||||
newInfo.add(ByteBufUtils.readUTF8String(buf));
|
|
||||||
} else if (type == 1) {
|
|
||||||
newInfo.add(ByteBufUtils.readItemStack(buf));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
info = newInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ClientSideCraftingTask> getTasks() {
|
public List<ClientSideCraftingTask> getTasks() {
|
||||||
return tasks;
|
return tasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSelected() {
|
|
||||||
return selected;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelected(int selected) {
|
|
||||||
this.selected = selected;
|
|
||||||
|
|
||||||
if (!worldObj.isRemote) {
|
|
||||||
if (selected != -1) {
|
|
||||||
info = controller.getCraftingTasks().get(selected).getInfo();
|
|
||||||
} else {
|
|
||||||
info.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasSelection() {
|
|
||||||
return selected != -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Object> getInfo() {
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends Container> getContainer() {
|
public Class<? extends Container> getContainer() {
|
||||||
return ContainerCraftingMonitor.class;
|
return ContainerCraftingMonitor.class;
|
||||||
@@ -129,10 +79,12 @@ public class TileCraftingMonitor extends TileMachine {
|
|||||||
public class ClientSideCraftingTask {
|
public class ClientSideCraftingTask {
|
||||||
public ItemStack output;
|
public ItemStack output;
|
||||||
public int id;
|
public int id;
|
||||||
|
public String info;
|
||||||
|
|
||||||
public ClientSideCraftingTask(ItemStack output, int id) {
|
public ClientSideCraftingTask(ItemStack output, int id, String info) {
|
||||||
this.output = output;
|
this.output = output;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
this.info = info;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ gui.refinedstorage:relay=Relay
|
|||||||
gui.refinedstorage:interface.import=Interface Import
|
gui.refinedstorage:interface.import=Interface Import
|
||||||
gui.refinedstorage:interface.export=Interface Export
|
gui.refinedstorage:interface.export=Interface Export
|
||||||
gui.refinedstorage:crafting_monitor=Crafting Monitor
|
gui.refinedstorage:crafting_monitor=Crafting Monitor
|
||||||
gui.refinedstorage:crafting_monitor.items_in_queue=Items in queue
|
gui.refinedstorage:crafting_monitor.missing_items=Missing items:
|
||||||
gui.refinedstorage:crafting_monitor.items_crafting=Items crafting
|
gui.refinedstorage:crafting_monitor.items_crafting=Items crafting:
|
||||||
gui.refinedstorage:crafting_monitor.items_processing=Items processing
|
gui.refinedstorage:crafting_monitor.items_processing=Items processing:
|
||||||
gui.refinedstorage:crafting_monitor.not_started_yet=Not started yet
|
gui.refinedstorage:crafting_monitor.not_started_yet=Crafting task not started yet.
|
||||||
gui.refinedstorage:wireless_transmitter=Wireless Transmitter
|
gui.refinedstorage:wireless_transmitter=Wireless Transmitter
|
||||||
gui.refinedstorage:wireless_transmitter.distance=%d blocks
|
gui.refinedstorage:wireless_transmitter.distance=%d blocks
|
||||||
gui.refinedstorage:crafter=Crafter
|
gui.refinedstorage:crafter=Crafter
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ gui.refinedstorage:relay=Relais
|
|||||||
gui.refinedstorage:interface.import=Interface d'Import
|
gui.refinedstorage:interface.import=Interface d'Import
|
||||||
gui.refinedstorage:interface.export=Interface d'Export
|
gui.refinedstorage:interface.export=Interface d'Export
|
||||||
gui.refinedstorage:crafting_monitor=Moniteur de Craft
|
gui.refinedstorage:crafting_monitor=Moniteur de Craft
|
||||||
gui.refinedstorage:crafting_monitor.missing_items=Items manquant
|
gui.refinedstorage:crafting_monitor.missing_items=Items manquant:
|
||||||
gui.refinedstorage:crafting_monitor.items_crafting=Items en craft
|
gui.refinedstorage:crafting_monitor.items_crafting=Items en craft:
|
||||||
gui.refinedstorage:crafting_monitor.items_processing=Items en traitement
|
gui.refinedstorage:crafting_monitor.items_processing=Items en traitement:
|
||||||
gui.refinedstorage:crafting_monitor.not_started_yet=Pas encore commencé
|
gui.refinedstorage:crafting_monitor.not_started_yet=Tâche crafting pas encore commencé.
|
||||||
gui.refinedstorage:wireless_transmitter=Émetteur sans Fil
|
gui.refinedstorage:wireless_transmitter=Émetteur sans Fil
|
||||||
gui.refinedstorage:wireless_transmitter.distance=%d blocks
|
gui.refinedstorage:wireless_transmitter.distance=%d blocks
|
||||||
gui.refinedstorage:crafter=Crafteur
|
gui.refinedstorage:crafter=Crafteur
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ gui.refinedstorage:relay=Relais
|
|||||||
gui.refinedstorage:interface.import=Interface Import
|
gui.refinedstorage:interface.import=Interface Import
|
||||||
gui.refinedstorage:interface.export=Interface Export
|
gui.refinedstorage:interface.export=Interface Export
|
||||||
gui.refinedstorage:crafting_monitor=Crafting Monitor
|
gui.refinedstorage:crafting_monitor=Crafting Monitor
|
||||||
gui.refinedstorage:crafting_monitor.missing_items=Ontbrekende items
|
gui.refinedstorage:crafting_monitor.missing_items=Ontbrekende items:
|
||||||
gui.refinedstorage:crafting_monitor.items_crafting=Items aan het craften
|
gui.refinedstorage:crafting_monitor.items_crafting=Items aan het craften:
|
||||||
gui.refinedstorage:crafting_monitor.items_processing=Items aan het verwerken
|
gui.refinedstorage:crafting_monitor.items_processing=Items aan het verwerken:
|
||||||
gui.refinedstorage:crafting_monitor.not_started_yet=Nog niet begonnen
|
gui.refinedstorage:crafting_monitor.not_started_yet=Crafting opdracht nog niet begonnen.
|
||||||
gui.refinedstorage:wireless_transmitter=Draadloze Zender
|
gui.refinedstorage:wireless_transmitter=Draadloze Zender
|
||||||
gui.refinedstorage:wireless_transmitter.distance=%d blokken
|
gui.refinedstorage:wireless_transmitter.distance=%d blokken
|
||||||
gui.refinedstorage:crafter=Crafter
|
gui.refinedstorage:crafter=Crafter
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.8 KiB |
Reference in New Issue
Block a user