mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-16 10:34:50 +00:00
Code refactoring
This commit is contained in:
1 parent
e24a94f0ba
commit
f3d3a0a2df
11 files changed
+270
-546
No files matched your search
@@ -1,50 +1,57 @@
|
||||
package magicbees.client.gui;
|
||||
|
||||
import magicbees.item.ItemBeeRing;
|
||||
import magicbees.itemInventories.InventoryBeeRing;
|
||||
import magicbees.main.CommonProxy;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GUIEffectRing extends effectGui {
|
||||
import forestry.core.gui.GuiForestry;
|
||||
|
||||
public class GUIEffectRing extends GuiForestry<ContainerEffectRing, IInventory> {
|
||||
|
||||
public static final String BACKGROUND_FILE = "ringScreen.png";
|
||||
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(
|
||||
CommonProxy.DOMAIN,
|
||||
CommonProxy.GUI_TEXTURE + BACKGROUND_FILE);
|
||||
|
||||
private static final int BAR_DEST_X = 117;
|
||||
private static final int BAR_DEST_Y = 10;
|
||||
|
||||
public GUIEffectRing(ItemStack itemStack, EntityPlayer player) {
|
||||
super(
|
||||
new ContainerEffectRing(
|
||||
ItemBeeRing.getInventory(player, itemStack, player.inventory.currentItem, false),
|
||||
player));
|
||||
this.xSize = WIDTH;
|
||||
this.ySize = HEIGHT;
|
||||
private static final int BAR_SRC_X = 176;
|
||||
private static final int BAR_SRC_Y = 0;
|
||||
|
||||
private static final int BAR_WIDTH = 10;
|
||||
private static final int BAR_HEIGHT = 40;
|
||||
|
||||
private final InventoryBeeRing inventoryBeeRing;
|
||||
|
||||
protected GUIEffectRing(InventoryBeeRing inventory, InventoryPlayer playerInventory) {
|
||||
super(BACKGROUND_LOCATION, new ContainerEffectRing(inventory, playerInventory), inventory);
|
||||
this.inventoryBeeRing = inventory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
|
||||
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);
|
||||
|
||||
InventoryBeeRing IBR = (InventoryBeeRing) ((ContainerEffectRing) this.inventorySlots).inventory;
|
||||
float r = ((IBR.currentBeeColour >> 16) & 255) / 255f;
|
||||
float g = ((IBR.currentBeeColour >> 8) & 255) / 255f;
|
||||
float b = (IBR.currentBeeColour & 255) / 255f;
|
||||
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);
|
||||
|
||||
int value = BAR_HEIGHT - (IBR.currentBeeHealth * BAR_HEIGHT) / 100;
|
||||
int value = BAR_HEIGHT - (this.inventoryBeeRing.getCurrentBeeHealth() * BAR_HEIGHT) / 100;
|
||||
this.drawTexturedModalRect(
|
||||
this.guiLeft + BAR_DEST_X,
|
||||
this.guiTop + value + BAR_DEST_Y,
|
||||
|
||||
Reference in new issue
Block a user