Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

  • 2 weeks later...

Write some code in. :P

protected void drawSlot(int par1, int par2, int par3, int par4, Tessellator par5Tessellator)

 

protected void drawBackground()

  • Author

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.