fix grid bug
This commit is contained in:
@@ -3,7 +3,6 @@ package storagecraft.gui;
|
|||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@@ -146,8 +145,6 @@ public abstract class GuiBase extends GuiContainer
|
|||||||
|
|
||||||
public void drawItem(int x, int y, ItemStack stack, boolean withOverlay)
|
public void drawItem(int x, int y, ItemStack stack, boolean withOverlay)
|
||||||
{
|
{
|
||||||
GlStateManager.translate(0.0F, 0.0F, 32.0F);
|
|
||||||
|
|
||||||
zLevel = 200.0F;
|
zLevel = 200.0F;
|
||||||
itemRender.zLevel = 200.0F;
|
itemRender.zLevel = 200.0F;
|
||||||
|
|
||||||
|
@@ -112,9 +112,9 @@ public class GuiGrid extends GuiBase
|
|||||||
return offset + delta <= getMaxOffset();
|
return offset + delta <= getMaxOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isHoveringOverValidSlot()
|
private boolean isHoveringOverValidSlot(List<StorageItem> items)
|
||||||
{
|
{
|
||||||
return grid.isConnected() && isHoveringOverSlot() && hoveringSlotId < getItems().size();
|
return grid.isConnected() && isHoveringOverSlot() && hoveringSlotId < items.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isHoveringOverSlot()
|
private boolean isHoveringOverSlot()
|
||||||
@@ -147,8 +147,6 @@ public class GuiGrid extends GuiBase
|
|||||||
@Override
|
@Override
|
||||||
public void drawForeground(int mouseX, int mouseY)
|
public void drawForeground(int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
RenderHelper.enableGUIStandardItemLighting();
|
|
||||||
|
|
||||||
drawString(7, 7, t("gui.storagecraft:grid"));
|
drawString(7, 7, t("gui.storagecraft:grid"));
|
||||||
|
|
||||||
if (grid.getType() == EnumGridType.CRAFTING)
|
if (grid.getType() == EnumGridType.CRAFTING)
|
||||||
@@ -167,6 +165,8 @@ public class GuiGrid extends GuiBase
|
|||||||
|
|
||||||
int slot = offset * 9;
|
int slot = offset * 9;
|
||||||
|
|
||||||
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
|
||||||
for (int i = 0; i < 9 * 4; ++i)
|
for (int i = 0; i < 9 * 4; ++i)
|
||||||
{
|
{
|
||||||
if (slot < items.size())
|
if (slot < items.size())
|
||||||
@@ -209,7 +209,7 @@ public class GuiGrid extends GuiBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHoveringOverValidSlot())
|
if (isHoveringOverValidSlot(items))
|
||||||
{
|
{
|
||||||
drawTooltip(mouseX, mouseY, items.get(hoveringSlotId).toItemStack());
|
drawTooltip(mouseX, mouseY, items.get(hoveringSlotId).toItemStack());
|
||||||
}
|
}
|
||||||
@@ -218,8 +218,6 @@ public class GuiGrid extends GuiBase
|
|||||||
{
|
{
|
||||||
drawTooltip(mouseX, mouseY, t("misc.storagecraft:clear"));
|
drawTooltip(mouseX, mouseY, t("misc.storagecraft:clear"));
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderHelper.disableStandardItemLighting();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<StorageItem> getItems()
|
public List<StorageItem> getItems()
|
||||||
@@ -308,7 +306,7 @@ public class GuiGrid extends GuiBase
|
|||||||
{
|
{
|
||||||
StorageCraft.NETWORK.sendToServer(new MessageStoragePush(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), -1, clickedButton == 1));
|
StorageCraft.NETWORK.sendToServer(new MessageStoragePush(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), -1, clickedButton == 1));
|
||||||
}
|
}
|
||||||
else if (isHoveringOverValidSlot() && container.getPlayer().inventory.getItemStack() == null)
|
else if (isHoveringOverValidSlot(getItems()) && container.getPlayer().inventory.getItemStack() == null)
|
||||||
{
|
{
|
||||||
StorageCraft.NETWORK.sendToServer(new MessageStoragePull(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), hoveringId, clickedButton == 1, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
|
StorageCraft.NETWORK.sendToServer(new MessageStoragePull(controller.getPos().getX(), controller.getPos().getY(), controller.getPos().getZ(), hoveringId, clickedButton == 1, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user