Search in sources :

Example 1 with GuiInventorySearcher

use of me.desht.pneumaticcraft.client.gui.GuiInventorySearcher in project pnc-repressurized by TeamPneumatic.

the class GuiProgWidgetArea method actionPerformed.

@Override
public void actionPerformed(GuiButton button) throws IOException {
    if (button.id == 0 || button.id == 1) {
        invSearchGui = new GuiInventorySearcher(FMLClientHandler.instance().getClient().player);
        invSearchGui.setStackPredicate(itemStack -> itemStack.getItem() instanceof IPositionProvider);
        ItemStack gps = new ItemStack(Itemss.GPS_TOOL);
        if (button.id == 0) {
            ItemGPSTool.setGPSLocation(gps, new BlockPos(widget.x1, widget.y1, widget.z1));
        } else {
            ItemGPSTool.setGPSLocation(gps, new BlockPos(widget.x2, widget.y2, widget.z2));
        }
        invSearchGui.setSearchStack(ItemGPSTool.getGPSLocation(gps) != null ? gps : ItemStack.EMPTY);
        FMLClientHandler.instance().showGuiScreen(invSearchGui);
        pointSearched = button.id;
    }
    if (button.id == 1000) {
        // When the area is going to be displayed.
        saveWidgets();
    }
    super.actionPerformed(button);
}
Also used : IPositionProvider(me.desht.pneumaticcraft.api.item.IPositionProvider) GuiInventorySearcher(me.desht.pneumaticcraft.client.gui.GuiInventorySearcher) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack)

Example 2 with GuiInventorySearcher

use of me.desht.pneumaticcraft.client.gui.GuiInventorySearcher in project pnc-repressurized by TeamPneumatic.

the class GuiProgWidgetCoordinate method actionPerformed.

@Override
public void actionPerformed(GuiButton button) throws IOException {
    if (button.id == 0) {
        invSearchGui = new GuiInventorySearcher(FMLClientHandler.instance().getClient().player);
        invSearchGui.setStackPredicate(itemStack -> itemStack.getItem() instanceof IPositionProvider);
        BlockPos area = widget.getRawCoordinate();
        ItemStack gps = new ItemStack(Itemss.GPS_TOOL);
        ItemGPSTool.setGPSLocation(gps, area);
        invSearchGui.setSearchStack(ItemGPSTool.getGPSLocation(gps) != null ? gps : ItemStack.EMPTY);
        FMLClientHandler.instance().showGuiScreen(invSearchGui);
    }
    super.actionPerformed(button);
}
Also used : IPositionProvider(me.desht.pneumaticcraft.api.item.IPositionProvider) GuiInventorySearcher(me.desht.pneumaticcraft.client.gui.GuiInventorySearcher) BlockPos(net.minecraft.util.math.BlockPos) ItemStack(net.minecraft.item.ItemStack)

Example 3 with GuiInventorySearcher

use of me.desht.pneumaticcraft.client.gui.GuiInventorySearcher in project pnc-repressurized by TeamPneumatic.

the class GuiProgWidgetItemFilter method actionPerformed.

@Override
public void actionPerformed(GuiButton button) throws IOException {
    if (button.id == 0) {
        searchGui = new GuiSearcher(FMLClientHandler.instance().getClient().player);
        searchGui.setSearchStack(widg.getFilter());
        FMLClientHandler.instance().showGuiScreen(searchGui);
    } else if (button.id == 1) {
        invSearchGui = new GuiInventorySearcher(FMLClientHandler.instance().getClient().player);
        invSearchGui.setSearchStack(widg.getFilter());
        FMLClientHandler.instance().showGuiScreen(invSearchGui);
    } else if (button.id == 2) {
        if (--widg.specificMeta < 0)
            widg.specificMeta = 15;
    } else if (button.id == 3) {
        if (++widg.specificMeta > 15)
            widg.specificMeta = 0;
    }
    super.actionPerformed(button);
}
Also used : GuiSearcher(me.desht.pneumaticcraft.client.gui.GuiSearcher) GuiInventorySearcher(me.desht.pneumaticcraft.client.gui.GuiInventorySearcher)

Aggregations

GuiInventorySearcher (me.desht.pneumaticcraft.client.gui.GuiInventorySearcher)3 IPositionProvider (me.desht.pneumaticcraft.api.item.IPositionProvider)2 ItemStack (net.minecraft.item.ItemStack)2 BlockPos (net.minecraft.util.math.BlockPos)2 GuiSearcher (me.desht.pneumaticcraft.client.gui.GuiSearcher)1