Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package claygolem.client.gui;
- import java.util.ArrayList; [..]
- @SideOnly(Side.CLIENT)
- public class GuiClayGolem extends GuiContainer
- {
- private static final ResourceLocation _horseGuiTextures = new ResourceLocation(ModConst._MODID, "textures/gui/container/claygolem.png");
- private IInventory _playerInventory;
- private IInventory _claygolemInventory;
- private EntityClayGolem _claygolem;
- private float _screenWidth;
- private float _screenHeight;
- private static final String __OBFID = "CL_00000760";
- private boolean _showOptions = false;
- private String _enabled = "enabled";
- private String _disabled = "disabled";
- protected GuiButton _nbtButton;
- public GuiClayGolem(IInventory par1IInventory, IInventory par2IInventory, EntityClayGolem par3ClayGolem)
- {
- super(new ContainerClayGolem(par1IInventory, par2IInventory, par3ClayGolem));
- this._playerInventory = par1IInventory;
- this._claygolemInventory = par2IInventory;
- this._claygolem = par3ClayGolem;
- this.allowUserInput = false;
- }
- @Override
- public void initGui()
- {
- int width = (this.width - this.xSize) / 2;
- int height = (this.height - this.ySize) / 2;
- this.buttonList.add(0, new GuiButtonOptions(0, width + 5, height + 40));
- this._nbtButton = new GuiButton(1, width + 26, height + 50, 52, 20, _disabled);
- this.buttonList.add(_nbtButton);
- super.initGui();
- }
- @Override
- protected void actionPerformed(GuiButton guibutton)
- {
- if (guibutton instanceof GuiButtonOptions)
- _showOptions = !_showOptions;
- else if (guibutton instanceof GuiButton)
- if(guibutton.id == 1)
- ClayGolem.packetPipeline.sendToServer(new PacketUpdateClayGolem(this._claygolem, !this._claygolem.isSetWithNBT()));
- }
- /**
- * Draw the foreground layer for the GuiContainer (everything in front of the items)
- */
- @Override
- protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
- {
- this.fontRendererObj.drawString(this._claygolemInventory.hasCustomInventoryName() ? this._claygolemInventory.getInventoryName() : I18n.format(this._claygolemInventory.getInventoryName(), new Object[0]), 8, 6, 4210752);
- this.fontRendererObj.drawString(this._playerInventory.hasCustomInventoryName() ? this._playerInventory.getInventoryName() : I18n.format(this._playerInventory.getInventoryName(), new Object[0]), 8, this.ySize - 96 + 2, 4210752);
- }
- @Override
- protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
- {
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.getTextureManager().bindTexture(_horseGuiTextures);
- int k = (this.width - this.xSize) / 2;
- int l = (this.height - this.ySize) / 2;
- this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
- if (this._claygolem.isChested())
- {
- this.drawTexturedModalRect(k + 79, l + 17, 0, this.ySize, 90, 54);
- }
- if(_showOptions) {
- drawCenteredString(fontRendererObj, "\247fsome text", (width / 2)-40, (height / 2)-60, 0xffffaa);
- this._nbtButton.visible = true;
- if(_claygolem.GetItemStack() != null) {
- System.out.println(_claygolem.GetItemStack());
- }
- if(_claygolem.isSetWithNBT())
- this._nbtButton.displayString = _enabled;
- else
- this._nbtButton.displayString = _disabled;
- }
- else {
- GuiInventory.func_147046_a(k + 51, l + 60, 30, (float)(k + 51) - this._screenWidth, (float)(l + 75 - 50) - this._screenHeight, this._claygolem);
- this._nbtButton.visible = false;
- }
- }
- /**
- * Draws the screen and all the components in it.
- */
- @Override
- public void drawScreen(int par1, int par2, float par3)
- {
- this._screenWidth = (float)par1;
- this._screenHeight = (float)par2;
- try{
- super.drawScreen(par1, par2, par3);
- }catch (Exception e){
- System.out.println("Prevented guiscreen from opening server-sided");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment