private float plusOX;
private float plusOY;
private FancyCompass() {
Minecraft minecraft = MCPatcherUtils.getMinecraft();
RenderEngine renderEngine = minecraft.renderEngine;
int targetTexture = renderEngine.getTexture(ITEMS_PNG);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, targetTexture);
tileSize = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) / 16;
compassX = (int) (RELATIVE_X * tileSize * 16);
compassY = (int) (RELATIVE_Y * tileSize * 16);
Properties properties = TexturePackAPI.getProperties(COMPASS_PROPERTIES);
scaleX = getFloatProperty(properties, "scaleX", 1.0f);
scaleY = getFloatProperty(properties, "scaleY", 0.5f);
offsetX = getFloatProperty(properties, "offsetX", 1.0f / (2 * tileSize));
offsetY = getFloatProperty(properties, "offsetY", -1.0f / (2 * tileSize));
renderEngine.blurTexture = getBooleanProperty(properties, "filter", false);
debug = getBooleanProperty(properties, "debug", false);
BufferedImage image = TexturePackAPI.getImage(COMPASS_BASE_PNG);
if (image == null) {
image = new BufferedImage(tileSize, tileSize, BufferedImage.TYPE_INT_ARGB);
BufferedImage items = TexturePackAPI.getImage(ITEMS_PNG);
Graphics2D graphics2D = image.createGraphics();
int sx = (int) (items.getWidth() * RELATIVE_X);
int sy = (int) (items.getHeight() * RELATIVE_Y);
graphics2D.drawImage(items,
0, 0, image.getWidth(), image.getHeight(),
sx, sy, sx + items.getWidth() / 16, sy + items.getHeight() / 16,
null
);
}
baseTexture = renderEngine.allocateAndSetupTexture(image);
image = TexturePackAPI.getImage(COMPASS_DIAL_PNG);
dialTexture = renderEngine.allocateAndSetupTexture(image);
image = TexturePackAPI.getImage(COMPASS_OVERLAY_PNG);
if (image == null) {
overlayTexture = -1;
} else {
overlayTexture = renderEngine.allocateAndSetupTexture(image);
}
frameBuffer = glGenFramebuffersEXT();
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, frameBuffer);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, targetTexture, 0);