Guest User

Untitled

a guest
Nov 15th, 2018
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. package com.TheRPGAdventurer.ROTD.client.gui;
  2.  
  3. import com.TheRPGAdventurer.ROTD.DragonMounts;
  4. import com.TheRPGAdventurer.ROTD.client.inventory.ContainerDragon;
  5. import com.TheRPGAdventurer.ROTD.server.entity.EntityTameableDragon;
  6.  
  7. import net.minecraft.client.Minecraft;
  8. import net.minecraft.client.gui.GuiButton;
  9. import net.minecraft.client.gui.inventory.GuiContainer;
  10. import net.minecraft.client.gui.inventory.GuiInventory;
  11. import net.minecraft.client.renderer.GlStateManager;
  12. import net.minecraft.inventory.IInventory;
  13. import net.minecraft.util.ResourceLocation;
  14. import net.minecraftforge.fml.relauncher.Side;
  15. import net.minecraftforge.fml.relauncher.SideOnly;
  16. import scala.swing.TextComponent.HasColumns;
  17.  
  18. @SideOnly(Side.CLIENT)
  19. public class GuiDragon extends GuiContainer {
  20.  
  21. private static final ResourceLocation texture = new ResourceLocation(DragonMounts.MODID, "textures/gui/dragon.png");
  22. private IInventory playerInventory;
  23. private IInventory dragonInv;
  24. private EntityTameableDragon dragon;
  25. private float mousePosX;
  26. private float mousePosY;
  27. private GuiButton SIT;
  28.  
  29. public GuiDragon(IInventory playerInv, EntityTameableDragon dragon) {
  30. super(new ContainerDragon(dragon, Minecraft.getMinecraft().player));
  31. this.playerInventory = playerInv;
  32. this.dragonInv = dragon.dragonInv;
  33. this.dragon = dragon;
  34. this.allowUserInput = false;
  35. this.ySize = 214;
  36. }
  37.  
  38. /**
  39. * Draw the foreground layer for the GuiContainer (everything in front of the
  40. * items)
  41. */
  42. protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
  43. this.fontRenderer.drawString(dragon.hasCustomName() ? dragon.getCustomNameTag() : "Dragon Inventory", 8, 6, dragon.getBreed().getColor());
  44. this.fontRenderer.drawString(dragon.isMale() ? "M" : "FM", 156, 6, dragon.isMale() ? 0x0079be : 0Xff8b8b);
  45. }
  46.  
  47. @Override
  48. protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  49. GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
  50. this.mc.getTextureManager().bindTexture(texture);
  51. int x = (this.width - this.xSize) / 2;
  52. int y = (this.height - this.ySize) / 2;
  53. this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
  54. if (dragon.isChested()) {
  55. this.drawTexturedModalRect(x + 0, y + 73, 0, 130, 170, 55);
  56. }
  57. GuiInventory.drawEntityOnScreen(x + 88, y + 65, (int) (13 / dragon.getScale()), x + 51 - this.mousePosX, y + 75 - 50 - this.mousePosY,
  58. this.dragon);
  59.  
  60. }
  61.  
  62. // @Override
  63. // public void initGui() {
  64. // this.buttonList.clear();
  65. // this.SIT = this.addButton(new GuiButton(0, 100, 100 , 5, 5, "SIT!"));
  66. // if(this.SIT.enabled && !dragon.isSitting()) {
  67. // dragon.getAISit().setSitting(true);
  68. // } else if(!this.SIT.enabled && dragon.isSitting()) {
  69. // dragon.getAISit().setSitting(false);
  70. // }
  71. // }
  72.  
  73. @Override
  74. public void drawScreen(int mouseX, int mouseY, float partialTicks) {
  75. this.drawDefaultBackground();
  76. this.mousePosX = mouseX;
  77. this.mousePosY = mouseY;
  78. super.drawScreen(mouseX, mouseY, partialTicks);
  79. this.renderHoveredToolTip(mouseX, mouseY);
  80. }
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment