Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mDiyo committed Sep 30, 2013
2 parents 702abbb + 2407548 commit 9a6ace2
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Run [Apache Ant](http://ant.apache.org/bindownload.cgi) in the repository root:
Please include the following:

* Minecraft version
* TinkersConstruct version
* Tinkers Construct version
* Forge version/build
* Versions of any mods potentially related to the issue
* Any relevant screenshots are greatly appreciated.
Expand All @@ -24,4 +24,8 @@ Most code is public domain under [Creative Commons 0](http://creativecommons.org

Textures and binaries are licensed under [Creative Commons 3](http://creativecommons.org/licenses/by/3.0/).

Any modpack which uses Tinkers' Construct takes **full** responsability for user support queries. For anyone else, we only support official builds from the main CI server, not custom built jars. We also do not take bug reports for outdated builds of Minecraft.

If you have queries about any license or the above support restrictions, please drop by our IRC channel, #TinkersConstruct on irc.esper.net

Any alternate licenses are noted where appropriate.
1 change: 1 addition & 0 deletions resources/assets/tinker/lang/en_US.xml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
}
2 changes: 2 additions & 0 deletions src/tconstruct/common/TContent.java
Original file line number Diff line number Diff line change
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 Expand Up @@ -1846,6 +1847,7 @@ public void oreRegistry()
//Vanilla stuff
OreDictionary.registerOre("slimeball", new ItemStack(Item.slimeBall));
OreDictionary.registerOre("slimeball", new ItemStack(strangeFood, 1, 0));
OreDictionary.registerOre("glass", new ItemStack(clearGlass));
RecipeRemover.removeShapedRecipe(new ItemStack(Block.pistonStickyBase));
RecipeRemover.removeShapedRecipe(new ItemStack(Item.magmaCream));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Block.pistonStickyBase), "slimeball", Block.pistonBase));
Expand Down
42 changes: 41 additions & 1 deletion src/tconstruct/util/network/TPacketHandler.java
Original file line number Diff line number Diff line change
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 9a6ace2

Please sign in to comment.