mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 20:22:36 +00:00
Finish updating slot logic for Tool Stations, fix dupe bugs
This commit is contained in:
1 parent
c16c376868
commit
2629e241cd
26 files changed
+202
-154
No files matched your search
@@ -57,6 +57,8 @@ import org.w3c.dom.Document;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.TinkerArmor;
|
||||
import tconstruct.armor.ArmorProxyCommon;
|
||||
import tconstruct.armor.gui.ArmorExtendedGui;
|
||||
import tconstruct.armor.gui.KnapsackGui;
|
||||
import tconstruct.armor.modelblock.DryingRackRender;
|
||||
import tconstruct.armor.modelblock.DryingRackSpecialRender;
|
||||
import tconstruct.blocks.logic.DryingRackLogic;
|
||||
@@ -64,19 +66,6 @@ import tconstruct.client.entity.item.ExplosiveRender;
|
||||
import tconstruct.client.entity.projectile.ArrowRenderCustom;
|
||||
import tconstruct.client.entity.projectile.DaggerRenderCustom;
|
||||
import tconstruct.client.entity.projectile.LaunchedItemRender;
|
||||
import tconstruct.client.gui.AdaptiveSmelteryGui;
|
||||
import tconstruct.client.gui.ArmorExtendedGui;
|
||||
import tconstruct.client.gui.CraftingStationGui;
|
||||
import tconstruct.client.gui.FrypanGui;
|
||||
import tconstruct.client.gui.FurnaceGui;
|
||||
import tconstruct.client.gui.GuiLandmine;
|
||||
import tconstruct.client.gui.KnapsackGui;
|
||||
import tconstruct.client.gui.PartCrafterGui;
|
||||
import tconstruct.client.gui.PatternChestGui;
|
||||
import tconstruct.client.gui.SmelteryGui;
|
||||
import tconstruct.client.gui.StencilTableGui;
|
||||
import tconstruct.client.gui.ToolForgeGui;
|
||||
import tconstruct.client.gui.ToolStationGui;
|
||||
import tconstruct.client.pages.BlockCastPage;
|
||||
import tconstruct.client.pages.MaterialPage;
|
||||
import tconstruct.client.pages.ModifierPage;
|
||||
@@ -94,11 +83,14 @@ import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.mechworks.MechworksProxyCommon;
|
||||
import tconstruct.mechworks.entity.item.EntityLandmineFirework;
|
||||
import tconstruct.mechworks.entity.item.ExplosivePrimed;
|
||||
import tconstruct.mechworks.gui.GuiLandmine;
|
||||
import tconstruct.mechworks.inventory.ContainerLandmine;
|
||||
import tconstruct.mechworks.logic.TileEntityLandmine;
|
||||
import tconstruct.mechworks.model.CartRender;
|
||||
import tconstruct.smeltery.SmelteryProxyCommon;
|
||||
import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.smeltery.gui.AdaptiveSmelteryGui;
|
||||
import tconstruct.smeltery.gui.SmelteryGui;
|
||||
import tconstruct.smeltery.logic.AdaptiveSmelteryLogic;
|
||||
import tconstruct.smeltery.logic.CastingBasinLogic;
|
||||
import tconstruct.smeltery.logic.CastingTableLogic;
|
||||
@@ -118,6 +110,14 @@ import tconstruct.tools.entity.ArrowEntity;
|
||||
import tconstruct.tools.entity.DaggerEntity;
|
||||
import tconstruct.tools.entity.FancyEntityItem;
|
||||
import tconstruct.tools.entity.LaunchedPotion;
|
||||
import tconstruct.tools.gui.CraftingStationGui;
|
||||
import tconstruct.tools.gui.FrypanGui;
|
||||
import tconstruct.tools.gui.FurnaceGui;
|
||||
import tconstruct.tools.gui.PartCrafterGui;
|
||||
import tconstruct.tools.gui.PatternChestGui;
|
||||
import tconstruct.tools.gui.StencilTableGui;
|
||||
import tconstruct.tools.gui.ToolForgeGui;
|
||||
import tconstruct.tools.gui.ToolStationGui;
|
||||
import tconstruct.tools.items.ManualInfo;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
import tconstruct.tools.logic.FrypanLogic;
|
||||
|
||||
@@ -1,486 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.component.MultiFluidTank;
|
||||
import tconstruct.smeltery.component.SmelteryComponent;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
import tconstruct.smeltery.inventory.AdaptiveSmelteryContainer;
|
||||
import tconstruct.smeltery.logic.AdaptiveSmelteryLogic;
|
||||
|
||||
public class AdaptiveSmelteryGui extends NewContainerGui
|
||||
{
|
||||
public AdaptiveSmelteryLogic logic;
|
||||
String username;
|
||||
boolean isScrolling = false;
|
||||
boolean wasClicking;
|
||||
float currentScroll = 0.0F;
|
||||
int slotPos = 0;
|
||||
int prevSlotPos = 0;
|
||||
private final SmelteryComponent scomp;
|
||||
private final MultiFluidTank multitank;
|
||||
|
||||
public AdaptiveSmelteryGui(InventoryPlayer inventoryplayer, AdaptiveSmelteryLogic smeltery, World world, int x, int y, int z)
|
||||
{
|
||||
super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
logic = smeltery;
|
||||
username = inventoryplayer.player.getDisplayName();
|
||||
xSize = 248;
|
||||
scomp = logic.getSmeltery();
|
||||
multitank = logic.getMultiTank();
|
||||
scomp.update();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen (int mouseX, int mouseY, float par3)
|
||||
{
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
updateScrollbar(mouseX, mouseY, par3);
|
||||
}
|
||||
|
||||
protected void updateScrollbar (int mouseX, int mouseY, float par3)
|
||||
{
|
||||
if (logic.getSizeInventory() > 24)
|
||||
{
|
||||
boolean mouseDown = Mouse.isButtonDown(0);
|
||||
int lefto = this.guiLeft;
|
||||
int topo = this.guiTop;
|
||||
int xScroll = lefto + 67;
|
||||
int yScroll = topo + 8;
|
||||
int scrollWidth = xScroll + 14;
|
||||
int scrollHeight = yScroll + 144;
|
||||
|
||||
if (!this.wasClicking && mouseDown && mouseX >= xScroll && mouseY >= yScroll && mouseX < scrollWidth && mouseY < scrollHeight)
|
||||
{
|
||||
this.isScrolling = true;
|
||||
}
|
||||
|
||||
if (!mouseDown)
|
||||
{
|
||||
this.isScrolling = false;
|
||||
}
|
||||
|
||||
if (wasClicking && !isScrolling && slotPos != prevSlotPos)
|
||||
{
|
||||
prevSlotPos = slotPos;
|
||||
}
|
||||
|
||||
this.wasClicking = mouseDown;
|
||||
|
||||
if (this.isScrolling)
|
||||
{
|
||||
this.currentScroll = (mouseY - yScroll - 7.5F) / (scrollHeight - yScroll - 15.0F);
|
||||
|
||||
if (this.currentScroll < 0.0F)
|
||||
{
|
||||
this.currentScroll = 0.0F;
|
||||
}
|
||||
|
||||
if (this.currentScroll > 1.0F)
|
||||
{
|
||||
this.currentScroll = 1.0F;
|
||||
}
|
||||
|
||||
int s = ((AdaptiveSmelteryContainer) this.container).scrollTo(this.currentScroll);
|
||||
if (s != -1)
|
||||
slotPos = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Smeltery"), 86, 5, 0x404040);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 90, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
int base = 0;
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
FluidTankInfo[] info = logic.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
|
||||
int capacity = 0;
|
||||
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
if (liquid != null)
|
||||
capacity += info[i].capacity;
|
||||
}
|
||||
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
int basePos = 54;
|
||||
int initialLiquidSize = 0;
|
||||
int liquidSize = 0;
|
||||
if (capacity > 0)
|
||||
{
|
||||
liquidSize = liquid.amount * 52 / capacity;
|
||||
if (liquidSize == 0)
|
||||
liquidSize = 1;
|
||||
base += liquidSize;
|
||||
|
||||
}
|
||||
|
||||
int leftX = cornerX + basePos;
|
||||
int topY = (cornerY + 68) - base;
|
||||
int sizeX = 52;
|
||||
int sizeY = liquidSize;
|
||||
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
|
||||
{
|
||||
drawFluidStackTooltip(liquid, mouseX - cornerX + 36, mouseY - cornerY);
|
||||
|
||||
}
|
||||
}
|
||||
if (scomp.fuelGague > 0)
|
||||
{
|
||||
int leftX = cornerX + 117;
|
||||
int topY = (cornerY + 68) - scomp.getScaledFuelGague(52);
|
||||
int sizeX = 12;
|
||||
int sizeY = scomp.getScaledFuelGague(52);
|
||||
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
|
||||
{
|
||||
drawFluidStackTooltip(new FluidStack(-37, scomp.fuelAmount), mouseX - cornerX + 36, mouseY - cornerY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/smeltery.png");
|
||||
private static final ResourceLocation backgroundSide = new ResourceLocation("tinker", "textures/gui/smelteryside.png");
|
||||
private static final ResourceLocation terrain = new ResourceLocation("terrain.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX + 46, cornerY, 0, 0, 176, ySize);
|
||||
|
||||
// Fuel - Lava
|
||||
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
if (scomp.fuelGague > 0)
|
||||
{
|
||||
IIcon lavaIcon = Blocks.lava.getIcon(0, 0);
|
||||
int fuel = scomp.getScaledFuelGague(52);
|
||||
int count = 0;
|
||||
while (fuel > 0)
|
||||
{
|
||||
int size = fuel >= 16 ? 16 : fuel;
|
||||
fuel -= size;
|
||||
drawLiquidRect(cornerX + 117, (cornerY + 68) - size - 16 * count, lavaIcon, 12, size);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
FluidTankInfo[] info = logic.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
int capacity = 0;
|
||||
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
if (liquid != null)
|
||||
capacity += info[i].capacity;
|
||||
}
|
||||
|
||||
// Liquids - molten metal
|
||||
int base = 0;
|
||||
for (int i = 0; i < info.length - 1; i++)
|
||||
{
|
||||
FluidStack liquid = info[i].fluid;
|
||||
IIcon renderIndex = liquid.getFluid().getStillIcon();
|
||||
int basePos = 54;
|
||||
if (capacity > 0)
|
||||
{
|
||||
int liquidSize = liquid.amount * 52 / capacity;
|
||||
if (liquidSize == 0)
|
||||
liquidSize = 1;
|
||||
while (liquidSize > 0)
|
||||
{
|
||||
int size = liquidSize >= 16 ? 16 : liquidSize;
|
||||
drawLiquidRect(cornerX + basePos, (cornerY + 68) - size - base, renderIndex, 16, size);
|
||||
drawLiquidRect(cornerX + basePos + 16, (cornerY + 68) - size - base, renderIndex, 16, size);
|
||||
drawLiquidRect(cornerX + basePos + 32, (cornerY + 68) - size - base, renderIndex, 16, size);
|
||||
drawLiquidRect(cornerX + basePos + 48, (cornerY + 68) - size - base, renderIndex, 4, size);
|
||||
liquidSize -= size;
|
||||
base += size;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Liquid gague
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
drawTexturedModalRect(cornerX + 54, cornerY + 16, 176, 76, 52, 52);
|
||||
|
||||
// Side inventory
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(backgroundSide);
|
||||
// if (logic.layers > 0)
|
||||
{
|
||||
/*
|
||||
* if (logic.layers == 1) { drawTexturedModalRect(cornerX - 46,
|
||||
* cornerY, 0, 0, 98, 43); drawTexturedModalRect(cornerX - 46,
|
||||
* cornerY + 43, 0, 133, 98, 25); } else if (logic.layers == 2) {
|
||||
* drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, 61);
|
||||
* drawTexturedModalRect(cornerX - 46, cornerY + 61, 0, 97, 98, 61);
|
||||
* } else
|
||||
*/
|
||||
{
|
||||
drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, ySize - 8);
|
||||
}
|
||||
drawTexturedModalRect(cornerX + 32, (int) (cornerY + 8 + 127 * currentScroll), 98, 0, 12, 15);
|
||||
}
|
||||
|
||||
// Temperature
|
||||
int slotSize = logic.getSizeInventory();
|
||||
if (slotSize > 24)
|
||||
slotSize = 24;
|
||||
for (int iter = 0; iter < slotSize; iter++)
|
||||
{
|
||||
int slotTemp = logic.getTempForSlot(iter + slotPos * 3) - 20;
|
||||
int maxTemp = logic.getMeltingPointForSlot(iter + slotPos * 3) - 20;
|
||||
if (slotTemp > 0 && maxTemp > 0)
|
||||
{
|
||||
int size = 16 * slotTemp / maxTemp + 1;
|
||||
drawTexturedModalRect(cornerX - 38 + (iter % 3 * 22), cornerY + 8 + (iter / 3 * 18) + 16 - size, 98, 15 + 16 - size, 5, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawFluidStackTooltip (FluidStack par1ItemStack, int par2, int par3)
|
||||
{
|
||||
this.zLevel = 100;
|
||||
List list = getLiquidTooltip(par1ItemStack, this.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
for (int k = 0; k < list.size(); ++k)
|
||||
{
|
||||
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
|
||||
}
|
||||
|
||||
this.drawToolTip(list, par2, par3);
|
||||
this.zLevel = 0;
|
||||
}
|
||||
|
||||
public List getLiquidTooltip (FluidStack liquid, boolean par2)
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
if (liquid.fluidID == -37)
|
||||
{
|
||||
list.add("\u00A7f" + StatCollector.translateToLocal("gui.smeltery1"));
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
String name = StatCollector.translateToLocal(FluidRegistry.getFluidName(liquid));
|
||||
list.add("\u00A7f" + name);
|
||||
if (name.equals("liquified emerald"))
|
||||
{
|
||||
list.add("Emeralds: " + liquid.amount / 320f);
|
||||
}
|
||||
else if (name.contains("Molten"))
|
||||
{
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add("Ingots: " + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
{
|
||||
int nuggets = mB / TConstruct.nuggetLiquidValue;
|
||||
int junk = (mB % TConstruct.nuggetLiquidValue);
|
||||
if (nuggets > 0)
|
||||
list.add("Nuggets: " + nuggets);
|
||||
if (junk > 0)
|
||||
list.add("mB: " + junk);
|
||||
}
|
||||
}
|
||||
else if (name.equals("Seared Stone"))
|
||||
{
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add("Blocks: " + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else if (name.equals("Molten Glass"))
|
||||
{
|
||||
int blocks = liquid.amount / 1000;
|
||||
if (blocks > 0)
|
||||
list.add("Blocks: " + blocks);
|
||||
int panels = (liquid.amount % 1000) / 250;
|
||||
if (panels > 0)
|
||||
list.add("Panels: " + panels);
|
||||
int mB = (liquid.amount % 1000) % 250;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected void drawToolTip (List par1List, int par2, int par3)
|
||||
{
|
||||
if (!par1List.isEmpty())
|
||||
{
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
int k = 0;
|
||||
Iterator iterator = par1List.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String s = (String) iterator.next();
|
||||
int l = this.fontRendererObj.getStringWidth(s);
|
||||
|
||||
if (l > k)
|
||||
{
|
||||
k = l;
|
||||
}
|
||||
}
|
||||
|
||||
int i1 = par2 + 12;
|
||||
int j1 = par3 - 12;
|
||||
int k1 = 8;
|
||||
|
||||
if (par1List.size() > 1)
|
||||
{
|
||||
k1 += 2 + (par1List.size() - 1) * 10;
|
||||
}
|
||||
|
||||
if (i1 + k > this.width)
|
||||
{
|
||||
i1 -= 28 + k;
|
||||
}
|
||||
|
||||
if (j1 + k1 + 6 > this.height)
|
||||
{
|
||||
j1 = this.height - k1 - 6;
|
||||
}
|
||||
|
||||
this.zLevel = 300.0F;
|
||||
itemRenderer.zLevel = 300.0F;
|
||||
int l1 = -267386864;
|
||||
this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
|
||||
this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
|
||||
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
|
||||
this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
|
||||
this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
|
||||
int i2 = 1347420415;
|
||||
int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
|
||||
this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
|
||||
this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
|
||||
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
|
||||
this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);
|
||||
|
||||
for (int k2 = 0; k2 < par1List.size(); ++k2)
|
||||
{
|
||||
String s1 = (String) par1List.get(k2);
|
||||
this.fontRendererObj.drawStringWithShadow(s1, i1, j1, -1);
|
||||
|
||||
if (k2 == 0)
|
||||
{
|
||||
j1 += 2;
|
||||
}
|
||||
|
||||
j1 += 10;
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
public void drawLiquidRect (int startU, int startV, IIcon par3Icon, int endU, int endV)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(startU + 0, startV + endV, this.zLevel, par3Icon.getMinU(), par3Icon.getMaxV());// Bottom left
|
||||
tessellator.addVertexWithUV(startU + endU, startV + endV, this.zLevel, par3Icon.getMaxU(), par3Icon.getMaxV());// Bottom right
|
||||
tessellator.addVertexWithUV(startU + endU, startV + 0, this.zLevel, par3Icon.getMaxU(), par3Icon.getMinV());// Top right
|
||||
tessellator.addVertexWithUV(startU + 0, startV + 0, this.zLevel, par3Icon.getMinU(), par3Icon.getMinV()); // Top left
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public void mouseClicked(int mouseX, int mouseY, int
|
||||
* mouseButton) { super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
*
|
||||
* int base = 0; int cornerX = (width - xSize) / 2 + 36; int cornerY =
|
||||
* (height - ySize) / 2; int fluidToBeBroughtUp = -1;
|
||||
*
|
||||
* for (FluidStack liquid : multitank.getAllFluids()) { int basePos = 54;
|
||||
* int initialLiquidSize = 0; int liquidSize = 0;//liquid.amount * 52 /
|
||||
* liquidLayers; if (multitank.getCapacity() > 0) { int total =
|
||||
* multitank.getFluidAmount(); int liquidLayers = (total / 20000 + 1) *
|
||||
* 20000; if (liquidLayers > 0) { liquidSize = liquid.amount * 52 /
|
||||
* liquidLayers; if (liquidSize == 0) liquidSize = 1; base += liquidSize; }
|
||||
* }
|
||||
*
|
||||
* int leftX = cornerX + basePos; int topY = (cornerY + 68) - base; int
|
||||
* sizeX = 52; int sizeY = liquidSize; if (mouseX >= leftX && mouseX <=
|
||||
* leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY) {
|
||||
* fluidToBeBroughtUp = liquid.fluidID;
|
||||
*
|
||||
* Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
*
|
||||
* ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream
|
||||
* dos = new DataOutputStream(bos);
|
||||
*
|
||||
* try { dos.write(11);
|
||||
*
|
||||
* dos.writeInt(logic.worldObj.provider.dimensionId);
|
||||
* dos.writeInt(logic.xCoord); dos.writeInt(logic.yCoord);
|
||||
* dos.writeInt(logic.zCoord);
|
||||
*
|
||||
* dos.writeBoolean(this.isShiftKeyDown());
|
||||
*
|
||||
* dos.writeInt(fluidToBeBroughtUp); } catch (Exception e) {
|
||||
* e.printStackTrace(); }
|
||||
*
|
||||
* packet.channel = "TConstruct"; packet.data = bos.toByteArray();
|
||||
* packet.length = bos.size();
|
||||
*
|
||||
* PacketDispatcher.sendPacketToServer(packet); } } }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onGuiClosed ()
|
||||
{
|
||||
super.onGuiClosed();
|
||||
logic.getWorldObj().markBlockForUpdate(logic.xCoord, logic.yCoord, logic.zCoord);
|
||||
}
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.InventoryEffectRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import tconstruct.armor.inventory.ArmorExtendedContainer;
|
||||
import tconstruct.client.tabs.InventoryTabArmorExtended;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.util.player.ArmorExtended;
|
||||
|
||||
public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
{
|
||||
public InventoryPlayer inv;
|
||||
public ArmorExtended stats;
|
||||
|
||||
private float xSize_lo;
|
||||
private float ySize_lo;
|
||||
|
||||
public ArmorExtendedGui(InventoryPlayer inventoryplayer, ArmorExtended holder)
|
||||
{
|
||||
super(new ArmorExtendedContainer(inventoryplayer, holder));
|
||||
inv = inventoryplayer;
|
||||
stats = holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int cornerX = guiLeft;
|
||||
int cornerY = guiTop;
|
||||
this.buttonList.clear();
|
||||
|
||||
// InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new
|
||||
// ItemStack(Block.workbench), 0);
|
||||
// this.buttonList.add(tab);
|
||||
// tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new
|
||||
// ItemStack(Item.plateDiamond), 1);
|
||||
// tab.enabled = false;
|
||||
// this.buttonList.add(tab);
|
||||
|
||||
TabRegistry.updateTabValues(cornerX, cornerY, InventoryTabArmorExtended.class);
|
||||
TabRegistry.addTabsToList(this.buttonList);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
// fontRenderer.drawString(StatCollector.translateToLocal("inventory.armorextended"),
|
||||
// 60, 6, 0x404040);
|
||||
// fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"),
|
||||
// 17, (ySize - 96) + 2, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen (int par1, int par2, float par3)
|
||||
{
|
||||
super.drawScreen(par1, par2, par3);
|
||||
this.xSize_lo = (float) par1;
|
||||
this.ySize_lo = (float) par2;
|
||||
// if (stats.inventory[2] != null && stats.inventory[2].getItem() ==
|
||||
// TContent.knapsack)
|
||||
// {
|
||||
// if (this.buttonList.size() < 3)
|
||||
// {
|
||||
// int cornerX = guiLeft;
|
||||
// int cornerY = (this.height - this.ySize) / 2;
|
||||
// InventoryTab tab = new InventoryTab(4, cornerX + 56, cornerY - 28,
|
||||
// new ItemStack(TContent.knapsack), 1);
|
||||
// this.buttonList.add(tab);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (this.buttonList.size() >= 3)
|
||||
// {
|
||||
// buttonList.remove(2);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/armorextended.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// mc.renderEngine.bindTexture("/mods/tinker/textures/gui/armorextended.png");
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = guiLeft;
|
||||
int cornerY = guiTop;
|
||||
drawTexturedModalRect(cornerX, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if (!stats.isStackInSlot(0))
|
||||
drawTexturedModalRect(cornerX + 79, cornerY + 16, 176, 9, 18, 18);
|
||||
if (!stats.isStackInSlot(1))
|
||||
drawTexturedModalRect(cornerX + 79, cornerY + 34, 176, 27, 18, 18);
|
||||
if (!stats.isStackInSlot(2))
|
||||
drawTexturedModalRect(cornerX + 115, cornerY + 16, 212, 9, 18, 18);
|
||||
if (!stats.isStackInSlot(3))
|
||||
drawTexturedModalRect(cornerX + 115, cornerY + 34, 212, 27, 18, 18);
|
||||
if (!stats.isStackInSlot(4))
|
||||
drawTexturedModalRect(cornerX + 151, cornerY + 52, 230, 0, 18, 18);
|
||||
if (!stats.isStackInSlot(5))
|
||||
drawTexturedModalRect(cornerX + 151, cornerY + 34, 230, 18, 18, 18);
|
||||
if (!stats.isStackInSlot(6))
|
||||
drawTexturedModalRect(cornerX + 151, cornerY + 16, 230, 36, 18, 18);
|
||||
|
||||
cornerX = this.guiLeft;
|
||||
cornerY = this.guiTop;
|
||||
drawPlayerOnGui(this.mc, cornerX + 33, cornerY + 75, 30, (float) (cornerX + 51) - this.xSize_lo, (float) (cornerY + 75 - 50) - this.ySize_lo);
|
||||
}
|
||||
|
||||
public static void drawPlayerOnGui (Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5)
|
||||
{
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par1, (float) par2, 50.0F);
|
||||
GL11.glScalef((float) (-par3), (float) par3, (float) par3);
|
||||
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
float f2 = par0Minecraft.thePlayer.renderYawOffset;
|
||||
float f3 = par0Minecraft.thePlayer.rotationYaw;
|
||||
float f4 = par0Minecraft.thePlayer.rotationPitch;
|
||||
par4 -= 19;
|
||||
GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-((float) Math.atan((double) (par5 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
|
||||
par0Minecraft.thePlayer.renderYawOffset = (float) Math.atan((double) (par4 / 40.0F)) * 20.0F;
|
||||
par0Minecraft.thePlayer.rotationYaw = (float) Math.atan((double) (par4 / 40.0F)) * 40.0F;
|
||||
par0Minecraft.thePlayer.rotationPitch = -((float) Math.atan((double) (par5 / 40.0F))) * 20.0F;
|
||||
par0Minecraft.thePlayer.rotationYawHead = par0Minecraft.thePlayer.rotationYaw;
|
||||
GL11.glTranslatef(0.0F, par0Minecraft.thePlayer.yOffset, 0.0F);
|
||||
RenderManager.instance.playerViewY = 180.0F;
|
||||
RenderManager.instance.renderEntityWithPosYaw(par0Minecraft.thePlayer, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
|
||||
par0Minecraft.thePlayer.renderYawOffset = f2;
|
||||
par0Minecraft.thePlayer.rotationYaw = f3;
|
||||
par0Minecraft.thePlayer.rotationPitch = f4;
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
}
|
||||
|
||||
/*
|
||||
* protected void keyTyped(char par1, int par2) { if (par2 ==
|
||||
* TControls.armorKey.keyCode) { this.mc.thePlayer.closeScreen(); }
|
||||
*
|
||||
* super.keyTyped(par1, par2); }
|
||||
*/
|
||||
}
|
||||
@@ -1,402 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.tools.logic.CraftingStationLogic;
|
||||
|
||||
public class CraftingStationGui extends GuiContainer
|
||||
{
|
||||
public boolean active;
|
||||
public String toolName;
|
||||
public GuiTextField text;
|
||||
public String title, body = "";
|
||||
CraftingStationLogic logic;
|
||||
|
||||
public CraftingStationGui(InventoryPlayer inventory, CraftingStationLogic logic, World world, int x, int y, int z)
|
||||
{
|
||||
super(logic.getGuiContainer(inventory, world, x, y, z));
|
||||
this.logic = logic;
|
||||
// text = new GuiTextField(this.fontRendererObj, this.xSize / 2 - 5, 8,
|
||||
// 30, 12);
|
||||
// this.text.setText("");
|
||||
title = "\u00A7n" + StatCollector.translateToLocal("gui.toolforge1");
|
||||
body = StatCollector.translateToLocal("gui.toolforge2");
|
||||
toolName = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal(logic.tinkerTable ? "crafters.TinkerTable" : logic.getInvName()), 8, 6, 0x202020);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 0x202020);
|
||||
if (logic.chest != null)
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal(logic.chest.get().getInventoryName()), -108, this.ySize - 160, 0x202020);
|
||||
// this.fontRendererObj.drawString(toolName + "_", this.xSize / 2 - 18,
|
||||
// 8, 0xffffff);
|
||||
|
||||
if (logic.tinkerTable)
|
||||
{
|
||||
if (logic.isStackInSlot(0))
|
||||
drawToolStats();
|
||||
else
|
||||
drawToolInformation();
|
||||
}
|
||||
}
|
||||
|
||||
void drawToolStats ()
|
||||
{
|
||||
ItemStack stack = logic.getStackInSlot(0);
|
||||
if (stack.getItem() instanceof ToolCore)
|
||||
{
|
||||
ToolCore tool = (ToolCore) stack.getItem();
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
this.drawCenteredString(fontRendererObj, "\u00A7n" + tool.getToolName(), xSize + 63, 8, 0xffffff);
|
||||
|
||||
drawModularToolStats(stack, tool, tags);
|
||||
}
|
||||
else if (stack.getItem() instanceof ArmorCore)
|
||||
{
|
||||
ArmorCore armor = (ArmorCore) stack.getItem();
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
this.drawCenteredString(fontRendererObj, "\u00A7n" + armor.getClass().getSimpleName(), xSize + 63, 8, 0xffffff);
|
||||
|
||||
drawModularArmorStats(stack, armor, tags);
|
||||
}
|
||||
}
|
||||
|
||||
void drawModularArmorStats (ItemStack stack, ArmorCore tool, NBTTagCompound tags)
|
||||
{
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
int base = 24;
|
||||
int offset = 0;
|
||||
if (modifiers > 0)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation18") + tags.getInteger("Modifiers"), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "ModifierTip" + tipNum;
|
||||
if (tags.hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getString(tooltip);
|
||||
fontRendererObj.drawString("- " + tipName, xSize + 8, base + (offset + tipNum) * 10, 0xffffff);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
|
||||
void drawModularToolStats (ItemStack stack, ToolCore tool, NBTTagCompound tags)
|
||||
{
|
||||
List categories = Arrays.asList(tool.getTraits());
|
||||
final int durability = tags.getInteger("Damage");
|
||||
final int maxDur = tags.getInteger("TotalDurability");
|
||||
int availableDurability = maxDur - durability;
|
||||
|
||||
// Durability
|
||||
int base = 24;
|
||||
int offset = 0;
|
||||
if (maxDur > 0)
|
||||
{
|
||||
if (maxDur >= 10000)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation1"), xSize + 8, base + offset * 11, 0xffffff);
|
||||
offset++;
|
||||
fontRendererObj.drawString("- " + availableDurability + "/" + maxDur, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
else
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation2") + availableDurability + "/" + maxDur, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
final float stonebound = tags.getFloat("Shoddy");
|
||||
// Attack
|
||||
if (categories.contains("weapon"))
|
||||
{
|
||||
int attack = (int) (tags.getInteger("Attack"));
|
||||
float stoneboundDamage = (float) Math.log(durability / 72f + 1) * -2 * stonebound;
|
||||
attack += stoneboundDamage;
|
||||
attack *= tool.getDamageModifier();
|
||||
if (attack < 1)
|
||||
attack = 1;
|
||||
|
||||
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9");
|
||||
if (attack % 2 == 0)
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation3") + attack / 2 + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
else
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation3") + attack / 2f + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
|
||||
if (stoneboundDamage != 0)
|
||||
{
|
||||
heart = stoneboundDamage == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9");
|
||||
String bloss = stoneboundDamage > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5");
|
||||
this.fontRendererObj.drawString(bloss + (int) stoneboundDamage / 2 + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (categories.contains("bow"))
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
int drawSpeed = tags.getInteger("DrawSpeed");
|
||||
float flightSpeed = tags.getFloat("FlightSpeed");
|
||||
float trueDraw = drawSpeed / 20f * flightSpeed;
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation6") + df.format(trueDraw) + "s", xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation7") + df.format(flightSpeed) + "x", xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (categories.contains("ammo"))
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
int attack = (int) (tags.getInteger("Attack"));
|
||||
float mass = tags.getFloat("Mass");
|
||||
float shatter = tags.getFloat("BreakChance");
|
||||
float accuracy = tags.getFloat("Accuracy");
|
||||
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation10"), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9");
|
||||
if (attack % 2 == 0)
|
||||
this.fontRendererObj.drawString("- " + attack / 2 + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
else
|
||||
this.fontRendererObj.drawString("- " + attack / 2f + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
int minAttack = attack;
|
||||
int maxAttack = attack * 2;
|
||||
heart = StatCollector.translateToLocal("gui.partcrafter9");
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation11"), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
this.fontRendererObj.drawString(df.format(minAttack / 2f) + "-" + df.format(maxAttack / 2f) + heart, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation8") + df.format(mass), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation9") + df.format(accuracy - 4) + "%", xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
/*
|
||||
* this.fontRendererObj.drawString("Chance to break: " +
|
||||
* df.format(shatter)+"%", xSize + 8, base + offset * 10, 0xffffff);
|
||||
* offset++;
|
||||
*/
|
||||
offset++;
|
||||
}
|
||||
|
||||
// Mining
|
||||
if (categories.contains("dualharvest"))
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed") / 100f;
|
||||
float mineSpeed2 = tags.getInteger("MiningSpeed2") / 100f;
|
||||
float stoneboundSpeed = (float) Math.log(durability / 90f + 1) * 2 * stonebound;
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
float trueSpeed = mineSpeed + stoneboundSpeed;
|
||||
float trueSpeed2 = mineSpeed + stoneboundSpeed;
|
||||
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation12"), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
fontRendererObj.drawString("- " + df.format(trueSpeed) + ", " + df.format(trueSpeed2), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
if (stoneboundSpeed != 0)
|
||||
{
|
||||
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5");
|
||||
fontRendererObj.drawString(bloss + df.format(stoneboundSpeed), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
offset++;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation13"), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
fontRendererObj.drawString("- " + getHarvestLevelName(tags.getInteger("HarvestLevel")) + ", " + getHarvestLevelName(tags.getInteger("HarvestLevel2")), xSize + 8, base + offset * 10,
|
||||
0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
else if (categories.contains("harvest"))
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed");
|
||||
int heads = 1;
|
||||
|
||||
if (tags.hasKey("MiningSpeed2"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeed2");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedHandle"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedHandle");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedExtra"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedExtra");
|
||||
heads++;
|
||||
}
|
||||
|
||||
float trueSpeed = mineSpeed / (heads * 100f);
|
||||
|
||||
float stoneboundSpeed = (float) Math.log(durability / 90f + 1) * 2 * stonebound;
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
trueSpeed += stoneboundSpeed;
|
||||
if (trueSpeed < 0)
|
||||
trueSpeed = 0;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation14") + df.format(trueSpeed), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
if (stoneboundSpeed != 0)
|
||||
{
|
||||
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5");
|
||||
fontRendererObj.drawString(bloss + df.format(stoneboundSpeed), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation15") + getHarvestLevelName(tags.getInteger("HarvestLevel")), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
else if (categories.contains("utility"))
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed");
|
||||
float trueSpeed = mineSpeed / (100f);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation16") + trueSpeed, xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
if (modifiers > 0)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation18") + tags.getInteger("Modifiers"), xSize + 8, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
if (tags.hasKey("Tooltip1"))
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation17"), xSize + 8, base + offset * 10, 0xffffff);
|
||||
}
|
||||
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "ModifierTip" + tipNum;
|
||||
if (tags.hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getString(tooltip);
|
||||
fontRendererObj.drawString("- " + tipName, xSize + 8, base + (offset + tipNum) * 10, 0xffffff);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getHarvestLevelName (int num)
|
||||
{
|
||||
switch (num)
|
||||
{
|
||||
case 0:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining1");
|
||||
case 1:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining2");
|
||||
case 2:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining3");
|
||||
case 3:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining4");
|
||||
case 4:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining5");
|
||||
case 5:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining6");
|
||||
default:
|
||||
return String.valueOf(num);
|
||||
}
|
||||
}
|
||||
|
||||
void drawToolInformation ()
|
||||
{
|
||||
this.drawCenteredString(fontRendererObj, title, xSize + 63, 8, 0xffffff);
|
||||
fontRendererObj.drawSplitString(body, xSize + 8, 24, 115, 0xffffff);
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/tinkertable.png");
|
||||
private static final ResourceLocation description = new ResourceLocation("tinker", "textures/gui/description.png");
|
||||
private static final ResourceLocation icons = new ResourceLocation("tinker", "textures/gui/icons.png");
|
||||
private static final ResourceLocation chest = new ResourceLocation("tinker", "textures/gui/chestside.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
|
||||
{
|
||||
// Draw the background
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (this.width - this.xSize) / 2;
|
||||
int cornerY = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
if (active)
|
||||
{
|
||||
this.drawTexturedModalRect(cornerX + 62, cornerY, 0, this.ySize, 112, 22);
|
||||
}
|
||||
|
||||
this.mc.getTextureManager().bindTexture(icons);
|
||||
// Draw the slots
|
||||
|
||||
if (logic.tinkerTable && !logic.isStackInSlot(5))
|
||||
this.drawTexturedModalRect(cornerX + 47, cornerY + 33, 0, 233, 18, 18);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(icons);
|
||||
|
||||
// Draw chest side
|
||||
if (logic.chest != null)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(chest);
|
||||
if (logic.doubleChest == null)
|
||||
this.drawTexturedModalRect(cornerX - 116, cornerY, 0, 0, 121, this.ySize);
|
||||
else
|
||||
this.drawTexturedModalRect(cornerX - 116, cornerY, 125, 0, 122, this.ySize + 21);
|
||||
}
|
||||
|
||||
// Draw description
|
||||
if (logic.tinkerTable)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(description);
|
||||
cornerX = (this.width + this.xSize) / 2;
|
||||
cornerY = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, 126, this.ySize + 30);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.tools.logic.FrypanLogic;
|
||||
|
||||
public class FrypanGui extends GuiContainer
|
||||
{
|
||||
public FrypanLogic logic;
|
||||
|
||||
public FrypanGui(InventoryPlayer inventoryplayer, FrypanLogic frypan, World world, int x, int y, int z)
|
||||
{
|
||||
super(frypan.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
logic = frypan;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Frypan"), 60, 6, 0x404040);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/frypan.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
|
||||
if (logic.fuel > 0)
|
||||
{
|
||||
int fuel = logic.gaugeFuelScaled(12);
|
||||
drawTexturedModalRect(cornerX + 27, (cornerY + 40) - fuel, 176, 12 - fuel, 14, fuel + 2);
|
||||
}
|
||||
int fuelgague = logic.gaugeProgressScaled(24);
|
||||
drawTexturedModalRect(cornerX + 140, cornerY + 8, 176, 14, fuelgague, 16);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.tools.inventory.FurnaceContainer;
|
||||
import tconstruct.tools.logic.FurnaceLogic;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class FurnaceGui extends GuiContainer
|
||||
{
|
||||
private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/furnace.png");
|
||||
private FurnaceLogic logic;
|
||||
|
||||
public FurnaceGui(InventoryPlayer inventory, FurnaceLogic furnace)
|
||||
{
|
||||
super(new FurnaceContainer(inventory, furnace));
|
||||
this.logic = furnace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of
|
||||
* the items)
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
String s = this.logic.isInvNameLocalized() ? this.logic.getInvName() : I18n.format(this.logic.getInvName());
|
||||
this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the
|
||||
* items)
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(furnaceGuiTextures);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
int i1;
|
||||
|
||||
if (this.logic.isBurning())
|
||||
{
|
||||
i1 = this.logic.gaugeFuelScaled(12);
|
||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2);
|
||||
}
|
||||
|
||||
i1 = this.logic.gaugeProgressScaled(24);
|
||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, i1 + 1, 16);
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.client.ToolGuiElement;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiButtonTool extends GuiButton
|
||||
{
|
||||
/**
|
||||
* True for pointing right (next page), false for pointing left (previous
|
||||
* page).
|
||||
*/
|
||||
int textureX;
|
||||
int textureY;
|
||||
public String texture;
|
||||
public ToolGuiElement element;
|
||||
private static ResourceLocation background;// = new
|
||||
// ResourceLocation("tinker",
|
||||
// "textures/gui/armorextended.png");
|
||||
|
||||
public GuiButtonTool(int id, int posX, int posY, int texX, int texY, String domain, String tex, ToolGuiElement e)
|
||||
{
|
||||
super(id, posX, posY, 18, 18, "");
|
||||
textureX = texX;
|
||||
textureY = texY;
|
||||
texture = tex;
|
||||
element = e;
|
||||
background = new ResourceLocation(domain, tex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws this button to the screen.
|
||||
*/
|
||||
@Override
|
||||
public void drawButton (Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
boolean var4 = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.getTextureManager().bindTexture(background);
|
||||
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
int var5 = this.getHoverState(this.field_146123_n);
|
||||
int index = 18 * getHoverState(field_146123_n);
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, 144 + index * 2, 216, 18, 18);
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, textureX * 18, textureY * 18, 18, 18);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.mechworks.inventory.ContainerLandmine;
|
||||
import tconstruct.mechworks.landmine.behavior.Behavior;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class GuiLandmine extends GuiContainer
|
||||
{
|
||||
|
||||
ContainerLandmine container;
|
||||
|
||||
ResourceLocation background = new ResourceLocation("tinker:textures/gui/landmine.png");
|
||||
|
||||
public GuiLandmine(ContainerLandmine par1Container)
|
||||
{
|
||||
super(par1Container);
|
||||
container = par1Container;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderToolTip (ItemStack par1ItemStack, int par2, int par3)
|
||||
{
|
||||
List list = par1ItemStack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
Behavior b = Behavior.getBehaviorFromStack(par1ItemStack);
|
||||
if (b != null)
|
||||
{
|
||||
b.getInformation(par1ItemStack, list);
|
||||
}
|
||||
|
||||
for (int k = 0; k < list.size(); ++k)
|
||||
{
|
||||
if (k == 0)
|
||||
{
|
||||
list.set(k, par1ItemStack.getRarity().rarityColor + (String) list.get(k));
|
||||
}
|
||||
else
|
||||
{
|
||||
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
|
||||
}
|
||||
}
|
||||
|
||||
FontRenderer font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
|
||||
drawHoveringText(list, par2, par3, (font == null ? fontRendererObj : font));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int i, int j)
|
||||
{
|
||||
if (container.te != null)
|
||||
{
|
||||
fontRendererObj.drawString(container.te.getInventoryName(), 8, 5, 4210752);
|
||||
}
|
||||
else
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.landmine"), 8, 5, 4210752);
|
||||
}
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 96 + 3, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(background);
|
||||
int x = (width - xSize) / 2;
|
||||
int y = (height - ySize) / 2;
|
||||
this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.InventoryEffectRenderer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.armor.inventory.KnapsackContainer;
|
||||
import tconstruct.client.tabs.InventoryTabKnapsack;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.util.player.KnapsackInventory;
|
||||
|
||||
public class KnapsackGui extends InventoryEffectRenderer
|
||||
{
|
||||
public InventoryPlayer inv;
|
||||
public KnapsackInventory stats;
|
||||
|
||||
public KnapsackGui(InventoryPlayer inventoryplayer, KnapsackInventory holder)
|
||||
{
|
||||
super(new KnapsackContainer(inventoryplayer, holder));
|
||||
inv = inventoryplayer;
|
||||
stats = holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
int cornerX = guiLeft;
|
||||
int cornerY = guiTop;
|
||||
this.buttonList.clear();
|
||||
|
||||
TabRegistry.updateTabValues(cornerX, cornerY, InventoryTabKnapsack.class);
|
||||
TabRegistry.addTabsToList(this.buttonList);
|
||||
|
||||
// InventoryTab tab = new InventoryTab(2, cornerX, cornerY - 28, new
|
||||
// ItemStack(Block.workbench), 0);
|
||||
// this.buttonList.add(tab);
|
||||
// tab = new InventoryTab(3, cornerX + 28, cornerY - 28, new
|
||||
// ItemStack(Item.plateDiamond), 1);
|
||||
// this.buttonList.add(tab);
|
||||
// tab = new InventoryTab(4, cornerX + 56, cornerY - 28, new
|
||||
// ItemStack(TContent.knapsack), 1);
|
||||
// tab.enabled = false;
|
||||
// this.buttonList.add(tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("inventory.knapsack"), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/knapsack.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = guiLeft;
|
||||
int cornerY = guiTop;
|
||||
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
/*
|
||||
* protected void keyTyped(char par1, int par2) { if (par2 ==
|
||||
* TControls.armorKey.keyCode) { this.mc.thePlayer.closeScreen(); }
|
||||
*
|
||||
* super.keyTyped(par1, par2); }
|
||||
*/
|
||||
}
|
||||
@@ -1,301 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
import tconstruct.tools.inventory.PartCrafterChestContainer;
|
||||
import tconstruct.tools.logic.PartBuilderLogic;
|
||||
|
||||
public class PartCrafterGui extends NewContainerGui
|
||||
{
|
||||
PartBuilderLogic logic;
|
||||
String title, otherTitle = "";
|
||||
boolean drawChestPart;
|
||||
boolean hasTop, hasBottom;
|
||||
ItemStack topMaterial, bottomMaterial;
|
||||
ToolMaterial topEnum, bottomEnum;
|
||||
|
||||
public PartCrafterGui(InventoryPlayer inventoryplayer, PartBuilderLogic partlogic, World world, int x, int y, int z)
|
||||
{
|
||||
super((ActiveContainer) partlogic.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
logic = partlogic;
|
||||
drawChestPart = container instanceof PartCrafterChestContainer;
|
||||
|
||||
title = "\u00A7n" + (StatCollector.translateToLocal("gui.partcrafter1"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("crafters.PartBuilder"), 6, 6, 4210752);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
if (drawChestPart)
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("inventory.PatternChest"), -108, this.ySize - 148, 4210752);
|
||||
|
||||
drawMaterialInformation();
|
||||
}
|
||||
|
||||
void drawDefaultInformation ()
|
||||
{
|
||||
title = "\u00A7n" + StatCollector.translateToLocal("gui.partcrafter2");
|
||||
this.drawCenteredString(fontRendererObj, title, xSize + 63, 8, 16777215);
|
||||
fontRendererObj.drawSplitString(StatCollector.translateToLocal("gui.partcrafter3"), xSize + 8, 24, 115, 16777215);
|
||||
}
|
||||
|
||||
void drawMaterialInformation ()
|
||||
{
|
||||
ItemStack top = logic.getStackInSlot(2);
|
||||
//ItemStack topResult = logic.getStackInSlot(4);
|
||||
ItemStack bottom = logic.getStackInSlot(3);
|
||||
//ItemStack bottomResult = logic.getStackInSlot(6);
|
||||
if (topMaterial != top)
|
||||
{
|
||||
topMaterial = top;
|
||||
int topID = PatternBuilder.instance.getPartID(top);
|
||||
|
||||
if (topID != Short.MAX_VALUE)// && topResult != null)
|
||||
{
|
||||
topEnum = TConstructRegistry.getMaterial(topID);
|
||||
hasTop = true;
|
||||
title = "\u00A7n" + topEnum.name();
|
||||
}
|
||||
else
|
||||
hasTop = false;
|
||||
}
|
||||
|
||||
if (bottomMaterial != bottom)
|
||||
{
|
||||
bottomMaterial = bottom;
|
||||
int bottomID = PatternBuilder.instance.getPartID(bottom);
|
||||
|
||||
if (bottomID != Short.MAX_VALUE)// && bottomResult != null)
|
||||
{
|
||||
bottomEnum = TConstructRegistry.getMaterial(bottomID);
|
||||
hasBottom = true;
|
||||
otherTitle = "\u00A7n" + bottomEnum.name();
|
||||
}
|
||||
else
|
||||
hasBottom = false;
|
||||
}
|
||||
|
||||
int offset = 8;
|
||||
if (hasTop)
|
||||
{
|
||||
this.drawCenteredString(fontRendererObj, title, xSize + 63, offset, 16777215);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter4") + topEnum.durability(), xSize + 8, offset + 16, 16777215);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter5") + topEnum.handleDurability() + "x", xSize + 8, offset + 27, 16777215);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter6") + topEnum.toolSpeed() / 100f, xSize + 8, offset + 38, 16777215);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter7") + getHarvestLevelName(topEnum.harvestLevel()), xSize + 8, offset + 49, 16777215);
|
||||
|
||||
int attack = topEnum.attack();
|
||||
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9");
|
||||
if (attack % 2 == 0)
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart, xSize + 8, offset + 60, 0xffffff);
|
||||
else
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart, xSize + 8, offset + 60, 0xffffff);
|
||||
}
|
||||
|
||||
offset = 90;
|
||||
if (hasBottom)
|
||||
{
|
||||
this.drawCenteredString(fontRendererObj, otherTitle, xSize + 63, offset, 16777215);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter4") + bottomEnum.durability(), xSize + 8, offset + 16, 16777215);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter5") + bottomEnum.handleDurability() + "x", xSize + 8, offset + 27, 16777215);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter6") + bottomEnum.toolSpeed() / 100f, xSize + 8, offset + 38, 16777215);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter7") + getHarvestLevelName(bottomEnum.harvestLevel()), xSize + 8, offset + 49, 16777215);
|
||||
int attack = bottomEnum.attack();
|
||||
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9");
|
||||
if (attack % 2 == 0)
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart, xSize + 8, offset + 60, 0xffffff);
|
||||
else
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart, xSize + 8, offset + 60, 0xffffff);
|
||||
}
|
||||
|
||||
if (!hasTop && !hasBottom)
|
||||
drawDefaultInformation();
|
||||
}
|
||||
|
||||
public static String getHarvestLevelName (int num)
|
||||
{
|
||||
switch (num)
|
||||
{
|
||||
case 0:
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining1"));
|
||||
case 1:
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining2"));
|
||||
case 2:
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining3"));
|
||||
case 3:
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining4"));
|
||||
case 4:
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining5"));
|
||||
case 5:
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining6"));
|
||||
default:
|
||||
return String.valueOf(num);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/toolparts.png");
|
||||
private static final ResourceLocation minichest = new ResourceLocation("tinker", "textures/gui/patternchestmini.png");
|
||||
private static final ResourceLocation description = new ResourceLocation("tinker", "textures/gui/description.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
|
||||
{
|
||||
// Draw the background
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (this.width - this.xSize) / 2;
|
||||
int cornerY = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
|
||||
|
||||
// Draw Slots
|
||||
this.drawTexturedModalRect(cornerX + 39, cornerY + 26, 0, 166, 98, 36);
|
||||
if (!logic.isStackInSlot(0))
|
||||
{
|
||||
this.drawTexturedModalRect(cornerX + 39, cornerY + 26, 176, 0, 18, 18);
|
||||
}
|
||||
if (!logic.isStackInSlot(2))
|
||||
{
|
||||
this.drawTexturedModalRect(cornerX + 57, cornerY + 26, 176, 18, 18, 18);
|
||||
}
|
||||
if (!logic.isStackInSlot(1))
|
||||
{
|
||||
this.drawTexturedModalRect(cornerX + 39, cornerY + 44, 176, 0, 18, 18);
|
||||
}
|
||||
if (!logic.isStackInSlot(3))
|
||||
{
|
||||
this.drawTexturedModalRect(cornerX + 57, cornerY + 44, 176, 36, 18, 18);
|
||||
}
|
||||
|
||||
// Draw chest
|
||||
if (drawChestPart)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(minichest);
|
||||
this.drawTexturedModalRect(cornerX - 116, cornerY + 11, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
// Draw description
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(description);
|
||||
cornerX = (this.width + this.xSize) / 2;
|
||||
cornerY = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(cornerX, cornerY, 126, 0, 126, this.ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked (int mouseX, int mouseY, int clickNum)
|
||||
{
|
||||
boolean flag = clickNum == this.mc.gameSettings.keyBindPickBlock.getKeyCode() + 100;
|
||||
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
|
||||
long l = Minecraft.getSystemTime();
|
||||
this.field_94074_J = this.field_94072_H == slot && l - this.field_94070_G < 250L && this.field_94073_I == clickNum;
|
||||
this.field_94068_E = false;
|
||||
|
||||
int offsetLeft = drawChestPart ? 108 : 0;
|
||||
|
||||
if (clickNum == 0 || clickNum == 1 || flag)
|
||||
{
|
||||
int i1 = this.guiLeft;
|
||||
int j1 = this.guiTop;
|
||||
boolean flag1 = mouseX < i1 - offsetLeft || mouseY < j1 || mouseX >= i1 + this.xSize || mouseY >= j1 + this.ySize;
|
||||
int k1 = -1;
|
||||
|
||||
if (slot != null)
|
||||
{
|
||||
k1 = slot.slotNumber;
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
k1 = -999;
|
||||
}
|
||||
|
||||
if (this.mc.gameSettings.touchscreen && flag1 && this.mc.thePlayer.inventory.getItemStack() == null)
|
||||
{
|
||||
this.mc.displayGuiScreen((GuiScreen) null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (k1 != -1)
|
||||
{
|
||||
if (this.mc.gameSettings.touchscreen)
|
||||
{
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
this.clickedSlot = slot;
|
||||
this.draggedStack = null;
|
||||
this.isRightMouseClick = clickNum == 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.clickedSlot = null;
|
||||
}
|
||||
}
|
||||
else if (!this.field_94076_q)
|
||||
{
|
||||
if (this.mc.thePlayer.inventory.getItemStack() == null)
|
||||
{
|
||||
if (clickNum == this.mc.gameSettings.keyBindPickBlock.getKeyCode() + 100)
|
||||
{
|
||||
this.handleMouseClick(slot, k1, clickNum, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean flag2 = k1 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54));
|
||||
byte b0 = 0;
|
||||
|
||||
if (flag2)
|
||||
{
|
||||
this.field_94075_K = slot != null && slot.getHasStack() ? slot.getStack() : null;
|
||||
b0 = 1;
|
||||
}
|
||||
else if (k1 == -999)
|
||||
{
|
||||
b0 = 4;
|
||||
}
|
||||
|
||||
this.handleMouseClick(slot, k1, clickNum, b0);
|
||||
}
|
||||
|
||||
this.field_94068_E = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_94076_q = true;
|
||||
this.field_94067_D = clickNum;
|
||||
this.field_94077_p.clear();
|
||||
|
||||
if (clickNum == 0)
|
||||
{
|
||||
this.field_94071_C = 0;
|
||||
}
|
||||
else if (clickNum == 1)
|
||||
{
|
||||
this.field_94071_C = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.field_94072_H = slot;
|
||||
this.field_94070_G = l;
|
||||
this.field_94073_I = clickNum;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.tools.logic.PatternChestLogic;
|
||||
|
||||
public class PatternChestGui extends GuiContainer
|
||||
{
|
||||
public PatternChestLogic logic;
|
||||
|
||||
public PatternChestGui(InventoryPlayer inventoryplayer, PatternChestLogic holder, World world, int x, int y, int z)
|
||||
{
|
||||
super(holder.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
logic = holder;
|
||||
xSize = 194;
|
||||
ySize = 168;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("inventory.PatternChest"), 60, 6, 0x404040);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 17, (ySize - 96) + 2, 0x404040);
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/patternchest.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
|
||||
}
|
||||
}
|
||||
@@ -1,463 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
import tconstruct.smeltery.inventory.SmelteryContainer;
|
||||
import tconstruct.smeltery.logic.SmelteryLogic;
|
||||
import tconstruct.util.network.packet.PacketSmeltery;
|
||||
|
||||
public class SmelteryGui extends NewContainerGui
|
||||
{
|
||||
public SmelteryLogic logic;
|
||||
String username;
|
||||
boolean isScrolling = false;
|
||||
boolean wasClicking;
|
||||
float currentScroll = 0.0F;
|
||||
int slotPos = 0;
|
||||
int prevSlotPos = 0;
|
||||
|
||||
public SmelteryGui(InventoryPlayer inventoryplayer, SmelteryLogic smeltery, World world, int x, int y, int z)
|
||||
{
|
||||
super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
logic = smeltery;
|
||||
username = inventoryplayer.player.getDisplayName();
|
||||
xSize = 248;
|
||||
smeltery.updateFuelDisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen (int mouseX, int mouseY, float par3)
|
||||
{
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
updateScrollbar(mouseX, mouseY, par3);
|
||||
}
|
||||
|
||||
protected void updateScrollbar (int mouseX, int mouseY, float par3)
|
||||
{
|
||||
if (logic.layers > 2)
|
||||
{
|
||||
boolean mouseDown = Mouse.isButtonDown(0);
|
||||
int lefto = this.guiLeft;
|
||||
int topo = this.guiTop;
|
||||
int xScroll = lefto + 67;
|
||||
int yScroll = topo + 8;
|
||||
int scrollWidth = xScroll + 14;
|
||||
int scrollHeight = yScroll + 144;
|
||||
|
||||
if (!this.wasClicking && mouseDown && mouseX >= xScroll && mouseY >= yScroll && mouseX < scrollWidth && mouseY < scrollHeight)
|
||||
{
|
||||
this.isScrolling = true;
|
||||
}
|
||||
|
||||
if (!mouseDown)
|
||||
{
|
||||
this.isScrolling = false;
|
||||
}
|
||||
|
||||
if (wasClicking && !isScrolling && slotPos != prevSlotPos)
|
||||
{
|
||||
prevSlotPos = slotPos;
|
||||
}
|
||||
|
||||
this.wasClicking = mouseDown;
|
||||
|
||||
if (this.isScrolling)
|
||||
{
|
||||
this.currentScroll = (mouseY - yScroll - 7.5F) / (scrollHeight - yScroll - 15.0F);
|
||||
|
||||
if (this.currentScroll < 0.0F)
|
||||
{
|
||||
this.currentScroll = 0.0F;
|
||||
}
|
||||
|
||||
if (this.currentScroll > 1.0F)
|
||||
{
|
||||
this.currentScroll = 1.0F;
|
||||
}
|
||||
|
||||
int s = ((SmelteryContainer) this.container).scrollTo(this.currentScroll);
|
||||
if (s != -1)
|
||||
slotPos = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Smeltery"), 86, 5, 0x404040);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 90, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
int base = 0;
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
|
||||
for (FluidStack liquid : logic.moltenMetal)
|
||||
{
|
||||
int basePos = 54;
|
||||
int initialLiquidSize = 0;
|
||||
int liquidSize = 0;// liquid.amount * 52 / liquidLayers;
|
||||
if (logic.getCapacity() > 0)
|
||||
{
|
||||
int total = logic.getTotalLiquid();
|
||||
int liquidLayers = (total / 20000 + 1) * 20000;
|
||||
if (liquidLayers > 0)
|
||||
{
|
||||
liquidSize = liquid.amount * 52 / liquidLayers;
|
||||
if (liquidSize == 0)
|
||||
liquidSize = 1;
|
||||
base += liquidSize;
|
||||
}
|
||||
}
|
||||
|
||||
int leftX = cornerX + basePos;
|
||||
int topY = (cornerY + 68) - base;
|
||||
int sizeX = 52;
|
||||
int sizeY = liquidSize;
|
||||
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
|
||||
{
|
||||
drawFluidStackTooltip(liquid, mouseX - cornerX + 36, mouseY - cornerY);
|
||||
|
||||
}
|
||||
}
|
||||
if (logic.fuelGague > 0)
|
||||
{
|
||||
int leftX = cornerX + 117;
|
||||
int topY = (cornerY + 68) - logic.getScaledFuelGague(52);
|
||||
int sizeX = 12;
|
||||
int sizeY = logic.getScaledFuelGague(52);
|
||||
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
|
||||
{
|
||||
drawFluidStackTooltip(new FluidStack(-37, logic.fuelAmount), mouseX - cornerX + 36, mouseY - cornerY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/smeltery.png");
|
||||
private static final ResourceLocation backgroundSide = new ResourceLocation("tinker", "textures/gui/smelteryside.png");
|
||||
private static final ResourceLocation terrain = new ResourceLocation("terrain.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int mouseX, int mouseY)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
drawTexturedModalRect(cornerX + 46, cornerY, 0, 0, 176, ySize);
|
||||
|
||||
// Fuel - Lava
|
||||
this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
if (logic.fuelGague > 0)
|
||||
{
|
||||
IIcon lavaIcon = Blocks.lava.getIcon(0, 0);
|
||||
int fuel = logic.getScaledFuelGague(52);
|
||||
int count = 0;
|
||||
while (fuel > 0)
|
||||
{
|
||||
int size = fuel >= 16 ? 16 : fuel;
|
||||
fuel -= size;
|
||||
drawLiquidRect(cornerX + 117, (cornerY + 68) - size - 16 * count, lavaIcon, 12, size);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
// Liquids - molten metal
|
||||
int base = 0;
|
||||
for (FluidStack liquid : logic.moltenMetal)
|
||||
{
|
||||
IIcon renderIndex = liquid.getFluid().getStillIcon();
|
||||
int basePos = 54;
|
||||
if (logic.getCapacity() > 0)
|
||||
{
|
||||
int total = logic.getTotalLiquid();
|
||||
int liquidLayers = (total / 20000 + 1) * 20000;
|
||||
if (liquidLayers > 0)
|
||||
{
|
||||
int liquidSize = liquid.amount * 52 / liquidLayers;
|
||||
if (liquidSize == 0)
|
||||
liquidSize = 1;
|
||||
while (liquidSize > 0)
|
||||
{
|
||||
int size = liquidSize >= 16 ? 16 : liquidSize;
|
||||
if (renderIndex != null)
|
||||
{
|
||||
drawLiquidRect(cornerX + basePos, (cornerY + 68) - size - base, renderIndex, 16, size);
|
||||
drawLiquidRect(cornerX + basePos + 16, (cornerY + 68) - size - base, renderIndex, 16, size);
|
||||
drawLiquidRect(cornerX + basePos + 32, (cornerY + 68) - size - base, renderIndex, 16, size);
|
||||
drawLiquidRect(cornerX + basePos + 48, (cornerY + 68) - size - base, renderIndex, 4, size);
|
||||
}
|
||||
liquidSize -= size;
|
||||
base += size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Liquid gague
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
drawTexturedModalRect(cornerX + 54, cornerY + 16, 176, 76, 52, 52);
|
||||
|
||||
// Side inventory
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(backgroundSide);
|
||||
if (logic.layers > 0)
|
||||
{
|
||||
if (logic.layers == 1)
|
||||
{
|
||||
drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, 43);
|
||||
drawTexturedModalRect(cornerX - 46, cornerY + 43, 0, 133, 98, 25);
|
||||
}
|
||||
else if (logic.layers == 2)
|
||||
{
|
||||
drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, 61);
|
||||
drawTexturedModalRect(cornerX - 46, cornerY + 61, 0, 97, 98, 61);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawTexturedModalRect(cornerX - 46, cornerY, 0, 0, 98, ySize - 8);
|
||||
}
|
||||
drawTexturedModalRect(cornerX + 32, (int) (cornerY + 8 + 127 * currentScroll), 98, 0, 12, 15);
|
||||
}
|
||||
|
||||
// Temperature
|
||||
int slotSize = logic.layers * 9;
|
||||
if (slotSize > 24)
|
||||
slotSize = 24;
|
||||
for (int iter = 0; iter < slotSize; iter++)
|
||||
{
|
||||
int slotTemp = logic.getTempForSlot(iter + slotPos * 3) - 20;
|
||||
int maxTemp = logic.getMeltingPointForSlot(iter + slotPos * 3) - 20;
|
||||
if (slotTemp > 0 && maxTemp > 0)
|
||||
{
|
||||
int size = 16 * slotTemp / maxTemp + 1;
|
||||
drawTexturedModalRect(cornerX - 38 + (iter % 3 * 22), cornerY + 8 + (iter / 3 * 18) + 16 - size, 98, 15 + 16 - size, 5, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawFluidStackTooltip (FluidStack par1ItemStack, int par2, int par3)
|
||||
{
|
||||
this.zLevel = 100;
|
||||
List list = getLiquidTooltip(par1ItemStack, this.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
for (int k = 0; k < list.size(); ++k)
|
||||
{
|
||||
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
|
||||
}
|
||||
|
||||
this.drawToolTip(list, par2, par3);
|
||||
this.zLevel = 0;
|
||||
}
|
||||
|
||||
public List getLiquidTooltip (FluidStack liquid, boolean par2)
|
||||
{
|
||||
ArrayList list = new ArrayList();
|
||||
if (liquid.fluidID == -37)
|
||||
{
|
||||
list.add("\u00A7f" + StatCollector.translateToLocal("gui.smeltery.fuel"));
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
else
|
||||
{
|
||||
String name = StatCollector.translateToLocal("fluid." + FluidRegistry.getFluidName(liquid));
|
||||
list.add("\u00A7f" + name);
|
||||
if (name.equals("Liquified Emerald"))
|
||||
{
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.emerald") + liquid.amount / 640f);
|
||||
}
|
||||
else if (name.equals("Molten Glass"))
|
||||
{
|
||||
int blocks = liquid.amount / 1000;
|
||||
if (blocks > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.glass.block") + blocks);
|
||||
int panels = (liquid.amount % 1000) / 250;
|
||||
if (panels > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.glass.pannel") + panels);
|
||||
int mB = (liquid.amount % 1000) % 250;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else if (name.contains("Molten"))
|
||||
{
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.metal.ingot") + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
{
|
||||
int nuggets = mB / TConstruct.nuggetLiquidValue;
|
||||
int junk = (mB % TConstruct.nuggetLiquidValue);
|
||||
if (nuggets > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.metal.nugget") + nuggets);
|
||||
if (junk > 0)
|
||||
list.add("mB: " + junk);
|
||||
}
|
||||
}
|
||||
else if (name.equals("Seared Stone"))
|
||||
{
|
||||
int ingots = liquid.amount / TConstruct.ingotLiquidValue;
|
||||
if (ingots > 0)
|
||||
list.add(StatCollector.translateToLocal("gui.smeltery.glass.block") + ingots);
|
||||
int mB = liquid.amount % TConstruct.ingotLiquidValue;
|
||||
if (mB > 0)
|
||||
list.add("mB: " + mB);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.add("mB: " + liquid.amount);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected void drawToolTip (List par1List, int par2, int par3)
|
||||
{
|
||||
if (!par1List.isEmpty())
|
||||
{
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
int k = 0;
|
||||
Iterator iterator = par1List.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String s = (String) iterator.next();
|
||||
int l = this.fontRendererObj.getStringWidth(s);
|
||||
|
||||
if (l > k)
|
||||
{
|
||||
k = l;
|
||||
}
|
||||
}
|
||||
|
||||
int i1 = par2 + 12;
|
||||
int j1 = par3 - 12;
|
||||
int k1 = 8;
|
||||
|
||||
if (par1List.size() > 1)
|
||||
{
|
||||
k1 += 2 + (par1List.size() - 1) * 10;
|
||||
}
|
||||
|
||||
if (i1 + k > this.width)
|
||||
{
|
||||
i1 -= 28 + k;
|
||||
}
|
||||
|
||||
if (j1 + k1 + 6 > this.height)
|
||||
{
|
||||
j1 = this.height - k1 - 6;
|
||||
}
|
||||
|
||||
this.zLevel = 300.0F;
|
||||
itemRenderer.zLevel = 300.0F;
|
||||
int l1 = -267386864;
|
||||
this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
|
||||
this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
|
||||
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
|
||||
this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
|
||||
this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
|
||||
int i2 = 1347420415;
|
||||
int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
|
||||
this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
|
||||
this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
|
||||
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
|
||||
this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);
|
||||
|
||||
for (int k2 = 0; k2 < par1List.size(); ++k2)
|
||||
{
|
||||
String s1 = (String) par1List.get(k2);
|
||||
this.fontRendererObj.drawStringWithShadow(s1, i1, j1, -1);
|
||||
|
||||
if (k2 == 0)
|
||||
{
|
||||
j1 += 2;
|
||||
}
|
||||
|
||||
j1 += 10;
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
public void drawLiquidRect (int startU, int startV, IIcon par3Icon, int endU, int endV)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(startU + 0, startV + endV, this.zLevel, par3Icon.getMinU(), par3Icon.getMaxV());// Bottom left
|
||||
tessellator.addVertexWithUV(startU + endU, startV + endV, this.zLevel, par3Icon.getMaxU(), par3Icon.getMaxV());// Bottom right
|
||||
tessellator.addVertexWithUV(startU + endU, startV + 0, this.zLevel, par3Icon.getMaxU(), par3Icon.getMinV());// Top right
|
||||
tessellator.addVertexWithUV(startU + 0, startV + 0, this.zLevel, par3Icon.getMinU(), par3Icon.getMinV()); // Top left
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked (int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
|
||||
int base = 0;
|
||||
int cornerX = (width - xSize) / 2 + 36;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
int fluidToBeBroughtUp = -1;
|
||||
|
||||
for (FluidStack liquid : logic.moltenMetal)
|
||||
{
|
||||
int basePos = 54;
|
||||
int initialLiquidSize = 0;
|
||||
int liquidSize = 0;// liquid.amount * 52 / liquidLayers;
|
||||
if (logic.getCapacity() > 0)
|
||||
{
|
||||
int total = logic.getTotalLiquid();
|
||||
int liquidLayers = (total / 20000 + 1) * 20000;
|
||||
if (liquidLayers > 0)
|
||||
{
|
||||
liquidSize = liquid.amount * 52 / liquidLayers;
|
||||
if (liquidSize == 0)
|
||||
liquidSize = 1;
|
||||
base += liquidSize;
|
||||
}
|
||||
}
|
||||
|
||||
int leftX = cornerX + basePos;
|
||||
int topY = (cornerY + 68) - base;
|
||||
int sizeX = 52;
|
||||
int sizeY = liquidSize;
|
||||
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
|
||||
{
|
||||
fluidToBeBroughtUp = liquid.fluidID;
|
||||
|
||||
TConstruct.packetPipeline
|
||||
.sendToServer(new PacketSmeltery(logic.getWorldObj().provider.dimensionId, logic.xCoord, logic.yCoord, logic.zCoord, this.isShiftKeyDown(), fluidToBeBroughtUp));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.tools.inventory.PatternShaperContainer;
|
||||
import tconstruct.tools.logic.StencilTableLogic;
|
||||
import tconstruct.util.network.packet.PacketStencilTable;
|
||||
|
||||
public class StencilTableGui extends GuiContainer
|
||||
{
|
||||
StencilTableLogic logic;
|
||||
int patternIndex;
|
||||
|
||||
public StencilTableGui(InventoryPlayer inventoryplayer, StencilTableLogic shaper, World world, int x, int y, int z)
|
||||
{
|
||||
super(new PatternShaperContainer(inventoryplayer, shaper));
|
||||
logic = shaper;
|
||||
patternIndex = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed ()
|
||||
{
|
||||
super.onGuiClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.PatternShaper"), 50, 6, 0x404040);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/patternshaper.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
|
||||
{
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = (this.width - this.xSize) / 2;
|
||||
int cornerY = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
|
||||
if (!logic.isStackInSlot(0))
|
||||
{
|
||||
this.drawTexturedModalRect(cornerX + 47, cornerY + 34, 176, 0, 18, 18);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
super.initGui();
|
||||
int cornerX = (this.width - this.xSize) / 2;
|
||||
int cornerY = (this.height - this.ySize) / 2;
|
||||
|
||||
this.buttonList.clear();
|
||||
/*ToolGuiElement repair = TConstruct.toolButtons.get(0);
|
||||
GuiButtonTool repairButton = new GuiButtonTool(0, cornerX - 110, cornerY, repair.buttonIconX, repair.buttonIconY, repair.texture); // Repair
|
||||
repairButton.enabled = false;
|
||||
this.buttonList.add(repairButton);*/
|
||||
this.buttonList.add(new GuiButton(0, cornerX - 120, cornerY, 120, 20, (StatCollector.translateToLocal("gui.stenciltable1"))));
|
||||
this.buttonList.add(new GuiButton(1, cornerX - 120, cornerY + 20, 120, 20, (StatCollector.translateToLocal("gui.stenciltable2"))));
|
||||
|
||||
//for (int iter = 0; iter < TConstructContent.patternOutputs.length; iter++)
|
||||
//{
|
||||
|
||||
/*ToolGuiElement element = TConstruct.toolButtons.get(iter);
|
||||
GuiButtonTool button = new GuiButtonTool(iter, cornerX - 110 + 22 * (iter % 5), cornerY + 22 * (iter / 5), element.buttonIconX, element.buttonIconY, element.texture); // Repair
|
||||
this.buttonList.add(button);*/
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed (GuiButton button)
|
||||
{
|
||||
ItemStack pattern = logic.getStackInSlot(0);
|
||||
if (pattern != null && pattern.getItem() == TinkerTools.blankPattern)
|
||||
{
|
||||
int meta = pattern.getItemDamage();
|
||||
if (meta == 0)
|
||||
{
|
||||
if (button.id == 0)
|
||||
{
|
||||
patternIndex++;
|
||||
if (patternIndex == 21)
|
||||
patternIndex++;
|
||||
if (patternIndex >= TinkerTools.patternOutputs.length - 1)
|
||||
patternIndex = 0;
|
||||
}
|
||||
else if (button.id == 1)
|
||||
{
|
||||
patternIndex--;
|
||||
if (patternIndex < 0)
|
||||
patternIndex = TinkerTools.patternOutputs.length - 2;
|
||||
if (patternIndex == 21)
|
||||
patternIndex--;
|
||||
}
|
||||
ItemStack stack = new ItemStack(TinkerTools.woodPattern, 1, patternIndex + 1);
|
||||
logic.setInventorySlotContents(1, stack);
|
||||
updateServer(stack);
|
||||
}
|
||||
/*else if (meta == 1 || meta == 2)
|
||||
{
|
||||
ItemStack stack = new ItemStack(TContent.metalPattern, 1, 0);
|
||||
logic.setInventorySlotContents(1, stack);
|
||||
updateServer(stack);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
void updateServer (ItemStack stack)
|
||||
{
|
||||
|
||||
TConstruct.packetPipeline.sendToServer(new PacketStencilTable(logic.xCoord, logic.yCoord, logic.zCoord, stack));
|
||||
}
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.client.TConstructClientRegistry;
|
||||
import tconstruct.library.client.ToolGuiElement;
|
||||
import tconstruct.tools.logic.ToolForgeLogic;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ToolForgeGui extends ToolStationGui
|
||||
{
|
||||
int selectedButton;
|
||||
|
||||
public ToolForgeGui(InventoryPlayer inventoryplayer, ToolForgeLogic stationlogic, World world, int x, int y, int z)
|
||||
{
|
||||
super(inventoryplayer, stationlogic, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked (int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
if (mouseButton == 0)
|
||||
{
|
||||
int gLeft = this.guiLeft + 68;
|
||||
int gTop = this.guiTop + 6;
|
||||
int gwidth = 102;
|
||||
int gheight = 12;
|
||||
active = mouseX > gLeft && mouseX < gLeft + gwidth && mouseY > gTop && mouseY < gTop + gheight;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
this.buttonList.clear();
|
||||
ToolGuiElement repair = TConstructClientRegistry.toolButtons.get(0);
|
||||
GuiButtonTool repairButton = new GuiButtonTool(0, this.guiLeft, this.guiTop, repair.buttonIconX, repair.buttonIconY, repair.domain, repair.texture, repair); // Repair
|
||||
repairButton.enabled = false;
|
||||
this.buttonList.add(repairButton);
|
||||
int offset = TConstructClientRegistry.tierTwoButtons.size();
|
||||
|
||||
for (int iter = 0; iter < TConstructClientRegistry.tierTwoButtons.size(); iter++)
|
||||
{
|
||||
ToolGuiElement element = TConstructClientRegistry.tierTwoButtons.get(iter);
|
||||
GuiButtonTool button = new GuiButtonTool(iter + 1, this.guiLeft + 22 * ((iter + 1) % 5), this.guiTop + 22 * ((iter + 1) / 5), element.buttonIconX, element.buttonIconY, repair.domain,
|
||||
element.texture, element);
|
||||
this.buttonList.add(button);
|
||||
}
|
||||
|
||||
for (int iter = 1; iter < TConstructClientRegistry.toolButtons.size(); iter++)
|
||||
{
|
||||
ToolGuiElement element = TConstructClientRegistry.toolButtons.get(iter);
|
||||
GuiButtonTool button = new GuiButtonTool(iter + offset, this.guiLeft + 22 * ((iter + offset) % 5), this.guiTop + 22 * ((iter + offset) / 5), element.buttonIconX, element.buttonIconY,
|
||||
repair.domain, element.texture, element);
|
||||
this.buttonList.add(button);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed (GuiButton button)
|
||||
{
|
||||
GuiButtonTool b = (GuiButtonTool) button;
|
||||
((GuiButton) this.buttonList.get(selectedButton)).enabled = true;
|
||||
selectedButton = button.id;
|
||||
button.enabled = false;
|
||||
|
||||
setSlotType(b.element.slotType);
|
||||
iconX = b.element.iconsX;
|
||||
iconY = b.element.iconsY;
|
||||
title = "\u00A7n" + b.element.title;
|
||||
body = b.element.body;
|
||||
}
|
||||
|
||||
@Override
|
||||
void resetGui ()
|
||||
{
|
||||
this.text.setText("");
|
||||
selectedButton = 0;
|
||||
setSlotType(0);
|
||||
iconX = new int[] { 0, 1, 2, 13 };
|
||||
iconY = new int[] { 13, 13, 13, 13 };
|
||||
title = "\u00A7n" + StatCollector.translateToLocal("gui.toolforge1");
|
||||
body = StatCollector.translateToLocal("gui.toolforge2");
|
||||
}
|
||||
|
||||
@Override
|
||||
void setSlotType (int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
slotX = new int[] { 56, 38, 38, 14 }; // Repair
|
||||
slotY = new int[] { 37, 28, 46, 37 };
|
||||
break;
|
||||
case 1:
|
||||
slotX = new int[] { 56, 56, 56, 14 }; // Three parts
|
||||
slotY = new int[] { 19, 55, 37, 37 };
|
||||
break;
|
||||
case 2:
|
||||
slotX = new int[] { 56, 56, 14, 14 }; // Two parts
|
||||
slotY = new int[] { 28, 46, 28, 46 };
|
||||
break;
|
||||
case 3:
|
||||
slotX = new int[] { 38, 47, 56, 14 }; // Double head
|
||||
slotY = new int[] { 28, 46, 28, 37 };
|
||||
break;
|
||||
case 4:
|
||||
slotX = new int[] { 47, 38, 56, 47 }; // Four parts
|
||||
slotY = new int[] { 19, 37, 37, 55 };
|
||||
break;
|
||||
case 5:
|
||||
slotX = new int[] { 38, 47, 56, 47 }; // Four parts, double head
|
||||
slotY = new int[] { 19, 55, 19, 37 };
|
||||
break;
|
||||
case 6:
|
||||
slotX = new int[] { 38, 38, 20, 56 }; // Double head
|
||||
slotY = new int[] { 28, 46, 28, 28 };
|
||||
break;
|
||||
case 7:
|
||||
slotX = new int[] { 56, 56, 56, 14 }; // Three parts reverse
|
||||
slotY = new int[] { 19, 37, 55, 37 };
|
||||
break;
|
||||
}
|
||||
toolSlots.resetSlots(slotX, slotY);
|
||||
}
|
||||
}
|
||||
@@ -1,517 +0,0 @@
|
||||
package tconstruct.client.gui;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.client.TConstructClientRegistry;
|
||||
import tconstruct.library.client.ToolGuiElement;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
import tconstruct.tools.inventory.ToolStationContainer;
|
||||
import tconstruct.tools.logic.ToolStationLogic;
|
||||
import tconstruct.util.network.packet.PacketToolStation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ToolStationGui extends GuiContainer
|
||||
{
|
||||
public ToolStationLogic logic;
|
||||
public ToolStationContainer toolSlots;
|
||||
public GuiTextField text;
|
||||
public String toolName;
|
||||
public int guiType;
|
||||
public int[] slotX, slotY, iconX, iconY;
|
||||
public boolean active;
|
||||
public String title, body = "";
|
||||
|
||||
public ToolStationGui(InventoryPlayer inventoryplayer, ToolStationLogic stationlogic, World world, int x, int y, int z)
|
||||
{
|
||||
super((ActiveContainer) stationlogic.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
this.logic = stationlogic;
|
||||
toolSlots = (ToolStationContainer) inventorySlots;
|
||||
text = new GuiTextField(this.fontRendererObj, 83, 8, 30, 12);
|
||||
this.text.setMaxStringLength(40);
|
||||
this.text.setEnableBackgroundDrawing(false);
|
||||
this.text.setVisible(true);
|
||||
this.text.setCanLoseFocus(false);
|
||||
this.text.setFocused(true);
|
||||
this.text.setTextColor(0xffffff);
|
||||
toolName = "";
|
||||
resetGui();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked (int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
if (mouseButton == 0)
|
||||
{
|
||||
int gLeft = this.guiLeft + 68;
|
||||
int gTop = this.guiTop + 6;
|
||||
int gwidth = 102;
|
||||
int gheight = 12;
|
||||
active = mouseX > gLeft && mouseX < gLeft + gwidth && mouseY > gTop && mouseY < gTop + gheight;
|
||||
}
|
||||
}
|
||||
|
||||
void resetGui ()
|
||||
{
|
||||
this.text.setText("");
|
||||
guiType = 0;
|
||||
setSlotType(0);
|
||||
iconX = new int[] { 0, 1, 2 };
|
||||
iconY = new int[] { 13, 13, 13 };
|
||||
title = "\u00A7n" + StatCollector.translateToLocal("gui.toolforge1");
|
||||
body = StatCollector.translateToLocal("gui.toolforge2");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
super.initGui();
|
||||
this.guiLeft -= 110;
|
||||
this.xSize += 110;
|
||||
|
||||
this.buttonList.clear();
|
||||
ToolGuiElement repair = TConstructClientRegistry.toolButtons.get(0);
|
||||
GuiButtonTool repairButton = new GuiButtonTool(0, this.guiLeft, this.guiTop, repair.buttonIconX, repair.buttonIconY, repair.domain, repair.texture, repair); // Repair
|
||||
repairButton.enabled = false;
|
||||
this.buttonList.add(repairButton);
|
||||
|
||||
for (int iter = 1; iter < TConstructClientRegistry.toolButtons.size(); iter++)
|
||||
{
|
||||
ToolGuiElement element = TConstructClientRegistry.toolButtons.get(iter);
|
||||
GuiButtonTool button = new GuiButtonTool(iter, this.guiLeft + 22 * (iter % 5), this.guiTop + 22 * (iter / 5), element.buttonIconX, element.buttonIconY, repair.domain, element.texture,
|
||||
element);
|
||||
this.buttonList.add(button);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed (GuiButton button)
|
||||
{
|
||||
((GuiButton) this.buttonList.get(guiType)).enabled = true;
|
||||
guiType = button.id;
|
||||
button.enabled = false;
|
||||
|
||||
ToolGuiElement element = TConstructClientRegistry.toolButtons.get(guiType);
|
||||
setSlotType(element.slotType);
|
||||
iconX = element.iconsX;
|
||||
iconY = element.iconsY;
|
||||
title = "\u00A7n" + element.title;
|
||||
body = element.body;
|
||||
}
|
||||
|
||||
void setSlotType (int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
slotX = new int[] { 56, 38, 38 }; // Repair
|
||||
slotY = new int[] { 37, 28, 46 };
|
||||
break;
|
||||
case 1:
|
||||
slotX = new int[] { 56, 56, 56 }; // Three parts
|
||||
slotY = new int[] { 19, 55, 37 };
|
||||
break;
|
||||
case 2:
|
||||
slotX = new int[] { 56, 56, 14 }; // Two parts
|
||||
slotY = new int[] { 28, 46, 37 };
|
||||
break;
|
||||
case 3:
|
||||
slotX = new int[] { 38, 47, 56 }; // Double head
|
||||
slotY = new int[] { 28, 46, 28 };
|
||||
break;
|
||||
case 7:
|
||||
slotX = new int[] { 56, 56, 56 }; // Three parts reverse
|
||||
slotY = new int[] { 19, 37, 55 };
|
||||
break;
|
||||
}
|
||||
toolSlots.resetSlots(slotX, slotY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen ()
|
||||
{
|
||||
super.updateScreen();
|
||||
this.text.updateCursorCounter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of
|
||||
* the items)
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal(logic.getInvName()), 116, 8, 0x000000);
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 118, this.ySize - 96 + 2, 0x000000);
|
||||
this.fontRendererObj.drawString(toolName + "_", 180, 8, 0xffffff);
|
||||
|
||||
if (logic.isStackInSlot(0))
|
||||
drawToolStats();
|
||||
else
|
||||
drawToolInformation();
|
||||
}
|
||||
|
||||
void drawToolStats ()
|
||||
{
|
||||
ItemStack stack = logic.getStackInSlot(0);
|
||||
if (stack.getItem() instanceof ToolCore)
|
||||
{
|
||||
ToolCore tool = (ToolCore) stack.getItem();
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
this.drawCenteredString(fontRendererObj, "\u00A7n" + tool.getToolName(), 349, 8, 0xffffff);
|
||||
|
||||
drawModularToolStats(stack, tool, tags);
|
||||
}
|
||||
}
|
||||
|
||||
void drawModularToolStats (ItemStack stack, ToolCore tool, NBTTagCompound tags)
|
||||
{
|
||||
List categories = Arrays.asList(tool.getTraits());
|
||||
final int durability = tags.getInteger("Damage");
|
||||
final int maxDur = tags.getInteger("TotalDurability");
|
||||
int availableDurability = maxDur - durability;
|
||||
|
||||
// Durability
|
||||
int base = 24;
|
||||
int offset = 0;
|
||||
if (maxDur > 0)
|
||||
{
|
||||
if (maxDur >= 10000)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation1"), 294, base + offset * 11, 0xffffff);
|
||||
offset++;
|
||||
fontRendererObj.drawString("- " + availableDurability + "/" + maxDur, 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
else
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation2") + availableDurability + "/" + maxDur, 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
final float stonebound = tags.getFloat("Shoddy");
|
||||
// Attack
|
||||
if (categories.contains("weapon"))
|
||||
{
|
||||
int attack = (int) (tags.getInteger("Attack")) + 1;
|
||||
float stoneboundDamage = (float) Math.log(durability / 72f + 1) * -2 * stonebound;
|
||||
attack += stoneboundDamage;
|
||||
attack *= tool.getDamageModifier();
|
||||
if (attack < 1)
|
||||
attack = 1;
|
||||
|
||||
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9");
|
||||
if (attack % 2 == 0)
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation3") + attack / 2 + heart, 294, base + offset * 10, 0xffffff);
|
||||
else
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation3") + attack / 2f + heart, 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
|
||||
if (stoneboundDamage != 0)
|
||||
{
|
||||
heart = stoneboundDamage == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9");
|
||||
String bloss = stoneboundDamage > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5");
|
||||
this.fontRendererObj.drawString(bloss + (int) stoneboundDamage / 2 + heart, 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (categories.contains("bow"))
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
int drawSpeed = tags.getInteger("DrawSpeed");
|
||||
float flightSpeed = tags.getFloat("FlightSpeed");
|
||||
float trueDraw = drawSpeed / 20f * flightSpeed;
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation6") + df.format(trueDraw) + "s", 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation7") + df.format(flightSpeed) + "x", 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (categories.contains("ammo"))
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
int attack = (int) (tags.getInteger("Attack"));
|
||||
float mass = tags.getFloat("Mass");
|
||||
float shatter = tags.getFloat("BreakChance");
|
||||
float accuracy = tags.getFloat("Accuracy");
|
||||
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation10"), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8") : StatCollector.translateToLocal("gui.partcrafter9");
|
||||
if (attack % 2 == 0)
|
||||
this.fontRendererObj.drawString("- " + attack / 2 + heart, 294, base + offset * 10, 0xffffff);
|
||||
else
|
||||
this.fontRendererObj.drawString("- " + attack / 2f + heart, 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
int minAttack = attack;
|
||||
int maxAttack = attack * 2;
|
||||
heart = StatCollector.translateToLocal("gui.partcrafter9");
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation11"), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
this.fontRendererObj.drawString(df.format(minAttack / 2f) + "-" + df.format(maxAttack / 2f) + heart, 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation8") + df.format(mass), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
this.fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation9") + df.format(accuracy - 4) + "%", 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
/*
|
||||
* this.fontRendererObj.drawString("Chance to break: " +
|
||||
* df.format(shatter)+"%", xSize + 8, base + offset * 10, 0xffffff);
|
||||
* offset++;
|
||||
*/
|
||||
offset++;
|
||||
}
|
||||
|
||||
// Mining
|
||||
if (categories.contains("dualharvest"))
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed") / 100f;
|
||||
float mineSpeed2 = tags.getInteger("MiningSpeed2") / 100f;
|
||||
float stoneboundSpeed = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
float trueSpeed = mineSpeed + stoneboundSpeed;
|
||||
float trueSpeed2 = mineSpeed + stoneboundSpeed;
|
||||
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation12"), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
fontRendererObj.drawString("- " + df.format(trueSpeed) + ", " + df.format(trueSpeed2), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
if (stoneboundSpeed != 0)
|
||||
{
|
||||
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5");
|
||||
fontRendererObj.drawString(bloss + df.format(stoneboundSpeed), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
offset++;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation13"), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
fontRendererObj.drawString("- " + getHarvestLevelName(tags.getInteger("HarvestLevel")) + ", " + getHarvestLevelName(tags.getInteger("HarvestLevel2")), 294, base + offset * 10,
|
||||
0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
else if (categories.contains("harvest"))
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed");
|
||||
int heads = 1;
|
||||
|
||||
if (tags.hasKey("MiningSpeed2"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeed2");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedHandle"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedHandle");
|
||||
heads++;
|
||||
}
|
||||
|
||||
if (tags.hasKey("MiningSpeedExtra"))
|
||||
{
|
||||
mineSpeed += tags.getInteger("MiningSpeedExtra");
|
||||
heads++;
|
||||
}
|
||||
|
||||
float trueSpeed = mineSpeed / (heads * 100f);
|
||||
|
||||
float stoneboundSpeed = (float) Math.log(durability / 72f + 1) * 2 * stonebound;
|
||||
DecimalFormat df = new DecimalFormat("##.##");
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
trueSpeed += stoneboundSpeed;
|
||||
if (trueSpeed < 0)
|
||||
trueSpeed = 0;
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation14") + df.format(trueSpeed), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
if (stoneboundSpeed != 0)
|
||||
{
|
||||
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4") : StatCollector.translateToLocal("gui.toolstation5");
|
||||
fontRendererObj.drawString(bloss + df.format(stoneboundSpeed), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation15") + getHarvestLevelName(tags.getInteger("HarvestLevel")), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
else if (categories.contains("utility"))
|
||||
{
|
||||
float mineSpeed = tags.getInteger("MiningSpeed");
|
||||
float trueSpeed = mineSpeed / (100f);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation16") + trueSpeed, 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
offset++;
|
||||
}
|
||||
|
||||
int modifiers = tags.getInteger("Modifiers");
|
||||
if (modifiers > 0)
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation18") + tags.getInteger("Modifiers"), 294, base + offset * 10, 0xffffff);
|
||||
offset++;
|
||||
}
|
||||
if (tags.hasKey("Tooltip1"))
|
||||
{
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.toolstation17"), 294, base + offset * 10, 0xffffff);
|
||||
}
|
||||
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "ModifierTip" + tipNum;
|
||||
if (tags.hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getString(tooltip);
|
||||
fontRendererObj.drawString("- " + tipName, 294, base + (offset + tipNum) * 10, 0xffffff);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
|
||||
void drawToolInformation ()
|
||||
{
|
||||
this.drawCenteredString(fontRendererObj, title, 349, 8, 0xffffff);
|
||||
fontRendererObj.drawSplitString(body, 294, 24, 115, 0xffffff);
|
||||
}
|
||||
|
||||
protected String getHarvestLevelName (int num)
|
||||
{
|
||||
switch (num)
|
||||
{
|
||||
case 0:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining1");
|
||||
case 1:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining2");
|
||||
case 2:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining3");
|
||||
case 3:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining4"); // Mithril
|
||||
case 4:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining5");
|
||||
case 5:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining6");
|
||||
default:
|
||||
return String.valueOf(num);
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/toolstation.png");
|
||||
private static final ResourceLocation icons = new ResourceLocation("tinker", "textures/gui/icons.png");
|
||||
private static final ResourceLocation description = new ResourceLocation("tinker", "textures/gui/description.png");
|
||||
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the
|
||||
* items)
|
||||
*/
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
|
||||
{
|
||||
// Draw the background
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
final int cornerX = this.guiLeft + 110;
|
||||
this.drawTexturedModalRect(cornerX, this.guiTop, 0, 0, 176, this.ySize);
|
||||
|
||||
if (active)
|
||||
{
|
||||
this.drawTexturedModalRect(cornerX + 62, this.guiTop, 0, this.ySize, 112, 22);
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(icons);
|
||||
// Draw the slots
|
||||
|
||||
for (int i = 0; i < slotX.length; i++)
|
||||
{
|
||||
this.drawTexturedModalRect(cornerX + slotX[i] - 4, this.guiTop + slotY[i] - 4, 140, 212, 28, 28);
|
||||
if (!logic.isStackInSlot(i + 1))
|
||||
{
|
||||
this.drawTexturedModalRect(cornerX + slotX[i], this.guiTop + slotY[i], 18 * iconX[i], 18 * iconY[i], 18, 18);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw description
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(description);
|
||||
this.drawTexturedModalRect(cornerX + 176, this.guiTop, 0, 0, 126, this.ySize + 30);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped (char par1, int keyCode)
|
||||
{
|
||||
if (keyCode == 1 || (!active && keyCode == this.mc.gameSettings.keyBindInventory.getKeyCode()))
|
||||
{
|
||||
logic.setToolname("");
|
||||
updateServer("");
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
else if (active)
|
||||
{
|
||||
text.textboxKeyTyped(par1, keyCode);
|
||||
toolName = text.getText().trim();
|
||||
logic.setToolname(toolName);
|
||||
updateServer(toolName);
|
||||
}
|
||||
}
|
||||
|
||||
void updateServer (String name)
|
||||
{
|
||||
/*
|
||||
* ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
|
||||
* DataOutputStream outputStream = new DataOutputStream(bos); try {
|
||||
* outputStream.writeByte(1);
|
||||
* outputStream.writeInt(logic.getWorld().provider.dimensionId);
|
||||
* outputStream.writeInt(logic.xCoord);
|
||||
* outputStream.writeInt(logic.yCoord);
|
||||
* outputStream.writeInt(logic.zCoord); outputStream.writeUTF(name); }
|
||||
* catch (Exception ex) { ex.printStackTrace(); }
|
||||
*
|
||||
* Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
* packet.channel = "TConstruct"; packet.data = bos.toByteArray();
|
||||
* packet.length = bos.size();
|
||||
*
|
||||
* PacketDispatcher.sendPacketToServer(packet);
|
||||
*/
|
||||
|
||||
TConstruct.packetPipeline.sendToServer(new PacketToolStation(logic.xCoord, logic.yCoord, logic.zCoord, name));
|
||||
}
|
||||
|
||||
/*
|
||||
* protected void mouseClicked(int par1, int par2, int par3) {
|
||||
* super.mouseClicked(par1, par2, par3); text.mouseClicked(par1, par2,
|
||||
* par3); }
|
||||
*/
|
||||
}
|
||||
@@ -11,10 +11,10 @@ import org.lwjgl.opengl.GL12;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import tconstruct.client.gui.PartCrafterGui;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.tools.gui.PartCrafterGui;
|
||||
|
||||
public class MaterialPage extends BookPage
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user