Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.gugu42.rcmod;
- import org.lwjgl.opengl.GL11;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- import net.minecraft.client.gui.GuiButton;
- import net.minecraft.client.gui.inventory.GuiContainer;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.resources.I18n;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.util.ResourceLocation;
- import net.minecraft.util.StatCollector;
- @SideOnly(Side.CLIENT)
- public class GuiVendor extends GuiContainer {
- private static final ResourceLocation texturepath = new ResourceLocation("rcmod", "textures/gui/vendor.png");
- private GuiButton ammoBtn;
- public GuiVendor(InventoryPlayer inventoryPlayer,
- TileEntityVendor tileEntity) {
- // the container is instanciated and passed to the superclass for
- // handling
- super(new ContainerVendor(inventoryPlayer, tileEntity));
- }
- @Override
- public void initGui()
- {
- this.buttonList.clear();
- int posX = (this.width - xSize) / 2;
- int posY = (this.height - ySize) / 2;
- this.buttonList.add(this.ammoBtn = new GuiButton(0, posX + 13, posY + 15, "cc"));
- }
- @Override
- protected void drawGuiContainerForegroundLayer(int param1, int param2) {
- // draw text and stuff here
- // the parameters for drawString are: string, x, y, color
- fontRenderer.drawString("Vendor", 8, 6, 4210752);
- // draws "Inventory" or your regional equivalent
- fontRenderer.drawString(
- StatCollector.translateToLocal("container.inventory"), 8,
- ySize - 96 + 2, 4210752);
- }
- @Override
- protected void drawGuiContainerBackgroundLayer(float par1, int par2,
- int par3) {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glDisable(GL11.GL_LIGHTING);
- this.mc.getTextureManager().bindTexture(texturepath);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glDisable(GL11.GL_DEPTH_TEST);
- GL11.glDepthMask(false);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glDisable(GL11.GL_ALPHA_TEST);
- int x = (width - xSize) / 2;
- int y = (height - ySize) / 2;
- drawTexturedQuadFit(x, y, 256, 256, 0);
- GL11.glEnable(GL11.GL_DEPTH_TEST);
- GL11.glDepthMask(true);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glDisable(GL11.GL_LIGHTING);
- }
- @SideOnly(Side.CLIENT)
- public static void drawTexturedQuadFit(double x, double y, double width, double height, double zLevel){
- Tessellator tessellator = Tessellator.instance;
- tessellator.startDrawingQuads();
- tessellator.addVertexWithUV(x + 0, y + height, zLevel, 0,1);
- tessellator.addVertexWithUV(x + width, y + height, zLevel, 1, 1);
- tessellator.addVertexWithUV(x + width, y + 0, zLevel, 1,0);
- tessellator.addVertexWithUV(x + 0, y + 0, zLevel, 0, 0);
- tessellator.draw();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment