Skip to content

Commit

Permalink
Added toolpart.ToolShard to en_US.xml, added casting recipe for the s…
Browse files Browse the repository at this point in the history
…eared brick item using the ingot cast

If you click on a liquid in the smeltery gui it will go to the bottom and if you shift click it, it will go to the top
  • Loading branch information
mlazaric committed Sep 29, 2013
1 parent abdd27c commit 364c564
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 2 deletions.
1 change: 1 addition & 0 deletions resources/assets/tinker/lang/en_US.xml
Expand Up @@ -464,6 +464,7 @@
<entry key="toolpart.ScytheHead">Scythe Head</entry>
<entry key="toolpart.LumberHead">Broad Axe Head</entry>
<entry key="toolpart.ExcavatorHead">Excavator Head</entry>
<entry key="toolpart.ToolShard">Shard</entry>
<entry key="toolpart.LargeSwordBlade">Large Sword Blade</entry>
<entry key="toolpart.HammerHead">Hammer Head</entry>
<entry key="toolpart.Bowstring">Bowstring</entry>
Expand Down
75 changes: 74 additions & 1 deletion src/tconstruct/client/gui/SmelteryGui.java
@@ -1,5 +1,7 @@
package tconstruct.client.gui;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
Expand All @@ -9,6 +11,7 @@
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;
Expand All @@ -24,6 +27,7 @@
import tconstruct.blocks.logic.SmelteryLogic;
import tconstruct.inventory.ActiveContainer;
import tconstruct.inventory.SmelteryContainer;
import cpw.mods.fml.common.network.PacketDispatcher;

public class SmelteryGui extends NewContainerGui
{
Expand Down Expand Up @@ -108,6 +112,7 @@ protected void drawGuiContainerForegroundLayer (int mouseX, int mouseY)
int base = 0;
int cornerX = (width - xSize) / 2 + 36;
int cornerY = (height - ySize) / 2;

for (FluidStack liquid : logic.moltenMetal)
{
int basePos = 54;
Expand All @@ -133,9 +138,9 @@ protected void drawGuiContainerForegroundLayer (int mouseX, int mouseY)
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;
Expand Down Expand Up @@ -414,4 +419,72 @@ public void drawLiquidRect (int startU, int startV, Icon par3Icon, int endU, int
tessellator.addVertexWithUV((double) (startU + 0), (double) (startV + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) 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;

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);
}
}
}
}
1 change: 1 addition & 0 deletions src/tconstruct/common/TContent.java
Expand Up @@ -1178,6 +1178,7 @@ void addCraftingRecipes()
tableCasting.addCastingRecipe(new ItemStack(materials, 1, 15), new FluidStack(moltenAlumiteFluid, TConstruct.ingotLiquidValue), ingotcast, 80); //alumite
tableCasting.addCastingRecipe(new ItemStack(materials, 1, 18), new FluidStack(moltenObsidianFluid, TConstruct.ingotLiquidValue), ingotcast, 80); //obsidian
tableCasting.addCastingRecipe(new ItemStack(materials, 1, 16), new FluidStack(moltenSteelFluid, TConstruct.ingotLiquidValue), ingotcast, 80); //steel
tableCasting.addCastingRecipe(new ItemStack(materials, 1, 2), new FluidStack(moltenStoneFluid, TConstruct.ingotLiquidValue), ingotcast, 80); //steel

//Buckets
ItemStack bucket = new ItemStack(Item.bucketEmpty);
Expand Down
42 changes: 41 additions & 1 deletion src/tconstruct/util/network/TPacketHandler.java
Expand Up @@ -13,13 +13,16 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fluids.FluidStack;
import tconstruct.TConstruct;
import tconstruct.blocks.logic.DrawbridgeLogic;
import tconstruct.blocks.logic.SmelteryLogic;
import tconstruct.blocks.logic.ToolForgeLogic;
import tconstruct.blocks.logic.ToolStationLogic;
import tconstruct.library.blocks.InventoryLogic;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;

Expand Down Expand Up @@ -137,13 +140,50 @@ else if (packetID == 5) //Drawbridge
((DrawbridgeLogic) te).setPlacementDirection(direction);
}
}

else if (packetID == 10) //Double jump
{
//String user = inputStream.readUTF();
//EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
player.fallDistance = 0;
}

else if (packetID == 11) //Smeltery
{
int dimension = inputStream.readInt();
World world = DimensionManager.getWorld(dimension);
int x = inputStream.readInt();
int y = inputStream.readInt();
int z = inputStream.readInt();

boolean isShiftPressed = inputStream.readBoolean();
int fluidID = inputStream.readInt();

TileEntity te = world.getBlockTileEntity(x, y, z);

if (te instanceof SmelteryLogic)
{
FluidStack temp = null;

for(FluidStack liquid : ((SmelteryLogic) te).moltenMetal)
{
if (liquid.fluidID == fluidID)
{
temp = liquid;
}
}

if (temp != null)
{
((SmelteryLogic) te).moltenMetal.remove(temp);
if (isShiftPressed)
((SmelteryLogic) te).moltenMetal.add(temp);
else
((SmelteryLogic) te).moltenMetal.add(0, temp);
}
PacketDispatcher.sendPacketToAllInDimension(te.getDescriptionPacket(), dimension);
}
}
}
catch (IOException e)
{
Expand Down

0 comments on commit 364c564

Please sign in to comment.