Search in sources :

Example 1 with TankWidget

use of forestry.core.gui.widgets.TankWidget in project ForestryMC by ForestryMC.

the class GuiForestry method getFluidStackAtPosition.

@Nullable
public FluidStack getFluidStackAtPosition(int mouseX, int mouseY) {
    for (Widget widget : widgetManager.getWidgets()) {
        if (widget instanceof TankWidget && widget.isMouseOver(mouseX - guiLeft, mouseY - guiTop)) {
            TankWidget tankWidget = (TankWidget) widget;
            IFluidTank tank = tankWidget.getTank();
            if (tank != null) {
                return tank.getFluid();
            }
        }
    }
    return null;
}
Also used : TankWidget(forestry.core.gui.widgets.TankWidget) TankWidget(forestry.core.gui.widgets.TankWidget) Widget(forestry.core.gui.widgets.Widget) IFluidTank(net.minecraftforge.fluids.IFluidTank) Nullable(javax.annotation.Nullable)

Aggregations

TankWidget (forestry.core.gui.widgets.TankWidget)1 Widget (forestry.core.gui.widgets.Widget)1 Nullable (javax.annotation.Nullable)1 IFluidTank (net.minecraftforge.fluids.IFluidTank)1