Skip to content

Instantly share code, notes, and snippets.

@thvortex
thvortex / GuiTexturedRect.java
Created March 20, 2012 17:14
Drawing a textured rectangle in a Minecraft GUI
// HOW TO DRAW A TEXTURED RECTANGLE IN A MINECRAFT GUI WITH THE TEXTURE SCALED TO FIT
//
//
// 1. You need an instance of RenderEngine. Using ModLoader you can obtain it with:
//
RenderEngine renderEngine = ModLoader.getMinecraftInstance().renderEngine;
// 2a. When your mod first starts, you need to load your texture into OpenGL. If your image
// file is on the classpath (i.e. inside minecraft.jar or inside your own mod's jar) then
// you can load it easily. Your image file should contain an alpha layer with only 0 or 255