Search in sources :

Example 1 with CustomSlot

use of binnie.core.gui.minecraft.CustomSlot in project Binnie by ForestryMC.

the class ControlErrorState method onUpdateClient.

@Override
@SideOnly(Side.CLIENT)
public final void onUpdateClient() {
    this.errorState = this.getError();
    this.type = Window.get(this).getContainer().getErrorType();
    ControlSlot.highlighting.get(EnumHighlighting.ERROR).clear();
    ControlSlot.highlighting.get(EnumHighlighting.WARNING).clear();
    ControlLiquidTank.tankError.clear();
    ControlEnergyBar.isError = false;
    if (!this.isMouseOver() || this.errorState == null) {
        return;
    }
    ControlEnergyBar.isError = this.errorState.isPowerError();
    if (this.errorState.isItemError()) {
        Collection<CustomSlot> slots = this.errorState.getCustomSlots(Window.get(this).getContainer());
        for (CustomSlot slot : slots) {
            if (this.type == 0) {
                ControlSlot.highlighting.get(EnumHighlighting.ERROR).add(slot.slotNumber);
            } else {
                ControlSlot.highlighting.get(EnumHighlighting.WARNING).add(slot.slotNumber);
            }
        }
    }
    if (this.errorState.isTankError()) {
        for (final int slot : this.errorState.getData()) {
            ControlLiquidTank.tankError.add(slot);
        }
    }
}
Also used : CustomSlot(binnie.core.gui.minecraft.CustomSlot) Point(binnie.core.gui.geometry.Point) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with CustomSlot

use of binnie.core.gui.minecraft.CustomSlot in project Binnie by ForestryMC.

the class ErrorState method getTooltip.

public String getTooltip(ContainerCraftGUI container) {
    Collection<CustomSlot> slots = getCustomSlots(container);
    Set<Validator<?>> validators = new HashSet<>();
    for (CustomSlot slot : slots) {
        InventorySlot inventorySlot = slot.getInventorySlot();
        if (inventorySlot != null) {
            SlotValidator validator = inventorySlot.getValidator();
            if (validator != null) {
                validators.add(validator);
            }
        }
    }
    return definition.getDescription(validators);
}
Also used : CustomSlot(binnie.core.gui.minecraft.CustomSlot) InventorySlot(binnie.core.machines.inventory.InventorySlot) SlotValidator(binnie.core.machines.inventory.SlotValidator) Validator(binnie.core.machines.inventory.Validator) SlotValidator(binnie.core.machines.inventory.SlotValidator) HashSet(java.util.HashSet)

Aggregations

CustomSlot (binnie.core.gui.minecraft.CustomSlot)2 Point (binnie.core.gui.geometry.Point)1 InventorySlot (binnie.core.machines.inventory.InventorySlot)1 SlotValidator (binnie.core.machines.inventory.SlotValidator)1 Validator (binnie.core.machines.inventory.Validator)1 HashSet (java.util.HashSet)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1