mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 22:44:23 +00:00
Smeltery Fixes
This commit is contained in:
1 parent
a2ae40c930
commit
41a0e80078
21 files changed
+1225
-272
No files matched your search
@@ -109,6 +109,7 @@ public abstract class InventoryLogic extends TileEntity
|
||||
public void readFromNBT(NBTTagCompound tags)
|
||||
{
|
||||
super.readFromNBT(tags);
|
||||
this.invName = tags.getString("InvName");
|
||||
NBTTagList nbttaglist = tags.getTagList("Items");
|
||||
inventory = new ItemStack[getSizeInventory()];
|
||||
for (int iter = 0; iter < nbttaglist.tagCount(); iter++)
|
||||
@@ -126,6 +127,8 @@ public abstract class InventoryLogic extends TileEntity
|
||||
public void writeToNBT(NBTTagCompound tags)
|
||||
{
|
||||
super.writeToNBT(tags);
|
||||
if (invName != null)
|
||||
tags.setString("InvName", invName);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
for (int iter = 0; iter < inventory.length; iter++)
|
||||
{
|
||||
@@ -159,9 +162,13 @@ public abstract class InventoryLogic extends TileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStackValidForSlot (int i, ItemStack itemstack)
|
||||
public boolean isStackValidForSlot (int slot, ItemStack itemstack)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
if (slot < getSizeInventory())
|
||||
{
|
||||
if (inventory[slot] == null || itemstack.stackSize + inventory[slot].stackSize <= getInventoryStackLimit())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public abstract class ToolMod
|
||||
{
|
||||
ItemStack removeStack = (ItemStack) iterate.next();
|
||||
|
||||
if (craftingStack.itemID == removeStack.itemID && (removeStack.getItemDamage() == -1 || craftingStack.getItemDamage() == removeStack.getItemDamage()))
|
||||
if (craftingStack.itemID == removeStack.itemID && (removeStack.getItemDamage() == Short.MAX_VALUE || craftingStack.getItemDamage() == removeStack.getItemDamage()))
|
||||
{
|
||||
canCraft = true;
|
||||
list.remove(removeStack);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class PHConstruct {
|
||||
|
||||
redCreeper = config.get("Mob Spawning", "Activate Nitro Creeper Spawns", true).getBoolean(true);
|
||||
blueSlime = config.get("Mob Spawning", "Activate Blue Slime Spawns", true).getBoolean(true);
|
||||
redCreeperWeight = config.get("Mob Spawning", "Spawn Weight for Nitro Creeper", 7).getInt(7);
|
||||
redCreeperWeight = config.get("Mob Spawning", "Spawn Weight for Nitro Creeper", 5).getInt(5);
|
||||
blueSlimeWeight = config.get("Mob Spawning", "Spawn Weight for Blue Slime", 8).getInt(8);
|
||||
|
||||
woodCrafter = config.getBlock("Wood Tool Station", 1471).getInt(1471);
|
||||
|
||||
@@ -25,7 +25,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
* @author: mDiyo
|
||||
*/
|
||||
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.16")
|
||||
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.17")
|
||||
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.TPacketHandler.class)
|
||||
public class TConstruct
|
||||
{
|
||||
|
||||
@@ -8,6 +8,9 @@ import mods.tinker.common.IPattern;
|
||||
import mods.tinker.common.RecipeRemover;
|
||||
import mods.tinker.common.fancyitem.FancyEntityItem;
|
||||
import mods.tinker.tconstruct.blocks.EquipBlock;
|
||||
import mods.tinker.tconstruct.blocks.GolemCoreBlock;
|
||||
import mods.tinker.tconstruct.blocks.GolemHeadBlock;
|
||||
import mods.tinker.tconstruct.blocks.GolemPedestalBlock;
|
||||
import mods.tinker.tconstruct.blocks.LavaTankBlock;
|
||||
import mods.tinker.tconstruct.blocks.LiquidMetalFlowing;
|
||||
import mods.tinker.tconstruct.blocks.LiquidMetalStill;
|
||||
@@ -46,6 +49,8 @@ import mods.tinker.tconstruct.library.ToolCore;
|
||||
import mods.tinker.tconstruct.logic.CastingTableLogic;
|
||||
import mods.tinker.tconstruct.logic.FaucetLogic;
|
||||
import mods.tinker.tconstruct.logic.FrypanLogic;
|
||||
import mods.tinker.tconstruct.logic.GolemCoreLogic;
|
||||
import mods.tinker.tconstruct.logic.GolemPedestalLogic;
|
||||
import mods.tinker.tconstruct.logic.LavaTankLogic;
|
||||
import mods.tinker.tconstruct.logic.LiquidTextureLogic;
|
||||
import mods.tinker.tconstruct.logic.MultiServantLogic;
|
||||
|
||||
@@ -19,12 +19,15 @@ import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TEventHandler
|
||||
{
|
||||
Random random = new Random();
|
||||
/* Sounds */
|
||||
@ForgeSubscribe
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onSound(SoundLoadEvent event)
|
||||
{
|
||||
try
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
package mods.tinker.golems.blocks;
|
||||
package mods.tinker.tconstruct.blocks;
|
||||
|
||||
import mods.tinker.common.InventoryBlock;
|
||||
import mods.tinker.golems.client.GolemCoreRender;
|
||||
import mods.tinker.golems.logic.GolemCoreLogic;
|
||||
import mods.tinker.tconstruct.TConstruct;
|
||||
import mods.tinker.tconstruct.client.GolemCoreRender;
|
||||
import mods.tinker.tconstruct.library.TConstructRegistry;
|
||||
import mods.tinker.tconstruct.logic.GolemCoreLogic;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package mods.tinker.golems.blocks;
|
||||
package mods.tinker.tconstruct.blocks;
|
||||
|
||||
import mods.tinker.golems.logic.GolemCoreLogic;
|
||||
import mods.tinker.tconstruct.TContent;
|
||||
import mods.tinker.tconstruct.logic.GolemCoreLogic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IconRegister;
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package mods.tinker.golems.blocks;
|
||||
package mods.tinker.tconstruct.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mods.tinker.common.InventoryBlock;
|
||||
import mods.tinker.golems.logic.GolemPedestalLogic;
|
||||
import mods.tinker.tconstruct.logic.GolemPedestalLogic;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package mods.tinker.golems.client;
|
||||
package mods.tinker.tconstruct.client;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package mods.tinker.golems.client;
|
||||
package mods.tinker.tconstruct.client;
|
||||
|
||||
import mods.tinker.common.fancyitem.FancyEntityItem;
|
||||
import mods.tinker.golems.logic.GolemCoreLogic;
|
||||
import mods.tinker.tconstruct.logic.GolemCoreLogic;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
@@ -9,9 +9,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import mods.tinker.common.fancyitem.FancyEntityItem;
|
||||
import mods.tinker.common.fancyitem.FancyItemRender;
|
||||
import mods.tinker.golems.client.GolemCoreRender;
|
||||
import mods.tinker.golems.client.GolemCoreSpecialRender;
|
||||
import mods.tinker.golems.logic.GolemCoreLogic;
|
||||
import mods.tinker.tconstruct.TConstruct;
|
||||
import mods.tinker.tconstruct.TContent;
|
||||
import mods.tinker.tconstruct.TProxyCommon;
|
||||
@@ -29,6 +26,7 @@ import mods.tinker.tconstruct.entity.UnstableCreeper;
|
||||
import mods.tinker.tconstruct.library.client.TConstructClientRegistry;
|
||||
import mods.tinker.tconstruct.library.client.ToolGuiElement;
|
||||
import mods.tinker.tconstruct.logic.CastingTableLogic;
|
||||
import mods.tinker.tconstruct.logic.GolemCoreLogic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
@@ -0,0 +1,902 @@
|
||||
package mods.tinker.tconstruct.client.gui;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mods.tinker.tconstruct.container.ActiveContainer;
|
||||
import mods.tinker.tconstruct.container.ActiveSlot;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class NewContainerGui extends GuiScreen
|
||||
{
|
||||
/** Stacks renderer. Icons, stack size, health, etc... */
|
||||
protected static RenderItem itemRenderer = new RenderItem();
|
||||
|
||||
/** The X/Y size of the inventory window in stretched pixels. */
|
||||
protected int xSize = 176;
|
||||
protected int ySize = 166;
|
||||
|
||||
/** A list of the players inventory slots. */
|
||||
public ActiveContainer container;
|
||||
|
||||
/**
|
||||
* Starting X/Y position for the Gui. Inconsistent use for Gui backgrounds.
|
||||
*/
|
||||
protected int guiLeft;
|
||||
protected int guiTop;
|
||||
|
||||
protected Slot mainSlot;
|
||||
|
||||
/** Used when touchscreen is enabled */
|
||||
protected Slot clickedSlot = null;
|
||||
protected boolean isRightMouseClick = false;
|
||||
protected ItemStack draggedStack = null;
|
||||
|
||||
protected int field_85049_r = 0;
|
||||
protected int field_85048_s = 0;
|
||||
protected Slot returningStackDestSlot = null;
|
||||
protected long returningStackTime = 0L;
|
||||
|
||||
/** Used when touchscreen is enabled */
|
||||
protected ItemStack returningStack = null;
|
||||
protected Slot field_92033_y = null;
|
||||
protected long field_92032_z = 0L;
|
||||
protected final Set field_94077_p = new HashSet();
|
||||
protected boolean field_94076_q;
|
||||
protected int field_94071_C = 0;
|
||||
protected int field_94067_D = 0;
|
||||
protected boolean field_94068_E = false;
|
||||
protected int field_94069_F;
|
||||
protected long field_94070_G = 0L;
|
||||
protected Slot field_94072_H = null;
|
||||
protected int field_94073_I = 0;
|
||||
protected boolean field_94074_J;
|
||||
protected ItemStack field_94075_K = null;
|
||||
|
||||
public NewContainerGui(ActiveContainer container)
|
||||
{
|
||||
this.container = container;
|
||||
this.field_94068_E = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the buttons (and other controls) to the screen in question.
|
||||
*/
|
||||
public void initGui ()
|
||||
{
|
||||
super.initGui();
|
||||
this.mc.thePlayer.openContainer = this.container;
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it.
|
||||
*/
|
||||
public void drawScreen (int mouseX, int mouseY, float par3)
|
||||
{
|
||||
this.drawDefaultBackground();
|
||||
int gLeft = this.guiLeft;
|
||||
int gTop = this.guiTop;
|
||||
this.drawGuiContainerBackgroundLayer(par3, mouseX, mouseY);
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) gLeft, (float) gTop, 0.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
this.mainSlot = null;
|
||||
short short1 = 240;
|
||||
short short2 = 240;
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) short1 / 1.0F, (float) short2 / 1.0F);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int slotXPos;
|
||||
int slotYPos;
|
||||
|
||||
for (int slotIter = 0; slotIter < this.container.inventorySlots.size(); ++slotIter)
|
||||
{
|
||||
Slot slot = (Slot) this.container.inventorySlots.get(slotIter);
|
||||
if (!(slot instanceof ActiveSlot) || ((ActiveSlot) slot).getActive())
|
||||
{
|
||||
this.drawSlotInventory(slot);
|
||||
|
||||
if (this.isMouseOverSlot(slot, mouseX, mouseY))
|
||||
{
|
||||
this.mainSlot = slot;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
slotXPos = slot.xDisplayPosition;
|
||||
slotYPos = slot.yDisplayPosition;
|
||||
this.drawGradientRect(slotXPos, slotYPos, slotXPos + 16, slotYPos + 16, -2130706433, -2130706433);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*for (int slotIter = 0; slotIter < this.container.otherInventorySlots.size(); ++slotIter)
|
||||
{
|
||||
ActiveSlot slot = (ActiveSlot) this.container.otherInventorySlots.get(slotIter);
|
||||
if (slot.getActive())
|
||||
{
|
||||
this.drawSlotInventory(slot);
|
||||
|
||||
if (this.isMouseOverSlot(slot, mouseX, mouseY))
|
||||
{
|
||||
this.mainSlot = slot;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
slotXPos = slot.xDisplayPosition;
|
||||
slotYPos = slot.yDisplayPosition;
|
||||
this.drawGradientRect(slotXPos, slotYPos, slotXPos + 16, slotYPos + 16, -2130706433, -2130706433);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
this.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory;
|
||||
ItemStack itemstack = this.draggedStack == null ? inventoryplayer.getItemStack() : this.draggedStack;
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
byte b0 = 8;
|
||||
slotYPos = this.draggedStack == null ? 8 : 16;
|
||||
String s = null;
|
||||
|
||||
if (this.draggedStack != null && this.isRightMouseClick)
|
||||
{
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.stackSize = MathHelper.ceiling_float_int((float) itemstack.stackSize / 2.0F);
|
||||
}
|
||||
else if (this.field_94076_q && this.field_94077_p.size() > 1)
|
||||
{
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.stackSize = this.field_94069_F;
|
||||
|
||||
if (itemstack.stackSize == 0)
|
||||
{
|
||||
s = "" + EnumChatFormatting.YELLOW + "0";
|
||||
}
|
||||
}
|
||||
|
||||
this.drawItemStack(itemstack, mouseX - gLeft - b0, mouseY - gTop - slotYPos, s);
|
||||
}
|
||||
|
||||
if (this.returningStack != null)
|
||||
{
|
||||
float f1 = (float) (Minecraft.getSystemTime() - this.returningStackTime) / 100.0F;
|
||||
|
||||
if (f1 >= 1.0F)
|
||||
{
|
||||
f1 = 1.0F;
|
||||
this.returningStack = null;
|
||||
}
|
||||
|
||||
slotXPos = this.returningStackDestSlot.xDisplayPosition - this.field_85049_r;
|
||||
slotYPos = this.returningStackDestSlot.yDisplayPosition - this.field_85048_s;
|
||||
int xPos = this.field_85049_r + (int) ((float) slotXPos * f1);
|
||||
int yPos = this.field_85048_s + (int) ((float) slotYPos * f1);
|
||||
this.drawItemStack(this.returningStack, xPos, yPos, (String) null);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (inventoryplayer.getItemStack() == null && this.mainSlot != null && this.mainSlot.getHasStack())
|
||||
{
|
||||
ItemStack itemstack1 = this.mainSlot.getStack();
|
||||
this.drawItemStackTooltip(itemstack1, mouseX, mouseY);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
protected void drawItemStack (ItemStack par1ItemStack, int par2, int par3, String par4Str)
|
||||
{
|
||||
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
|
||||
this.zLevel = 200.0F;
|
||||
itemRenderer.zLevel = 200.0F;
|
||||
itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.renderEngine, par1ItemStack, par2, par3);
|
||||
itemRenderer.renderItemStack(this.fontRenderer, this.mc.renderEngine, par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str);
|
||||
this.zLevel = 0.0F;
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
protected void drawItemStackTooltip (ItemStack par1ItemStack, int par2, int par3)
|
||||
{
|
||||
List list = par1ItemStack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
|
||||
for (int k = 0; k < list.size(); ++k)
|
||||
{
|
||||
if (k == 0)
|
||||
{
|
||||
list.set(k, "\u00a7" + Integer.toHexString(par1ItemStack.getRarity().rarityColor) + (String) list.get(k));
|
||||
}
|
||||
else
|
||||
{
|
||||
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
|
||||
}
|
||||
}
|
||||
|
||||
this.func_102021_a(list, par2, par3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the text when mouse is over creative inventory tab. Params: current creative tab to be checked, current
|
||||
* mouse x position, current mouse y position.
|
||||
*/
|
||||
protected void drawCreativeTabHoveringText (String par1Str, int par2, int par3)
|
||||
{
|
||||
this.func_102021_a(Arrays.asList(new String[] { par1Str }), par2, par3);
|
||||
}
|
||||
|
||||
protected void func_102021_a (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.fontRenderer.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.fontRenderer.drawStringWithShadow(s1, i1, j1, -1);
|
||||
|
||||
if (k2 == 0)
|
||||
{
|
||||
j1 += 2;
|
||||
}
|
||||
|
||||
j1 += 10;
|
||||
}
|
||||
|
||||
this.zLevel = 0.0F;
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||
*/
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the background layer for the GuiContainer (everything behind the items)
|
||||
*/
|
||||
protected abstract void drawGuiContainerBackgroundLayer (float f, int i, int j);
|
||||
|
||||
/**
|
||||
* Draws an inventory slot
|
||||
*/
|
||||
protected void drawSlotInventory (Slot par1Slot)
|
||||
{
|
||||
int i = par1Slot.xDisplayPosition;
|
||||
int j = par1Slot.yDisplayPosition;
|
||||
ItemStack itemstack = par1Slot.getStack();
|
||||
boolean flag = false;
|
||||
boolean flag1 = par1Slot == this.clickedSlot && this.draggedStack != null && !this.isRightMouseClick;
|
||||
ItemStack itemstack1 = this.mc.thePlayer.inventory.getItemStack();
|
||||
String s = null;
|
||||
|
||||
if (par1Slot == this.clickedSlot && this.draggedStack != null && this.isRightMouseClick && itemstack != null)
|
||||
{
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.stackSize /= 2;
|
||||
}
|
||||
else if (this.field_94076_q && this.field_94077_p.contains(par1Slot) && itemstack1 != null)
|
||||
{
|
||||
if (this.field_94077_p.size() == 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Container.func_94527_a(par1Slot, itemstack1, true) && this.container.func_94531_b(par1Slot))
|
||||
{
|
||||
itemstack = itemstack1.copy();
|
||||
flag = true;
|
||||
Container.func_94525_a(this.field_94077_p, this.field_94071_C, itemstack, par1Slot.getStack() == null ? 0 : par1Slot.getStack().stackSize);
|
||||
|
||||
if (itemstack.stackSize > itemstack.getMaxStackSize())
|
||||
{
|
||||
s = EnumChatFormatting.YELLOW + "" + itemstack.getMaxStackSize();
|
||||
itemstack.stackSize = itemstack.getMaxStackSize();
|
||||
}
|
||||
|
||||
if (itemstack.stackSize > par1Slot.getSlotStackLimit())
|
||||
{
|
||||
s = EnumChatFormatting.YELLOW + "" + par1Slot.getSlotStackLimit();
|
||||
itemstack.stackSize = par1Slot.getSlotStackLimit();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_94077_p.remove(par1Slot);
|
||||
this.func_94066_g();
|
||||
}
|
||||
}
|
||||
|
||||
this.zLevel = 100.0F;
|
||||
itemRenderer.zLevel = 100.0F;
|
||||
|
||||
if (itemstack == null)
|
||||
{
|
||||
Icon icon = par1Slot.getBackgroundIconIndex();
|
||||
|
||||
if (icon != null)
|
||||
{
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.mc.renderEngine.bindTexture("/gui/items.png");
|
||||
this.drawTexturedModelRectFromIcon(i, j, icon, 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag1)
|
||||
{
|
||||
if (flag)
|
||||
{
|
||||
drawRect(i, j, i + 16, j + 16, -2130706433);
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.renderEngine, itemstack, i, j);
|
||||
itemRenderer.renderItemStack(this.fontRenderer, this.mc.renderEngine, itemstack, i, j, s);
|
||||
}
|
||||
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
this.zLevel = 0.0F;
|
||||
}
|
||||
|
||||
protected void func_94066_g ()
|
||||
{
|
||||
ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();
|
||||
|
||||
if (itemstack != null && this.field_94076_q)
|
||||
{
|
||||
this.field_94069_F = itemstack.stackSize;
|
||||
ItemStack itemstack1;
|
||||
int i;
|
||||
|
||||
for (Iterator iterator = this.field_94077_p.iterator(); iterator.hasNext(); this.field_94069_F -= itemstack1.stackSize - i)
|
||||
{
|
||||
Slot slot = (Slot) iterator.next();
|
||||
itemstack1 = itemstack.copy();
|
||||
i = slot.getStack() == null ? 0 : slot.getStack().stackSize;
|
||||
Container.func_94525_a(this.field_94077_p, this.field_94071_C, itemstack1, i);
|
||||
|
||||
if (itemstack1.stackSize > itemstack1.getMaxStackSize())
|
||||
{
|
||||
itemstack1.stackSize = itemstack1.getMaxStackSize();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize > slot.getSlotStackLimit())
|
||||
{
|
||||
itemstack1.stackSize = slot.getSlotStackLimit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the slot at the given coordinates or null if there is none.
|
||||
*/
|
||||
protected Slot getSlotAtPosition (int mouseX, int mouseY)
|
||||
{
|
||||
for (int k = 0; k < this.container.inventorySlots.size(); ++k)
|
||||
{
|
||||
Slot slot = (Slot) this.container.inventorySlots.get(k);
|
||||
|
||||
if (this.isMouseOverSlot(slot, mouseX, mouseY))
|
||||
{
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is clicked.
|
||||
*/
|
||||
protected void mouseClicked (int mouseX, int mouseY, int mouseButton)
|
||||
{
|
||||
super.mouseClicked(mouseX, mouseY, mouseButton);
|
||||
boolean flag = mouseButton == this.mc.gameSettings.keyBindPickBlock.keyCode + 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 == mouseButton;
|
||||
this.field_94068_E = false;
|
||||
|
||||
if (mouseButton == 0 || mouseButton == 1 || flag)
|
||||
{
|
||||
int gLeft = this.guiLeft;
|
||||
int gTop = this.guiTop;
|
||||
boolean flag1 = mouseX < gLeft || mouseY < gTop || mouseX >= gLeft + this.xSize || mouseY >= gTop + 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 = mouseButton == 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.clickedSlot = null;
|
||||
}
|
||||
}
|
||||
else if (!this.field_94076_q)
|
||||
{
|
||||
if (this.mc.thePlayer.inventory.getItemStack() == null)
|
||||
{
|
||||
if (mouseButton == this.mc.gameSettings.keyBindPickBlock.keyCode + 100)
|
||||
{
|
||||
this.handleMouseClick(slot, k1, mouseButton, 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, mouseButton, b0);
|
||||
}
|
||||
|
||||
this.field_94068_E = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_94076_q = true;
|
||||
this.field_94067_D = mouseButton;
|
||||
this.field_94077_p.clear();
|
||||
|
||||
if (mouseButton == 0)
|
||||
{
|
||||
this.field_94071_C = 0;
|
||||
}
|
||||
else if (mouseButton == 1)
|
||||
{
|
||||
this.field_94071_C = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.field_94072_H = slot;
|
||||
this.field_94070_G = l;
|
||||
this.field_94073_I = mouseButton;
|
||||
}
|
||||
|
||||
protected void func_85041_a (int par1, int par2, int par3, long par4)
|
||||
{
|
||||
Slot slot = this.getSlotAtPosition(par1, par2);
|
||||
ItemStack itemstack = this.mc.thePlayer.inventory.getItemStack();
|
||||
|
||||
if (this.clickedSlot != null && this.mc.gameSettings.touchscreen)
|
||||
{
|
||||
if (par3 == 0 || par3 == 1)
|
||||
{
|
||||
if (this.draggedStack == null)
|
||||
{
|
||||
if (slot != this.clickedSlot)
|
||||
{
|
||||
this.draggedStack = this.clickedSlot.getStack().copy();
|
||||
}
|
||||
}
|
||||
else if (this.draggedStack.stackSize > 1 && slot != null && Container.func_94527_a(slot, this.draggedStack, false))
|
||||
{
|
||||
long i1 = Minecraft.getSystemTime();
|
||||
|
||||
if (this.field_92033_y == slot)
|
||||
{
|
||||
if (i1 - this.field_92032_z > 500L)
|
||||
{
|
||||
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0);
|
||||
this.handleMouseClick(slot, slot.slotNumber, 1, 0);
|
||||
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, 0, 0);
|
||||
this.field_92032_z = i1 + 750L;
|
||||
--this.draggedStack.stackSize;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_92033_y = slot;
|
||||
this.field_92032_z = i1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.field_94076_q && slot != null && itemstack != null && itemstack.stackSize > this.field_94077_p.size() && Container.func_94527_a(slot, itemstack, true)
|
||||
&& slot.isItemValid(itemstack) && this.container.func_94531_b(slot))
|
||||
{
|
||||
this.field_94077_p.add(slot);
|
||||
this.func_94066_g();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the mouse is moved or a mouse button is released. Signature: (mouseX, mouseY, which) which==-1 is
|
||||
* mouseMove, which==0 or which==1 is mouseUp
|
||||
*/
|
||||
protected void mouseMovedOrUp (int par1, int par2, int par3)
|
||||
{
|
||||
Slot slot = this.getSlotAtPosition(par1, par2);
|
||||
int l = this.guiLeft;
|
||||
int i1 = this.guiTop;
|
||||
boolean flag = par1 < l || par2 < i1 || par1 >= l + this.xSize || par2 >= i1 + this.ySize;
|
||||
int j1 = -1;
|
||||
|
||||
if (slot != null)
|
||||
{
|
||||
j1 = slot.slotNumber;
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
j1 = -999;
|
||||
}
|
||||
|
||||
Slot slot1;
|
||||
Iterator iterator;
|
||||
|
||||
if (this.field_94074_J && slot != null && par3 == 0 && this.container.func_94530_a((ItemStack) null, slot))
|
||||
{
|
||||
if (isShiftKeyDown())
|
||||
{
|
||||
if (slot != null && slot.inventory != null && this.field_94075_K != null)
|
||||
{
|
||||
iterator = this.container.inventorySlots.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
slot1 = (Slot) iterator.next();
|
||||
|
||||
if (slot1 != null && slot1.canTakeStack(this.mc.thePlayer) && slot1.getHasStack() && slot1.inventory == slot.inventory
|
||||
&& Container.func_94527_a(slot1, this.field_94075_K, true))
|
||||
{
|
||||
this.handleMouseClick(slot1, slot1.slotNumber, par3, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.handleMouseClick(slot, j1, par3, 6);
|
||||
}
|
||||
|
||||
this.field_94074_J = false;
|
||||
this.field_94070_G = 0L;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.field_94076_q && this.field_94067_D != par3)
|
||||
{
|
||||
this.field_94076_q = false;
|
||||
this.field_94077_p.clear();
|
||||
this.field_94068_E = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.field_94068_E)
|
||||
{
|
||||
this.field_94068_E = false;
|
||||
return;
|
||||
}
|
||||
|
||||
boolean flag1;
|
||||
|
||||
if (this.clickedSlot != null && this.mc.gameSettings.touchscreen)
|
||||
{
|
||||
if (par3 == 0 || par3 == 1)
|
||||
{
|
||||
if (this.draggedStack == null && slot != this.clickedSlot)
|
||||
{
|
||||
this.draggedStack = this.clickedSlot.getStack();
|
||||
}
|
||||
|
||||
flag1 = Container.func_94527_a(slot, this.draggedStack, false);
|
||||
|
||||
if (j1 != -1 && this.draggedStack != null && flag1)
|
||||
{
|
||||
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, par3, 0);
|
||||
this.handleMouseClick(slot, j1, 0, 0);
|
||||
|
||||
if (this.mc.thePlayer.inventory.getItemStack() != null)
|
||||
{
|
||||
this.handleMouseClick(this.clickedSlot, this.clickedSlot.slotNumber, par3, 0);
|
||||
this.field_85049_r = par1 - l;
|
||||
this.field_85048_s = par2 - i1;
|
||||
this.returningStackDestSlot = this.clickedSlot;
|
||||
this.returningStack = this.draggedStack;
|
||||
this.returningStackTime = Minecraft.getSystemTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.returningStack = null;
|
||||
}
|
||||
}
|
||||
else if (this.draggedStack != null)
|
||||
{
|
||||
this.field_85049_r = par1 - l;
|
||||
this.field_85048_s = par2 - i1;
|
||||
this.returningStackDestSlot = this.clickedSlot;
|
||||
this.returningStack = this.draggedStack;
|
||||
this.returningStackTime = Minecraft.getSystemTime();
|
||||
}
|
||||
|
||||
this.draggedStack = null;
|
||||
this.clickedSlot = null;
|
||||
}
|
||||
}
|
||||
else if (this.field_94076_q && !this.field_94077_p.isEmpty())
|
||||
{
|
||||
this.handleMouseClick((Slot) null, -999, Container.func_94534_d(0, this.field_94071_C), 5);
|
||||
iterator = this.field_94077_p.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
slot1 = (Slot) iterator.next();
|
||||
this.handleMouseClick(slot1, slot1.slotNumber, Container.func_94534_d(1, this.field_94071_C), 5);
|
||||
}
|
||||
|
||||
this.handleMouseClick((Slot) null, -999, Container.func_94534_d(2, this.field_94071_C), 5);
|
||||
}
|
||||
else if (this.mc.thePlayer.inventory.getItemStack() != null)
|
||||
{
|
||||
if (par3 == this.mc.gameSettings.keyBindPickBlock.keyCode + 100)
|
||||
{
|
||||
this.handleMouseClick(slot, j1, par3, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
flag1 = j1 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54));
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
this.field_94075_K = slot != null && slot.getHasStack() ? slot.getStack() : null;
|
||||
}
|
||||
|
||||
this.handleMouseClick(slot, j1, par3, flag1 ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.mc.thePlayer.inventory.getItemStack() == null)
|
||||
{
|
||||
this.field_94070_G = 0L;
|
||||
}
|
||||
|
||||
this.field_94076_q = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the passed mouse position is over the specified slot.
|
||||
*/
|
||||
protected boolean isMouseOverSlot (Slot slot, int mouseX, int mouseY)
|
||||
{
|
||||
if (!(slot instanceof ActiveSlot) || ((ActiveSlot) slot).getActive())
|
||||
{
|
||||
return this.isPointInRegion(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, mouseX, mouseY);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Args: left, top, width, height, pointX, pointY. Note: left, top are local to Gui, pointX, pointY are local to
|
||||
* screen
|
||||
*/
|
||||
protected boolean isPointInRegion (int par1, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
int k1 = this.guiLeft;
|
||||
int l1 = this.guiTop;
|
||||
par5 -= k1;
|
||||
par6 -= l1;
|
||||
return par5 >= par1 - 1 && par5 < par1 + par3 + 1 && par6 >= par2 - 1 && par6 < par2 + par4 + 1;
|
||||
}
|
||||
|
||||
protected void handleMouseClick (Slot par1Slot, int par2, int par3, int par4)
|
||||
{
|
||||
if (par1Slot != null)
|
||||
{
|
||||
par2 = par1Slot.slotNumber;
|
||||
}
|
||||
|
||||
this.mc.playerController.windowClick(this.container.windowId, par2, par3, par4, this.mc.thePlayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e).
|
||||
*/
|
||||
protected void keyTyped (char par1, int par2)
|
||||
{
|
||||
if (par2 == 1 || par2 == this.mc.gameSettings.keyBindInventory.keyCode)
|
||||
{
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
|
||||
this.checkHotbarKeys(par2);
|
||||
|
||||
if (this.mainSlot != null && this.mainSlot.getHasStack())
|
||||
{
|
||||
if (par2 == this.mc.gameSettings.keyBindPickBlock.keyCode)
|
||||
{
|
||||
this.handleMouseClick(this.mainSlot, this.mainSlot.slotNumber, 0, 3);
|
||||
}
|
||||
else if (par2 == this.mc.gameSettings.keyBindDrop.keyCode)
|
||||
{
|
||||
this.handleMouseClick(this.mainSlot, this.mainSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is what controls the hotbar shortcut check when you press a number key when hovering a stack.
|
||||
*/
|
||||
protected boolean checkHotbarKeys (int par1)
|
||||
{
|
||||
if (this.mc.thePlayer.inventory.getItemStack() == null && this.mainSlot != null)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
if (par1 == 2 + j)
|
||||
{
|
||||
this.handleMouseClick(this.mainSlot, this.mainSlot.slotNumber, j, 2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the screen is unloaded. Used to disable keyboard repeat events
|
||||
*/
|
||||
public void onGuiClosed ()
|
||||
{
|
||||
if (this.mc.thePlayer != null)
|
||||
{
|
||||
this.container.onCraftGuiClosed(this.mc.thePlayer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this GUI should pause the game when it is displayed in single-player
|
||||
*/
|
||||
public boolean doesGuiPauseGame ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from the main game loop to update the screen.
|
||||
*/
|
||||
public void updateScreen ()
|
||||
{
|
||||
super.updateScreen();
|
||||
|
||||
if (!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead)
|
||||
{
|
||||
this.mc.thePlayer.closeScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,24 +3,33 @@ package mods.tinker.tconstruct.client.gui;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
|
||||
import mods.tinker.tconstruct.container.ActiveContainer;
|
||||
import mods.tinker.tconstruct.container.SmelteryContainer;
|
||||
import mods.tinker.tconstruct.logic.SmelteryLogic;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class SmelteryGui extends GuiContainer
|
||||
public class SmelteryGui extends NewContainerGui
|
||||
{
|
||||
public SmelteryLogic logic;
|
||||
String username;
|
||||
@@ -29,10 +38,22 @@ public class SmelteryGui extends GuiContainer
|
||||
float currentScroll = 0.0F;
|
||||
int slotPos = 0;
|
||||
int prevSlotPos = 0;
|
||||
|
||||
/*private Slot theSlot;
|
||||
private Slot clickedSlot = null;
|
||||
private ItemStack draggedStack = null;
|
||||
private boolean isRightMouseClick = false;
|
||||
private int field_94069_F;
|
||||
private long returningStackTime = 0L;
|
||||
private ItemStack returningStack = null;
|
||||
private Slot returningStackDestSlot = null;
|
||||
private int field_85049_r = 0;
|
||||
private int field_85048_s = 0;*/
|
||||
|
||||
public SmelteryGui(InventoryPlayer inventoryplayer, SmelteryLogic smeltery, World world, int x, int y, int z)
|
||||
{
|
||||
super(smeltery.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z));
|
||||
//container = (SmelteryContainer) inventorySlots;
|
||||
logic = smeltery;
|
||||
username = inventoryplayer.player.username;
|
||||
xSize = 248;
|
||||
@@ -41,79 +62,60 @@ public class SmelteryGui extends GuiContainer
|
||||
public void drawScreen (int mouseX, int mouseY, float par3)
|
||||
{
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
if (logic.layers > 2)
|
||||
{
|
||||
boolean mouseDown = Mouse.isButtonDown(0);
|
||||
int lefto = this.guiLeft;
|
||||
int topo = this.guiTop;
|
||||
int xScroll = lefto + 31;
|
||||
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)
|
||||
{
|
||||
updateServer(username, slotPos);
|
||||
prevSlotPos = slotPos;
|
||||
}
|
||||
|
||||
this.wasClicking = mouseDown;
|
||||
|
||||
if (this.isScrolling)
|
||||
{
|
||||
this.currentScroll = ((float) (mouseY - yScroll) - 7.5F) / ((float) (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.inventorySlots).scrollTo(this.currentScroll);
|
||||
if (s != -1)
|
||||
slotPos = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void updateServer (String name, int row)
|
||||
{
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
|
||||
DataOutputStream outputStream = new DataOutputStream(bos);
|
||||
try
|
||||
{
|
||||
outputStream.writeByte(3);
|
||||
outputStream.writeInt(row);
|
||||
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);
|
||||
updateScrollbar(mouseX, mouseY, par3);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
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 = ((float) (mouseY - yScroll) - 7.5F) / ((float) (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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
fontRenderer.drawString(StatCollector.translateToLocal("crafters.Smeltery"), 86, 5, 0x404040);
|
||||
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 90, (ySize - 96) + 2, 0x404040);
|
||||
@@ -130,12 +132,8 @@ public class SmelteryGui extends GuiContainer
|
||||
//Fuel - Lava
|
||||
if (logic.fuelGague > 0)
|
||||
{
|
||||
//ForgeHooksClient.bindTexture(Block.lavaStill.getTextureFile(), 0);
|
||||
//int renderIndex = Block.lavaStill.getBlockTextureFromSideAndMetadata(0, 0);
|
||||
this.mc.renderEngine.bindTexture("/terrain.png");
|
||||
Icon lavaIcon = Block.lavaStill.getBlockTextureFromSideAndMetadata(0, 0);
|
||||
//int xTex = renderIndex % 16 * 16;
|
||||
//int yTex = renderIndex / 16 * 16;
|
||||
int fuel = logic.getScaledFuelGague(52);
|
||||
int count = 0;
|
||||
while (fuel > 0)
|
||||
@@ -143,7 +141,6 @@ public class SmelteryGui extends GuiContainer
|
||||
int size = fuel >= 16 ? 16 : fuel;
|
||||
fuel -= size;
|
||||
drawTexturedModelRectFromIcon(cornerX + 117, (cornerY + 68) - size - 16 * count, lavaIcon, 12, size);
|
||||
//drawTexturedModalRect(cornerX + 117, (cornerY + 68) - size - 16 * count, 0, 16 - size, 12, size);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -156,7 +153,6 @@ public class SmelteryGui extends GuiContainer
|
||||
if (liquid.itemID < 4096) //Block
|
||||
{
|
||||
Block liquidBlock = Block.blocksList[liquid.itemID];
|
||||
//ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
|
||||
this.mc.renderEngine.bindTexture("/terrain.png");
|
||||
renderIndex = liquidBlock.getBlockTextureFromSideAndMetadata(0, liquid.itemMeta);
|
||||
}
|
||||
@@ -164,13 +160,10 @@ public class SmelteryGui extends GuiContainer
|
||||
//Item
|
||||
{
|
||||
Item liquidItem = Item.itemsList[liquid.itemID];
|
||||
//ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
|
||||
this.mc.renderEngine.bindTexture("/gui/items.png");
|
||||
renderIndex = liquidItem.getIconFromDamage(liquid.itemMeta);
|
||||
}
|
||||
|
||||
//int xTex = renderIndex % 16 * 16;
|
||||
//int yTex = renderIndex / 16 * 16;
|
||||
if (logic.getCapacity() > 0)
|
||||
{
|
||||
int liquidSize = liquid.amount * 52 / logic.getCapacity();
|
||||
@@ -186,7 +179,6 @@ public class SmelteryGui extends GuiContainer
|
||||
base += size;
|
||||
}
|
||||
}
|
||||
//base = liquid.amount / 10000 * 52;
|
||||
}
|
||||
|
||||
//Liquid gague
|
||||
@@ -194,7 +186,6 @@ public class SmelteryGui extends GuiContainer
|
||||
|
||||
mc.renderEngine.bindTexture("/mods/tinker/textures/gui/smeltery.png");
|
||||
drawTexturedModalRect(cornerX + 54, cornerY + 16, 176, 76, 52, 52);
|
||||
//drawTexturedModalRect(cornerX+111, cornerY+16, xSize, 128, 52, 52);
|
||||
|
||||
//Side inventory
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package mods.tinker.tconstruct.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mods.tinker.tconstruct.logic.SmelteryLogic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ActiveContainer extends Container
|
||||
{
|
||||
public List<ActiveSlot> activeInventorySlots = new ArrayList<ActiveSlot>();
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected ActiveSlot addDualSlotToContainer (ActiveSlot slot)
|
||||
{
|
||||
slot.activeSlotNumber = this.activeInventorySlots.size();
|
||||
this.activeInventorySlots.add(slot);
|
||||
this.addSlotToContainer(slot);
|
||||
return slot;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package mods.tinker.tconstruct.container;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class ActiveSlot extends Slot
|
||||
{
|
||||
protected boolean active;
|
||||
public int activeSlotNumber;
|
||||
|
||||
public ActiveSlot(IInventory iinventory, int par2, int par3, int par4, boolean flag)
|
||||
{
|
||||
super(iinventory, par2, par3, par4);
|
||||
active = flag;
|
||||
}
|
||||
|
||||
public void setActive(boolean flag)
|
||||
{
|
||||
active = flag;
|
||||
}
|
||||
|
||||
public boolean getActive()
|
||||
{
|
||||
return active;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
package mods.tinker.tconstruct.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mods.tinker.tconstruct.logic.SmelteryLogic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -7,179 +10,167 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SmelteryContainer extends Container
|
||||
public class SmelteryContainer extends ActiveContainer
|
||||
{
|
||||
public SmelteryLogic logic;
|
||||
public InventoryPlayer playerInv;
|
||||
public int fuel = 0;
|
||||
int slotRow;
|
||||
public SmelteryLogic logic;
|
||||
public InventoryPlayer playerInv;
|
||||
public int fuel = 0;
|
||||
int slotRow;
|
||||
|
||||
public SmelteryContainer(InventoryPlayer inventoryplayer, SmelteryLogic smeltery)
|
||||
{
|
||||
logic = smeltery;
|
||||
playerInv = inventoryplayer;
|
||||
if (smeltery.layers > 2)
|
||||
{
|
||||
slotRow = -1;
|
||||
updateRows(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (smeltery.layers > 0)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 3; x++)
|
||||
this.addSlotToContainer(new Slot(smeltery, x + y * 3, 2 + x * 22, 8 + y * 18));
|
||||
}
|
||||
if (smeltery.layers > 1)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 3; x++)
|
||||
this.addSlotToContainer(new Slot(smeltery, 9 + x + y * 3, 2 + x * 22, 62 + y * 18));
|
||||
}
|
||||
|
||||
public SmelteryContainer(InventoryPlayer inventoryplayer, SmelteryLogic smeltery)
|
||||
{
|
||||
logic = smeltery;
|
||||
playerInv = inventoryplayer;
|
||||
slotRow = 0;
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 90 + row * 18, 84 + column * 18));
|
||||
}
|
||||
}
|
||||
/* Smeltery inventory */
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 90 + column * 18, 142));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int updateRows(int invRow)
|
||||
{
|
||||
if (invRow != slotRow)
|
||||
{
|
||||
slotRow = invRow;
|
||||
this.inventorySlots.clear();
|
||||
this.inventoryItemStacks.clear();
|
||||
|
||||
for (int y = 0; y < 8; y++)
|
||||
for (int x = 0; x < 3; x++)
|
||||
this.addSlotToContainer(new Slot(logic, x + y*3 + invRow*3, 2 + x * 22, 8 + y * 18));
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInv, row + column * 9 + 9, 90 + row * 18, 84 + column * 18));
|
||||
}
|
||||
}
|
||||
for (int y = 0; y < smeltery.layers * 3; y++)
|
||||
{
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
this.addDualSlotToContainer(new ActiveSlot(smeltery, x + y * 3, 2 + x * 22, 8 + y * 18, y < 8));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInv, column, 90 + column * 18, 142));
|
||||
}
|
||||
return slotRow;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 90 + row * 18, 84 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
public int scrollTo(float scrollPos)
|
||||
{
|
||||
float total = (logic.getSizeInventory() - 24) / 3;
|
||||
int rowPos = (int) (total * scrollPos);
|
||||
return updateRows(rowPos);
|
||||
}
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 90 + column * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges () //TODO: Sync with this
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
/*for (int i = 0; i < crafters.size(); i++)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting)crafters.get(i);
|
||||
if (progress != logic.progress)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 0, logic.progress);
|
||||
}
|
||||
if (fuel != logic.fuel)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 1, logic.fuel);
|
||||
}
|
||||
if (fuelGague != logic.fuelGague)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 2, logic.fuelGague);
|
||||
}
|
||||
}
|
||||
public int updateRows (int invRow)
|
||||
{
|
||||
if (invRow != slotRow)
|
||||
{
|
||||
slotRow = invRow;
|
||||
System.out.println(invRow);
|
||||
int basePos = invRow * 3;
|
||||
for (int iter = 0; iter < activeInventorySlots.size(); iter++)
|
||||
{
|
||||
ActiveSlot slot = (ActiveSlot) activeInventorySlots.get(iter);
|
||||
if (slot.activeSlotNumber >= basePos && slot.activeSlotNumber < basePos + 24)
|
||||
{
|
||||
slot.setActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.setActive(false);
|
||||
}
|
||||
int xPos = (iter - basePos) % 3;
|
||||
int yPos = (iter - basePos) / 3;
|
||||
slot.xDisplayPosition = 2 + 22 * xPos;
|
||||
slot.yDisplayPosition = 8 + 18 * yPos;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
progress = logic.progress;
|
||||
fuel = logic.fuel;
|
||||
fuelGague = logic.fuelGague;*/
|
||||
}
|
||||
public int scrollTo (float scrollPos)
|
||||
{
|
||||
float total = (logic.getSizeInventory() - 24) / 3;
|
||||
int rowPos = (int) (total * scrollPos);
|
||||
return updateRows(rowPos);
|
||||
}
|
||||
|
||||
public void updateProgressBar (int id, int value)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
logic.fuelGague = value;
|
||||
}
|
||||
/* if (id == 1)
|
||||
{
|
||||
logic.fuel = value;
|
||||
}*/
|
||||
/*if (id == 2)
|
||||
{
|
||||
logic.fuelGague = value;
|
||||
}*/
|
||||
}
|
||||
@Override
|
||||
public void detectAndSendChanges () //TODO: Sync with this
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
/*for (int i = 0; i < crafters.size(); i++)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting)crafters.get(i);
|
||||
if (progress != logic.progress)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 0, logic.progress);
|
||||
}
|
||||
if (fuel != logic.fuel)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 1, logic.fuel);
|
||||
}
|
||||
if (fuelGague != logic.fuelGague)
|
||||
{
|
||||
icrafting.sendProgressBarUpdate(this, 2, logic.fuelGague);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
return logic.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
progress = logic.progress;
|
||||
fuel = logic.fuel;
|
||||
fuelGague = logic.fuelGague;*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
public void updateProgressBar (int id, int value)
|
||||
{
|
||||
if (id == 0)
|
||||
{
|
||||
logic.fuelGague = value;
|
||||
}
|
||||
/* if (id == 1)
|
||||
{
|
||||
logic.fuel = value;
|
||||
}*/
|
||||
/*if (id == 2)
|
||||
{
|
||||
logic.fuelGague = value;
|
||||
}*/
|
||||
}
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
return logic.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
if (slotID < logic.getSizeInventory())
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
return stack;
|
||||
}
|
||||
if (slotID < logic.getSizeInventory())
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean mergeItemStack (ItemStack inputStack, int startSlot, int endSlot, boolean flag)
|
||||
{
|
||||
boolean merged = false;
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean mergeItemStack (ItemStack inputStack, int startSlot, int endSlot, boolean flag)
|
||||
{
|
||||
System.out.println("Merge");
|
||||
boolean merged = false;
|
||||
int slotPos = startSlot;
|
||||
|
||||
if (flag)
|
||||
@@ -194,7 +185,7 @@ public class SmelteryContainer extends Container
|
||||
{
|
||||
while (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag && slotPos >= startSlot))
|
||||
{
|
||||
slot = (Slot)this.inventorySlots.get(slotPos);
|
||||
slot = (Slot) this.inventorySlots.get(slotPos);
|
||||
slotStack = slot.getStack();
|
||||
|
||||
if (slotStack != null && ItemStack.areItemStacksEqual(inputStack, slotStack) && !inputStack.getHasSubtypes())
|
||||
@@ -241,14 +232,14 @@ public class SmelteryContainer extends Container
|
||||
|
||||
while (!flag && slotPos < endSlot || flag && slotPos >= startSlot)
|
||||
{
|
||||
slot = (Slot)this.inventorySlots.get(slotPos);
|
||||
slot = (Slot) this.inventorySlots.get(slotPos);
|
||||
slotStack = slot.getStack();
|
||||
|
||||
if (slotStack == null)
|
||||
{
|
||||
slot.putStack(inputStack.copy());
|
||||
slot.onSlotChanged();
|
||||
inputStack.stackSize = 0;
|
||||
inputStack.stackSize -= 1;
|
||||
merged = true;
|
||||
break;
|
||||
}
|
||||
@@ -265,5 +256,5 @@ public class SmelteryContainer extends Container
|
||||
}
|
||||
|
||||
return merged;
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package mods.tinker.golems.logic;
|
||||
package mods.tinker.tconstruct.logic;
|
||||
|
||||
import mods.tinker.common.InventoryLogic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package mods.tinker.golems.logic;
|
||||
package mods.tinker.tconstruct.logic;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -1,10 +1,10 @@
|
||||
package mods.tinker.tconstruct.logic;
|
||||
|
||||
import mods.tinker.common.IPattern;
|
||||
import mods.tinker.common.InventoryLogic;
|
||||
import mods.tinker.tconstruct.container.PartCrafterChestContainer;
|
||||
import mods.tinker.tconstruct.container.PartCrafterContainer;
|
||||
import mods.tinker.tconstruct.crafting.PatternBuilder;
|
||||
import mods.tinker.tconstruct.items.Pattern;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -57,10 +57,10 @@ public class PartCrafterLogic extends InventoryLogic
|
||||
{
|
||||
if (slotID == 4 || slotID == 5)
|
||||
{
|
||||
if (!craftedTop)
|
||||
if (!craftedTop && inventory[0] != null)
|
||||
{
|
||||
int value = PatternBuilder.instance.getPartValue(inventory[2]);
|
||||
Pattern item = (Pattern)inventory[0].getItem();
|
||||
IPattern item = (IPattern)inventory[0].getItem();
|
||||
int cost = item != null ? item.getPatternCost(inventory[0].getItemDamage()) : 0;
|
||||
if (value > 0 && cost > 0)
|
||||
{
|
||||
@@ -82,11 +82,10 @@ public class PartCrafterLogic extends InventoryLogic
|
||||
|
||||
if (slotID == 6 || slotID == 7)
|
||||
{
|
||||
if (!craftedBottom)
|
||||
if (!craftedBottom && inventory[1] != null)
|
||||
{
|
||||
int value = PatternBuilder.instance.getPartValue(inventory[3]);
|
||||
//int cost = ((Pattern)inventory[1].getItem()).getPatternCost(inventory[1].getItemDamage());
|
||||
Pattern item = (Pattern)inventory[1].getItem();
|
||||
IPattern item = (IPattern)inventory[1].getItem();
|
||||
int cost = item != null ? item.getPatternCost(inventory[1].getItemDamage()) : 0;
|
||||
if (value > 0 && cost > 0)
|
||||
{
|
||||
|
||||
@@ -231,6 +231,7 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci
|
||||
if (addMoltenMetal(result, false))
|
||||
{
|
||||
inventory[i] = null;
|
||||
activeTemps[i] = 20;
|
||||
ArrayList alloys = Smeltery.mixMetals(moltenMetal);
|
||||
for (int al = 0; al < alloys.size(); al++)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user