Search in sources :

Example 16 with AWGuiContainerBase

use of com.codetaylor.mc.artisanworktables.modules.worktables.gui.AWGuiContainerBase in project artisan-worktables by codetaylor.

the class GuiElementButtonExportShaped method elementClicked.

@Override
public void elementClicked(int mouseX, int mouseY, int mouseButton) {
    super.elementClicked(mouseX, mouseY, mouseButton);
    AWGuiContainerBase gui = (AWGuiContainerBase) this.guiBase;
    TileEntityBase tileEntity = gui.getTileEntity();
    try {
        String data = ZSRecipeExport.getExportString((AWContainer) gui.inventorySlots, tileEntity, true);
        StringSelection contents = new StringSelection(data);
        Toolkit defaultToolkit = Toolkit.getDefaultToolkit();
        Clipboard systemClipboard = defaultToolkit.getSystemClipboard();
        systemClipboard.setContents(contents, null);
        Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("chat.artisanworktables.message.recipe.copy.success"));
    } catch (Exception e) {
        Minecraft.getMinecraft().player.sendMessage(new TextComponentTranslation("chat.artisanworktables.message.recipe.copy.error"));
        ModuleWorktables.LOG.error("", e);
    }
}
Also used : AWGuiContainerBase(com.codetaylor.mc.artisanworktables.modules.worktables.gui.AWGuiContainerBase) TextComponentTranslation(net.minecraft.util.text.TextComponentTranslation) TileEntityBase(com.codetaylor.mc.artisanworktables.modules.worktables.tile.spi.TileEntityBase) Clipboard(java.awt.datatransfer.Clipboard) StringSelection(java.awt.datatransfer.StringSelection)

Example 17 with AWGuiContainerBase

use of com.codetaylor.mc.artisanworktables.modules.worktables.gui.AWGuiContainerBase in project artisan-worktables by codetaylor.

the class GuiElementButtonCreative method isCreative.

private boolean isCreative() {
    AWGuiContainerBase gui = (AWGuiContainerBase) this.guiBase;
    TileEntityBase tileEntity = gui.getTileEntity();
    return !tileEntity.isCreative();
}
Also used : AWGuiContainerBase(com.codetaylor.mc.artisanworktables.modules.worktables.gui.AWGuiContainerBase) TileEntityBase(com.codetaylor.mc.artisanworktables.modules.worktables.tile.spi.TileEntityBase)

Aggregations

AWGuiContainerBase (com.codetaylor.mc.artisanworktables.modules.worktables.gui.AWGuiContainerBase)17 TileEntityBase (com.codetaylor.mc.artisanworktables.modules.worktables.tile.spi.TileEntityBase)17 Clipboard (java.awt.datatransfer.Clipboard)2 StringSelection (java.awt.datatransfer.StringSelection)2 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)2 CSPacketWorktableClear (com.codetaylor.mc.artisanworktables.modules.worktables.network.CSPacketWorktableClear)1 CSPacketWorktableCreativeToggle (com.codetaylor.mc.artisanworktables.modules.worktables.network.CSPacketWorktableCreativeToggle)1 CSPacketWorktableLockedModeToggle (com.codetaylor.mc.artisanworktables.modules.worktables.network.CSPacketWorktableLockedModeToggle)1