Fix the few guis we have

This commit is contained in:
Vincent Lee committed 2017-06-29 20:58:51 -05:00
1 parent d7ffc27dc9
commit 209b52bb80
7 files changed
+21 -104

No files matched your search

@@ -32,6 +32,13 @@ public class GuiFlowerBag extends GuiContainer {
super(new ContainerFlowerBag(playerInv, flowerBagInv));
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
super.drawScreen(mouseX, mouseY, partialTicks);
this.renderHoveredToolTip(mouseX, mouseY);
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String s = I18n.format("item.botania:flowerBag.name");
@@ -25,6 +25,13 @@ public class GuiBaubleBox extends GuiContainer {
super(new ContainerBaubleBox(player, box));
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
super.drawScreen(mouseX, mouseY, partialTicks);
this.renderHoveredToolTip(mouseX, mouseY);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
@@ -36,8 +43,6 @@ public class GuiBaubleBox extends GuiContainer {
if(slot.getHasStack() && slot.getSlotStackLimit() == 1)
drawTexturedModalRect(guiLeft+slot.xPos, guiTop+slot.yPos, 200, 0, 16, 16);
}
// GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - mouseX, guiTop + 45 - 30 - mouseY, mc.player);
}
}
@@ -13,6 +13,7 @@ package vazkii.botania.client.gui.crafting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ContainerWorkbench;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.util.math.BlockPos;
@@ -24,39 +25,6 @@ public class ContainerCraftingHalo extends ContainerWorkbench {
public ContainerCraftingHalo(InventoryPlayer playerInv, World world) {
super(playerInv, world, BlockPos.ORIGIN);
craftMatrix = new InventoryCraftingHalo(this, 3, 3);
inventorySlots.clear();
inventoryItemStacks.clear();
// Le copypasta
addSlotToContainer(new SlotCrafting(playerInv.player, craftMatrix, craftResult, 0, 124, 35));
int l;
int i1;
for (l = 0; l < 3; ++l)
{
for (i1 = 0; i1 < 3; ++i1)
{
addSlotToContainer(new Slot(craftMatrix, i1 + l * 3, 30 + i1 * 18, 17 + l * 18));
}
}
for (l = 0; l < 3; ++l)
{
for (i1 = 0; i1 < 9; ++i1)
{
addSlotToContainer(new Slot(playerInv, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18));
}
}
for (l = 0; l < 9; ++l)
{
addSlotToContainer(new Slot(playerInv, l, 8 + l * 18, 142));
}
onCraftMatrixChanged(craftMatrix);
}
@Override
@@ -1,44 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Dec 15, 2014, 6:02:04 PM (GMT)]
*/
package vazkii.botania.client.gui.crafting;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
// This is pretty much a copypasta of GuiCrafting >_>
public class GuiCraftingHalo extends GuiContainer {
private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation("textures/gui/container/crafting_table.png");
public GuiCraftingHalo(InventoryPlayer playerInv, World world) {
super(new ContainerCraftingHalo(playerInv, world));
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
fontRenderer.drawString(I18n.format("container.crafting"), 28, 6, 4210752);
fontRenderer.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(craftingTableGuiTextures);
int k = (width - xSize) / 2;
int l = (height - ySize) / 2;
drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
}
}
@@ -1,22 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Dec 20, 2014, 4:29:09 PM (GMT)]
*/
package vazkii.botania.client.gui.crafting;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
public class InventoryCraftingHalo extends InventoryCrafting {
public InventoryCraftingHalo(Container container, int width, int height) {
super(container, width, height);
}
}
@@ -51,6 +51,7 @@ import net.minecraftforge.items.ItemHandlerHelper;
import net.minecraftforge.items.ItemStackHandler;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.gui.crafting.ContainerCraftingHalo;
import vazkii.botania.client.gui.crafting.InventoryCraftingHalo;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
@@ -306,7 +307,7 @@ public class ItemCraftingHalo extends ItemMod {
@SubscribeEvent
public void onItemCrafted(ItemCraftedEvent event) {
if(!(event.craftMatrix instanceof InventoryCraftingHalo))
if(!(event.player.openContainer instanceof ContainerCraftingHalo))
return;
for(int i = 0; i < event.player.inventory.getSizeInventory(); i++) {
@@ -10,8 +10,11 @@
*/
package vazkii.botania.common.network;
import net.minecraft.client.gui.inventory.GuiCrafting;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ContainerWorkbench;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import vazkii.botania.client.gui.bag.ContainerFlowerBag;
@@ -21,7 +24,6 @@ import vazkii.botania.client.gui.box.ContainerBaubleBox;
import vazkii.botania.client.gui.box.GuiBaubleBox;
import vazkii.botania.client.gui.box.InventoryBaubleBox;
import vazkii.botania.client.gui.crafting.ContainerCraftingHalo;
import vazkii.botania.client.gui.crafting.GuiCraftingHalo;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
import vazkii.botania.common.lib.LibGuiIDs;
@@ -51,7 +53,7 @@ public class GuiHandler implements IGuiHandler {
case LibGuiIDs.LEXICON :
return GuiLexicon.currentOpenLexicon;
case LibGuiIDs.CRAFTING_HALO :
return new GuiCraftingHalo(player.inventory, world);
return new GuiCrafting(player.inventory, world);
case LibGuiIDs.FLOWER_BAG :
return new GuiFlowerBag(player.inventory, new InventoryFlowerBag(player.getHeldItem(hand)));
case LibGuiIDs.BAUBLE_BOX :