diff --git a/resources/lang/TConstruct_en_US.xml b/resources/lang/TConstruct_en_US.xml
deleted file mode 100644
index 5bbd1a6f..00000000
--- a/resources/lang/TConstruct_en_US.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- TConstruct Tools
- TConstruct Materials
- TConstruct Blocks
-
-
\ No newline at end of file
diff --git a/resources/tinkerlang/en_US.xml b/resources/tinkerlang/en_US.xml
new file mode 100644
index 00000000..774de323
--- /dev/null
+++ b/resources/tinkerlang/en_US.xml
@@ -0,0 +1,39 @@
+
+
+
+ TConstruct Tools
+ TConstruct Materials
+ TConstruct Blocks
+
+ Tool Station
+ Part Builder
+ Stencil Table
+ Pattern Chest
+ Smeltery
+ Frying Pan
+
+ Tool Station
+ Part Builder
+ Pattern Chest
+ Stencil Table
+ Casting Table
+
+ Slimy Mud
+ Grout
+
+ Netherack Slag
+ Cobalt Ore
+ Ardite Ore
+ Copper Ore
+ Tin Ore
+ Aluminum Ore
+ Stone Slag
+
+ Smeltery
+ Smeltery Drain
+ Seared Bricks
+ Lava Tank
+ Hardened Glass
+ Hardened Window
+
+
\ No newline at end of file
diff --git a/resources/tinkertextures/ConstructBlocks.png b/resources/tinkertextures/ConstructBlocks.png
index 2fe1bf96..c4d37f9a 100644
Binary files a/resources/tinkertextures/ConstructBlocks.png and b/resources/tinkertextures/ConstructBlocks.png differ
diff --git a/resources/tinkertextures/materials.png b/resources/tinkertextures/materials.png
index 50be9bff..5452e18e 100644
Binary files a/resources/tinkertextures/materials.png and b/resources/tinkertextures/materials.png differ
diff --git a/resources/tinkertextures/tools/patterns.png b/resources/tinkertextures/tools/patterns.png
index 4e7adb11..66a758cd 100644
Binary files a/resources/tinkertextures/tools/patterns.png and b/resources/tinkertextures/tools/patterns.png differ
diff --git a/tinker/common/CoordTuple.java b/tinker/common/CoordTuple.java
index 96eba678..474d66b8 100644
--- a/tinker/common/CoordTuple.java
+++ b/tinker/common/CoordTuple.java
@@ -24,4 +24,12 @@ public class CoordTuple
else
return false;
}
+
+ public boolean equals(int posX, int posY, int posZ)
+ {
+ if (this.x == posX && this.y == posY && this.z == posZ)
+ return true;
+ else
+ return false;
+ }
}
diff --git a/tinker/common/IFacingLogic.java b/tinker/common/IFacingLogic.java
index 475c9a87..a6261c40 100644
--- a/tinker/common/IFacingLogic.java
+++ b/tinker/common/IFacingLogic.java
@@ -1,7 +1,11 @@
package tinker.common;
+import net.minecraft.entity.EntityLiving;
+import net.minecraftforge.common.ForgeDirection;
+
public interface IFacingLogic
{
- public byte getDirection();
- public void setDirection(float yaw, float pitch);
+ public byte getRenderDirection();
+ public ForgeDirection getForgeDirection();
+ public void setDirection(float yaw, float pitch, EntityLiving player);
}
\ No newline at end of file
diff --git a/tinker/common/InventoryBlock.java b/tinker/common/InventoryBlock.java
index c6e63a1f..b2fad8b0 100644
--- a/tinker/common/InventoryBlock.java
+++ b/tinker/common/InventoryBlock.java
@@ -49,10 +49,11 @@ public abstract class InventoryBlock extends BlockContainer
@Override
public void breakBlock (World par1World, int x, int y, int z, int par5, int par6)
{
- InventoryLogic logic = (InventoryLogic) par1World.getBlockTileEntity(x, y, z);
+ TileEntity te = par1World.getBlockTileEntity(x, y, z);
- if (logic != null)
+ if (te != null && te instanceof InventoryLogic)
{
+ InventoryLogic logic = (InventoryLogic) te;
for (int iter = 0; iter < logic.getSizeInventory(); ++iter)
{
ItemStack stack = logic.getStackInSlot(iter);
@@ -103,11 +104,11 @@ public abstract class InventoryBlock extends BlockContainer
IFacingLogic direction = (IFacingLogic) logic;
if (entityliving == null)
{
- direction.setDirection(0F, 0F);
+ direction.setDirection(0F, 0F, null);
}
else
{
- direction.setDirection(entityliving.rotationYaw * 4F, entityliving.rotationPitch);
+ direction.setDirection(entityliving.rotationYaw * 4F, entityliving.rotationPitch, entityliving);
}
}
}
@@ -121,4 +122,9 @@ public abstract class InventoryBlock extends BlockContainer
}
return false;
}
+
+ public int damageDropped (int meta)
+ {
+ return meta;
+ }
}
diff --git a/tinker/tconstruct/modifiers/ToolMod.java b/tinker/common/ToolMod.java
similarity index 97%
rename from tinker/tconstruct/modifiers/ToolMod.java
rename to tinker/common/ToolMod.java
index 109b24ee..b49fb83a 100644
--- a/tinker/tconstruct/modifiers/ToolMod.java
+++ b/tinker/common/ToolMod.java
@@ -1,4 +1,4 @@
-package tinker.tconstruct.modifiers;
+package tinker.common;
import java.util.ArrayList;
import java.util.Iterator;
@@ -9,8 +9,6 @@ import net.minecraft.nbt.NBTTagCompound;
public abstract class ToolMod
{
- // The ItemStacks used to compare against
- //ItemStack[] stacks;
public final String key;
public final List stacks;
public final int effectIndex; //255 is always blank
diff --git a/tinker/tconstruct/PHConstruct.java b/tinker/tconstruct/PHConstruct.java
index 280a5053..82c78df4 100644
--- a/tinker/tconstruct/PHConstruct.java
+++ b/tinker/tconstruct/PHConstruct.java
@@ -46,7 +46,8 @@ public class PHConstruct {
smeltery = config.getBlock("Smeltery", 1474).getInt(1474);
oreSlag = config.getBlock("Ores Slag", 1475).getInt(1475);
craftedSoil = config.getBlock("Special Soil", 1476).getInt(1476);
- landmine = config.getBlock("Landmine", 1477).getInt(1477);
+ searedTable = config.getBlock("Seared Table", 1477).getInt(1477);
+ //landmine = config.getBlock("Landmine", 1477).getInt(1477);
ironFlowing = config.getBlock("Liquid Iron Flowing", 1478).getInt(1478);
ironStill = config.getBlock("Liquid Iron Still", 1479).getInt(1479);
@@ -113,6 +114,8 @@ public class PHConstruct {
lumberaxe = config.getItem("Tools", "Lumber Axe", 14061).getInt(14061);
longbow = config.getItem("Tools", "Longbow", 14062).getInt(14062);
+ buckets = config.getItem("Patterns and Misc", "Buckets", 14101).getInt(14101);
+
boolean ic2 = true;
boolean xycraft = true;
try
@@ -155,12 +158,13 @@ public class PHConstruct {
public static int ores;
public static int lavaTank;
public static int smeltery;
+ public static int searedTable;
public static int craftedSoil;
public static int oreSlag;
- public static int axle;
+ //public static int axle;
//Traps
- public static int landmine;
+ //public static int landmine;
//Liquids
public static int ironFlowing;
@@ -200,6 +204,7 @@ public class PHConstruct {
public static int woodPattern;
public static int manual;
+ public static int buckets;
//Tools
public static int pickaxe;
diff --git a/tinker/tconstruct/TConstruct.java b/tinker/tconstruct/TConstruct.java
index b5f24ee5..6224e7a1 100644
--- a/tinker/tconstruct/TConstruct.java
+++ b/tinker/tconstruct/TConstruct.java
@@ -3,9 +3,15 @@ package tinker.tconstruct;
import java.util.ArrayList;
import java.util.Random;
+import net.minecraft.block.material.Material;
+import net.minecraft.entity.passive.EntityCow;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumMovingObjectType;
import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe;
+import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
import tinker.tconstruct.crafting.PatternBuilder;
@@ -29,8 +35,8 @@ import cpw.mods.fml.common.registry.GameRegistry;
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.4.7_1.1.5")
-@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels={"TConstruct"}, packetHandler = tinker.tconstruct.TPacketHandler.class)
-public class TConstruct
+@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = tinker.tconstruct.TPacketHandler.class)
+public class TConstruct
{
/* Instance of this mod, used for grabbing prototype fields */
@Instance("TConstruct")
@@ -38,62 +44,38 @@ public class TConstruct
/* Proxies for sides, used for graphics processing */
@SidedProxy(clientSide = "tinker.tconstruct.client.TProxyClient", serverSide = "tinker.tconstruct.TProxyCommon")
public static TProxyCommon proxy;
-
+
@PreInit
- public void preInit(FMLPreInitializationEvent evt)
+ public void preInit (FMLPreInitializationEvent evt)
{
- MinecraftForge.EVENT_BUS.register(this);
+ MinecraftForge.EVENT_BUS.register(new TEventHandler());
PHConstruct.initProps();
materialTab = new TabTools("TConstructMaterials");
toolTab = new TabTools("TConstructTools");
blockTab = new TabTools("TConstructBlocks");
content = new TContent();
-
+
NetworkRegistry.instance().registerGuiHandler(instance, new TGuiHandler());
}
-
+
@Init
- public void load(FMLInitializationEvent evt)
+ public void load (FMLInitializationEvent evt)
{
GameRegistry.registerWorldGenerator(new TBaseWorldGenerator());
content.oreRegistry();
}
-
+
@PostInit
- public void postInit(FMLPostInitializationEvent evt)
+ public void postInit (FMLPostInitializationEvent evt)
{
proxy.addNames();
proxy.registerRenderer();
proxy.readManuals();
content.modIntegration();
-
- ArrayList copperIngots = OreDictionary.getOres("ingotCopper");
- for (ItemStack copper : copperIngots)
- PatternBuilder.instance.registerMaterial(copper, 2, "Copper");
-
- ArrayList bronzeIngots = OreDictionary.getOres("ingotBronze");
- for (ItemStack bronze : bronzeIngots)
- PatternBuilder.instance.registerMaterial(bronze, 2, "Bronze");
}
-
- @ForgeSubscribe
- public void registerOre(OreRegisterEvent evt)
- {
- if (evt.Name == "battery")
- content.modE.batteries.add(evt.Ore);
-
- if (evt.Name == "basicCircuit")
- content.modE.circuits.add(evt.Ore);
-
- if (evt.Name == "ingotCopper")
- PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Copper");
-
- if (evt.Name == "ingotBronze")
- PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Bronze");
- }
-
+
public static TContent content;
-
+
public static Random tRand = new Random();
public static TabTools toolTab;
public static TabTools materialTab;
diff --git a/tinker/tconstruct/TConstructRegistry.java b/tinker/tconstruct/TConstructRegistry.java
index 15b11a4e..d9760e03 100644
--- a/tinker/tconstruct/TConstructRegistry.java
+++ b/tinker/tconstruct/TConstructRegistry.java
@@ -3,8 +3,9 @@ package tinker.tconstruct;
import java.util.ArrayList;
import java.util.HashMap;
-import tinker.tconstruct.client.gui.ToolGuiElement;
-import tinker.tconstruct.tools.ToolCore;
+import tinker.tconstruct.client.gui.*;
+import tinker.tconstruct.crafting.*;
+import tinker.tconstruct.tools.*;
/** A registry to store any relevant API work
*
@@ -13,7 +14,7 @@ import tinker.tconstruct.tools.ToolCore;
public class TConstructRegistry
{
- public static TConstructRegistry instance = new TConstructRegistry();
+ public static TConstructRegistry instance = new TConstructRegistry();
public static ArrayList tools = new ArrayList(20);
public static ArrayList toolButtons = new ArrayList(20);
public static HashMap toolMaterials = new HashMap(60);
diff --git a/tinker/tconstruct/TContent.java b/tinker/tconstruct/TContent.java
index 5b24db60..4244b8d1 100644
--- a/tinker/tconstruct/TContent.java
+++ b/tinker/tconstruct/TContent.java
@@ -1,28 +1,31 @@
package tinker.tconstruct;
+import java.util.ArrayList;
+
import net.minecraft.block.Block;
-import net.minecraft.block.EnumMobType;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.liquids.LiquidContainerData;
+import net.minecraftforge.liquids.LiquidContainerRegistry;
+import net.minecraftforge.liquids.LiquidDictionary;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
-
-import tinker.common.*;
+import tinker.common.IPattern;
import tinker.common.fancyitem.FancyEntityItem;
import tinker.tconstruct.blocks.*;
import tinker.tconstruct.blocks.liquids.*;
-import tinker.tconstruct.client.gui.*;
+import tinker.tconstruct.client.gui.ToolGuiElement;
import tinker.tconstruct.crafting.*;
import tinker.tconstruct.entity.*;
import tinker.tconstruct.items.*;
+import tinker.tconstruct.logic.*;
import tinker.tconstruct.modifiers.*;
import tinker.tconstruct.tools.*;
-
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -37,6 +40,7 @@ public class TContent implements IFuelHandler
public static Item woodPattern;
public static Item manualBook;
+ public static Item buckets;
//public static Item stonePattern;
//public static Item netherPattern;
@@ -71,12 +75,13 @@ public class TContent implements IFuelHandler
public static Item lumberHead;
//Crafting blocks
- public static Block woodCrafter;
- public static Block smeltery;
-
+ public static Block woodCrafter;
public static Block heldItemBlock;
- public static Block lavaTank;
public static Block craftedSoil;
+
+ public static Block smeltery;
+ public static Block lavaTank;
+ public static Block searedBlock;
public static Block oreSlag;
//Traps
@@ -143,12 +148,11 @@ public class TContent implements IFuelHandler
{
//Tool Station
woodCrafter = new ToolStationBlock(PHConstruct.woodCrafter, Material.wood);
- GameRegistry.registerBlock(woodCrafter, tinker.tconstruct.items.ToolStationItemBlock.class, "ToolStationBlock");
- GameRegistry.registerTileEntity(tinker.tconstruct.logic.ToolStationLogic.class, "ToolStation");
- GameRegistry.registerTileEntity(tinker.tconstruct.logic.PartCrafterLogic.class, "PartCrafter");
- GameRegistry.registerTileEntity(tinker.tconstruct.logic.PatternChestLogic.class, "PatternHolder");
- GameRegistry.registerTileEntity(tinker.tconstruct.logic.PatternShaperLogic.class, "PatternShaper");
- GameRegistry.registerTileEntity(tinker.tconstruct.logic.CastingTableLogic.class, "CastingTable");
+ GameRegistry.registerBlock(woodCrafter, ToolStationItemBlock.class, "ToolStationBlock");
+ GameRegistry.registerTileEntity(ToolStationLogic.class, "ToolStation");
+ GameRegistry.registerTileEntity(PartCrafterLogic.class, "PartCrafter");
+ GameRegistry.registerTileEntity(PatternChestLogic.class, "PatternHolder");
+ GameRegistry.registerTileEntity(PatternShaperLogic.class, "PatternShaper");
heldItemBlock = new EquipBlock(PHConstruct.heldItemBlock, Material.wood);
GameRegistry.registerBlock(heldItemBlock, "HeldItemBlock");
@@ -161,14 +165,19 @@ public class TContent implements IFuelHandler
//Smeltery
smeltery = new SmelteryBlock(PHConstruct.smeltery).setBlockName("Smeltery");
GameRegistry.registerBlock(smeltery, SmelteryItemBlock.class, "Smeltery");
- GameRegistry.registerTileEntity(tinker.tconstruct.logic.SmelteryLogic.class, "TConstruct.Smeltery");
- GameRegistry.registerTileEntity(tinker.tconstruct.logic.SmelteryDrainLogic.class, "TConstruct.SmelteryDrain");
- GameRegistry.registerTileEntity(tinker.tconstruct.logic.MultiServantLogic.class, "TConstruct.Servants");
+ GameRegistry.registerTileEntity(SmelteryLogic.class, "TConstruct.Smeltery");
+ GameRegistry.registerTileEntity(SmelteryDrainLogic.class, "TConstruct.SmelteryDrain");
+ GameRegistry.registerTileEntity(MultiServantLogic.class, "TConstruct.Servants");
- lavaTank = new LavaTankBlock(PHConstruct.lavaTank);
+ lavaTank = new LavaTankBlock(PHConstruct.lavaTank).setBlockName("LavaTank");
lavaTank.setStepSound(Block.soundGlassFootstep);
- GameRegistry.registerBlock(lavaTank, "LavaTank");
+ GameRegistry.registerBlock(lavaTank, LavaTankItemBlock.class, "LavaTank");
GameRegistry.registerTileEntity(tinker.tconstruct.logic.LavaTankLogic.class, "TConstruct.LavaTank");
+
+ searedBlock = new SearedBlock(PHConstruct.searedTable).setBlockName("SearedTable");
+ GameRegistry.registerBlock(searedBlock, SearedTableItemBlock.class, "SearedTable");
+ GameRegistry.registerTileEntity(CastingTableLogic.class, "CastingTable");
+ GameRegistry.registerTileEntity(FaucetLogic.class, "Faucet");
oreSlag = new MetalOre(PHConstruct.oreSlag, 80, Material.iron, 10.0F, 6);
GameRegistry.registerBlock(oreSlag, tinker.tconstruct.items.MetalOreItemBlock.class, "SearedBrick");
@@ -180,8 +189,8 @@ public class TContent implements IFuelHandler
MinecraftForge.setBlockHarvestLevel(oreSlag, 5, "pickaxe", 1);
//Traps
- landmine = new Landmine(PHConstruct.landmine, 0, EnumMobType.mobs, Material.cactus).setBlockName("landmine");
- GameRegistry.registerBlock(landmine, "landmine");
+ /*landmine = new Landmine(PHConstruct.landmine, 0, EnumMobType.mobs, Material.cactus).setBlockName("landmine");
+ GameRegistry.registerBlock(landmine, "landmine");*/
//Liquids
ironFlowing = new IronFlowing(PHConstruct.ironFlowing).setBlockName("liquid.ironFlow");
@@ -249,6 +258,7 @@ public class TContent implements IFuelHandler
//netherPattern = new Pattern(PHTools.netherPattern, 128, patternTexture).setItemName("tconstruct.Pattern");
manualBook = new PatternManual(PHConstruct.manual);
+ buckets = new FilledBucket(PHConstruct.buckets);
pickaxe = new Pickaxe(PHConstruct.pickaxe, pickaxeTexture);
shovel = new Shovel(PHConstruct.shovel, shovelTexture);
@@ -411,15 +421,15 @@ public class TContent implements IFuelHandler
void addSmelteryRecipes()
{
- Smeltery.addMelting(Block.oreIron, 0, 600, new LiquidStack(ironStill.blockID, 250, 0));
- Smeltery.addMelting(Block.oreGold, 0, 550, new LiquidStack(goldStill.blockID, 250, 0));
- Smeltery.addMelting(new ItemStack(Item.ingotIron, 8), Block.blockSteel.blockID, 0, 500, new LiquidStack(ironStill.blockID, 250, 0));
- Smeltery.addMelting(new ItemStack(Item.ingotGold, 8), Block.blockGold.blockID, 0, 450, new LiquidStack(goldStill.blockID, 250, 0));
- Smeltery.addMelting(Block.blockSteel, 0, 500, new LiquidStack(ironStill.blockID, 2250, 0));
- Smeltery.addMelting(Block.blockGold, 0, 450, new LiquidStack(goldStill.blockID, 2250, 0));
- Smeltery.addMelting(oreSlag, 3, 550, new LiquidStack(copperStill.blockID, 250, 0));
- Smeltery.addMelting(oreSlag, 4, 175, new LiquidStack(tinStill.blockID, 250, 0));
- Smeltery.addMelting(oreSlag, 5, 350, new LiquidStack(aluminumStill.blockID, 250, 0));
+ Smeltery.addMelting(Block.oreIron, 0, 600, new LiquidStack(ironStill.blockID, 2125, 0));
+ Smeltery.addMelting(Block.oreGold, 0, 550, new LiquidStack(goldStill.blockID, 2125, 0));
+ Smeltery.addMelting(new ItemStack(Item.ingotIron, 8), Block.blockSteel.blockID, 0, 500, new LiquidStack(ironStill.blockID, 125, 0));
+ Smeltery.addMelting(new ItemStack(Item.ingotGold, 8), Block.blockGold.blockID, 0, 450, new LiquidStack(goldStill.blockID, 125, 0));
+ Smeltery.addMelting(Block.blockSteel, 0, 500, new LiquidStack(ironStill.blockID, 1125, 0));
+ Smeltery.addMelting(Block.blockGold, 0, 450, new LiquidStack(goldStill.blockID, 1125, 0));
+ Smeltery.addMelting(oreSlag, 3, 550, new LiquidStack(copperStill.blockID, 2125, 0));
+ Smeltery.addMelting(oreSlag, 4, 275, new LiquidStack(tinStill.blockID, 2125, 0));
+ Smeltery.addMelting(oreSlag, 5, 350, new LiquidStack(aluminumStill.blockID, 125, 0));
Smeltery.addAlloyMixing(new LiquidStack(bronzeStill.blockID, 4, 0), new LiquidStack(copperStill.blockID, 3, 0), new LiquidStack(tinStill.blockID, 1, 0));
Smeltery.addAlloyMixing(new LiquidStack(alBrassStill.blockID, 4, 0), new LiquidStack(aluminumStill.blockID, 3, 0), new LiquidStack(copperStill.blockID, 1, 0));
@@ -554,11 +564,37 @@ public class TContent implements IFuelHandler
OreDictionary.registerOre("ingotCopper", new ItemStack(materials, 1, 9));
OreDictionary.registerOre("ingotTin", new ItemStack(materials, 1, 10));
OreDictionary.registerOre("ingotAluminum", new ItemStack(materials, 1, 11));
- OreDictionary.registerOre("rawAluminum", new ItemStack(materials, 1, 12));
+ OreDictionary.registerOre("naturalAluminum", new ItemStack(materials, 1, 12));
+ OreDictionary.registerOre("ingotAluminium", new ItemStack(materials, 1, 11));
+ OreDictionary.registerOre("naturalAluminium", new ItemStack(materials, 1, 12));
}
public void modIntegration ()
- {
+ {
+ /* Liquids */
+ Block[] liquids = new Block[] { ironStill, goldStill, copperStill, tinStill, aluminumStill, cobaltStill,
+ arditeStill, bronzeStill, alBrassStill, manyullynStill, alumiteStill, obsidianStill, steelStill };
+ String[] liquidNames = new String[] { "Iron", "Gold", "Copper", "Tin", "Aluminum", "Cobalt", "Ardite", "Bronze", "Brass", "Manyullyn", "Alumite", "Obsidian", "Steel" };
+ for (int i = 0; i < liquids.length; i++)
+ {
+ LiquidStack liquidstack = new LiquidStack(liquids[i].blockID, LiquidContainerRegistry.BUCKET_VOLUME, i);
+ LiquidDictionary.getOrCreateLiquid("Liquid"+liquidNames[i], liquidstack);
+ LiquidContainerRegistry.registerLiquid(new LiquidContainerData(liquidstack, new ItemStack(buckets, 1, i), new ItemStack(Item.bucketEmpty)));
+ }
+
+ /* Ore Dictionary */
+ ArrayList copperIngots = OreDictionary.getOres("ingotCopper");
+ for (ItemStack copper : copperIngots)
+ {
+ PatternBuilder.instance.registerMaterial(copper, 2, "Copper");
+ }
+
+ ArrayList bronzeIngots = OreDictionary.getOres("ingotBronze");
+ for (ItemStack bronze : bronzeIngots)
+ {
+ PatternBuilder.instance.registerMaterial(bronze, 2, "Bronze");
+ }
+
/* IC2 */
ItemStack reBattery = ic2.api.Items.getItem("reBattery");
if (reBattery != null)
diff --git a/tinker/tconstruct/TEventHandler.java b/tinker/tconstruct/TEventHandler.java
new file mode 100644
index 00000000..bde6fffd
--- /dev/null
+++ b/tinker/tconstruct/TEventHandler.java
@@ -0,0 +1,102 @@
+package tinker.tconstruct;
+
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumMovingObjectType;
+import net.minecraftforge.event.ForgeSubscribe;
+import net.minecraftforge.event.Event.Result;
+import net.minecraftforge.event.entity.player.FillBucketEvent;
+import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
+import tinker.tconstruct.crafting.PatternBuilder;
+
+public class TEventHandler
+{
+ @ForgeSubscribe
+ public void registerOre (OreRegisterEvent evt)
+ {
+ if (evt.Name == "battery")
+ TConstruct.content.modE.batteries.add(evt.Ore);
+
+ if (evt.Name == "basicCircuit")
+ TConstruct.content.modE.circuits.add(evt.Ore);
+
+ /*if (evt.Name == "ingotCopper")
+ {
+ PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Copper");
+ }
+
+ if (evt.Name == "ingotBronze")
+ {
+ PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Bronze");
+ }*/
+ }
+
+ @ForgeSubscribe
+ public void bucketFill (FillBucketEvent evt)
+ {
+ System.out.println("Fired");
+
+ if (evt.current.getItem() == Item.bucketEmpty && evt.target.typeOfHit == EnumMovingObjectType.TILE)
+ {
+ int hitX = evt.target.blockX;
+ int hitY = evt.target.blockY;
+ int hitZ = evt.target.blockZ;
+
+ if (!evt.entityPlayer.canPlayerEdit(hitX, hitY, hitZ, evt.target.sideHit, evt.current))
+ {
+ return;
+ //return evt.current;
+ }
+
+ int bID = evt.world.getBlockId(hitX, hitY, hitZ);
+ int meta = -1;
+
+ //Want switch, can't do it!
+ if (bID == TContent.ironStill.blockID)
+ meta = 0;
+
+ else if (bID == TContent.goldStill.blockID)
+ meta = 1;
+
+ else if (bID == TContent.copperStill.blockID)
+ meta = 2;
+
+ else if (bID == TContent.tinStill.blockID)
+ meta = 3;
+
+ else if (bID == TContent.aluminumStill.blockID)
+ meta = 4;
+
+ else if (bID == TContent.cobaltStill.blockID)
+ meta = 5;
+
+ else if (bID == TContent.arditeStill.blockID)
+ meta = 6;
+
+ else if (bID == TContent.bronzeStill.blockID)
+ meta = 7;
+
+ else if (bID == TContent.alBrassStill.blockID)
+ meta = 8;
+
+ else if (bID == TContent.manyullynStill.blockID)
+ meta = 9;
+
+ else if (bID == TContent.alumiteStill.blockID)
+ meta = 10;
+
+ else if (bID == TContent.obsidianStill.blockID)
+ meta = 11;
+
+ else if (bID == TContent.steelStill.blockID)
+ meta = 12;
+
+ if (meta != -1)
+ {
+ evt.world.setBlockWithNotify(hitX, hitY, hitZ, 0);
+ evt.result = new ItemStack(TContent.buckets, 1, meta);
+ evt.setResult(Result.ALLOW);
+ }
+ }
+ }
+}
diff --git a/tinker/tconstruct/blocks/LavaTankBlock.java b/tinker/tconstruct/blocks/LavaTankBlock.java
index 9a591f52..3a5c0f45 100644
--- a/tinker/tconstruct/blocks/LavaTankBlock.java
+++ b/tinker/tconstruct/blocks/LavaTankBlock.java
@@ -1,9 +1,13 @@
package tinker.tconstruct.blocks;
+import java.util.List;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@@ -18,12 +22,13 @@ public class LavaTankBlock extends BlockContainer
{
public LavaTankBlock(int id)
{
- super(id, 38, Material.iron);
+ super(id, 38, Material.rock);
+ setHardness(30F);
setCreativeTab(TConstruct.blockTab);
setBlockName("TConstruct.LavaTank");
setStepSound(Block.soundGlassFootstep);
}
-
+
@Override
public boolean isOpaqueCube ()
{
@@ -35,49 +40,65 @@ public class LavaTankBlock extends BlockContainer
{
return false;
}
-
+
@Override
- public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
+ public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
{
- if (par5 == 0)
- return super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
- return true;
+ //if (side == 0 && world.getBlockMetadata(x, y, z) == 0)
+ //return super.shouldSideBeRendered(world, x, y, z, side);
+ int bID = world.getBlockId(x, y, z);
+ return bID == this.blockID ? false : super.shouldSideBeRendered(world, x, y, z, side);
+ //return true;
}
-
+
@Override
public String getTextureFile ()
{
return TContent.blockTexture;
}
-
+
@Override
public int getRenderType ()
{
return TankRender.tankModelID;
}
-
+
public int getBlockTextureFromSideAndMetadata (int side, int meta)
{
- if (side == 0 || side == 1)
+ if (meta == 0)
{
- return blockIndexInTexture + 1 + meta * 3;
+ if (side == 0 || side == 1)
+ {
+ return blockIndexInTexture + 1;
+ }
+ else
+ {
+ return blockIndexInTexture;
+ }
}
- /*else if (side == 1)
- {
- return blockIndexInTexture + 1 + meta * 3;
- }*/
else
{
- return blockIndexInTexture + meta * 3;
+ if (side == 0)
+ {
+ return blockIndexInTexture + 1 + meta * 3;
+ }
+ else if (side == 1)
+ {
+ return blockIndexInTexture + meta * 3;
+ }
+ else
+ {
+ return blockIndexInTexture - 1 + meta * 3;
+ }
}
}
@Override
public TileEntity createNewTileEntity (World world, int metadata)
- {
- return new LavaTankLogic();
- }
-
+ {
+ return new LavaTankLogic();
+ }
+
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
{
@@ -93,7 +114,7 @@ public class LavaTankBlock extends BlockContainer
}
else
{
-
+
}
return false;
}
@@ -103,4 +124,19 @@ public class LavaTankBlock extends BlockContainer
{
return createNewTileEntity(world, 0);
}
+
+ @Override
+ public void getSubBlocks (int id, CreativeTabs tab, List list)
+ {
+ for (int iter = 0; iter < 3; iter++)
+ {
+ list.add(new ItemStack(id, 1, iter));
+ }
+ }
+
+ /* Data */
+ public int damageDropped (int meta)
+ {
+ return meta;
+ }
}
diff --git a/tinker/tconstruct/blocks/SearedBlock.java b/tinker/tconstruct/blocks/SearedBlock.java
new file mode 100644
index 00000000..82d1cfaa
--- /dev/null
+++ b/tinker/tconstruct/blocks/SearedBlock.java
@@ -0,0 +1,176 @@
+package tinker.tconstruct.blocks;
+
+import java.util.List;
+
+import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.IBlockAccess;
+import net.minecraft.world.World;
+import tinker.common.InventoryBlock;
+import tinker.tconstruct.TConstruct;
+import tinker.tconstruct.TContent;
+import tinker.tconstruct.client.SearedRender;
+import tinker.tconstruct.logic.CastingTableLogic;
+import tinker.tconstruct.logic.FaucetLogic;
+
+public class SearedBlock extends InventoryBlock
+{
+ public SearedBlock(int id)
+ {
+ super(id, Material.rock);
+ this.setCreativeTab(TConstruct.blockTab);
+ blockIndexInTexture = 32;
+ setHardness(30F);
+ setStepSound(soundMetalFootstep);
+ }
+
+ @Override
+ public TileEntity createNewTileEntity (World world, int metadata)
+ {
+ switch (metadata)
+ {
+ case 0: return new CastingTableLogic();
+ case 1: return new FaucetLogic();
+ default: return null;
+ }
+ }
+
+ @Override
+ public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ switch (meta)
+ {
+ case 0: return null;
+ case 1: return null;
+ default: return null;
+ }
+ }
+
+ @Override
+ public Object getModInstance ()
+ {
+ return TConstruct.instance;
+ }
+
+ /* Activation */
+ @Override
+ public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
+ {
+ int md = world.getBlockMetadata(x, y, z);
+ if (md == 0)
+ {
+ return activateCastingTable(world, x, y, z, player);
+ }
+ else if (md == 1)
+ {
+ if (player.isSneaking())
+ return false;
+
+ FaucetLogic logic = (FaucetLogic) world.getBlockTileEntity(x, y, z);
+ logic.setActive(true);
+ return true;
+ }
+ else
+ return super.onBlockActivated(world, x, y, z, player, side, clickX, clickY, clickZ);
+ }
+
+ boolean activateCastingTable (World world, int x, int y, int z, EntityPlayer player)
+ {
+ if (!world.isRemote)
+ {
+ //System.out.println("Castses");
+ CastingTableLogic logic = (CastingTableLogic) world.getBlockTileEntity(x, y, z);
+ if (!logic.isStackInSlot(0))
+ {
+ ItemStack stack = player.getCurrentEquippedItem();
+ stack = player.inventory.decrStackSize(player.inventory.currentItem, 1);
+ logic.setInventorySlotContents(0, stack);
+ }
+ else
+ {
+ /*ItemStack insideStack = logic.takeItemInColumn(0);
+
+ if (insideStack == null)
+ {r
+ insideStack = logic.takeItemInColumn(1 - 0);
+ }
+
+ if (insideStack != null)
+ {
+ this.spawnItem(world, x, y, z, insideStack);
+ }*/
+ }
+
+ world.markBlockForUpdate(x, y, z);
+ }
+ return true;
+ }
+
+ /* Rendering */
+ @Override
+ public int getRenderType ()
+ {
+ return SearedRender.searedModel;
+ }
+
+ @Override
+ public String getTextureFile ()
+ {
+ return TContent.blockTexture;
+ }
+
+ public int getBlockTextureFromSideAndMetadata (int side, int meta)
+ {
+ if (meta == 0)
+ return blockIndexInTexture + meta * 3 + getBlockTextureFromSide(side);
+ /*else if (meta == 1)
+ {
+ if (side == 0 || side == 1)
+ return blockIndexInTexture + meta + 3;
+ else
+ return blockIndexInTexture + meta + 2;
+ }*/
+ return blockIndexInTexture + meta + 2;
+ }
+
+ public int getBlockTextureFromSide (int side)
+ {
+ if (side == 0)
+ return 2;
+ if (side == 1)
+ return 0;
+
+ return 1;
+ }
+
+ @Override
+ public boolean renderAsNormalBlock ()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isOpaqueCube ()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
+ {
+ return true;
+ }
+
+ @Override
+ public void getSubBlocks (int id, CreativeTabs tab, List list)
+ {
+ for (int iter = 0; iter < 2; iter++)
+ {
+ list.add(new ItemStack(id, 1, iter));
+ }
+ }
+}
diff --git a/tinker/tconstruct/blocks/SmelteryBlock.java b/tinker/tconstruct/blocks/SmelteryBlock.java
index ff926e28..ec80d3fe 100644
--- a/tinker/tconstruct/blocks/SmelteryBlock.java
+++ b/tinker/tconstruct/blocks/SmelteryBlock.java
@@ -28,9 +28,9 @@ public class SmelteryBlock extends InventoryBlock
public SmelteryBlock(int id)
{
- super(id, Material.iron);
+ super(id, Material.rock);
blockIndexInTexture = 64;
- setHardness(1.5F);
+ setHardness(30F);
setStepSound(soundMetalFootstep);
rand = new Random();
this.setCreativeTab(TConstruct.blockTab);
@@ -80,7 +80,7 @@ public class SmelteryBlock extends InventoryBlock
public int getBlockTexture (IBlockAccess world, int x, int y, int z, int side)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
- short direction = (logic instanceof IFacingLogic) ? ((IFacingLogic) logic).getDirection() : 0;
+ short direction = (logic instanceof IFacingLogic) ? ((IFacingLogic) logic).getRenderDirection() : 0;
int meta = world.getBlockMetadata(x, y, z);
if (meta == 0) //Smeltery
{
@@ -151,7 +151,7 @@ public class SmelteryBlock extends InventoryBlock
TileEntity logic = world.getBlockTileEntity(x, y, z);
byte face = 0;
if (logic instanceof IFacingLogic)
- face = ((IFacingLogic) logic).getDirection();
+ face = ((IFacingLogic) logic).getRenderDirection();
float f = (float) x + 0.5F;
float f1 = (float) y + 0.5F + (random.nextFloat() * 6F) / 16F;
float f2 = (float) z + 0.5F;
diff --git a/tinker/tconstruct/blocks/ToolStationBlock.java b/tinker/tconstruct/blocks/ToolStationBlock.java
index 855258c9..887b665d 100644
--- a/tinker/tconstruct/blocks/ToolStationBlock.java
+++ b/tinker/tconstruct/blocks/ToolStationBlock.java
@@ -105,57 +105,6 @@ public class ToolStationBlock extends InventoryBlock
return AxisAlignedBB.getAABBPool().addOrModifyAABBInPool((double) x + this.minX, (double) y + this.minY, (double) z + this.minZ, (double) x + this.maxX, (double) y + this.maxY, (double) z + this.maxZ);
}
- /* Activation */
- @Override
- public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
- {
- int md = world.getBlockMetadata(x, y, z);
- if (md == 14)
- {
- return activateCastingTable(world, x, y, z, player);
- }
- else
- return super.onBlockActivated(world, x, y, z, player, side, clickX, clickY, clickZ);
- }
-
- boolean activateCastingTable (World world, int x, int y, int z, EntityPlayer player)
- {
- if (!world.isRemote)
- {
- System.out.println("Castses");
- CastingTableLogic logic = (CastingTableLogic) world.getBlockTileEntity(x, y, z);
- if (!logic.isStackInSlot(0))
- {
- ItemStack stack = player.getCurrentEquippedItem();
- stack = player.inventory.decrStackSize(player.inventory.currentItem, 1);
- logic.setInventorySlotContents(0, stack);
- }
- else
- {
- /*ItemStack insideStack = logic.takeItemInColumn(0);
-
- if (insideStack == null)
- {r
- insideStack = logic.takeItemInColumn(1 - 0);
- }
-
- if (insideStack != null)
- {
- this.spawnItem(world, x, y, z, insideStack);
- }*/
- }
-
- world.markBlockForUpdate(x, y, z);
- }
- return true;
- }
-
- /* Data */
- public int damageDropped (int meta)
- {
- return meta;
- }
-
public TileEntity createNewTileEntity (World world, int metadata)
{
switch (metadata)
@@ -188,8 +137,8 @@ public class ToolStationBlock extends InventoryBlock
return new PatternShaperLogic();
case 13:
return new PatternShaperLogic();
- case 14:
- return new CastingTableLogic();
+ /*case 14:
+ return new CastingTableLogic();*/
default:
return null;
}
@@ -225,7 +174,7 @@ public class ToolStationBlock extends InventoryBlock
list.add(new ItemStack(id, 1, iter));
}
- for (int iter = 10; iter < 15; iter++)
+ for (int iter = 10; iter < 14; iter++)
{
list.add(new ItemStack(id, 1, iter));
}
diff --git a/tinker/tconstruct/client/SearedRender.java b/tinker/tconstruct/client/SearedRender.java
new file mode 100644
index 00000000..221d6fda
--- /dev/null
+++ b/tinker/tconstruct/client/SearedRender.java
@@ -0,0 +1,255 @@
+package tinker.tconstruct.client;
+
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+import net.minecraft.client.renderer.Tessellator;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.IBlockAccess;
+import net.minecraftforge.client.ForgeHooksClient;
+
+import org.lwjgl.opengl.GL11;
+
+import tinker.common.BlockSkinRenderHelper;
+import tinker.tconstruct.logic.CastingTableLogic;
+import tinker.tconstruct.logic.FaucetLogic;
+import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
+import cpw.mods.fml.client.registry.RenderingRegistry;
+
+public class SearedRender implements ISimpleBlockRenderingHandler
+{
+ public static int searedModel = RenderingRegistry.getNextAvailableRenderId();
+
+ @Override
+ public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
+ {
+ if (modelID == searedModel)
+ {
+ if (metadata == 0)
+ {
+ //Top
+ renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
+ renderDo(renderer, block, metadata);
+
+ //Lip
+ renderer.setRenderBounds(0.0F, 0.9375, 0.0F, 0.0625, 1.0, 1.0F);
+ renderDo(renderer, block, metadata);
+ renderer.setRenderBounds(0.0625, 0.9375, 0.9375, 0.9375, 1.0, 1.0F);
+ renderDo(renderer, block, metadata);
+ renderer.setRenderBounds(0.9375, 0.9375, 0.0F, 1.0F, 1.0, 1.0F);
+ renderDo(renderer, block, metadata);
+ renderer.setRenderBounds(0.0625, 0.9375, 0.0F, 0.9375, 1.0, 0.0625);
+ renderDo(renderer, block, metadata);
+
+ //Legs
+ renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.625F, 0.3125F);
+ renderDo(renderer, block, metadata);
+ renderer.setRenderBounds(0.6875, 0.0F, 0.0F, 1.0F, 0.625F, 0.25F);
+ renderDo(renderer, block, metadata);
+ renderer.setRenderBounds(0.0F, 0.0F, 0.6875, 0.3125F, 0.625F, 1.0F);
+ renderDo(renderer, block, metadata);
+ renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
+ renderDo(renderer, block, metadata);
+ }
+ else
+ {
+ renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
+ renderDo(renderer, block, metadata);
+ renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
+ renderDo(renderer, block, metadata);
+ renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
+ renderDo(renderer, block, metadata);
+ renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
+ renderDo(renderer, block, metadata);
+ renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
+ renderDo(renderer, block, metadata);
+ }
+ }
+ }
+
+ @Override
+ public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
+ {
+ if (modelID == searedModel)
+ {
+ int metadata = world.getBlockMetadata(x, y, z);
+ if (metadata == 0)
+ {
+ //Top
+ renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
+ renderer.renderStandardBlock(block, x, y, z);
+
+ //Lip
+ renderer.setRenderBounds(0.0F, 0.9375, 0.0F, 0.0625, 1.0, 1.0F);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.0625, 0.9375, 0.9375, 0.9375, 1.0, 1.0F);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.9375, 0.9375, 0.0F, 1.0F, 1.0, 1.0F);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.0625, 0.9375, 0.0F, 0.9375, 1.0, 0.0625);
+ renderer.renderStandardBlock(block, x, y, z);
+
+ //Legs
+ renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.625F, 0.3125F);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.6875, 0.0F, 0.0F, 1.0F, 0.625F, 0.25F);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.0F, 0.0F, 0.6875, 0.3125F, 0.625F, 1.0F);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
+ renderer.renderStandardBlock(block, x, y, z);
+
+ CastingTableLogic logic = (CastingTableLogic) world.getBlockTileEntity(x, y, z);
+ if (logic.liquid != null)
+ {
+ float height = logic.liquid.amount / (logic.getCapacity() * 1.03F) / 16F;
+ renderer.setRenderBounds(0.0625F, 0.9375F, 0.0625F, 0.9375F, 0.9375F + height, 0.9375F);
+ if (logic.liquid.itemID < 4096) //Block
+ {
+ Block liquidBlock = Block.blocksList[logic.liquid.itemID];
+ if (liquidBlock != null)
+ {
+ ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
+ BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, logic.liquid.itemMeta, x, y, z, renderer, world);
+ }
+ }
+ else
+ //Item
+ {
+ Item liquidItem = Item.itemsList[logic.liquid.itemID];
+ if (liquidItem != null)
+ {
+ ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
+ BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(logic.liquid.itemMeta), logic.liquid.itemMeta, x, y, z, renderer, world);
+ }
+ }
+ }
+ }
+ else if (metadata == 1)
+ {
+ FaucetLogic logic = (FaucetLogic) world.getBlockTileEntity(x, y, z);
+ switch (logic.getRenderDirection())
+ {
+ case 2:
+ renderer.setRenderBounds(0.25, 0.25, 0.625, 0.75, 0.375, 1);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.25, 0.25, 0.625, 0.375, 0.625, 1);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.625, 0.25, 0.625, 0.75, 0.625, 1);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.375, 0.375, 0.625, 0.625, 0.625, 1);
+ break;
+ case 3:
+ renderer.setRenderBounds(0.25, 0.25, 0, 0.75, 0.375, 0.375);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.25, 0.25, 0, 0.375, 0.625, 0.375);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.625, 0.25, 0, 0.75, 0.625, 0.375);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.375, 0.375, 0, 0.625, 0.625, 0.375);
+ break;
+ case 4:
+ renderer.setRenderBounds(0.625, 0.25, 0.25, 1, 0.375, 0.75);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.625, 0.25, 0.25, 1, 0.625, 0.375);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.625, 0.25, 0.625, 1, 0.625, 0.75);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.625, 0.375, 0.375, 1, 0.625, 0.625);
+ break;
+ case 5:
+ renderer.setRenderBounds(0, 0.25, 0.25, 0.375, 0.375, 0.75);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0, 0.25, 0.25, 0.375, 0.625, 0.375);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0, 0.25, 0.625, 0.375, 0.625, 0.75);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0, 0.375, 0.375, 0.325, 0.625, 0.625);
+ break;
+ }
+
+ if (logic.liquid != null)
+ {
+ ItemStack blockToRender = new ItemStack(logic.liquid.itemID, 1, logic.liquid.itemMeta);
+ if (blockToRender.itemID < 4096) //Block
+ {
+ Block liquidBlock = Block.blocksList[blockToRender.itemID];
+ ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
+ BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, blockToRender.getItemDamage(), x, y, z, renderer, world);
+ renderer.setRenderBounds(0.375, 0, 0.375, 0.625, 0.625, 0.625);
+ BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, blockToRender.getItemDamage(), x, y, z, renderer, world);
+ }
+ else
+ //Item
+ {
+ Item liquidItem = Item.itemsList[blockToRender.itemID];
+ ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
+ int meta = blockToRender.getItemDamage();
+ BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(meta), meta, x, y, z, renderer, world);
+ renderer.setRenderBounds(0.375, 0, 0.375, 0.625, 0.625, 0.625);
+ BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(meta), meta, x, y, z, renderer, world);
+ }
+ //renderer.renderStandardBlock(block, x, y, z);
+ }
+
+ }
+ else
+ {
+ renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.25F, 0.75F, 0.25F);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.75F, 0.0F, 0.0F, 1.0F, 0.75F, 0.25F);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.0F, 0.0F, 0.75F, 0.25F, 0.75F, 1.0F);
+ renderer.renderStandardBlock(block, x, y, z);
+ renderer.setRenderBounds(0.75F, 0.0F, 0.75F, 1.0F, 0.75F, 1.0F);
+ renderer.renderStandardBlock(block, x, y, z);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean shouldRender3DInInventory ()
+ {
+ return true;
+ }
+
+ @Override
+ public int getRenderId ()
+ {
+ return searedModel;
+ }
+
+ private void renderDo (RenderBlocks renderblocks, Block block, int meta)
+ {
+ Tessellator tessellator = Tessellator.instance;
+ GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, -1F, 0.0F);
+ renderblocks.renderBottomFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(0, meta));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 1.0F, 0.0F);
+ renderblocks.renderTopFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(1, meta));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, -1F);
+ renderblocks.renderEastFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(2, meta));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(0.0F, 0.0F, 1.0F);
+ renderblocks.renderWestFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(3, meta));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(-1F, 0.0F, 0.0F);
+ renderblocks.renderNorthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(4, meta));
+ tessellator.draw();
+ tessellator.startDrawingQuads();
+ tessellator.setNormal(1.0F, 0.0F, 0.0F);
+ renderblocks.renderSouthFace(block, 0.0D, 0.0D, 0.0D, block.getBlockTextureFromSideAndMetadata(5, meta));
+ tessellator.draw();
+ GL11.glTranslatef(0.5F, 0.5F, 0.5F);
+ }
+}
diff --git a/tinker/tconstruct/client/SmelteryRender.java b/tinker/tconstruct/client/SmelteryRender.java
index e51b4114..e52e4274 100644
--- a/tinker/tconstruct/client/SmelteryRender.java
+++ b/tinker/tconstruct/client/SmelteryRender.java
@@ -21,6 +21,7 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
public class SmelteryRender implements ISimpleBlockRenderingHandler
{
public static int smelteryModel = RenderingRegistry.getNextAvailableRenderId();
+
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
@@ -42,8 +43,8 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler
}
return false;
}
-
- public boolean renderSmeltery(IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
+
+ public boolean renderSmeltery (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
renderer.renderStandardBlock(block, x, y, z);
SmelteryLogic logic = (SmelteryLogic) world.getBlockTileEntity(x, y, z);
@@ -59,14 +60,15 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler
ItemStack blockToRender = Smeltery.getRenderIndex(input);
float blockHeight = input.stackSize / (float) blockToRender.stackSize;
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, MathHelper.clamp_float(blockHeight, 0.01F, 1.0F), 1.0F);
-
+
if (blockToRender.itemID < 4096) //Block
{
Block liquidBlock = Block.blocksList[blockToRender.itemID];
ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, blockToRender.getItemDamage(), posX + i % 3, posY, posZ + i / 3, renderer, world);
}
- else //Item
+ else
+ //Item
{
Item liquidItem = Item.itemsList[blockToRender.itemID];
ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
@@ -75,28 +77,48 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler
}
}
}
-
+
//Liquids
float base = 0F;
+ int yBase = 0;
+ int liquidBase = 0;
for (LiquidStack liquid : logic.moltenMetal)
{
- float height = liquid.amount / 10000F;
- renderer.setRenderBounds(0.0F, base, 0.0F, 1.0F, height + base, 1.0F);
- base += height;
-
- if (liquid.itemID < 4096) //Block
+ int liquidSize = liquid.amount;
+ while (liquidSize > 0)
{
- Block liquidBlock = Block.blocksList[liquid.itemID];
- ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
- for (int i = 0; i < 9; i++)
- BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, liquid.itemMeta, posX + i % 3, posY, posZ + i / 3, renderer, world);
- }
- else //Item
- {
- Item liquidItem = Item.itemsList[liquid.itemID];
- ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
- for (int i = 0; i < 9; i++)
- BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(liquid.itemMeta), liquid.itemMeta, posX, posY, posZ, renderer, world);
+ int room = 20000 - liquidBase;
+ int countSize = liquidSize > room ? room : liquidSize;
+ liquidSize -= countSize;
+
+ float height = countSize > 20000 ? 1.0F : countSize / 20000F;
+ renderer.setRenderBounds(0.0F, base, 0.0F, 1.0F, height + base, 1.0F);
+ base += height;
+ liquidBase += countSize;
+
+
+ if (liquid.itemID < 4096) //Block
+ {
+ Block liquidBlock = Block.blocksList[liquid.itemID];
+ ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
+ for (int i = 0; i < 9; i++)
+ BlockSkinRenderHelper.renderMetadataBlock(liquidBlock, liquid.itemMeta, posX + i % 3, posY+yBase, posZ + i / 3, renderer, world);
+ }
+ else
+ //Item
+ {
+ Item liquidItem = Item.itemsList[liquid.itemID];
+ ForgeHooksClient.bindTexture(liquidItem.getTextureFile(), 0);
+ for (int i = 0; i < 9; i++)
+ BlockSkinRenderHelper.renderFakeBlock(liquidItem.getIconFromDamage(liquid.itemMeta), liquid.itemMeta, posX, posY+yBase, posZ, renderer, world);
+ }
+
+ if (countSize == room)
+ {
+ base = 0F;
+ yBase++;
+ liquidBase = 0;
+ }
}
}
}
@@ -115,7 +137,7 @@ public class SmelteryRender implements ISimpleBlockRenderingHandler
return smelteryModel;
}
- private void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta)
+ private void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
diff --git a/tinker/tconstruct/client/TProxyClient.java b/tinker/tconstruct/client/TProxyClient.java
index e8203444..50c11bfc 100644
--- a/tinker/tconstruct/client/TProxyClient.java
+++ b/tinker/tconstruct/client/TProxyClient.java
@@ -37,9 +37,10 @@ public class TProxyClient extends TProxyCommon
Minecraft mc = Minecraft.getMinecraft();
smallFontRenderer = new SmallFontRenderer(mc.gameSettings, "/font/default.png", mc.renderEngine, false);
RenderingRegistry.registerBlockHandler(new TableRender());
+ RenderingRegistry.registerBlockHandler(new FrypanRender());
RenderingRegistry.registerBlockHandler(new SmelteryRender());
RenderingRegistry.registerBlockHandler(new TankRender());
- RenderingRegistry.registerBlockHandler(new FrypanRender());
+ RenderingRegistry.registerBlockHandler(new SearedRender());
RenderingRegistry.registerBlockHandler(new RenderLiquidMetal());
//RenderingRegistry.registerBlockHandler(new AxleRender());
@@ -97,12 +98,12 @@ public class TProxyClient extends TProxyCommon
LanguageRegistry.instance().addStringLocalization("itemGroup.TConstructMaterials", "TConstruct Materials");
LanguageRegistry.instance().addStringLocalization("itemGroup.TConstructBlocks", "TConstruct Blocks");*/
- String langDir = "/lang/";
- String[] langFiles =
- { "TConstruct_en_US.xml" };
+ String langDir = "/tinkerlang/";
+ String[] langFiles =
+ { "en_US.xml" };
for (String langFile : langFiles)
- //{
+ {
try
{
LanguageRegistry.instance().loadLocalization(langDir + langFile, langFile.substring(langFile.lastIndexOf('/') + 1, langFile.lastIndexOf('.')), true);
@@ -111,9 +112,9 @@ public class TProxyClient extends TProxyCommon
{
e.printStackTrace();
}
- //}
+ }
- LanguageRegistry.instance().addStringLocalization("crafters.ToolStation", "Tool Station");
+ /*LanguageRegistry.instance().addStringLocalization("crafters.ToolStation", "Tool Station");
LanguageRegistry.instance().addStringLocalization("crafters.PartBuilder", "Part Builder");
LanguageRegistry.instance().addStringLocalization("crafters.PatternShaper", "Pattern Shaper");
LanguageRegistry.instance().addStringLocalization("inventory.PatternChest", "Pattern Chest");
@@ -141,7 +142,7 @@ public class TProxyClient extends TProxyCommon
LanguageRegistry.instance().addStringLocalization("Smeltery.Drain.name", "Smeltery Drain");
LanguageRegistry.instance().addStringLocalization("Smeltery.Brick.name", "Seared Bricks");
LanguageRegistry.instance().addStringLocalization("Smeltery.Gague.name", "Seared Glass");
- LanguageRegistry.instance().addStringLocalization("Smeltery.Window.name", "Seared Window");
+ LanguageRegistry.instance().addStringLocalization("Smeltery.Window.name", "Seared Window");*/
for (int mat = 0; mat < materialTypes.length; mat++)
{
diff --git a/tinker/tconstruct/client/TableRender.java b/tinker/tconstruct/client/TableRender.java
index 1210614d..c21be9c1 100644
--- a/tinker/tconstruct/client/TableRender.java
+++ b/tinker/tconstruct/client/TableRender.java
@@ -22,32 +22,6 @@ public class TableRender implements ISimpleBlockRenderingHandler
renderer.setRenderBounds(0.0F, 0.0, 0.0F, 1.0F, 0.875F, 1.0F);
renderDo(renderer, block, metadata);
}
- else if (metadata == 14)
- {
- //Top
- renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
- renderDo(renderer, block, metadata);
-
- //Lip
- renderer.setRenderBounds(0.0F, 0.9375, 0.0F, 0.0625, 1.0, 1.0F);
- renderDo(renderer, block, metadata);
- renderer.setRenderBounds(0.0625, 0.9375, 0.9375, 0.9375, 1.0, 1.0F);
- renderDo(renderer, block, metadata);
- renderer.setRenderBounds(0.9375, 0.9375, 0.0F, 1.0F, 1.0, 1.0F);
- renderDo(renderer, block, metadata);
- renderer.setRenderBounds(0.0625, 0.9375, 0.0F, 0.9375, 1.0, 0.0625);
- renderDo(renderer, block, metadata);
-
- //Legs
- renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.625F, 0.3125F);
- renderDo(renderer, block, metadata);
- renderer.setRenderBounds(0.6875, 0.0F, 0.0F, 1.0F, 0.625F, 0.25F);
- renderDo(renderer, block, metadata);
- renderer.setRenderBounds(0.0F, 0.0F, 0.6875, 0.3125F, 0.625F, 1.0F);
- renderDo(renderer, block, metadata);
- renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
- renderDo(renderer, block, metadata);
- }
else
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
@@ -75,32 +49,6 @@ public class TableRender implements ISimpleBlockRenderingHandler
renderer.setRenderBounds(0.0F, 0.0, 0.0F, 1.0F, 0.875F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
}
- else if (metadata == 14)
- {
- //Top
- renderer.setRenderBounds(0.0F, 0.625F, 0.0F, 1.0F, 0.9375F, 1.0F);
- renderer.renderStandardBlock(block, x, y, z);
-
- //Lip
- renderer.setRenderBounds(0.0F, 0.9375, 0.0F, 0.0625, 1.0, 1.0F);
- renderer.renderStandardBlock(block, x, y, z);
- renderer.setRenderBounds(0.0625, 0.9375, 0.9375, 0.9375, 1.0, 1.0F);
- renderer.renderStandardBlock(block, x, y, z);
- renderer.setRenderBounds(0.9375, 0.9375, 0.0F, 1.0F, 1.0, 1.0F);
- renderer.renderStandardBlock(block, x, y, z);
- renderer.setRenderBounds(0.0625, 0.9375, 0.0F, 0.9375, 1.0, 0.0625);
- renderer.renderStandardBlock(block, x, y, z);
-
- //Legs
- renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 0.3125F, 0.625F, 0.3125F);
- renderer.renderStandardBlock(block, x, y, z);
- renderer.setRenderBounds(0.6875, 0.0F, 0.0F, 1.0F, 0.625F, 0.25F);
- renderer.renderStandardBlock(block, x, y, z);
- renderer.setRenderBounds(0.0F, 0.0F, 0.6875, 0.3125F, 0.625F, 1.0F);
- renderer.renderStandardBlock(block, x, y, z);
- renderer.setRenderBounds(0.6875, 0.0F, 0.6875, 1.0F, 0.625F, 1.0F);
- renderer.renderStandardBlock(block, x, y, z);
- }
else
{
renderer.setRenderBounds(0.0F, 0.75F, 0.0F, 1.0F, 1.0F, 1.0F);
diff --git a/tinker/tconstruct/client/TankRender.java b/tinker/tconstruct/client/TankRender.java
index 3e63ef80..8e23a09b 100644
--- a/tinker/tconstruct/client/TankRender.java
+++ b/tinker/tconstruct/client/TankRender.java
@@ -15,14 +15,18 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
public class TankRender implements ISimpleBlockRenderingHandler
{
public static int tankModelID = RenderingRegistry.getNextAvailableRenderId();
+
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
if (modelID == tankModelID)
{
renderDo(renderer, block, metadata);
- renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125);
- renderDoRe(renderer, block, metadata);
+ if (metadata == 0)
+ {
+ renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125);
+ renderDoRe(renderer, block, metadata);
+ }
}
}
@@ -31,9 +35,13 @@ public class TankRender implements ISimpleBlockRenderingHandler
{
if (modelID == tankModelID)
{
- renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125);
- renderer.renderStandardBlock(block, x, y+1, z);
- renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
+ int meta = world.getBlockMetadata(x, y, z);
+ if (meta == 0 && world.getBlockId(x, y + 1, z) == 0)
+ {
+ renderer.setRenderBounds(0.1875, 0, 0.1875, 0.8125, 0.125, 0.8125);
+ renderer.renderStandardBlock(block, x, y + 1, z);
+ renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
+ }
renderer.renderStandardBlock(block, x, y, z);
LavaTankLogic logic = (LavaTankLogic) world.getBlockTileEntity(x, y, z);
if (logic.getLiquidAmount() > 0)
@@ -42,7 +50,7 @@ public class TankRender implements ISimpleBlockRenderingHandler
if (liquidBlock != null)
{
ForgeHooksClient.bindTexture(liquidBlock.getTextureFile(), 0);
- renderer.setRenderBounds(0.03, 0.03, 0.03, 0.97, logic.getLiquidAmount()/4020f, 0.97);
+ renderer.setRenderBounds(0.03, 0.03, 0.03, 0.97, logic.getLiquidAmount() / 4020f, 0.97);
renderer.renderStandardBlock(liquidBlock, x, y, z);
}
}
@@ -62,7 +70,7 @@ public class TankRender implements ISimpleBlockRenderingHandler
return tankModelID;
}
- private void renderDo(RenderBlocks renderblocks, Block block, int meta)
+ private void renderDo (RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
@@ -92,8 +100,8 @@ public class TankRender implements ISimpleBlockRenderingHandler
tessellator.draw();
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
-
- private void renderDoRe(RenderBlocks renderblocks, Block block, int meta)
+
+ private void renderDoRe (RenderBlocks renderblocks, Block block, int meta)
{
Tessellator tessellator = Tessellator.instance;
GL11.glTranslatef(-0.5F, 0.5F, -0.5F);
diff --git a/tinker/tconstruct/client/gui/SmelteryGui.java b/tinker/tconstruct/client/gui/SmelteryGui.java
index 6836cc4f..006d2ca8 100644
--- a/tinker/tconstruct/client/gui/SmelteryGui.java
+++ b/tinker/tconstruct/client/gui/SmelteryGui.java
@@ -34,10 +34,11 @@ public class SmelteryGui extends GuiContainer
void drawStats ()
{
fontRenderer.drawString("Temp: " + logic.getInternalTemperature(), xSize + 6, 6, 0xffffff);
+ fontRenderer.drawString("Liquid: " + logic.getCapacity(), xSize + 6, 16, 0xffffff);
for (int iter = 0; iter < 9; iter++)
- fontRenderer.drawString("Slot "+iter+" temp: " + logic.getTempForSlot(iter), xSize + 6, 15+iter*9, 0xffffff);
- for (int iter = 0; iter < 9; iter++)
- fontRenderer.drawString("Slot "+iter+" mTemp: " + logic.meltingTemps[iter], xSize + 6, 100+iter*9, 0xffffff);
+ fontRenderer.drawString("Slot "+iter+" temp: " + logic.getTempForSlot(iter), xSize + 6, 26+iter*10, 0xffffff);
+ /*for (int iter = 0; iter < 9; iter++)
+ fontRenderer.drawString("Slot "+iter+" mTemp: " + logic.meltingTemps[iter], xSize + 6, 100+iter*9, 0xffffff);*/
}
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
@@ -87,7 +88,7 @@ public class SmelteryGui extends GuiContainer
int xTex = renderIndex % 16 * 16;
int yTex = renderIndex / 16 * 16;
- int liquidSize = liquid.amount * 52 / 10000;
+ int liquidSize = liquid.amount * 52 / logic.getCapacity();
while (liquidSize > 0)
{
int size = liquidSize >= 16 ? 16 : liquidSize;
diff --git a/tinker/tconstruct/crafting/CastingRecipe.java b/tinker/tconstruct/crafting/CastingRecipe.java
new file mode 100644
index 00000000..e5b59a26
--- /dev/null
+++ b/tinker/tconstruct/crafting/CastingRecipe.java
@@ -0,0 +1,30 @@
+package tinker.tconstruct.crafting;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.liquids.LiquidStack;
+
+public class CastingRecipe
+{
+ public final ItemStack output;
+ public final LiquidStack castingMetal;
+ public final ItemStack cast;
+ public final boolean consumeCast;
+ public final int coolTime;
+
+ public CastingRecipe(ItemStack replacement, LiquidStack metal, ItemStack cast, boolean consume, int delay)
+ {
+ castingMetal = metal;
+ this.cast = cast;
+ output = replacement;
+ consumeCast = consume;
+ coolTime = delay;
+ }
+
+ public boolean matches(LiquidStack metal, ItemStack cast)
+ {
+ if (metal.isLiquidEqual(metal) && metal.amount >= castingMetal.amount && ItemStack.areItemStacksEqual(this.cast, cast))
+ return true;
+ else
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/tinker/tconstruct/crafting/LiquidCasting.java b/tinker/tconstruct/crafting/LiquidCasting.java
new file mode 100644
index 00000000..3bd4048d
--- /dev/null
+++ b/tinker/tconstruct/crafting/LiquidCasting.java
@@ -0,0 +1,43 @@
+package tinker.tconstruct.crafting;
+
+import java.util.ArrayList;
+
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.liquids.LiquidStack;
+
+/* Melting becomes hardened */
+public class LiquidCasting
+{
+ public static LiquidCasting instance = new LiquidCasting();
+ private ArrayList casts = new ArrayList();
+
+ public static void addCastingRecipe(ItemStack replacement, LiquidStack metal, ItemStack cast, boolean consume, int delay)
+ {
+ instance.casts.add(new CastingRecipe(replacement, metal, cast, consume, delay));
+ }
+
+ public static void addCastingRecipe(ItemStack replacement, LiquidStack metal, ItemStack cast, int delay)
+ { addCastingRecipe(replacement, metal, cast, false, delay); }
+ public static void addCastingRecipe(ItemStack replacement, LiquidStack metal, int delay)
+ { addCastingRecipe(replacement, metal, null, false, delay); }
+
+ public int getCastingDelay(LiquidStack metal, ItemStack cast)
+ {
+ for (CastingRecipe recipe : casts)
+ {
+ if (recipe.matches(metal, cast))
+ return recipe.coolTime;
+ }
+ return -1;
+ }
+
+ public CastingRecipe getCastingRecipe(LiquidStack metal, ItemStack cast)
+ {
+ for (CastingRecipe recipe : casts)
+ {
+ if (recipe.matches(metal, cast))
+ return recipe;
+ }
+ return null;
+ }
+}
diff --git a/tinker/tconstruct/crafting/ToolBuilder.java b/tinker/tconstruct/crafting/ToolBuilder.java
index 5c20e0ab..55a1c490 100644
--- a/tinker/tconstruct/crafting/ToolBuilder.java
+++ b/tinker/tconstruct/crafting/ToolBuilder.java
@@ -9,9 +9,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tinker.common.IToolPart;
+import tinker.common.ToolMod;
import tinker.tconstruct.TConstructRegistry;
import tinker.tconstruct.ToolMaterial;
-import tinker.tconstruct.modifiers.ToolMod;
import tinker.tconstruct.tools.ToolCore;
public class ToolBuilder
diff --git a/tinker/tconstruct/items/FilledBucket.java b/tinker/tconstruct/items/FilledBucket.java
new file mode 100644
index 00000000..d097709a
--- /dev/null
+++ b/tinker/tconstruct/items/FilledBucket.java
@@ -0,0 +1,179 @@
+package tinker.tconstruct.items;
+
+import java.util.List;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import tinker.tconstruct.TContent;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.passive.EntityCow;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemBucket;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumMovingObjectType;
+import net.minecraft.util.MovingObjectPosition;
+import net.minecraft.world.World;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.Event;
+import net.minecraftforge.event.entity.player.FillBucketEvent;
+
+public class FilledBucket extends ItemBucket
+{
+
+ public FilledBucket(int id)
+ {
+ super(id, 0);
+ setTextureFile(TContent.craftingTexture);
+ setIconIndex(224);
+ }
+
+ public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
+ {
+ float var4 = 1.0F;
+ double trueX = player.prevPosX + (player.posX - player.prevPosX) * (double) var4;
+ double trueY = player.prevPosY + (player.posY - player.prevPosY) * (double) var4 + 1.62D - (double) player.yOffset;
+ double trueZ = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) var4;
+ boolean wannabeFull = false;
+ MovingObjectPosition position = this.getMovingObjectPositionFromPlayer(world, player, wannabeFull);
+
+ if (position == null)
+ {
+ return stack;
+ }
+ else
+ {
+ /*FillBucketEvent event = new FillBucketEvent(player, stack, world, position);
+ if (MinecraftForge.EVENT_BUS.post(event))
+ {
+ return stack;
+ }
+
+ if (event.getResult() == Event.Result.ALLOW)
+ {
+ if (player.capabilities.isCreativeMode)
+ {
+ return stack;
+ }
+
+ if (--stack.stackSize <= 0)
+ {
+ return event.result;
+ }
+
+ if (!player.inventory.addItemStackToInventory(event.result))
+ {
+ player.dropPlayerItem(event.result);
+ }
+
+ return stack;
+ }*/
+
+ if (position.typeOfHit == EnumMovingObjectType.TILE)
+ {
+ int clickX = position.blockX;
+ int clickY = position.blockY;
+ int clickZ = position.blockZ;
+
+ if (!world.canMineBlock(player, clickX, clickY, clickZ))
+ {
+ return stack;
+ }
+
+ if (position.sideHit == 0)
+ {
+ --clickY;
+ }
+
+ if (position.sideHit == 1)
+ {
+ ++clickY;
+ }
+
+ if (position.sideHit == 2)
+ {
+ --clickZ;
+ }
+
+ if (position.sideHit == 3)
+ {
+ ++clickZ;
+ }
+
+ if (position.sideHit == 4)
+ {
+ --clickX;
+ }
+
+ if (position.sideHit == 5)
+ {
+ ++clickX;
+ }
+
+ if (!player.canPlayerEdit(clickX, clickY, clickZ, position.sideHit, stack))
+ {
+ return stack;
+ }
+
+ if (this.tryPlaceContainedLiquid(world, clickX, clickY, clickZ, stack.getItemDamage()) && !player.capabilities.isCreativeMode)
+ {
+ return new ItemStack(Item.bucketEmpty);
+ }
+ }
+
+ return stack;
+ }
+ }
+
+ public boolean tryPlaceContainedLiquid(World world, int clickX, int clickY, int clickZ, int meta)
+ {
+ if (!world.isAirBlock(clickX, clickY, clickZ) && world.getBlockMaterial(clickX, clickY, clickZ).isSolid())
+ {
+ return false;
+ }
+ else
+ {
+ world.setBlockAndMetadataWithNotify(clickX, clickY, clickZ, getSourceBlock(meta), 0);
+
+ return true;
+ }
+ }
+
+ public int getSourceBlock(int meta)
+ {
+ switch(meta)
+ {
+ case 0: return TContent.ironStill.blockID;
+ case 1: return TContent.goldStill.blockID;
+ case 2: return TContent.copperStill.blockID;
+ case 3: return TContent.tinStill.blockID;
+ case 4: return TContent.aluminumStill.blockID;
+ case 5: return TContent.cobaltStill.blockID;
+ case 6: return TContent.arditeStill.blockID;
+ case 7: return TContent.bronzeStill.blockID;
+ case 8: return TContent.alBrassStill.blockID;
+ case 9: return TContent.manyullynStill.blockID;
+ case 10: return TContent.alumiteStill.blockID;
+ case 11: return TContent.obsidianStill.blockID;
+ case 12: return TContent.steelStill.blockID;
+ //case 13: return TContent.ironStill.blockID;
+ default: return 0;
+ }
+ }
+
+ @Override
+ public void getSubItems(int id, CreativeTabs tab, List list)
+ {
+ for (int i = 0; i < 13; i++)
+ list.add(new ItemStack(id, 1, i));
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getIconFromDamage(int meta)
+ {
+ return this.iconIndex + meta;
+ }
+}
diff --git a/tinker/tconstruct/items/PatternManual.java b/tinker/tconstruct/items/PatternManual.java
index 55c7b5f9..92336440 100644
--- a/tinker/tconstruct/items/PatternManual.java
+++ b/tinker/tconstruct/items/PatternManual.java
@@ -20,7 +20,7 @@ public class PatternManual extends CraftingItem
public PatternManual(int id)
{
- super(id, 144, TContent.craftingTexture);
+ super(id, 192, TContent.craftingTexture);
setItemName("tconstruct.PatternManual");
}
diff --git a/tinker/tconstruct/items/SearedTableItemBlock.java b/tinker/tconstruct/items/SearedTableItemBlock.java
new file mode 100644
index 00000000..0004374b
--- /dev/null
+++ b/tinker/tconstruct/items/SearedTableItemBlock.java
@@ -0,0 +1,29 @@
+package tinker.tconstruct.items;
+
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+
+public class SearedTableItemBlock extends ItemBlock
+{
+ public static final String blockType[] =
+ {
+ "Table", "Faucet"
+ };
+
+ public SearedTableItemBlock(int id)
+ {
+ super(id);
+ setMaxDamage(0);
+ setHasSubtypes(true);
+ }
+
+ public int getMetadata(int meta)
+ {
+ return meta;
+ }
+
+ public String getItemNameIS(ItemStack itemstack)
+ {
+ return (new StringBuilder()).append("SearedTable.").append(blockType[itemstack.getItemDamage()]).toString();
+ }
+}
diff --git a/tinker/tconstruct/logic/CastingTableLogic.java b/tinker/tconstruct/logic/CastingTableLogic.java
index 1af846d5..299655a7 100644
--- a/tinker/tconstruct/logic/CastingTableLogic.java
+++ b/tinker/tconstruct/logic/CastingTableLogic.java
@@ -7,11 +7,17 @@ import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.world.World;
+import net.minecraftforge.liquids.ILiquidTank;
+import net.minecraftforge.liquids.LiquidStack;
+import tinker.common.IPattern;
import tinker.common.InventoryLogic;
public class CastingTableLogic extends InventoryLogic
+ implements ILiquidTank
{
-
+ public LiquidStack liquid;
+ int baseMax = 125;
+
public CastingTableLogic()
{
super(2);
@@ -29,6 +35,96 @@ public class CastingTableLogic extends InventoryLogic
return null;
}
+ @Override
+ public LiquidStack getLiquid ()
+ {
+ return null;
+ }
+
+ @Override
+ public int getCapacity ()
+ {
+ if (inventory[0] != null && inventory[0].getItem() instanceof IPattern)
+ {
+ return baseMax * ((IPattern) inventory[0].getItem()).getPatternCost(inventory[0].getItemDamage());
+ }
+ return baseMax; //One ingot
+ }
+
+ @Override
+ public int fill (LiquidStack resource, boolean doFill)
+ {
+ if (resource == null)
+ return 0;
+
+ if (liquid == null)
+ {
+ liquid = resource.copy();
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ return liquid.amount;
+ }
+ else if (resource.itemID != liquid.itemID || resource.itemMeta != liquid.itemMeta)
+ {
+ return 0;
+ }
+ else if (resource.amount + liquid.amount >= getCapacity()) //Start timer here
+ {
+ int total = getCapacity();
+ int cap = total - liquid.amount;
+ if (doFill && cap != total)
+ {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ liquid.amount = getCapacity();
+ }
+ return cap;
+ }
+ else
+ {
+ if (doFill)
+ {
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ liquid.amount += resource.amount;
+ }
+ return resource.amount;
+ }
+ }
+
+ @Override
+ public LiquidStack drain (int maxDrain, boolean doDrain) //Doesn't actually drain
+ {
+ return null;
+ }
+
+ @Override
+ public int getTankPressure ()
+ {
+ return 0;
+ }
+
+ /* NBT */
+ public void readFromNBT(NBTTagCompound par1NBTTagCompound)
+ {
+ this.liquid = new LiquidStack(par1NBTTagCompound.getInteger("itemID"), par1NBTTagCompound.getInteger("amount"), par1NBTTagCompound.getInteger("itemMeta"));
+ super.readFromNBT(par1NBTTagCompound);
+ }
+
+ public void writeToNBT(NBTTagCompound par1NBTTagCompound)
+ {
+ if (liquid != null)
+ {
+ par1NBTTagCompound.setInteger("itemID", liquid.itemID);
+ par1NBTTagCompound.setInteger("amount", liquid.amount);
+ par1NBTTagCompound.setInteger("itemMeta", liquid.itemMeta);
+ }
+ else
+ {
+ par1NBTTagCompound.setInteger("itemID", 0);
+ par1NBTTagCompound.setInteger("amount", 0);
+ par1NBTTagCompound.setInteger("itemMeta", 0);
+ }
+ super.writeToNBT(par1NBTTagCompound);
+ }
+
/* Packets */
@Override
public Packet getDescriptionPacket ()
diff --git a/tinker/tconstruct/logic/FaucetLogic.java b/tinker/tconstruct/logic/FaucetLogic.java
new file mode 100644
index 00000000..9821c352
--- /dev/null
+++ b/tinker/tconstruct/logic/FaucetLogic.java
@@ -0,0 +1,196 @@
+package tinker.tconstruct.logic;
+
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.INetworkManager;
+import net.minecraft.network.packet.Packet;
+import net.minecraft.network.packet.Packet132TileEntityData;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.MathHelper;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.liquids.ILiquidTank;
+import net.minecraftforge.liquids.LiquidStack;
+import tinker.common.IActiveLogic;
+import tinker.common.IFacingLogic;
+
+public class FaucetLogic extends TileEntity implements IFacingLogic, IActiveLogic
+{
+ byte direction;
+ boolean active;
+ public LiquidStack liquid;
+ ILiquidTank drain;
+ ILiquidTank tank;
+ int drainAmount = 2;
+
+ public void activateFaucet ()
+ {
+ if (liquid == null)
+ {
+ int x = xCoord, z = zCoord;
+ switch (getRenderDirection())
+ {
+ case 2:
+ z++;
+ break;
+ case 3:
+ z--;
+ break;
+ case 4:
+ x++;
+ break;
+ case 5:
+ x--;
+ break;
+ }
+
+ TileEntity drainte = worldObj.getBlockTileEntity(x, yCoord, z);
+ TileEntity tankte = worldObj.getBlockTileEntity(xCoord, yCoord - 1, zCoord);
+ if (drainte != null && drainte instanceof ILiquidTank && tankte != null && tankte instanceof ILiquidTank)
+ {
+ System.out.println("Activating Faucet");
+ liquid = ((ILiquidTank) drainte).drain(drainAmount, true);
+ drain = (ILiquidTank) drainte;
+ tank = (ILiquidTank) tankte;
+ active = true;
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ //System.out.println("Drained");
+ //return true;
+ }
+ }
+ //return true;
+ }
+
+ public void deactivateFaucet ()
+ {
+ System.out.println("Deactivating Faucet");
+ drain.fill(liquid, true);
+ liquid = null;
+ drain = null;
+ tank = null;
+ active = false;
+ worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
+ }
+
+ public void updateEntity ()
+ {
+ if (active && liquid != null)
+ {
+ int drained = tank.fill(liquid, true);
+ //System.out.println("Drained: "+drained);
+ if (drained < drainAmount)
+ {
+ liquid.amount -= drained;
+ deactivateFaucet();
+ }
+ else
+ {
+ liquid = drain.drain(drainAmount, true);
+ }
+ /*TileEntity te = worldObj.getBlockTileEntity(xCoord, yCoord-1, zCoord);
+ if (te != null && te instanceof ILiquidTank)
+ {
+ int amount = ((ILiquidTank) te).fill(new LiquidStack(liquid.itemID, 2, liquid.itemMeta), true);
+ liquid.amount -= amount;
+ if (liquid.amount <= 0)
+ {
+ liquid = null;
+ }
+ }*/
+ }
+ }
+
+ @Override
+ public byte getRenderDirection ()
+ {
+ return direction;
+ }
+
+ @Override
+ public ForgeDirection getForgeDirection ()
+ {
+ return ForgeDirection.VALID_DIRECTIONS[direction];
+ }
+
+ @Override
+ public void setDirection (float yaw, float pitch, EntityLiving player)
+ {
+ int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3;
+ switch (facing)
+ {
+ case 0:
+ direction = 2;
+ break;
+
+ case 1:
+ direction = 5;
+ break;
+
+ case 2:
+ direction = 3;
+ break;
+
+ case 3:
+ direction = 4;
+ break;
+ }
+ }
+
+ public void readFromNBT (NBTTagCompound tags)
+ {
+ super.readFromNBT(tags);
+ direction = tags.getByte("Direction");
+ if (tags.getBoolean("hasLiquid"))
+ this.liquid = new LiquidStack(tags.getInteger("itemID"), tags.getInteger("amount"), tags.getInteger("itemMeta"));
+ else
+ this.liquid = null;
+ }
+
+ @Override
+ public void writeToNBT (NBTTagCompound tags)
+ {
+ super.writeToNBT(tags);
+ tags.setByte("Direction", direction);
+ tags.setBoolean("hasLiquid", liquid != null);
+ if (liquid != null)
+ {
+ tags.setInteger("itemID", liquid.itemID);
+ tags.setInteger("amount", liquid.amount);
+ tags.setInteger("itemMeta", liquid.itemMeta);
+ }
+ }
+
+ /* Packets */
+ @Override
+ public Packet getDescriptionPacket ()
+ {
+ NBTTagCompound tag = new NBTTagCompound();
+ writeToNBT(tag);
+ return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag);
+ }
+
+ @Override
+ public void onDataPacket (INetworkManager net, Packet132TileEntityData packet)
+ {
+ readFromNBT(packet.customParam1);
+ worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
+ }
+
+ @Override
+ public boolean getActive ()
+ {
+ return active;
+ }
+
+ @Override
+ public void setActive (boolean flag)
+ {
+ //if (!worldObj.isRemote)
+ //{
+ if (flag)
+ activateFaucet();
+ else
+ deactivateFaucet();
+ //}
+ }
+
+}
diff --git a/tinker/tconstruct/logic/LavaTankLogic.java b/tinker/tconstruct/logic/LavaTankLogic.java
index de0be1b5..13ec203b 100644
--- a/tinker/tconstruct/logic/LavaTankLogic.java
+++ b/tinker/tconstruct/logic/LavaTankLogic.java
@@ -11,18 +11,16 @@ import net.minecraftforge.liquids.LiquidContainerRegistry;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
-public class LavaTankLogic extends TileEntity
+public class LavaTankLogic extends MultiServantLogic
implements ILiquidTank
{
- public LiquidTank tank;
- public int max;
+ public int maxLiquid;
public int pressure;
public LiquidStack liquid;
public LavaTankLogic()
{
- tank = new LiquidTank(LiquidContainerRegistry.BUCKET_VOLUME);
- max = LiquidContainerRegistry.BUCKET_VOLUME*4;
+ maxLiquid = LiquidContainerRegistry.BUCKET_VOLUME*4;
pressure = 0;
}
@@ -48,14 +46,14 @@ public class LavaTankLogic extends TileEntity
@Override
public int getCapacity ()
{
- return max;
+ return maxLiquid;
}
@Override
public int fill (LiquidStack resource, boolean doFill)
{
if (resource == null)
- return 0;
+ return 0;
if (liquid == null)
{
@@ -63,14 +61,20 @@ public class LavaTankLogic extends TileEntity
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
return liquid.amount;
}
- else if (resource.amount + liquid.amount > max)
+ else if (resource.itemID != liquid.itemID || resource.itemMeta != liquid.itemMeta)
{
- if (doFill)
+ return 0;
+ }
+ else if (resource.amount + liquid.amount >= getCapacity())
+ {
+ int total = getCapacity();
+ int cap = total - liquid.amount;
+ if (doFill && cap != total)
{
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- liquid.amount = max;
+ liquid.amount = getCapacity();
}
- return max - resource.amount;
+ return cap;
}
else
{
@@ -115,27 +119,23 @@ public class LavaTankLogic extends TileEntity
return pressure;
}
- public void readFromNBT(NBTTagCompound par1NBTTagCompound)
+ public void readFromNBT(NBTTagCompound tags)
{
- this.liquid = new LiquidStack(par1NBTTagCompound.getInteger("itemID"), par1NBTTagCompound.getInteger("amount"), par1NBTTagCompound.getInteger("itemMeta"));
- super.readFromNBT(par1NBTTagCompound);
+ if (tags.getBoolean("hasLiquid"))
+ this.liquid = new LiquidStack(tags.getInteger("itemID"), tags.getInteger("amount"), tags.getInteger("itemMeta"));
+ super.readFromNBT(tags);
}
- public void writeToNBT(NBTTagCompound par1NBTTagCompound)
+ public void writeToNBT(NBTTagCompound tags)
{
+ tags.setBoolean("hasLiquid", liquid != null);
if (liquid != null)
{
- par1NBTTagCompound.setInteger("itemID", liquid.itemID);
- par1NBTTagCompound.setInteger("amount", liquid.amount);
- par1NBTTagCompound.setInteger("itemMeta", liquid.itemMeta);
+ tags.setInteger("itemID", liquid.itemID);
+ tags.setInteger("amount", liquid.amount);
+ tags.setInteger("itemMeta", liquid.itemMeta);
}
- else
- {
- par1NBTTagCompound.setInteger("itemID", 0);
- par1NBTTagCompound.setInteger("amount", 0);
- par1NBTTagCompound.setInteger("itemMeta", 0);
- }
- super.writeToNBT(par1NBTTagCompound);
+ super.writeToNBT(tags);
}
public Packet getDescriptionPacket ()
diff --git a/tinker/tconstruct/logic/MultiServantLogic.java b/tinker/tconstruct/logic/MultiServantLogic.java
index aafad518..c3b5c792 100644
--- a/tinker/tconstruct/logic/MultiServantLogic.java
+++ b/tinker/tconstruct/logic/MultiServantLogic.java
@@ -2,12 +2,15 @@ package tinker.tconstruct.logic;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
import tinker.common.CoordTuple;
public class MultiServantLogic extends TileEntity
{
boolean hasMaster;
CoordTuple master;
+ short masterID;
+ byte masterMeat; //Typo, it stays!
public boolean canUpdate()
{
@@ -16,17 +19,59 @@ public class MultiServantLogic extends TileEntity
public boolean hasValidMaster ()
{
- return hasMaster;
+ if (!hasMaster)
+ return false;
+
+ if (worldObj.getBlockId(master.x, master.y, master.z) == masterID && worldObj.getBlockMetadata(master.x, master.y, master.z) == masterMeat)
+ return true;
+ else
+ {
+ hasMaster = false;
+ master = null;
+ return false;
+ }
}
- public CoordTuple getMaster ()
+ public CoordTuple getMasterPosition ()
{
return master;
}
- public void setMaster(int x, int y, int z)
+ public void overrideMaster(int x, int y, int z)
{
+ hasMaster = true;
master = new CoordTuple(x, y, z);
+ masterID = (short) worldObj.getBlockId(x, y, z);
+ masterMeat = (byte) worldObj.getBlockMetadata(x, y, z);
+ }
+
+ public void removeMaster()
+ {
+ hasMaster = false;
+ master = null;
+ masterID = 0;
+ masterMeat = 0;
+ }
+
+ public boolean verifyMaster(int x, int y, int z)
+ {
+ if (master.equals(x, y, z) && worldObj.getBlockId(x, y, z) == masterID && worldObj.getBlockMetadata(x, y, z) == masterMeat)
+ return true;
+ else
+ return false;
+ }
+
+ public boolean setMaster(int x, int y, int z)
+ {
+ if (!hasMaster || worldObj.getBlockId(master.x, master.y, master.z) != masterID || (worldObj.getBlockMetadata(master.x, master.y, master.z) != masterMeat))
+ {
+ overrideMaster(x, y, z);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
public void readFromNBT (NBTTagCompound tags)
@@ -39,6 +84,8 @@ public class MultiServantLogic extends TileEntity
int yCenter = tags.getInteger("yCenter");
int zCenter = tags.getInteger("zCenter");
master = new CoordTuple(xCenter, yCenter, zCenter);
+ masterID = tags.getShort("MasterID");
+ masterMeat = tags.getByte("masterMeat");
}
}
@@ -51,6 +98,8 @@ public class MultiServantLogic extends TileEntity
tags.setInteger("xCenter", master.x);
tags.setInteger("yCenter", master.y);
tags.setInteger("zCenter", master.z);
+ tags.setShort("MasterID", masterID);
+ tags.setByte("masterMeat", masterMeat);
}
}
}
diff --git a/tinker/tconstruct/logic/PatternShaperLogic.java b/tinker/tconstruct/logic/PatternShaperLogic.java
index 8a57c55a..1cd9aee5 100644
--- a/tinker/tconstruct/logic/PatternShaperLogic.java
+++ b/tinker/tconstruct/logic/PatternShaperLogic.java
@@ -52,22 +52,39 @@ public class PatternShaperLogic extends InventoryLogic
public ItemStack decrStackSize(int slot, int quantity)
{
if (slot == 1)
- {
- if (getStackInSlot(0) != null)
- {
- ItemStack ret = super.decrStackSize(slot, 0);
- decrStackSize(0, 1);
- return ret;
- }
+ {
+ super.decrStackSize(0, 1);
+ if (inventory[0] == null)
+ return super.decrStackSize(slot, quantity);
+ else
+ return inventory[1].copy();
}
- else if (slot == 0)
+ else
{
ItemStack ret = super.decrStackSize(slot, quantity);
- if (getStackInSlot(0) == null)
- decrStackSize(1, 1);
+ if (inventory[0] == null)
+ super.decrStackSize(1, 1);
return ret;
}
- return super.decrStackSize(slot, quantity);
+ }
+
+ public void altDecrStackSize(int slot, int quantity)
+ {
+ if (inventory[slot] != null)
+ {
+ if (inventory[slot].stackSize <= quantity)
+ {
+ ItemStack stack = inventory[slot];
+ inventory[slot] = null;
+ return;
+ }
+ ItemStack split = inventory[slot].splitStack(quantity);
+ if (inventory[slot].stackSize == 0)
+ {
+ inventory[slot] = null;
+ }
+ return;
+ }
}
@Override
diff --git a/tinker/tconstruct/logic/SmelteryDrainLogic.java b/tinker/tconstruct/logic/SmelteryDrainLogic.java
index 7f9b3929..b56404a8 100644
--- a/tinker/tconstruct/logic/SmelteryDrainLogic.java
+++ b/tinker/tconstruct/logic/SmelteryDrainLogic.java
@@ -1,23 +1,26 @@
package tinker.tconstruct.logic;
+import net.minecraft.entity.EntityLiving;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.INetworkManager;
+import net.minecraft.network.packet.Packet;
+import net.minecraft.network.packet.Packet132TileEntityData;
+import net.minecraft.util.MathHelper;
+import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.LiquidStack;
+import tinker.common.IFacingLogic;
public class SmelteryDrainLogic extends MultiServantLogic
- implements ILiquidTank
+ implements ILiquidTank, IFacingLogic
{
- boolean isDrain;
-
- public SmelteryDrainLogic()
+ byte direction;
+
+ public boolean canUpdate ()
{
- isDrain = true;
+ return false;
}
-
- public boolean canUpdate()
- {
- return false;
- }
-
+
@Override
public LiquidStack getLiquid ()
{
@@ -29,7 +32,7 @@ public class SmelteryDrainLogic extends MultiServantLogic
{
if (!hasMaster)
return 0;
-
+
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
return smeltery.getCapacity();
}
@@ -37,9 +40,17 @@ public class SmelteryDrainLogic extends MultiServantLogic
@Override
public int fill (LiquidStack resource, boolean doFill)
{
- if (hasMaster && !isDrain) //Not sure if it should fill or not
+ if (hasMaster) //Not sure if it should fill or not
{
- return 0;
+ if (doFill)
+ {
+ SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
+ return smeltery.fill(resource);
+ }
+ else
+ {
+ return resource.amount;
+ }
}
else
{
@@ -50,7 +61,7 @@ public class SmelteryDrainLogic extends MultiServantLogic
@Override
public LiquidStack drain (int maxDrain, boolean doDrain)
{
- if (hasMaster && isDrain)
+ if (hasValidMaster())
{
SmelteryLogic smeltery = (SmelteryLogic) worldObj.getBlockTileEntity(master.x, master.y, master.z);
return smeltery.drain(maxDrain, doDrain);
@@ -67,4 +78,75 @@ public class SmelteryDrainLogic extends MultiServantLogic
return 0;
}
+ @Override
+ public byte getRenderDirection ()
+ {
+ return direction;
+ }
+
+ @Override
+ public ForgeDirection getForgeDirection()
+ {
+ return ForgeDirection.VALID_DIRECTIONS[direction];
+ }
+
+ @Override
+ public void setDirection (float yaw, float pitch, EntityLiving player)
+ {
+ if (pitch > 45)
+ direction = 1;
+ else if (pitch < -45)
+ direction = 0;
+ else
+ {
+ int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3;
+ switch (facing)
+ {
+ case 0:
+ direction = 2;
+ break;
+
+ case 1:
+ direction = 5;
+ break;
+
+ case 2:
+ direction = 3;
+ break;
+
+ case 3:
+ direction = 4;
+ break;
+ }
+ }
+ }
+
+ public void readFromNBT (NBTTagCompound tags)
+ {
+ super.readFromNBT(tags);
+ direction = tags.getByte("Direction");
+ }
+
+ @Override
+ public void writeToNBT (NBTTagCompound tags)
+ {
+ super.writeToNBT(tags);
+ tags.setByte("Direction", direction);
+ }
+
+ /* Packets */
+ @Override
+ public Packet getDescriptionPacket ()
+ {
+ NBTTagCompound tag = new NBTTagCompound();
+ writeToNBT(tag);
+ return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag);
+ }
+
+ @Override
+ public void onDataPacket (INetworkManager net, Packet132TileEntityData packet)
+ {
+ readFromNBT(packet.customParam1);
+ worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
+ }
}
diff --git a/tinker/tconstruct/logic/SmelteryLogic.java b/tinker/tconstruct/logic/SmelteryLogic.java
index c177f953..43052994 100644
--- a/tinker/tconstruct/logic/SmelteryLogic.java
+++ b/tinker/tconstruct/logic/SmelteryLogic.java
@@ -2,6 +2,7 @@ package tinker.tconstruct.logic;
import java.util.ArrayList;
+import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
@@ -13,6 +14,7 @@ import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.LiquidStack;
import tinker.common.CoordTuple;
@@ -26,8 +28,7 @@ import tinker.tconstruct.crafting.Smeltery;
/* Simple class for storing items in the block
*/
-public class SmelteryLogic extends InventoryLogic
- implements IActiveLogic, IFacingLogic
+public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFacingLogic
{
public boolean validStructure;
byte direction;
@@ -35,24 +36,29 @@ public class SmelteryLogic extends InventoryLogic
int maxTemp;
int useTime;
public int fuelGague;
-
- CoordTuple lavaTank;
+
+ ArrayList lavaTanks;
+ CoordTuple activeLavaTank;
CoordTuple drain;
public CoordTuple centerPos;
-
+
public int[] activeTemps;
public int[] meltingTemps;
int tick;
-
+
public ArrayList moltenMetal = new ArrayList();
- int maxLiquid = 10000;
+ int maxLiquid;
int slag;
+ int numBricks;
+
public SmelteryLogic()
{
super(9);
+ maxLiquid = 0;
activeTemps = new int[9];
meltingTemps = new int[9];
+ lavaTanks = new ArrayList();
for (int i = 0; i < 9; i++)
{
activeTemps[i] = 20;
@@ -74,35 +80,39 @@ public class SmelteryLogic extends InventoryLogic
}
@Override
- public byte getDirection ()
+ public byte getRenderDirection ()
{
return direction;
}
@Override
- public void setDirection (float yaw, float pitch)
+ public ForgeDirection getForgeDirection ()
{
- int facing = MathHelper.floor_double((double)(yaw / 360) + 0.5D) & 3;
- switch (facing)
- {
- case 0:
- direction = 2;
- break;
+ return ForgeDirection.VALID_DIRECTIONS[direction];
+ }
- case 1:
- direction = 5;
- break;
+ @Override
+ public void setDirection (float yaw, float pitch, EntityLiving player)
+ {
+ int facing = MathHelper.floor_double((double) (yaw / 360) + 0.5D) & 3;
+ switch (facing)
+ {
+ case 0:
+ direction = 2;
+ break;
- case 2:
- direction = 3;
- break;
+ case 1:
+ direction = 5;
+ break;
- case 3:
- direction = 4;
- break;
- }
+ case 2:
+ direction = 3;
+ break;
- //direction = dir;
+ case 3:
+ direction = 4;
+ break;
+ }
}
@Override
@@ -140,7 +150,7 @@ public class SmelteryLogic extends InventoryLogic
if (tick % 4 == 0 && !worldObj.isRemote)
heatItems();
- if (tick == 20)
+ if (tick == 100)
{
tick = 0;
checkValidPlacement();
@@ -153,7 +163,7 @@ public class SmelteryLogic extends InventoryLogic
if (validStructure && useTime == 0)
{
- TileEntity tank = worldObj.getBlockTileEntity(lavaTank.x, lavaTank.y, lavaTank.z);
+ TileEntity tank = worldObj.getBlockTileEntity(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z);
if (tank instanceof ILiquidTank)
{
LiquidStack liquid = ((ILiquidTank) tank).drain(10, true);
@@ -174,7 +184,7 @@ public class SmelteryLogic extends InventoryLogic
if (meltingTemps[i] > 20 && this.isStackInSlot(i))
{
if (activeTemps[i] < internalTemp && activeTemps[i] < meltingTemps[i])
- activeTemps[i] += 1;
+ activeTemps[i] += 5;
else if (meltingTemps[i] >= activeTemps[i])
{
LiquidStack result = getResultFor(inventory[i]);
@@ -199,8 +209,8 @@ public class SmelteryLogic extends InventoryLogic
activeTemps[i] = 20;
}
}
-
- void addMoltenMetal(LiquidStack liquid)
+
+ void addMoltenMetal (LiquidStack liquid)
{
if (moltenMetal.size() == 0)
moltenMetal.add(liquid);
@@ -223,8 +233,8 @@ public class SmelteryLogic extends InventoryLogic
moltenMetal.add(liquid);
}
}
-
- void updateTemperatures()
+
+ void updateTemperatures ()
{
for (int i = 0; i < 9; i++)
{
@@ -234,10 +244,10 @@ public class SmelteryLogic extends InventoryLogic
void updateFuelGague ()
{
- if (lavaTank == null)
+ if (activeLavaTank == null)
return;
- TileEntity tank = worldObj.getBlockTileEntity(lavaTank.x, lavaTank.y, lavaTank.z);
+ TileEntity tank = worldObj.getBlockTileEntity(activeLavaTank.x, activeLavaTank.y, activeLavaTank.z);
if (tank == null)
{
fuelGague = 0;
@@ -263,8 +273,8 @@ public class SmelteryLogic extends InventoryLogic
{
return 1;
}
-
- public void onInventoryChanged()
+
+ public void onInventoryChanged ()
{
updateTemperatures();
super.onInventoryChanged();
@@ -274,108 +284,279 @@ public class SmelteryLogic extends InventoryLogic
/* Multiblock */
public void checkValidPlacement ()
{
- switch (getDirection())
+ switch (getRenderDirection())
{
case 2: // +z
- checkValidStructure(xCoord, yCoord, zCoord + 2);
+ alignInitialPlacement(xCoord, yCoord, zCoord + 2);
break;
case 3: // -z
- checkValidStructure(xCoord, yCoord, zCoord - 2);
+ alignInitialPlacement(xCoord, yCoord, zCoord - 2);
break;
case 4: // +x
- checkValidStructure(xCoord + 2, yCoord, zCoord);
+ alignInitialPlacement(xCoord + 2, yCoord, zCoord);
break;
case 5: // -x
- checkValidStructure(xCoord - 2, yCoord, zCoord);
+ alignInitialPlacement(xCoord - 2, yCoord, zCoord);
break;
}
}
+ public void alignInitialPlacement (int x, int y, int z)
+ {
+ int northID = worldObj.getBlockId(x, y, z + 1);
+ int southID = worldObj.getBlockId(x, y, z - 1);
+ int eastID = worldObj.getBlockId(x + 1, y, z);
+ int westID = worldObj.getBlockId(x - 1, y, z);
+
+ if (northID == 0 && southID == 0 && eastID == 0 && westID == 0) //Center
+ {
+ checkValidStructure(x, y, z);
+ }
+
+ else if (northID != 0 && southID == 0 && eastID == 0 && westID == 0)
+ {
+ checkValidStructure(x, y, z - 1);
+ }
+
+ else if (northID == 0 && southID != 0 && eastID == 0 && westID == 0)
+ {
+ checkValidStructure(x, y, z + 1);
+ }
+
+ else if (northID == 0 && southID == 0 && eastID != 0 && westID == 0)
+ {
+ checkValidStructure(x - 1, y, z);
+ }
+
+ else if (northID == 0 && southID == 0 && eastID == 0 && westID != 0)
+ {
+ checkValidStructure(x + 1, y, z);
+ }
+
+ //Not valid, sorry
+ }
+
public void checkValidStructure (int x, int y, int z)
{
- int numBricks = 0;
+ int capacity = 0;
+ //System.out.println("Yep");
+ if (checkSameLevel(x, y, z))
+ {
+ capacity++;
+ capacity += recurseStructureUp(x, y+1, z, 0);
+ capacity += recurseStructureDown(x, y-1, z, 0);
+ }
+
+ maxLiquid = capacity * 20000;
+
+ if (validStructure)
+ {
+ internalTemp = 800;
+ activeLavaTank = lavaTanks.get(0);
+ }
+ else
+ {
+ internalTemp = 20;
+ }
+ }
+
+ public boolean checkSameLevel (int x, int y, int z)
+ {
+ numBricks = 0;
+ lavaTanks.clear();
boolean hasLavaTank = false;
- //Check outer layer
- for (int xPos = x - 1; xPos <= x + 1; xPos++)
- {
- int southID = worldObj.getBlockId(xPos, y, z - 2);
- int northID = worldObj.getBlockId(xPos, y, z + 2);
- if (southID == TContent.smeltery.blockID)
- numBricks++;
- else if (southID == TContent.lavaTank.blockID)
- {
- lavaTank = new CoordTuple(xPos, y, z - 2);
- hasLavaTank = true;
- }
-
- if (northID == TContent.smeltery.blockID)
- numBricks++;
- else if (northID == TContent.lavaTank.blockID)
- {
- lavaTank = new CoordTuple(xPos, y, z + 2 );
- hasLavaTank = true;
- }
- }
- for (int zPos = z - 1; zPos <= z + 1; zPos++)
- {
- int westID = worldObj.getBlockId(x - 2, y, zPos);
- int eastID = worldObj.getBlockId(x + 2, y, zPos);
- if (westID == TContent.smeltery.blockID)
- numBricks++;
- else if (westID == TContent.lavaTank.blockID)
- {
- lavaTank = new CoordTuple(x - 2, y, zPos);
- hasLavaTank = true;
- }
-
- if (eastID == TContent.smeltery.blockID)
- numBricks++;
- else if (eastID == TContent.lavaTank.blockID)
- {
- lavaTank = new CoordTuple( x + 2, y, zPos );
- hasLavaTank = true;
- }
- }
-
- //Check floor
+ //Check inside
for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
for (int zPos = z - 1; zPos <= z + 1; zPos++)
{
- if (worldObj.getBlockId(xPos, y - 1, zPos) == TContent.smeltery.blockID)
- numBricks++;
+ if (worldObj.getBlockId(xPos, y, zPos) != 0)
+ return false;
}
}
-
- System.out.println(numBricks);
- if (numBricks == 20 && hasLavaTank)
+ //Check outer layer
+ for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
- if (!validStructure)
- {
- centerPos = new CoordTuple(x, y, z);
- validStructure = true;
- }
+ if (checkBricks(xPos, y, z - 2))
+ hasLavaTank = true;
+ if (checkBricks(xPos, y, z + 2))
+ hasLavaTank = true;
+ }
+
+ for (int zPos = z - 1; zPos <= z + 1; zPos++)
+ {
+ if (checkBricks(x - 2, y, zPos))
+ hasLavaTank = true;
+ if (checkBricks(x + 2, y, zPos))
+ hasLavaTank = true;
+ }
+
+ //System.out.println("numBricks: "+numBricks);
+ if (numBricks == 12 && hasLavaTank)
+ return true;
+ else
+ return false;
+
+ /*System.out.println("numBricks: "+numBricks);
+
+ if (numBricks == 21 && hasLavaTank)
+ {
+ centerPos = new CoordTuple(x, y, z);
+ activeLavaTank = lavaTanks.get(0);
+ validStructure = true;
internalTemp = 800;
+ return true;
}
else
{
validStructure = false;
internalTemp = 20;
+ return false;
+ }*/
+ }
+
+ public int recurseStructureUp (int x, int y, int z, int count)
+ {
+ numBricks = 0;
+ //Check inside
+ for (int xPos = x - 1; xPos <= x + 1; xPos++)
+ {
+ for (int zPos = z - 1; zPos <= z + 1; zPos++)
+ {
+ if (worldObj.getBlockId(xPos, y, zPos) != 0)
+ return count;
+ }
}
+
+ //Check outer layer
+ for (int xPos = x - 1; xPos <= x + 1; xPos++)
+ {
+ checkBricks(xPos, y, z - 2);
+ checkBricks(xPos, y, z + 2);
+ }
+
+ for (int zPos = z - 1; zPos <= z + 1; zPos++)
+ {
+ checkBricks(x - 2, y, zPos);
+ checkBricks(x + 2, y, zPos);
+ }
+
+ if (numBricks != 12)
+ return count;
+
+ count++;
+ return recurseStructureUp(x, y+1, z, count);
}
- public int getCapacity()
+ public int recurseStructureDown (int x, int y, int z, int count)
+ {
+ numBricks = 0;
+ //Check inside
+ for (int xPos = x - 1; xPos <= x + 1; xPos++)
+ {
+ for (int zPos = z - 1; zPos <= z + 1; zPos++)
+ {
+ int blockID = worldObj.getBlockId(xPos, y, zPos);
+ if (blockID != 0)
+ {
+ if (blockID == TContent.smeltery.blockID)
+ return validateBottom(x, y, z, count);
+ else
+ return count;
+ }
+ }
+ }
+
+ //Check outer layer
+ for (int xPos = x - 1; xPos <= x + 1; xPos++)
+ {
+ checkBricks(xPos, y, z - 2);
+ checkBricks(xPos, y, z + 2);
+ }
+
+ for (int zPos = z - 1; zPos <= z + 1; zPos++)
+ {
+ checkBricks(x - 2, y, zPos);
+ checkBricks(x + 2, y, zPos);
+ }
+
+ if (numBricks != 12)
+ return count;
+
+ count++;
+ return recurseStructureDown(x, y-1, z, count);
+ }
+
+ public int validateBottom(int x, int y, int z, int count)
+ {
+ int bottomBricks = 0;
+ for (int xPos = x - 1; xPos <= x + 1; xPos++)
+ {
+ for (int zPos = z - 1; zPos <= z + 1; zPos++)
+ {
+ if (worldObj.getBlockId(xPos, y, zPos) == TContent.smeltery.blockID && (worldObj.getBlockMetadata(xPos, y, zPos) == 2))
+ bottomBricks++;
+ }
+ }
+
+ if (bottomBricks == 9)
+ {
+ validStructure = true;
+ centerPos = new CoordTuple(x, y+1, z);
+ }
+ return count;
+ }
+
+ boolean checkBricks (int x, int y, int z)
+ {
+ //System.out.println("x: "+x+", z: "+z);
+ //System.out.println("Bricks: "+numBricks);
+ int blockID = worldObj.getBlockId(x, y, z);
+ if (blockID == TContent.smeltery.blockID || blockID == TContent.lavaTank.blockID)
+ {
+ TileEntity te = worldObj.getBlockTileEntity(x, y, z);
+ if (te == this)
+ {
+ numBricks++;
+ return false;
+ }
+ else if (te instanceof MultiServantLogic)
+ {
+ MultiServantLogic servant = (MultiServantLogic) te;
+ if (servant.hasValidMaster())
+ {
+ if (servant.verifyMaster(this.xCoord, this.yCoord, this.zCoord))
+ numBricks++;
+ }
+ else if (servant.setMaster(this.xCoord, this.yCoord, this.zCoord))
+ {
+ numBricks++;
+ }
+
+ if (te instanceof LavaTankLogic)
+ {
+ //System.out.println("Lava tank ho!");
+ lavaTanks.add(new CoordTuple(x, y, z));
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /* Not an ILiquidTank, but is still a liquid tank of sorts */
+ public int getCapacity ()
{
return maxLiquid;
}
-
+
public LiquidStack drain (int maxDrain, boolean doDrain)
{
if (moltenMetal.size() == 0)
return null;
-
+
LiquidStack liquid = moltenMetal.get(0);
if (liquid.amount - maxDrain < 0)
{
@@ -398,6 +579,14 @@ public class SmelteryLogic extends InventoryLogic
return new LiquidStack(liquid.itemID, maxDrain, liquid.itemMeta);
}
}
+
+
+ public int fill (LiquidStack resource)
+ {
+ int amount = resource.amount;
+ addMoltenMetal(resource);
+ return amount;
+ }
/* NBT */
@Override
@@ -406,20 +595,21 @@ public class SmelteryLogic extends InventoryLogic
super.readFromNBT(tags);
direction = tags.getByte("Direction");
useTime = tags.getInteger("UseTime");
+ maxLiquid = tags.getInteger("MaxLiquid");
meltingTemps = tags.getIntArray("MeltingTemps");
activeTemps = tags.getIntArray("ActiveTemps");
-
+
NBTTagList liquidTag = tags.getTagList("Liquids");
moltenMetal.clear();
-
+
for (int iter = 0; iter < liquidTag.tagCount(); iter++)
- {
- NBTTagCompound tagList = (NBTTagCompound)liquidTag.tagAt(iter);
- int id = tagList.getInteger("id");
- int amount = tagList.getInteger("amount");
- int meta = tagList.getInteger("meta");
- moltenMetal.add(new LiquidStack(id, amount, meta));
- }
+ {
+ NBTTagCompound tagList = (NBTTagCompound) liquidTag.tagAt(iter);
+ int id = tagList.getInteger("id");
+ int amount = tagList.getInteger("amount");
+ int meta = tagList.getInteger("meta");
+ moltenMetal.add(new LiquidStack(id, amount, meta));
+ }
}
@Override
@@ -428,9 +618,10 @@ public class SmelteryLogic extends InventoryLogic
super.writeToNBT(tags);
tags.setByte("Direction", direction);
tags.setInteger("UseTime", useTime);
+ tags.setInteger("MaxLiquid", maxLiquid);
tags.setIntArray("MeltingTemps", meltingTemps);
tags.setIntArray("ActiveTemps", activeTemps);
-
+
NBTTagList taglist = new NBTTagList();
for (LiquidStack liquid : moltenMetal)
{
@@ -440,7 +631,7 @@ public class SmelteryLogic extends InventoryLogic
liquidTag.setInteger("meta", liquid.itemMeta);
taglist.appendTag(liquidTag);
}
-
+
tags.setTag("Liquids", taglist);
}
diff --git a/tinker/tconstruct/modifiers/ModBlaze.java b/tinker/tconstruct/modifiers/ModBlaze.java
index af5d2d16..6dd83b9e 100644
--- a/tinker/tconstruct/modifiers/ModBlaze.java
+++ b/tinker/tconstruct/modifiers/ModBlaze.java
@@ -1,5 +1,6 @@
package tinker.tconstruct.modifiers;
+import tinker.common.ToolMod;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
diff --git a/tinker/tconstruct/modifiers/ModBoolean.java b/tinker/tconstruct/modifiers/ModBoolean.java
index fe0bc98b..9817702e 100644
--- a/tinker/tconstruct/modifiers/ModBoolean.java
+++ b/tinker/tconstruct/modifiers/ModBoolean.java
@@ -1,5 +1,6 @@
package tinker.tconstruct.modifiers;
+import tinker.common.ToolMod;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
diff --git a/tinker/tconstruct/modifiers/ModDurability.java b/tinker/tconstruct/modifiers/ModDurability.java
index da595c04..c53cab24 100644
--- a/tinker/tconstruct/modifiers/ModDurability.java
+++ b/tinker/tconstruct/modifiers/ModDurability.java
@@ -1,5 +1,6 @@
package tinker.tconstruct.modifiers;
+import tinker.common.ToolMod;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
diff --git a/tinker/tconstruct/modifiers/ModInteger.java b/tinker/tconstruct/modifiers/ModInteger.java
index 3dfa8d3b..3a2b8f1b 100644
--- a/tinker/tconstruct/modifiers/ModInteger.java
+++ b/tinker/tconstruct/modifiers/ModInteger.java
@@ -1,5 +1,6 @@
package tinker.tconstruct.modifiers;
+import tinker.common.ToolMod;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
diff --git a/tinker/tconstruct/modifiers/ModLapisBase.java b/tinker/tconstruct/modifiers/ModLapisBase.java
index 864e7bc4..9a19d69d 100644
--- a/tinker/tconstruct/modifiers/ModLapisBase.java
+++ b/tinker/tconstruct/modifiers/ModLapisBase.java
@@ -1,5 +1,6 @@
package tinker.tconstruct.modifiers;
+import tinker.common.ToolMod;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
diff --git a/tinker/tconstruct/modifiers/ModLapisIncrease.java b/tinker/tconstruct/modifiers/ModLapisIncrease.java
index eea95894..f27ec047 100644
--- a/tinker/tconstruct/modifiers/ModLapisIncrease.java
+++ b/tinker/tconstruct/modifiers/ModLapisIncrease.java
@@ -8,6 +8,7 @@ import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
+import tinker.common.ToolMod;
import tinker.tconstruct.tools.Weapon;
public class ModLapisIncrease extends ToolMod
diff --git a/tinker/tconstruct/modifiers/ModRedstone.java b/tinker/tconstruct/modifiers/ModRedstone.java
index 6f3c42d7..765a2107 100644
--- a/tinker/tconstruct/modifiers/ModRedstone.java
+++ b/tinker/tconstruct/modifiers/ModRedstone.java
@@ -1,5 +1,6 @@
package tinker.tconstruct.modifiers;
+import tinker.common.ToolMod;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
diff --git a/tinker/tconstruct/modifiers/ModRepair.java b/tinker/tconstruct/modifiers/ModRepair.java
index 4bfa01c1..338b725a 100644
--- a/tinker/tconstruct/modifiers/ModRepair.java
+++ b/tinker/tconstruct/modifiers/ModRepair.java
@@ -1,5 +1,6 @@
package tinker.tconstruct.modifiers;
+import tinker.common.ToolMod;
import tinker.tconstruct.crafting.PatternBuilder;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack;
diff --git a/tinker/tconstruct/tools/ToolCore.java b/tinker/tconstruct/tools/ToolCore.java
index 27343a81..4b83fda0 100644
--- a/tinker/tconstruct/tools/ToolCore.java
+++ b/tinker/tconstruct/tools/ToolCore.java
@@ -18,12 +18,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
+import tinker.common.ToolMod;
import tinker.tconstruct.AbilityHelper;
import tinker.tconstruct.TConstruct;
import tinker.tconstruct.TContent;
import tinker.tconstruct.TConstructRegistry;
import tinker.tconstruct.crafting.ToolBuilder;
-import tinker.tconstruct.modifiers.ToolMod;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;