Search in sources :

Example 16 with Area

use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.

the class WindowSequencer method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    super.initialiseClient();
    int x = 16;
    int y = 32;
    CraftGUIUtil.horizontalGrid(x, y, TextJustification.MIDDLE_CENTER, 2, new ControlSlotArray.Builder(this, 0, 0, 2, 2).create(Sequencer.SLOT_RESERVE), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation()), new ControlSequencerProgress(this, 0, 0), new ControlIconDisplay(this, 0, 0, GUIIcon.ARROW_RIGHT.getIcon().getResourceLocation()), new ControlSlot.Builder(this, 0, 0).assign(6));
    final ControlSlot slotTarget = new ControlSlot.Builder(this, x + 96, y + 16).assign(5);
    x = 34;
    y = 92;
    this.slotText = new ControlText(this, new Area(0, y, this.getWidth(), 12), TextFormatting.DARK_GRAY + I18N.localise("genetics.machine.sequencer.texts.userless"), TextJustification.MIDDLE_CENTER);
    y += 20;
    final ControlSlot slotDye = new ControlSlot.Builder(this, x, y).assign(0);
    x += 20;
    new ControlSlotCharge(this, x, y, 0).setColor(16750848);
    x += 32;
    new ControlEnergyBar(this, x, y, 60, 16, Alignment.LEFT);
    x += 92;
    final ControlErrorState errorState = new ControlErrorState(this, x, y + 1);
    new ControlPlayerInventory(this);
}
Also used : ControlIconDisplay(binnie.core.gui.minecraft.control.ControlIconDisplay) Area(binnie.core.gui.geometry.Area) ControlErrorState(binnie.core.gui.minecraft.control.ControlErrorState) ControlText(binnie.core.gui.controls.ControlText) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) ControlSlot(binnie.core.gui.minecraft.control.ControlSlot) ControlSlotCharge(binnie.core.gui.minecraft.control.ControlSlotCharge) ControlEnergyBar(binnie.core.gui.minecraft.control.ControlEnergyBar) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 17 with Area

use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.

the class ControlClimateBar method onRenderBackground.

@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
    CraftGUI.RENDER.texture(CraftGUITexture.ENERGY_BAR_BACK, getArea());
    int types = isHumidity ? 3 : 6;
    int w = (int) ((getSize().xPos() - 2.0f) / types);
    for (int i = 0; i < types; ++i) {
        int x = i * w;
        if (tolerated.contains(i)) {
            int color;
            if (isHumidity) {
                color = HUMID_COLORS[i];
            } else {
                color = TEMP_COLORS[i];
            }
            RenderUtil.drawSolidRect(new Area(x + 1, 1, w, getSize().yPos() - 2), color);
        }
    }
    CraftGUI.RENDER.texture(CraftGUITexture.ENERGY_BAR_GLASS, getArea());
}
Also used : Area(binnie.core.gui.geometry.Area) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 18 with Area

use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.

the class ControlSlot method onRenderForeground.

@Override
@SideOnly(Side.CLIENT)
public void onRenderForeground(int guiWidth, int guiHeight) {
    boolean highlighted = false;
    for (final Map.Entry<EnumHighlighting, List<Integer>> highlight : ControlSlot.highlighting.entrySet()) {
        if (highlight.getKey() == EnumHighlighting.SHIFT_CLICK && !ControlSlot.shiftClickActive) {
            continue;
        }
        if (highlighted || !highlight.getValue().contains(this.slot.slotNumber)) {
            continue;
        }
        highlighted = true;
        final int c = -1442840576 + Math.min(highlight.getKey().getColour(), 16777215);
        GlStateManager.disableBlend();
        GlStateManager.disableDepth();
        RenderUtil.drawGradientRect(new Area(1, 1, 16, 16), c, c);
        GlStateManager.enableBlend();
        GlStateManager.enableDepth();
    }
    if (!highlighted && this.getTopParent().getMousedOverWidget() == this) {
        GuiCraftGUI gui = Window.get(this).getGui();
        GlStateManager.disableBlend();
        GlStateManager.disableDepth();
        if (!gui.getDraggedItem().isEmpty() && !this.slot.isItemValid(gui.getDraggedItem())) {
            RenderUtil.drawGradientRect(new Area(1, 1, 16, 16), -1426089575, -1426089575);
        } else {
            RenderUtil.drawGradientRect(new Area(1, 1, 16, 16), -2130706433, -2130706433);
        }
        GlStateManager.enableBlend();
        GlStateManager.enableDepth();
    }
}
Also used : Area(binnie.core.gui.geometry.Area) IArea(binnie.core.api.gui.IArea) GuiCraftGUI(binnie.core.gui.minecraft.GuiCraftGUI) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) EnumMap(java.util.EnumMap) Point(binnie.core.gui.geometry.Point) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 19 with Area

