Merge branch 'master' into Blood-Frames

This commit is contained in:
Martin Robertz authored and GitHub committed 2023-04-30 12:06:03 +02:00
commit 66b1f3e075
13 files changed
+642 -25

No files matched your search

@@ -0,0 +1,17 @@
package magicbees.client.gui;
import magicbees.itemInventories.InventoryBeeRing;
import net.minecraft.entity.player.InventoryPlayer;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.core.gui.ContainerItemInventory;
public class ContainerEffectRing extends ContainerItemInventory<InventoryBeeRing> {
public ContainerEffectRing(InventoryBeeRing inventory, InventoryPlayer playerInventory) {
super(inventory, playerInventory, 8, 74);
addSlotToContainer(
new SlotCustomItems(inventory, 0, 80, 22, GameRegistry.findItemStack("Forestry", "beeDroneGE", 1)));
}
}
@@ -19,10 +19,6 @@ public class GUIEffectJar extends GuiContainer {
private static final int WIDTH = 176;
private static final int HEIGHT = 156;
private static final int SLOT_JAR_X = 80;
private static final int SLOT_JAR_Y = 22;
private static final int SLOT_INVENTORY_X = 8;
private static final int SLOT_INVENTORY_Y = 74;
private static final int BAR_DEST_X = 117;
private static final int BAR_DEST_Y = 10;
@@ -0,0 +1,63 @@
package magicbees.client.gui;
import magicbees.itemInventories.InventoryBeeRing;
import magicbees.main.CommonProxy;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
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;
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 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);
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 - (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);
}
}
@@ -1,5 +1,8 @@
package magicbees.client.gui;
import magicbees.itemInventories.InventoryBeeRing;
import magicbees.tileentity.TileEntityEffectJar;
import magicbees.tileentity.TileEntityMagicApiary;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@@ -18,6 +21,8 @@ public class GUIHandler implements IGuiHandler {
} else if (ID == UIScreens.THAUMIC_APIARY.ordinal()) {
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
value = new ContainerMagicApiary(player.inventory, tileEntityThaumicApiary);
} else if (ID == UIScreens.EFFECT_RING.ordinal()) {
value = new ContainerEffectRing(new InventoryBeeRing(player.getHeldItem(), player), player.inventory);
}
return value;
@@ -30,8 +35,9 @@ public class GUIHandler implements IGuiHandler {
} else if (ID == UIScreens.THAUMIC_APIARY.ordinal()) {
TileEntityMagicApiary tileEntityThaumicApiary = (TileEntityMagicApiary) world.getTileEntity(x, y, z);
return new GuiMagicApiary(player.inventory, tileEntityThaumicApiary);
} else {
return null;
} else if (ID == UIScreens.EFFECT_RING.ordinal()) {
return new GUIEffectRing(new InventoryBeeRing(player.getHeldItem(), player), player.inventory);
}
return null;
}
}
@@ -2,5 +2,6 @@ package magicbees.client.gui;
public enum UIScreens {
EFFECT_JAR,
THAUMIC_APIARY,;
THAUMIC_APIARY,
EFFECT_RING
}