diff options
author | bowser0000 <bowser0000@gmail.com> | 2021-11-20 22:39:13 -0500 |
---|---|---|
committer | bowser0000 <bowser0000@gmail.com> | 2021-11-20 22:39:13 -0500 |
commit | 8bd93c4ff81de99f73d24314e0bfd180e6f25255 (patch) | |
tree | c2ab3b893af64ef89b138f1bc30805b71b36df7c /src/main/java/me/Danker/containers | |
parent | 0e0321b594305981af84c884d9d3183533380121 (diff) | |
download | SkyblockMod-8bd93c4ff81de99f73d24314e0bfd180e6f25255.tar.gz SkyblockMod-8bd93c4ff81de99f73d24314e0bfd180e6f25255.tar.bz2 SkyblockMod-8bd93c4ff81de99f73d24314e0bfd180e6f25255.zip |
Add /hotmof command
Also make API handler use UTF-8
Diffstat (limited to 'src/main/java/me/Danker/containers')
-rw-r--r-- | src/main/java/me/Danker/containers/GuiChestDynamic.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/me/Danker/containers/GuiChestDynamic.java b/src/main/java/me/Danker/containers/GuiChestDynamic.java new file mode 100644 index 0000000..600abbc --- /dev/null +++ b/src/main/java/me/Danker/containers/GuiChestDynamic.java @@ -0,0 +1,45 @@ +package me.Danker.containers; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.IInventory; +import net.minecraft.util.ResourceLocation; + +// Hopefully this is dyanmic, only tested with 63 slots +public class GuiChestDynamic extends GuiContainer { + private final ResourceLocation CHEST_GUI_TEXTURE; + private IInventory upperChestInventory; + private IInventory lowerChestInventory; + private int inventoryRows; + + public GuiChestDynamic(IInventory upperInv, IInventory lowerInv, ResourceLocation texture) + { + super(new ContainerChest(upperInv, lowerInv, Minecraft.getMinecraft().thePlayer)); + this.upperChestInventory = upperInv; + this.lowerChestInventory = lowerInv; + this.allowUserInput = false; + this.inventoryRows = lowerInv.getSizeInventory() / 9; + int i = this.inventoryRows * 37; + int j = i - this.inventoryRows * 18; + this.ySize = j + this.inventoryRows * 18; + this.CHEST_GUI_TEXTURE = texture; + } + + protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) + { + this.fontRendererObj.drawString(this.lowerChestInventory.getDisplayName().getUnformattedText(), 8, 6, 4210752); + this.fontRendererObj.drawString(this.upperChestInventory.getDisplayName().getUnformattedText(), 8, this.ySize - this.inventoryRows * 16 - 1, 4210752); + } + + protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) + { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + this.mc.getTextureManager().bindTexture(CHEST_GUI_TEXTURE); + int i = (this.width - this.xSize) / 2; + int j = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17); + this.drawTexturedModalRect(i, j + this.inventoryRows * 18 + 17, 0, this.inventoryRows * 18 + 18, this.xSize, this.inventoryRows * 16); + } +} |