Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Oct 5, 2014
2 parents d6cd145 + 6cc5d96 commit ed87da1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 62 deletions.
3 changes: 2 additions & 1 deletion resources/assets/tinker/lang/zh_CN.lang
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@ gui.toolstation15=采掘等级:
gui.toolstation16=使用速度:
gui.toolstation17=强化次数
gui.toolstation18=剩余强化次数:
gui.toolstation19=损伤减少:
gui.toolstation20=保护:

gui.mining1=石头
gui.mining2=铁
Expand Down Expand Up @@ -792,7 +794,6 @@ material.alumite=耐酸铝
material.steel=钢
material.pigiron=生铁
material.pigiron.ability=美味
material.pigiron.display=生铁
material.thaumium=神秘
material.thaumium.ability=神秘

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/tconstruct/smeltery/gui/SmelteryGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.*;

import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
Expand Down Expand Up @@ -34,10 +33,10 @@ public SmelteryGui(InventoryPlayer inventoryplayer, SmelteryLogic smeltery, Worl
{
super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z));
logic = smeltery;
xSize = 248;
smeltery.updateFuelDisplay();

columns = ((SmelteryContainer) this.inventorySlots).columns;
xSize = 254 + (columns - 3) * 22; // Adjust for column count
}

@Override
Expand All @@ -63,7 +62,7 @@ protected void updateScrollbar (int mouseX, int mouseY, float par3)
boolean mouseDown = Mouse.isButtonDown(0);
int lefto = this.guiLeft;
int topo = this.guiTop;
int xScroll = lefto + 67;
int xScroll = lefto + 67 + (columns - 3) * 22; // Adjust for column count
int yScroll = topo + 8;
int scrollWidth = xScroll + 14;
int scrollHeight = yScroll + 144;
Expand Down Expand Up @@ -109,10 +108,11 @@ protected void updateScrollbar (int mouseX, int mouseY, float par3)
@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 baseX = 86 + (columns - 3) * 22;
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Smeltery"), baseX, 5, 0x404040);
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), baseX + 4, (ySize - 96) + 2, 0x404040);

int cornerX = (width - xSize) / 2 + 36;
int cornerX = (width - xSize) / 2 + 36 + (columns - 3) * 22;
int cornerY = (height - ySize) / 2;

int[] fluidHeights = calcLiquidHeights();
Expand Down Expand Up @@ -151,7 +151,7 @@ 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 cornerX = (width - xSize) / 2 + 36 + (columns - 3) * 22;
int cornerY = (height - ySize) / 2;
drawTexturedModalRect(cornerX + 46, cornerY, 0, 0, 176, ySize);

Expand Down
21 changes: 9 additions & 12 deletions src/main/java/tconstruct/smeltery/inventory/SmelteryContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,28 @@ public SmelteryContainer(InventoryPlayer inventoryplayer, SmelteryLogic smeltery
int totalSlots = smeltery.getBlockCapacity();
int y = 0;

int xleft = 2;
xleft -= 22 * (columns - 3); // we have to shift the whole thing to the left if we have more than 3 columns

for (int i = 0; i < totalSlots; i++)
{
int x = i % columns;
this.addDualSlotToContainer(new ActiveSlot(smeltery, x + y * columns, xleft + x * 22, 8 + y * 18, y < 8));
this.addDualSlotToContainer(new ActiveSlot(smeltery, x + y * columns, 2 + x * 22, 8 + y * 18, y < 8));
if (x == columns - 1)
y++;
}

int baseX = 90 + (columns - 3) * 22;

/* Player inventory */
for (int column = 0; column < 3; column++)
for (int row = 0; row < 3; row++)
{
for (int row = 0; row < 9; row++)
for (int column = 0; column < 9; column++)
{
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 90 + row * 18, 84 + column * 18));
this.addSlotToContainer(new Slot(inventoryplayer, column + row * 9 + 9, baseX + column * 18, 84 + row * 18));
}
}

for (int column = 0; column < 9; column++)
{
this.addSlotToContainer(new Slot(inventoryplayer, column, 90 + column * 18, 142));
this.addSlotToContainer(new Slot(inventoryplayer, column, baseX + column * 18, 142));
}
}

Expand All @@ -73,12 +72,10 @@ public int updateRows (int invRow)
{
slot.setActive(false);
}
int xleft = 2;
xleft -= 22 * (columns - 3); // we have to shift the whole thing to the left if we have more than 3 columns

