Search in sources :

Example 11 with Area

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

the class PagePlanksOverview method onValueChanged.

@Override
public void onValueChanged(final ItemStack species) {
    this.deleteAllChildren();
    final WindowAbstractDatabase database = Window.get(this);
    IPoint size = getSize();
    new ControlText(this, new Area(0, 0, size.xPos(), 24), species.getDisplayName(), TextJustification.MIDDLE_CENTER);
    new ControlText(this, new Area(12, 24, size.xPos() - 24, 24), I18N.localise(DatabaseConstants.EXTRATREES_KEY + ".planks.use"), TextJustification.MIDDLE_LEFT);
    final IPlankType type = WoodManager.getPlankType(species);
    int x = 12;
    if (type != null) {
        final ItemStack fence = WoodManager.getFence(type, new FenceType(0), 1);
        final ItemStack gate = WoodManager.getGate(type);
        final ItemStack door = WoodManager.getDoor(type);
        if (!fence.isEmpty()) {
            new ControlItemDisplay(this, x, 48).setItemStack(fence);
            x += 22;
        }
        if (!gate.isEmpty()) {
            new ControlItemDisplay(this, x, 48).setItemStack(gate);
            x += 22;
        }
        if (!door.isEmpty()) {
            new ControlItemDisplay(this, x, 48).setItemStack(door);
            x += 22;
        }
    }
    final ControlText controlDescription = new ControlText(this, new Area(8, 84, this.getSize().xPos() - 16, 0), "", TextJustification.MIDDLE_CENTER);
    final ControlText controlSignature = new ControlText(this, new Area(8, 84, this.getSize().xPos() - 16, 0), "", TextJustification.BOTTOM_RIGHT);
    String desc = "";
    if (type != null) {
        desc = type.getDescription();
    }
    StringBuilder descBody = new StringBuilder("§o");
    String descSig = "";
    if (desc == null || desc.length() == 0) {
        descBody.append(I18N.localise(DatabaseConstants.KEY + ".nodescription"));
    } else {
        final String[] descStrings = desc.split("\\|");
        descBody.append(descStrings[0]);
        for (int i = 1; i < descStrings.length - 1; ++i) {
            descBody.append(' ').append(descStrings[i]);
        }
        if (descStrings.length > 1) {
            descSig += descStrings[descStrings.length - 1];
        }
    }
    controlDescription.setValue(descBody + "§r");
    controlSignature.setValue(descSig + "§r");
    final int descHeight = CraftGUI.RENDER.textHeight(controlDescription.getValue(), controlDescription.getSize().xPos());
    controlSignature.setPosition(new Point(controlSignature.getPosition().xPos(), controlDescription.getPosition().yPos() + descHeight + 10));
}
Also used : ControlItemDisplay(binnie.core.gui.minecraft.control.ControlItemDisplay) IPlankType(binnie.extratrees.wood.planks.IPlankType) ControlText(binnie.core.gui.controls.ControlText) IPoint(binnie.core.api.gui.IPoint) FenceType(binnie.extratrees.blocks.decor.FenceType) IPoint(binnie.core.api.gui.IPoint) Point(binnie.core.gui.geometry.Point) IPoint(binnie.core.api.gui.IPoint) Point(binnie.core.gui.geometry.Point) Area(binnie.core.gui.geometry.Area) WindowAbstractDatabase(binnie.core.gui.database.WindowAbstractDatabase) ItemStack(net.minecraft.item.ItemStack)

Example 12 with Area

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

the class PageWood method onValueChanged.