use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.

the class ControlSlotBase method onRenderBackground.

@Override
@SideOnly(Side.CLIENT)
public void onRenderBackground(int guiWidth, int guiHeight) {
    CraftGUI.RENDER.texture(CraftGUITexture.SLOT, this.getArea());
    if (this.getTopParent().getMousedOverWidget() == this) {
        Area area = new Area(new Point(1, 1), this.getArea().size().sub(new Point(2, 2)));
        RenderUtil.drawGradientRect(area, -2130706433, -2130706433);
    }
}
Also used : Area(binnie.core.gui.geometry.Area) Point(binnie.core.gui.geometry.Point) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 20 with Area

use of binnie.core.gui.geometry.Area in project Binnie by ForestryMC.

the class WindowFieldKit method initialiseClient.

@Override
@SideOnly(Side.CLIENT)
public void initialiseClient() {
    this.setTitle(I18N.localise("binniecore.gui.fieldkit.title"));
    CraftGUI.RENDER.setStyleSheet(StyleSheetManager.getSheet(StyleSheetManager.PUNNETT_SHEET));
    WindowInventory inventory = this.getWindowInventory();
    inventory.createSlot(INDIVIDUAL_SLOT);
    inventory.createSlot(PAPER_SLOT);
    this.setupValidators();
    new ControlPlayerInventory(this);
    final Point handGlass = new Point(16, 32);
    this.GlassControl = new ControlImage(this, handGlass.xPos(), handGlass.yPos(), new StandardTexture(0, 160, 96, 96, BinnieCoreTexture.GUI_PUNNETT));
    new ControlSlot.Builder(this, handGlass.xPos() + 54, handGlass.yPos() + 26).assign(InventoryType.WINDOW, 0);
    new ControlSlot.Builder(this, 208, 8).assign(InventoryType.WINDOW, 1);
    (this.text = new ControlText(this, new Point(232, 13), I18N.localise("binniecore.gui.fieldkit.paper"))).setColor(2236962);
    (this.text = new ControlText(this, new Area(0, 120, this.getWidth(), 24), "", TextJustification.MIDDLE_CENTER)).setColor(2236962);
    this.chromo = new ControlChromosome(this, 150, 24);
    this.addEventHandler(EventValueChanged.class, EventHandlerOrigin.DIRECT_CHILD, this.chromo, event -> {
        final IChromosomeType type = (IChromosomeType) event.getValue();
        if (type != null && WindowFieldKit.this.info.containsKey(type)) {
            final String t = WindowFieldKit.this.info.get(type);
            WindowFieldKit.this.text.setValue(t);
        } else {
            WindowFieldKit.this.text.setValue("");
        }
    });
}
Also used : StandardTexture(binnie.core.gui.resource.textures.StandardTexture) Area(binnie.core.gui.geometry.Area) WindowInventory(binnie.core.gui.minecraft.WindowInventory) ControlPlayerInventory(binnie.core.gui.minecraft.control.ControlPlayerInventory) ControlText(binnie.core.gui.controls.ControlText) ControlSlot(binnie.core.gui.minecraft.control.ControlSlot) Point(binnie.core.gui.geometry.Point) ControlImage(binnie.core.gui.minecraft.control.ControlImage) IChromosomeType(forestry.api.genetics.IChromosomeType) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

Area (binnie.core.gui.geometry.Area)34 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)22 Point (binnie.core.gui.geometry.Point)14 ControlText (binnie.core.gui.controls.ControlText)10 IPoint (binnie.core.api.gui.IPoint)6 IArea (binnie.core.api.gui.IArea)5 ItemStack (net.minecraft.item.ItemStack)5 WindowAbstractDatabase (binnie.core.gui.database.WindowAbstractDatabase)4 ControlPlayerInventory (binnie.core.gui.minecraft.control.ControlPlayerInventory)4 IAllele (forestry.api.genetics.IAllele)4 ControlScrollableContent (binnie.core.gui.controls.scroll.ControlScrollableContent)3 ControlSpeciesBox (binnie.core.gui.database.ControlSpeciesBox)3 ControlItemDisplay (binnie.core.gui.minecraft.control.ControlItemDisplay)3 ControlSlot (binnie.core.gui.minecraft.control.ControlSlot)3 IAlleleSpecies (forestry.api.genetics.IAlleleSpecies)3 IFlower (binnie.botany.api.genetics.IFlower)2 IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)2 Control (binnie.core.gui.controls.core.Control)2 Border (binnie.core.gui.geometry.Border)2 GuiCraftGUI (binnie.core.gui.minecraft.GuiCraftGUI)2