co.uk.mattredmond.basewatcher.inventory.GuiBaseWatcherCore.java Source code

Java tutorial

Introduction

Here is the source code for co.uk.mattredmond.basewatcher.inventory.GuiBaseWatcherCore.java

Source

/**
 * Copyright (C) 2014 Matt Redmond and BaseWatcher contributors.
 *
 * This file is part of BaseWatcher.
 *
 * BaseWatcher is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * BaseWatcher is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with BaseWatcher. If not, see <http://www.gnu.org/licenses/>.
 */

package co.uk.mattredmond.basewatcher.inventory;

import co.uk.mattredmond.basewatcher.reference.ModInfo;
import co.uk.mattredmond.basewatcher.tileentities.TileEntityBaseWatcherCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;

@SideOnly(Side.CLIENT)
public class GuiBaseWatcherCore extends GuiContainer {
    private final TileEntityBaseWatcherCore core;

    /**
     *
     * @param player Player entity
     * @param core TileEntity to use
     */
    public GuiBaseWatcherCore(InventoryPlayer player, TileEntityBaseWatcherCore core) {
        super(new ContainerBaseWatcherCore(player, core));

        this.core = core;

        xSize = 172;
        ySize = 151;
    }

    // Resource location of the GUI texture
    private static final ResourceLocation texture = new ResourceLocation(ModInfo.MODID,
            "textures/gui/baseWatcherCoreGui.png");

    /**
     * Draws the specified GUI on the screen
     * @param f Color value (Might be wrong)
     * @param x X position to draw GUI (Might be wrong)
     * @param y Y position to draw GUI (Might be wrong)
     */
    @Override
    protected void drawGuiContainerBackgroundLayer(float f, int x, int y) {
        GL11.glColor4f(1, 1, 1, 1);

        // Bind the texture
        Minecraft.getMinecraft().getTextureManager().bindTexture(texture);

        // drawTexturedModalRect(xPos, yPos, xOffset, yOffset, xDimension, yDimension)
        drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
    }
}