int xPos = (iter - basePos) % columns;
int yPos = (iter - basePos) / columns;
slot.xDisplayPosition = xleft + 22 * xPos;
slot.xDisplayPosition = 2 + 22 * xPos;
slot.yDisplayPosition = 8 + 18 * yPos;
}
return slotRow;
Expand Down Expand Up @@ -217,7 +214,7 @@ protected boolean mergeItemStack (ItemStack inputStack, int startSlot, int endSl
slot = (Slot) this.inventorySlots.get(slotPos);
slotStack = slot.getStack();

if (slotStack != null && ItemStack.areItemStacksEqual(slotStack, inputStack))
if (slotStack != null && slotStack.isItemEqual(inputStack) && ItemStack.areItemStackTagsEqual(slotStack, inputStack))
{
int l = slotStack.stackSize + inputStack.stackSize;

Expand Down
64 changes: 23 additions & 41 deletions src/main/java/tconstruct/tools/entity/ArrowEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void onCollideWithPlayer (EntityPlayer par1EntityPlayer)
{
this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
par1EntityPlayer.onItemPickup(this, 1);
if(returnStack.stackSize <= 0)
if(returnStack.stackSize <= 0 || this.canBePickedUp == 2)
this.setDead();
}
}
Expand Down Expand Up @@ -411,24 +411,13 @@ public boolean addItemStackToInventory (ItemStack par1ItemStack, EntityLivingBas
{
int stackSize;

/*
* if (par1ItemStack.isItemDamaged()) { slotID =
* this.getFirstEmptyStack(living);
*
* if (slotID >= 0) { living.setCurrentItemOrArmor(slotID,
* par1ItemStack); living.setEquipmentDropChance(slotID, 2.0f);
* par1ItemStack.stackSize = 0; return true; } else { return
* false; } } else
*/
do
{
do
{
stackSize = par1ItemStack.stackSize;
par1ItemStack.stackSize = this.storePartialItemStack(par1ItemStack, living);
} while (par1ItemStack.stackSize > 0 && par1ItemStack.stackSize < stackSize);
stackSize = par1ItemStack.stackSize;
par1ItemStack.stackSize = this.storePartialItemStack(par1ItemStack, living);
} while (par1ItemStack.stackSize > 0 && par1ItemStack.stackSize < stackSize);

return par1ItemStack.stackSize < stackSize;
}
return par1ItemStack.stackSize < stackSize;
}
catch (Throwable throwable)
{
Expand Down Expand Up @@ -460,30 +449,22 @@ public int getFirstEmptyStack (EntityLivingBase living)

private int storePartialItemStack (ItemStack par1ItemStack, EntityLivingBase living)
{
Item i = par1ItemStack.getItem();
int j = par1ItemStack.stackSize;
int stackSize = par1ItemStack.stackSize;
int slotID;

if (par1ItemStack.getMaxStackSize() == 1)
if (!par1ItemStack.isStackable())
{
slotID = this.getFirstEmptyStack(living);

if (slotID < 0)
{
return j;
return stackSize;
}
else
{
/*
* if (this.mainInventory[k] == null) { this.mainInventory[k] =
* par1ItemStack; }
*/
if (living.getEquipmentInSlot(slotID) == null)
{
living.setCurrentItemOrArmor(slotID, par1ItemStack);
if (living instanceof EntityLiving)
((EntityLiving) living).setEquipmentDropChance(slotID, 2.0f);
}
living.setCurrentItemOrArmor(slotID, par1ItemStack.copy());
if (living instanceof EntityLiving)
((EntityLiving) living).setEquipmentDropChance(slotID, 2.0f);

return 0;
}
Expand All @@ -499,24 +480,24 @@ private int storePartialItemStack (ItemStack par1ItemStack, EntityLivingBase liv

if (slotID < 0)
{
return j;
return stackSize;
}
else
{
ItemStack stack = living.getEquipmentInSlot(slotID);
if (stack == null)
{
living.setCurrentItemOrArmor(slotID, par1ItemStack);
living.setCurrentItemOrArmor(slotID, par1ItemStack.copy());
if (living instanceof EntityLiving)
((EntityLiving) living).setEquipmentDropChance(slotID, 2.0f);
return par1ItemStack.stackSize;
return 0;
}
else
{

int l = j;
int l = stackSize;

if (j > stack.getMaxStackSize() - stack.stackSize)
if (stackSize > stack.getMaxStackSize() - stack.stackSize)
{
l = stack.getMaxStackSize() - stack.stackSize;
}
Expand All @@ -528,16 +509,17 @@ private int storePartialItemStack (ItemStack par1ItemStack, EntityLivingBase liv

if (l == 0)
{
return j;
return stackSize;
}
else
{
j -= l;
stack.stackSize++;
stackSize -= l;
stack.stackSize += l;
living.setCurrentItemOrArmor(slotID, stack);
if (living instanceof EntityLiving)
((EntityLiving) living).setEquipmentDropChance(slotID, 2.0f);
return j;

return stackSize;
}
}
}
Expand All @@ -549,7 +531,7 @@ private int storeItemStack (ItemStack par1ItemStack, EntityLivingBase living)
for (int slotID = 0; slotID < 5; ++slotID)
{
ItemStack stack = living.getEquipmentInSlot(slotID);
if (stack != null && ItemStack.areItemStacksEqual(stack, par1ItemStack) && stack.isStackable() && stack.stackSize < stack.getMaxStackSize())
if (stack != null && stack.isItemEqual(par1ItemStack) && ItemStack.areItemStackTagsEqual(stack, par1ItemStack) && stack.isStackable() && stack.stackSize < stack.getMaxStackSize())
{
return slotID;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/tools/model/BattlesignTesr.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public void renderTileEntityAt (BattlesignLogic te, double x, double y, double z

GL11.glTranslated(x, y, z);
GL11.glScalef(f, -f, f);
// GL11.glRotatef(180F, 0F, 0F, 1F);

FontRenderer fr = Minecraft.getMinecraft().fontRenderer;

Expand Down Expand Up @@ -55,6 +54,7 @@ public void renderTileEntityAt (BattlesignLogic te, double x, double y, double z
}
}

GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}

Expand Down

0 comments on commit ed87da1

Please sign in to comment.