Files
MagicBees/src/main/java/magicbees/client/gui/GUIEffectRing.java
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
2.2 KiB
Java
Raw Normal View History

2023-04-22 11:28:20 -05:00
package magicbees.client.gui;
2023-04-29 13:11:51 +03:00
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
2023-04-22 11:28:20 -05:00
import net.minecraft.util.ResourceLocation;
2023-04-22 11:28:20 -05:00
import org.lwjgl.opengl.GL11;
2023-04-29 13:11:51 +03:00
import forestry.core.gui.GuiForestry;
2023-04-30 10:10:49 +00:00
import magicbees.main.CommonProxy;
2023-04-30 20:13:07 +03:00
import magicbees.main.utils.compat.baubles.InventoryBeeRing;
2023-04-29 13:11:51 +03:00
public class GUIEffectRing extends GuiForestry<ContainerEffectRing, IInventory> {
2023-04-22 11:28:20 -05:00
2023-04-27 13:54:13 -05:00
public static final String BACKGROUND_FILE = "ringScreen.png";
2023-04-22 11:28:20 -05:00
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(
CommonProxy.DOMAIN,
2023-04-27 13:54:13 -05:00
CommonProxy.GUI_TEXTURE + BACKGROUND_FILE);
2023-04-22 11:28:20 -05:00
2023-04-29 13:11:51 +03:00
private static final int BAR_DEST_X = 117;
private static final int BAR_DEST_Y = 10;
2023-04-29 13:11:51 +03:00
private static final int BAR_SRC_X = 176;
private static final int BAR_SRC_Y = 0;
2023-04-22 11:28:20 -05:00
2023-04-29 13:11:51 +03:00
private static final int BAR_WIDTH = 10;
private static final int BAR_HEIGHT = 40;
2023-04-27 21:40:15 -05:00
2023-04-29 13:11:51 +03:00
private final InventoryBeeRing inventoryBeeRing;
protected GUIEffectRing(InventoryBeeRing inventory, InventoryPlayer playerInventory) {
super(BACKGROUND_LOCATION, new ContainerEffectRing(inventory, playerInventory), inventory);
this.inventoryBeeRing = inventory;
}
2023-04-22 11:28:20 -05:00
@Override
2023-04-29 13:11:51 +03:00
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
2023-04-22 11:28:20 -05:00
GL11.glColor4f(1f, 1f, 1f, 1f);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize);
2023-04-29 13:11:51 +03:00
int currentBeeColour = this.inventoryBeeRing.getCurrentBeeColour();
float r = ((currentBeeColour >> 16) & 255) / 255f;
float g = ((currentBeeColour >> 8) & 255) / 255f;
float b = (currentBeeColour & 255) / 255f;
GL11.glColor3f(r, g, b);
2023-04-29 13:11:51 +03:00
int value = BAR_HEIGHT - (this.inventoryBeeRing.getCurrentBeeHealth() * BAR_HEIGHT) / 100;
this.drawTexturedModalRect(
this.guiLeft + BAR_DEST_X,
this.guiTop + value + BAR_DEST_Y,
BAR_SRC_X,
BAR_SRC_Y,
BAR_WIDTH,
BAR_HEIGHT - value);
2023-04-22 11:28:20 -05:00
}
}