mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-18 22:25:12 +00:00
Move GUI constructors into the main GUI handler
We use @SideOnly to ensure classes aren't loaded on dedicated servers. Also a tiny bit of cleanup to change several GUIs just to accept containers.
This commit is contained in:
@@ -7,29 +7,27 @@
|
||||
package dan200.computercraft.client.gui;
|
||||
|
||||
import dan200.computercraft.shared.peripheral.diskdrive.ContainerDiskDrive;
|
||||
import dan200.computercraft.shared.peripheral.diskdrive.TileDiskDrive;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiDiskDrive extends GuiContainer
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/diskdrive.png" );
|
||||
|
||||
private TileDiskDrive m_diskDrive;
|
||||
private final ContainerDiskDrive m_container;
|
||||
|
||||
public GuiDiskDrive( InventoryPlayer inventoryplayer, TileDiskDrive diskDrive )
|
||||
public GuiDiskDrive( ContainerDiskDrive container )
|
||||
{
|
||||
super( new ContainerDiskDrive( inventoryplayer, diskDrive ) );
|
||||
m_diskDrive = diskDrive;
|
||||
super( container );
|
||||
m_container = container;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int par1, int par2 )
|
||||
{
|
||||
String title = m_diskDrive.getDisplayName().getUnformattedText();
|
||||
String title = m_container.getDiskDrive().getDisplayName().getUnformattedText();
|
||||
fontRenderer.drawString( title, (xSize - fontRenderer.getStringWidth( title )) / 2, 6, 0x404040 );
|
||||
fontRenderer.drawString( I18n.format( "container.inventory" ), 8, (ySize - 96) + 2, 0x404040 );
|
||||
}
|
||||
|
||||
@@ -7,31 +7,27 @@
|
||||
package dan200.computercraft.client.gui;
|
||||
|
||||
import dan200.computercraft.shared.peripheral.printer.ContainerPrinter;
|
||||
import dan200.computercraft.shared.peripheral.printer.TilePrinter;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiPrinter extends GuiContainer
|
||||
{
|
||||
private static final ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/printer.png" );
|
||||
|
||||
private TilePrinter m_printer;
|
||||
private ContainerPrinter m_container;
|
||||
private final ContainerPrinter m_container;
|
||||
|
||||
public GuiPrinter( InventoryPlayer inventoryplayer, TilePrinter printer )
|
||||
public GuiPrinter( ContainerPrinter container )
|
||||
{
|
||||
super( new ContainerPrinter( inventoryplayer, printer ) );
|
||||
m_printer = printer;
|
||||
m_container = (ContainerPrinter) inventorySlots;
|
||||
super( container );
|
||||
m_container = container;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int par1, int par2 )
|
||||
{
|
||||
String title = m_printer.getDisplayName().getUnformattedText();
|
||||
String title = m_container.getPrinter().getDisplayName().getUnformattedText();
|
||||
fontRenderer.drawString( title, (xSize - fontRenderer.getStringWidth( title )) / 2, 6, 0x404040 );
|
||||
fontRenderer.drawString( I18n.format( "container.inventory" ), 8, (ySize - 96) + 2, 0x404040 );
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
package dan200.computercraft.client.gui;
|
||||
|
||||
import dan200.computercraft.ComputerCraft;
|
||||
import dan200.computercraft.api.turtle.ITurtleAccess;
|
||||
import dan200.computercraft.client.gui.widgets.WidgetTerminal;
|
||||
import dan200.computercraft.shared.computer.core.ClientComputer;
|
||||
import dan200.computercraft.shared.computer.core.ComputerFamily;
|
||||
@@ -16,9 +15,7 @@ import dan200.computercraft.shared.turtle.inventory.ContainerTurtle;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
@@ -29,27 +26,18 @@ public class GuiTurtle extends GuiContainer
|
||||
private static final ResourceLocation background = new ResourceLocation( "computercraft", "textures/gui/turtle.png" );
|
||||
private static final ResourceLocation backgroundAdvanced = new ResourceLocation( "computercraft", "textures/gui/turtle_advanced.png" );
|
||||
|
||||
protected World m_world;
|
||||
protected ContainerTurtle m_container;
|
||||
private ContainerTurtle m_container;
|
||||
|
||||
protected final ComputerFamily m_family;
|
||||
protected final ITurtleAccess m_turtle;
|
||||
protected final ClientComputer m_computer;
|
||||
protected WidgetTerminal m_terminalGui;
|
||||
private final ComputerFamily m_family;
|
||||
private final ClientComputer m_computer;
|
||||
private WidgetTerminal m_terminalGui;
|
||||
|
||||
public GuiTurtle( World world, InventoryPlayer inventoryplayer, TileTurtle turtle )
|
||||
{
|
||||
this( world, turtle, new ContainerTurtle( inventoryplayer, turtle.getAccess() ) );
|
||||
}
|
||||
|
||||
protected GuiTurtle( World world, TileTurtle turtle, ContainerTurtle container )
|
||||
public GuiTurtle( TileTurtle turtle, ContainerTurtle container )
|
||||
{
|
||||
super( container );
|
||||
|
||||
m_world = world;
|
||||
m_container = container;
|
||||
m_family = turtle.getFamily();
|
||||
m_turtle = turtle.getAccess();
|
||||
m_computer = turtle.getClientComputer();
|
||||
|
||||
xSize = 254;
|
||||
|
||||
Reference in New Issue
Block a user