fix rendering in grid

This commit is contained in:
Raoul Van den Berge
2015-12-12 00:30:52 +01:00
parent feac88c17f
commit 003e87bd4d
2 changed files with 23 additions and 10 deletions

View File

@@ -42,15 +42,32 @@ public class GuiGrid extends GuiContainer {
int xx = getGridXStart();
int yy = getGridYStart();
for (int i = 0; i < grid.getController().getStorage().all().size(); ++i) {
StorageItem item = grid.getController().getStorage().all().get(i);
for (int i = 0; i < 9 * 4; ++i) {
if (i < grid.getController().getStorage().all().size()) {
StorageItem item = grid.getController().getStorage().all().get(i);
ItemStack stack = new ItemStack(item.getType(), item.getQuantity(), item.getMeta());
ItemStack stack = new ItemStack(item.getType(), item.getQuantity(), item.getMeta());
itemRender.renderItemIntoGUI(fontRendererObj, mc.getTextureManager(), stack, xx, yy);
itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), stack, xx, yy);
itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), stack, xx, yy);
itemRender.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), stack, xx, yy);
}
if (mouseX > xx && mouseX < xx + 16 && mouseY > yy && mouseY < yy + 16) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glColorMask(true, true, true, false);
drawGradientRect(xx, yy, xx + 16, yy + 16, -2130706433, -2130706433);
GL11.glColorMask(true, true, true, true);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
xx += 18;
if ((i + 1) % 9 == 0) {
xx = getGridXStart();
yy += 18;
}
}
}
}
@@ -75,7 +92,7 @@ public class GuiGrid extends GuiContainer {
public void mouseClicked(int mouseX, int mouseY, int clickedButton) {
super.mouseClicked(mouseX, mouseY, clickedButton);
if (clickedButton == 0) {
if (clickedButton == 0 && grid.isConnected()) {
if (mouseX > getGridXStart() && mouseX < getGridXEnd() && mouseY > getGridYStart() && mouseY < getGridYEnd()) {
SC.NETWORK.sendToServer(new MessagePushToStorage(grid.getController()));
}

View File

@@ -5,8 +5,6 @@ import cofh.api.energy.IEnergyHandler;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
@@ -34,8 +32,6 @@ public class TileController extends TileSC implements IEnergyHandler, INetworkTi
++ticks;
if (!worldObj.isRemote && ticks % 40 == 0) {
storage.push(new ItemStack(worldObj.rand.nextBoolean() ? Items.diamond : Items.apple, 10 + worldObj.rand.nextInt(40)));
if (!isActive()) {
disconnectAll();
} else {