Package de.eydamos.backpack.gui

Source Code of de.eydamos.backpack.gui.GuiWorkbenchBackpack

package de.eydamos.backpack.gui;

import java.util.ArrayList;

import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
import de.eydamos.backpack.helper.GuiHelper;
import de.eydamos.backpack.inventory.container.ContainerAdvanced;
import de.eydamos.backpack.misc.Constants;
import de.eydamos.backpack.misc.Localizations;

public class GuiWorkbenchBackpack extends GuiAdvanced {

    public GuiWorkbenchBackpack(ContainerAdvanced container) {
        super(container);
    }

    @Override
    public void drawScreen(int mouseX, int mouseY, float par3) {
        super.drawScreen(mouseX, mouseY, par3);

        ArrayList<String> tooltip = new ArrayList<String>();
        for(Object buttonObj : buttonList) {
            GuiButton button = (GuiButton) buttonObj;
            if(button.func_146115_a()) {
                if(button.id == 0) {
                    tooltip.add(I18n.format(Localizations.CLEAR_CRAFT_MATRIX));
                } else if(button.id == 1) {
                    tooltip.add(I18n.format(Localizations.SAVE_RECIPE));
                    tooltip.add(I18n.format(Localizations.CLICK_A_SLOT));
                }
            }
        }

        func_146283_a(tooltip, mouseX, mouseY);
    }

    @Override
    public void actionPerformed(GuiButton guiButton) {
        switch(guiButton.id) {
            case 0:
                GuiHelper.sendGuiCommand(Constants.GuiCommands.CLEAR);
                break;
            case 1:
                GuiHelper.sendGuiCommand(Constants.GuiCommands.SAVE);
                break;
        }
    }

    @Override
    protected void keyTyped(char charTyped, int keyCode) {
        super.keyTyped(charTyped, keyCode);

        switch(charTyped) {
            case 'c':
                GuiHelper.sendGuiCommand(Constants.GuiCommands.CLEAR);
                break;
            case 's':
                GuiHelper.sendGuiCommand(Constants.GuiCommands.SAVE);
                break;
        }
    }

}
TOP

Related Classes of de.eydamos.backpack.gui.GuiWorkbenchBackpack

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.