Jump to content

GuiSlot troublings


makerimages

Recommended Posts

Hey, I made this that extends GuiSlot

package mods.MCGadgetry.slots;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.TreeMap;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiSlot;
import net.minecraft.client.renderer.Tessellator;

import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
public class ApplicationSlot extends GuiSlot
{

protected Minecraft mc;

protected int slotHeight;

private String[] strings;
public ApplicationSlot(Minecraft par1Minecraft, int par2, int par3,
		int par4, int par5, int par6) {	
	super(par1Minecraft, par2, par3, par4, par5, par6);
	strings=new String[256];
	strings[0]="ahhs";
	// TODO Auto-generated constructor stub
}

/**
         * Gets the size of the current slot list.
         */
protected int getSize()
{
         return this.strings.length;
}
/**
         * the element in the slot that was clicked, boolean for wether it was double clicked or not
         */
protected void elementClicked(int index, boolean twice)
{
         if(!twice)
         {
        	 Minecraft.getMinecraft().thePlayer.sendChatMessage("Click me more");
         }
}
/**
         * returns true if the element passed in is currently selected
         */
protected boolean isSelected(int par1)
{
         return false;
}
/**
         * return the height of the content being scrolled
         */
protected int getContentHeight()
{
         return this.getSize() * 24;
}
protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator)
{
}
@Override
protected void drawBackground()
{
}
}

 

it is drawn in

package mods.MCGadgetry.interfaces;

import mods.MCGadgetry.slots.ApplicationSlot;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;


public class GuiSmartphoneHome extends GuiScreen
{
ApplicationSlot slot=new ApplicationSlot(Minecraft.getMinecraft(),32,32,10,10,51);

public GuiSmartphoneHome() 
{
}
@Override
    public void drawScreen(int par1, int par2, float par3)
{
            this.drawDefaultBackground();
            slot.drawScreen(5, 5, 0);
            
    }

}

 

it draws a 32*32 square of dirt texture.. how can I make it so I can put images and text into the slot??and move it?

Link to comment
Share on other sites

  • 2 weeks later...

I tried

 

package mods.MCGadgetry.slots;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.TreeMap;

import mods.MCGadgetry.interfaces.GuiSmartphoneHome;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiSlot;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;

import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
public class ApplicationSlot extends GuiSlot
{

protected Minecraft mc;

protected int slotHeight;

public String[] strings;
final GuiSmartphoneHome parentGui; 
public ResourceLocation rLoc=new ResourceLocation("mcgadgetry","textures/gui/Navigation.png");
public ApplicationSlot(Minecraft par1Minecraft, int par2, int par3,
		int par4, int par5, int par6,GuiSmartphoneHome sH) {	
	super(par1Minecraft, par2, par3, par4, par5, par6);
	this.parentGui=sH;
	strings=new String[256];
	strings[0]="ahhs";
	// TODO Auto-generated constructor stub
}

/**
         * Gets the size of the current slot list.
         */
protected int getSize()
{
         return this.strings.length;
}
/**
         * the element in the slot that was clicked, boolean for wether it was double clicked or not
         */
protected void elementClicked(int index, boolean twice)
{
         if(!twice)
         {
        	 Minecraft.getMinecraft().thePlayer.sendChatMessage("Click me more");
         }
}
/**
         * returns true if the element passed in is currently selected
         */
protected boolean isSelected(int par1)
{
         return false;
}
/**
         * return the height of the content being scrolled
         */
protected int getContentHeight()
{
         return this.getSize() * 24;
}
protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator)
{
Minecraft.getMinecraft().renderEngine.func_110577_a(rLoc);
this.parentGui.drawTexturedModalRect(10, 10, 0, 0, 32, 32);
}
@Override
protected void drawBackground()
{
}
}



 

 

as my slot code, does nothing

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.