Fixes
This commit is contained in:
		@@ -79,12 +79,14 @@ public class GuiController extends GuiBase {
 | 
			
		||||
                TileController.ClientSideMachine machine = machines.get(slot);
 | 
			
		||||
 | 
			
		||||
                drawItem(x, y + 5, machine.stack);
 | 
			
		||||
                GlStateManager.pushMatrix();
 | 
			
		||||
                float scale = 0.5f;
 | 
			
		||||
 | 
			
		||||
                GlStateManager.pushMatrix();
 | 
			
		||||
 | 
			
		||||
                float scale = 0.5f;
 | 
			
		||||
                GlStateManager.scale(scale, scale, 1);
 | 
			
		||||
                drawString(calculateOffsetOnScale(x + 1, scale), calculateOffsetOnScale(y - 3, scale), machine.stack.getDisplayName());
 | 
			
		||||
                drawString(calculateOffsetOnScale(x + 21, scale), calculateOffsetOnScale(y + 10, scale), t("misc.refinedstorage:energy_usage_minimal", machine.energyUsage));
 | 
			
		||||
 | 
			
		||||
                GlStateManager.popMatrix();
 | 
			
		||||
 | 
			
		||||
                if (inBounds(x, y, 16, 16, mouseX, mouseY)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,14 @@
 | 
			
		||||
package refinedstorage.gui;
 | 
			
		||||
 | 
			
		||||
import net.minecraft.client.renderer.GlStateManager;
 | 
			
		||||
import net.minecraft.client.renderer.RenderHelper;
 | 
			
		||||
import net.minecraft.item.ItemStack;
 | 
			
		||||
import refinedstorage.container.ContainerCraftingMonitor;
 | 
			
		||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
 | 
			
		||||
import refinedstorage.tile.autocrafting.TileCraftingMonitor;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
public class GuiCraftingMonitor extends GuiBase {
 | 
			
		||||
    public static final int VISIBLE_ROWS = 2;
 | 
			
		||||
 | 
			
		||||
@@ -37,15 +42,61 @@ public class GuiCraftingMonitor extends GuiBase {
 | 
			
		||||
        scrollbar.draw(this);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private int calculateOffsetOnScale(int pos, float scale) {
 | 
			
		||||
        float multiplier = (pos / scale);
 | 
			
		||||
        return (int) multiplier;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void drawForeground(int mouseX, int mouseY) {
 | 
			
		||||
        scrollbar.update(this, mouseX, mouseY);
 | 
			
		||||
 | 
			
		||||
        drawString(7, 7, t("gui.refinedstorage:crafting_monitor"));
 | 
			
		||||
        drawString(7, 87, t("container.inventory"));
 | 
			
		||||
 | 
			
		||||
        int ox = 11;
 | 
			
		||||
        int x = ox;
 | 
			
		||||
        int y = 26;
 | 
			
		||||
 | 
			
		||||
        int slot = getOffset() * 2;
 | 
			
		||||
 | 
			
		||||
        RenderHelper.enableGUIStandardItemLighting();
 | 
			
		||||
 | 
			
		||||
        List<ItemStack> tasks = craftingMonitor.getTasks();
 | 
			
		||||
 | 
			
		||||
        for (int i = 0; i < 4; ++i) {
 | 
			
		||||
            if (slot < tasks.size()) {
 | 
			
		||||
                ItemStack task = tasks.get(slot);
 | 
			
		||||
 | 
			
		||||
                drawItem(x, y + 5, task);
 | 
			
		||||
 | 
			
		||||
                GlStateManager.pushMatrix();
 | 
			
		||||
 | 
			
		||||
                float scale = 0.5f;
 | 
			
		||||
                GlStateManager.scale(scale, scale, 1);
 | 
			
		||||
                drawString(calculateOffsetOnScale(x + 1, scale), calculateOffsetOnScale(y - 3, scale), task.getDisplayName());
 | 
			
		||||
 | 
			
		||||
                GlStateManager.popMatrix();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (i == 1) {
 | 
			
		||||
                x = ox;
 | 
			
		||||
                y += 30;
 | 
			
		||||
            } else {
 | 
			
		||||
                x += 75;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            slot++;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getOffset() {
 | 
			
		||||
        return (int) (scrollbar.getCurrentScroll() / 59f * (float) getRows());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private int getRows() {
 | 
			
		||||
        return 0;
 | 
			
		||||
        int max = (int) Math.ceil((float) craftingMonitor.getTasks().size() / (float) 2);
 | 
			
		||||
 | 
			
		||||
        return max < 0 ? 0 : max;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,6 @@ 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.TileController;
 | 
			
		||||
import refinedstorage.tile.grid.TileGrid;
 | 
			
		||||
 | 
			
		||||
public class MessageGridStoragePull extends MessageHandlerPlayerToServer<MessageGridStoragePull> implements IMessage {
 | 
			
		||||
@@ -49,7 +48,7 @@ public class MessageGridStoragePull extends MessageHandlerPlayerToServer<Message
 | 
			
		||||
        TileEntity tile = player.worldObj.getTileEntity(new BlockPos(message.gridX, message.gridY, message.gridZ));
 | 
			
		||||
 | 
			
		||||
        if (tile instanceof TileGrid && ((TileGrid) tile).isConnected()) {
 | 
			
		||||
            ((TileController) tile).handleStoragePull(message.id, message.flags, player);
 | 
			
		||||
            ((TileGrid) tile).getController().handleStoragePull(message.id, message.flags, player);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,10 @@ public class CraftingTask {
 | 
			
		||||
        this.ingredients = ingredients;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public ItemStack getResult() {
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static CraftingTask create(ItemStack result) {
 | 
			
		||||
        List<ItemStack> ingredients = new ArrayList<ItemStack>();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,18 @@
 | 
			
		||||
package refinedstorage.tile.autocrafting;
 | 
			
		||||
 | 
			
		||||
import io.netty.buffer.ByteBuf;
 | 
			
		||||
import net.minecraft.inventory.Container;
 | 
			
		||||
import net.minecraft.item.ItemStack;
 | 
			
		||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
 | 
			
		||||
import refinedstorage.container.ContainerCraftingMonitor;
 | 
			
		||||
import refinedstorage.tile.TileMachine;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
public class TileCraftingMonitor extends TileMachine {
 | 
			
		||||
    private List<ItemStack> tasks = new ArrayList<ItemStack>();
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public int getEnergyUsage() {
 | 
			
		||||
        return 2;
 | 
			
		||||
@@ -14,6 +22,40 @@ public class TileCraftingMonitor extends TileMachine {
 | 
			
		||||
    public void updateMachine() {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void sendContainerData(ByteBuf buf) {
 | 
			
		||||
        super.sendContainerData(buf);
 | 
			
		||||
 | 
			
		||||
        if (connected) {
 | 
			
		||||
            buf.writeInt(controller.getCraftingTasks().size());
 | 
			
		||||
 | 
			
		||||
            for (CraftingTask task : controller.getCraftingTasks()) {
 | 
			
		||||
                ByteBufUtils.writeItemStack(buf, task.getResult());
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            buf.writeInt(0);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void receiveContainerData(ByteBuf buf) {
 | 
			
		||||
        super.receiveContainerData(buf);
 | 
			
		||||
 | 
			
		||||
        List<ItemStack> crafting = new ArrayList<ItemStack>();
 | 
			
		||||
 | 
			
		||||
        int size = buf.readInt();
 | 
			
		||||
 | 
			
		||||
        for (int i = 0; i < size; ++i) {
 | 
			
		||||
            crafting.add(ByteBufUtils.readItemStack(buf));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        tasks = crafting;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public List<ItemStack> getTasks() {
 | 
			
		||||
        return tasks;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Class<? extends Container> getContainer() {
 | 
			
		||||
        return ContainerCraftingMonitor.class;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user