mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-10-26 14:33:50 +00:00
Merge pull request #485 from alexbegt/master
Fix some bugs with the way Gui's work.
This commit is contained in:
commit
fa49ead3b6
8 files changed
+101
-91
No files matched your search
@@ -38,10 +38,10 @@ public class PartBuilderLogic extends InventoryLogic implements ISidedInventory
|
||||
{
|
||||
for (int zPos = z - 1; zPos <= z + 1; zPos++)
|
||||
{
|
||||
for (int yPos = y - 1; zPos <= y + 1; zPos++)
|
||||
for (int yPos = y - 1; yPos <= y + 1; yPos++)
|
||||
{
|
||||
TileEntity tile = world.getTileEntity(xPos, yPos, zPos);
|
||||
if (tile != null && tile instanceof PatternChestLogic)
|
||||
if (tile != null && tile instanceof PatternChestLogic && (x == xPos || z == zPos))
|
||||
return new PartCrafterChestContainer(inventoryplayer, this, (PatternChestLogic) tile);
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class PartBuilderLogic extends InventoryLogic implements ISidedInventory
|
||||
return new PartCrafterContainer(inventoryplayer, this);
|
||||
}
|
||||
|
||||
// Called when emptying a slot, not when another item is placed in it
|
||||
//Called when emptying a slot, not when another item is placed in it
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slotID, int quantity)
|
||||
{
|
||||
@@ -72,8 +72,7 @@ public class PartBuilderLogic extends InventoryLogic implements ISidedInventory
|
||||
int decrease = cost / value;
|
||||
if (cost % value != 0)
|
||||
decrease++;
|
||||
super.decrStackSize(2, decrease); // Call super to avoid
|
||||
// crafting again
|
||||
super.decrStackSize(2, decrease); //Call super to avoid crafting again
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,8 +97,7 @@ public class PartBuilderLogic extends InventoryLogic implements ISidedInventory
|
||||
int decrease = cost / value;
|
||||
if (cost % value != 0)
|
||||
decrease++;
|
||||
super.decrStackSize(3, decrease); // Call super to avoid
|
||||
// crafting again
|
||||
super.decrStackSize(3, decrease); //Call super to avoid crafting again
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +111,7 @@ public class PartBuilderLogic extends InventoryLogic implements ISidedInventory
|
||||
buildBottomPart();
|
||||
}
|
||||
|
||||
// Called when a slot has something placed into it.
|
||||
//Called when a slot has something placed into it.
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
|
||||
@@ -35,25 +35,24 @@ public class StencilTableLogic extends InventoryLogic implements ISidedInventory
|
||||
return new PatternShaperContainer(inventoryplayer, this);
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public void markDirty() { if (inventory[0] == null)
|
||||
* inventory[1] = null; super.markDirty(); }
|
||||
*/
|
||||
/*@Override
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
if (inventory[0] == null)
|
||||
inventory[1] = null;
|
||||
super.onInventoryChanged();
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
super.setInventorySlotContents(slot, itemstack);
|
||||
if (slot == 0 && itemstack != null && itemstack.getItem() == TRepo.blankPattern)// instanceof
|
||||
// tconstruct.items.Pattern)
|
||||
if (slot == 0 && itemstack != null && itemstack.getItem() == TRepo.blankPattern)//instanceof tconstruct.items.Pattern)
|
||||
{
|
||||
if (itemstack.getItemDamage() == 0)
|
||||
setInventorySlotContents(1, new ItemStack(TRepo.woodPattern, 1, 1));
|
||||
/*
|
||||
* else if (itemstack.getItemDamage() == 1)
|
||||
* setInventorySlotContents(1, new ItemStack(TContent.metalPattern,
|
||||
* 1, 0));
|
||||
*/
|
||||
/*else if (itemstack.getItemDamage() == 1)
|
||||
setInventorySlotContents(1, new ItemStack(TContent.metalPattern, 1, 0));*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,11 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import tconstruct.TConstruct;
|
||||
|
||||
public class BlockSkinRenderHelper
|
||||
{
|
||||
public static boolean renderMetadataBlock (Block block, int metadata, int x, int y, int z, RenderBlocks renderer, IBlockAccess world)
|
||||
{
|
||||
TConstruct.logger.error(block);
|
||||
// TODO CHECK THESE!!!!
|
||||
int var5 = block.colorMultiplier(world, x, y, z);
|
||||
float var6 = (float) (var5 >> 16 & 255) / 255.0F;
|
||||
|
||||
@@ -58,9 +58,9 @@ public class PartCrafterGui extends NewContainerGui
|
||||
void drawMaterialInformation ()
|
||||
{
|
||||
ItemStack top = logic.getStackInSlot(2);
|
||||
// ItemStack topResult = logic.getStackInSlot(4);
|
||||
//ItemStack topResult = logic.getStackInSlot(4);
|
||||
ItemStack bottom = logic.getStackInSlot(3);
|
||||
// ItemStack bottomResult = logic.getStackInSlot(6);
|
||||
//ItemStack bottomResult = logic.getStackInSlot(6);
|
||||
if (topMaterial != top)
|
||||
{
|
||||
topMaterial = top;
|
||||
@@ -133,17 +133,17 @@ public class PartCrafterGui extends NewContainerGui
|
||||
switch (num)
|
||||
{
|
||||
case 0:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining1");
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining1"));
|
||||
case 1:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining2");
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining2"));
|
||||
case 2:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining3");
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining3"));
|
||||
case 3:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining4");
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining4"));
|
||||
case 4:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining5");
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining5"));
|
||||
case 5:
|
||||
return StatCollector.translateToLocal("gui.partcrafter.mining6");
|
||||
return (StatCollector.translateToLocal("gui.partcrafter.mining6"));
|
||||
default:
|
||||
return String.valueOf(num);
|
||||
}
|
||||
@@ -298,4 +298,4 @@ public class PartCrafterGui extends NewContainerGui
|
||||
this.field_94070_G = l;
|
||||
this.field_94073_I = clickNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,27 +65,20 @@ public class StencilTableGui extends GuiContainer
|
||||
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);
|
||||
*/
|
||||
/*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++)
|
||||
// {
|
||||
//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);
|
||||
*/
|
||||
// }
|
||||
/*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
|
||||
@@ -117,16 +110,18 @@ public class StencilTableGui extends GuiContainer
|
||||
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); }
|
||||
*/
|
||||
/*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));
|
||||
}
|
||||
}
|
||||
@@ -91,4 +91,4 @@ public class PatternChestContainer extends Container
|
||||
|
||||
return super.mergeItemStack(stack, inventorySize, slotSize, par4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,13 @@ public class PatternShaperContainer extends Container
|
||||
logic = shaper;
|
||||
this.addSlotToContainer(new Slot(shaper, 0, 48, 35));
|
||||
this.addSlotToContainer(new SlotOnlyTake(shaper, 1, 106, 35));
|
||||
/*
|
||||
* for (int i = 0; i < 3; i++) { for (int l = 0; l < 3; l++) {
|
||||
* this.addSlotToContainer(new Slot(craftMatrix, l + i * 3, 30 + l * 18,
|
||||
* 17 + i * 18)); } }
|
||||
*/
|
||||
/*for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int l = 0; l < 3; l++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(craftMatrix, l + i * 3, 30 + l * 18, 17 + i * 18));
|
||||
}
|
||||
}*/
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
@@ -37,19 +39,25 @@ public class PatternShaperContainer extends Container
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* public void onCraftMatrixChanged(IInventory iinventory) {
|
||||
* craftResult.setInventorySlotContents(0,
|
||||
* CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
|
||||
* }
|
||||
*/
|
||||
/*public void onCraftMatrixChanged(IInventory iinventory)
|
||||
{
|
||||
craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
|
||||
}*/
|
||||
|
||||
/*
|
||||
* @Override public void onContainerClosed(EntityPlayer entityplayer) {
|
||||
* super.onContainerClosed(entityplayer); if (logic.worldObj.isRemote) {
|
||||
* return; } ItemStack itemstack = logic.getStackInSlot(0); if (itemstack !=
|
||||
* null) { entityplayer.dropPlayerItem(itemstack); } }
|
||||
*/
|
||||
/*@Override
|
||||
public void onContainerClosed(EntityPlayer entityplayer)
|
||||
{
|
||||
super.onContainerClosed(entityplayer);
|
||||
if (logic.worldObj.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ItemStack itemstack = logic.getStackInSlot(0);
|
||||
if (itemstack != null)
|
||||
{
|
||||
entityplayer.dropPlayerItem(itemstack);
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
@@ -61,24 +69,37 @@ public class PatternShaperContainer extends Container
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
return null;
|
||||
/*
|
||||
* ItemStack stack = null; Slot slot =
|
||||
* (Slot)this.inventorySlots.get(slotID);
|
||||
*
|
||||
* if (slot != null && slot.getHasStack()) { ItemStack slotStack =
|
||||
* slot.getStack(); stack = slotStack.copy();
|
||||
*
|
||||
* if (slotID < logic.getSizeInventory()) { if
|
||||
* (!this.mergeItemStack(slotStack, logic.getSizeInventory(),
|
||||
* this.inventorySlots.size(), true)) { return null; } } else if
|
||||
* (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory()-1,
|
||||
* false)) { return null; }
|
||||
*
|
||||
* if (slotStack.stackSize == 0) { slot.putStack((ItemStack)null); }
|
||||
* else { slot.onSlotChanged(); } }
|
||||
*
|
||||
* return stack;
|
||||
*/
|
||||
/*ItemStack stack = null;
|
||||
Slot slot = (Slot)this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if (slotID < logic.getSizeInventory())
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory()-1, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack)null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return stack;*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,12 +13,11 @@ public class SlotPattern extends Slot
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack stack)
|
||||
{
|
||||
return stack.getItem() instanceof IPattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user