mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-11 15:57:31 +00:00
Make all background slot images overlays, only render if slot is empty
This commit is contained in:
1 parent
c8621250f9
commit
80f6bbf156
5 files changed
+26
-1
No files matched your search
@@ -2,10 +2,12 @@ package com.cricketcraft.chisel.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
@@ -59,5 +61,20 @@ public class GuiAutoChisel extends GuiContainer {
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
for (int i = TileEntityAutoChisel.BASE; i < TileEntityAutoChisel.CHISEL; i++) {
|
||||
if (autochisel.getStackInSlot(i) == null) {
|
||||
drawSlotOverlay(this, x, y, inventorySlots.getSlot(i), xSize, 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
if (autochisel.getStackInSlot(TileEntityAutoChisel.CHISEL) == null) {
|
||||
drawSlotOverlay(this, x, y, inventorySlots.getSlot(TileEntityAutoChisel.CHISEL), xSize, 24, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawSlotOverlay(GuiContainer gui, int x, int y, Slot slot, int u, int v, int padding) {
|
||||
padding /= 2;
|
||||
gui.drawTexturedModalRect(x + (slot.xDisplayPosition - padding), y + (slot.yDisplayPosition - padding), u, v, 18 + padding, 18 + padding);
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,14 @@ public class GuiChisel extends GuiContainer {
|
||||
|
||||
GeneralClient.bind(texture);
|
||||
drawTexturedModalRect(i, j, 0, 0, xSize, ySize);
|
||||
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
|
||||
Slot main = (Slot) container.inventorySlots.get(InventoryChiselSelection.normalSlots);
|
||||
if (main.getStack() == null) {
|
||||
GuiAutoChisel.drawSlotOverlay(this, x + 14, y + 14, main, 0, ySize, 60);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ContainerAutoChisel extends Container {
|
||||
autoChisel = tileEntityAutoChisel;
|
||||
|
||||
addSlot(tileEntityAutoChisel, 0, 53, 15);
|
||||
addSlot(tileEntityAutoChisel, 1, 78, 51);
|
||||
addSlot(tileEntityAutoChisel, 1, 78, 52);
|
||||
addSlot(tileEntityAutoChisel, 2, 103, 15);
|
||||
addSlot(tileEntityAutoChisel, 3, 8, 62);
|
||||
addSlot(tileEntityAutoChisel, 4, 151, 11);
|
||||
|
||||
Reference in new issue
Block a user