mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 13:10:13 +00:00
Change GuiTravelAuth to use GhostSlots
This commit is contained in:
1 parent
76b3664c73
commit
01b80a7e35
2 files changed
+40
-3
No files matched your search
@@ -1,16 +1,21 @@
|
||||
package crazypants.enderio.teleport;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.enderio.core.client.gui.widget.TemplateSlot;
|
||||
import com.enderio.core.client.gui.widget.GhostSlot;
|
||||
import com.enderio.core.common.ContainerEnder;
|
||||
import com.enderio.core.common.TileEntityEnder;
|
||||
import com.enderio.core.common.util.ArrayInventory;
|
||||
|
||||
import crazypants.enderio.api.teleport.ITravelAccessable;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.teleport.ContainerTravelAuth.AuthInventory;
|
||||
import crazypants.enderio.teleport.packet.PacketPassword;
|
||||
|
||||
public class ContainerTravelAuth extends ContainerEnder<AuthInventory> {
|
||||
|
||||
@@ -94,14 +99,17 @@ public class ContainerTravelAuth extends ContainerEnder<AuthInventory> {
|
||||
|
||||
@Override
|
||||
protected void addSlots(InventoryPlayer playerInv) {
|
||||
}
|
||||
|
||||
public void addGhostSlots(List<GhostSlot> ghostSlots) {
|
||||
int x = 44;
|
||||
int y = 28;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
addSlotToContainer(new TemplateSlot(getInv(), i, x, y));
|
||||
ghostSlots.add(new AuthGhostSlot(getInv(), i, x, y));
|
||||
x += 18;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Point getPlayerInventoryOffset() {
|
||||
Point p = super.getPlayerInventoryOffset();
|
||||
@@ -114,4 +122,31 @@ public class ContainerTravelAuth extends ContainerEnder<AuthInventory> {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class AuthGhostSlot extends GhostSlot {
|
||||
|
||||
private AuthInventory inv;
|
||||
|
||||
public AuthGhostSlot(AuthInventory ta, int slotIndex, int x, int y) {
|
||||
this.slot = slotIndex;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.displayStdOverlay = false;
|
||||
this.grayOut = true;
|
||||
this.stackSizeLimit = 1;
|
||||
this.inv = ta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
ItemStack stack = inv.getStackInSlot(slot);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack stack) {
|
||||
inv.setInventorySlotContents(slot, stack);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,6 +44,7 @@ public class GuiTravelAuth extends GuiContainerBase {
|
||||
GuiButton okB = new GuiButton(0, width / 2 - (strLen / 2) - 5, sy + 50, strLen + 10, 20, str);
|
||||
buttonList.clear();
|
||||
buttonList.add(okB);
|
||||
((ContainerTravelAuth) inventorySlots).addGhostSlots(getGhostSlots());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,6 +94,7 @@ public class GuiTravelAuth extends GuiContainerBase {
|
||||
drawRect(sx + 43, sy + 27, sx + 43 + 90, sy + 27 + 18, ColorUtil.getARGB(new Color(1f, 0f, 0f, 0.5f)));
|
||||
}
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(f, mx, my);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user