/* * Copyright (C) 2012,2013 yogpstop * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the * GNU Lesser General Public License along with this program. * If not, see <http://www.gnu.org/licenses/>. */ package org.yogpstop.tof; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.util.StatCollector; @SideOnly(Side.CLIENT) public class GuiSelectBlock extends GuiScreen { private GuiSlotBlockList blocks; private GuiScreen parent; public GuiSelectBlock(GuiScreen pscr) { super(); this.parent = pscr; } @Override public void initGui() { this.blocks = new GuiSlotBlockList(this.mc, this.width, this.height, 24, this.height - 32, 18, this); this.buttonList.add(new GuiButton(-1, this.width / 2 - 150, this.height - 26, 140, 20, StatCollector.translateToLocal("gui.done"))); this.buttonList.add(new GuiButton(-2, this.width / 2 + 10, this.height - 26, 140, 20, StatCollector.translateToLocal("gui.cancel"))); } @Override public void actionPerformed(GuiButton par1) { switch (par1.id) { case -1: TimesOreForge.setting.add(new SettingObject(this.blocks.currentblockid, this.blocks.currentmeta)); case -2: this.mc.displayGuiScreen(this.parent); break; } } @Override public void drawScreen(int i, int j, float k) { drawDefaultBackground(); this.blocks.drawScreen(i, j, k); String title = StatCollector.translateToLocal("tof.selectblock"); this.fontRenderer.drawStringWithShadow(title, (this.width - this.fontRenderer.getStringWidth(title)) / 2, 8, 0xFFFFFF); super.drawScreen(i, j, k); } }