@Override
public void onValueChanged(final ItemStack species) {
    this.deleteAllChildren();
    final WindowAbstractDatabase database = Window.get(this);
    new ControlText(this, new Area(0, 0, this.getSize().xPos(), 24), this.getValue().toString(), TextJustification.MIDDLE_CENTER);
    ITreeBreedingSystem breedingSystem = (ITreeBreedingSystem) database.getBreedingSystem();
    final Collection<IAlleleSpecies> trees = breedingSystem.getTreesThatHaveWood(species, database.isMaster(), database.getWorld(), database.getUsername());
    new ControlSpeciesBox(this, 4, 24, this.getSize().xPos() - 8, this.getSize().yPos() - 4 - 24).setOptions(trees);
}
Also used : ITreeBreedingSystem(binnie.genetics.api.ITreeBreedingSystem) Area(binnie.core.gui.geometry.Area) ControlText(binnie.core.gui.controls.ControlText) IAlleleSpecies(forestry.api.genetics.IAlleleSpecies) WindowAbstractDatabase(binnie.core.gui.database.WindowAbstractDatabase) ControlSpeciesBox(binnie.core.gui.database.ControlSpeciesBox)

Example 13 with Area

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

the class PageFruit method onValueChanged.

@Override
public void onValueChanged(final ItemStack species) {
    this.deleteAllChildren();
    final WindowAbstractDatabase database = Window.get(this);
    new ControlText(this, new Area(0, 0, this.getSize().xPos(), 24), I18N.localise("extratrees.gui.database.tab.fruit." + (this.treesThatBearFruit ? "natural" : "potential")), TextJustification.MIDDLE_CENTER);
    ITreeBreedingSystem breedingSystem = (ITreeBreedingSystem) database.getBreedingSystem();
    final Collection<IAlleleSpecies> trees;
    if (this.treesThatBearFruit) {
        trees = breedingSystem.getTreesThatBearFruit(species, database.isMaster(), database.getWorld(), database.getUsername());
    } else {
        trees = breedingSystem.getTreesThatCanBearFruit(species, database.isMaster(), database.getWorld(), database.getUsername());
    }
    new ControlSpeciesBox(this, 4, 24, this.getSize().xPos() - 8, this.getSize().yPos() - 4 - 24).setOptions(trees);
}
Also used : ITreeBreedingSystem(binnie.genetics.api.ITreeBreedingSystem) Area(binnie.core.gui.geometry.Area) ControlText(binnie.core.gui.controls.ControlText) IAlleleSpecies(forestry.api.genetics.IAlleleSpecies) WindowAbstractDatabase(binnie.core.gui.database.WindowAbstractDatabase) ControlSpeciesBox(binnie.core.gui.database.ControlSpeciesBox)

Example 14 with Area

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

the class PagePlanksTrees method onValueChanged.

@Override
public void onValueChanged(final ItemStack species) {
    this.deleteAllChildren();
    final WindowAbstractDatabase database = Window.get(this);
    new ControlText(this, new Area(0, 0, this.getSize().xPos(), 24), species.getDisplayName(), TextJustification.MIDDLE_CENTER);
    final Collection<IAlleleSpecies> trees = getTreesThatMakePlanks(species, database.isMaster(), database.getWorld(), database.getUsername());
    new ControlSpeciesBox(this, 4, 24, this.getSize().xPos() - 8, this.getSize().yPos() - 4 - 24).setOptions(trees);
}
Also used : Area(binnie.core.gui.geometry.Area) ControlText(binnie.core.gui.controls.ControlText) IAlleleSpecies(forestry.api.genetics.IAlleleSpecies) WindowAbstractDatabase(binnie.core.gui.database.WindowAbstractDatabase) ControlSpeciesBox(binnie.core.gui.database.ControlSpeciesBox)

Example 15 with Area

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

the class ControlTankSlot method onUpdateClient.

@Override
@SideOnly(Side.CLIENT)
public void onUpdateClient() {
    this.fluidStack = Window.get(this).getContainer().getTankInfo(this.tankID).getLiquid();
    final int height = 16 * (((this.fluidStack == null) ? 0 : this.fluidStack.amount) / 1000);
    this.itemDisplay.setCroppedZone(this.itemDisplay, new Area(0, 16 - height, 16, 16));
    super.onUpdateClient();
}
Also used : Area(binnie.core.gui.geometry.Area) 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