- 128
- 12
Как сделать скроллинг в своём гуи? Пример: Креативные вкладки.
Java:
package ru.whitewarrior.testmod;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.ResourceLocation;
import sun.font.FontScaler;
public class GuiForge extends GuiScreen {
protected static final ResourceLocation BUTTON_TEXTURES = new ResourceLocation("textures/gui/widgets.png");
int guiWidth = 256;
int guiHeight = 256;
Minecraft mc = Minecraft.getMinecraft();
@Override
public void drawScreen(int x, int y, float ticks) {
ScaledResolution scale = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
int width = scale.getScaledWidth();
int height = scale.getScaledHeight();
int tabWidth = 40;
int tabHeight = 20;
int guiX = (width - guiWidth) / 2;
int guiY = (height - guiHeight) / 2;
GL11.glColor4f(1, 1, 1, 1);
drawDefaultBackground();
mc.renderEngine.bindTexture(new ResourceLocation(Main.modid, "textures/gui/ForgeGUI.png"));
drawTexturedModalRect(guiX, guiY, 0, 0, guiWidth, guiHeight);