Bugfixes galore

This commit is contained in:
mDiyo 2013-04-15 11:04:52 -07:00
parent 31c54e3dee
commit 7847102fff
20 changed files with 756 additions and 495 deletions

@ -48,6 +48,8 @@
<entry key="StorageMetals.Alumite.name">Block of Alumite</entry>
<entry key="StorageMetals.Steel.name">Block of Steel</entry>
<entry key="tile.decoration.stonetorch.name">Torch</entry>
<entry key="item.tconstruct.blankpattern.pattern.name">Blank Pattern</entry>
<entry key="item.tconstruct.blankpattern.cast.name">Blank Cast</entry>

@ -231,8 +231,8 @@ Class: Lethal Joke Weapon</text>
<text>Some materials have abilities that augment their natural uses.
- Reinforced: 10% chance per level of not using durability
- Shoddy: Mines faster and does less damage as the tool breaks
- Spiny: Opposite of Shoddy
- Stonebound: The tool mines faster as it wears out, but does less damage
- Spiny: The tool mines does more damage as it wears out, but mines slower
- Writable: One extra modifier per piece
- Awareness: Unknown</text>
</page>
@ -380,7 +380,7 @@ Class: Lethal Joke Weapon</text>
<page type="materialstats">
<title>Ardite</title>
<icon>arditelongsword</icon>
<text>One of the nether materials. It's rustic red.</text>
<text>One of the nether materials. It seems to mine faster as it wears out.</text>
<material>
<main>arditeingot</main>
</material>

@ -21,9 +21,10 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
/** TConstruct, the tool mod.
* Craft your tools with style, then modify until the original is gone!
* @author: mDiyo
* @dependencies: IC2 API, EBXL API
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.29.1")
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.2.29.4")
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.TPacketHandler.class)
public class TConstruct
{

@ -1,8 +1,5 @@
package mods.tinker.tconstruct;
import java.util.ArrayList;
import java.util.List;
import mods.tinker.common.IPattern;
import mods.tinker.common.RecipeRemover;
import mods.tinker.common.fancyitem.FancyEntityItem;
@ -24,6 +21,7 @@ import mods.tinker.tconstruct.entity.BlueSlime;
import mods.tinker.tconstruct.entity.Crystal;
import mods.tinker.tconstruct.entity.LaunchedPotion;
import mods.tinker.tconstruct.entity.NitroCreeper;
import mods.tinker.tconstruct.entity.Skyla;
import mods.tinker.tconstruct.items.CraftedSoilItemBlock;
import mods.tinker.tconstruct.items.CraftingItem;
import mods.tinker.tconstruct.items.FilledBucket;
@ -211,7 +209,7 @@ public class TContent implements IFuelHandler
//EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(Crystal.class, "Crystal", 2, TConstruct.instance, 32, 5, true);
//EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(Skyla.class, "Skyla", 10, TConstruct.instance, 32, 5, true);
EntityRegistry.registerModEntity(NitroCreeper.class, "UnstableCreeper", 11, TConstruct.instance, 64, 5, true);
EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true);
//EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13, TConstruct.instance, 64, 5, true);
@ -371,18 +369,18 @@ public class TContent implements IFuelHandler
void registerMaterials ()
{
TConstructRegistry.addToolMaterial(0, "Wood", 1, 0, 59, 200, 0, 1.0F, 0, 0f, "\u00A7e", "");
TConstructRegistry.addToolMaterial(1, "Stone", 1, 1, 131, 400, 1, 0.5F, 0, 1f, "", "Shoddy");
TConstructRegistry.addToolMaterial(1, "Stone", 1, 1, 131, 400, 1, 0.5F, 0, 1f, "", "Stonebound");
TConstructRegistry.addToolMaterial(2, "Iron", 1, 2, 250, 600, 2, 1.3F, 1, 0f, "\u00A7f", "");
TConstructRegistry.addToolMaterial(3, "Flint", 1, 1, 171, 525, 2, 0.7F, 0, 1f, "\u00A78", "Shoddy");
TConstructRegistry.addToolMaterial(3, "Flint", 1, 1, 171, 525, 2, 0.7F, 0, 1f, "\u00A78", "Stonebound");
TConstructRegistry.addToolMaterial(4, "Cactus", 1, 1, 150, 500, 2, 1.0F, 0, -1f, "\u00A72", "Spiny");
TConstructRegistry.addToolMaterial(5, "Bone", 1, 1, 200, 400, 1, 1.0F, 0, 0f, "\u00A7e", "");
TConstructRegistry.addToolMaterial(6, "Obsidian", 1, 3, 89, 700, 2, 0.8F, 3, 0f, "\u00A7d", "");
TConstructRegistry.addToolMaterial(7, "Netherrack", 1, 2, 131, 400, 1, 1.2F, 0, 1f, "\u00A74", "Shoddy");
TConstructRegistry.addToolMaterial(7, "Netherrack", 1, 2, 131, 400, 1, 1.2F, 0, 1f, "\u00A74", "Stonebound");
TConstructRegistry.addToolMaterial(8, "Slime", 1, 3, 1500, 150, 0, 5.0F, 0, 0f, "\u00A7a", "");
TConstructRegistry.addToolMaterial(9, "Paper", 1, 0, 30, 200, 0, 0.3F, 0, 0f, "\u00A7f", "Writable");
TConstructRegistry.addToolMaterial(10, "Cobalt", 2, 4, 800, 800, 3, 1.75F, 2, 0f, "\u00A73", "");
TConstructRegistry.addToolMaterial(11, "Ardite", 2, 4, 600, 800, 3, 2.0F, 0, 0f, "\u00A74", "");
TConstructRegistry.addToolMaterial(12, "Manyullyn", 2, 5, 1200, 1000, 4, 2.5F, 0, 0f, "\u00A75", "Awareness");
TConstructRegistry.addToolMaterial(10, "Cobalt", 2, 4, 800, 1100, 3, 1.75F, 2, 0f, "\u00A73", "");
TConstructRegistry.addToolMaterial(11, "Ardite", 2, 4, 600, 800, 3, 2.0F, 0, 3f, "\u00A74", "Stonebound");
TConstructRegistry.addToolMaterial(12, "Manyullyn", 2, 5, 1200, 900, 4, 2.5F, 0, 0f, "\u00A75", "");
TConstructRegistry.addToolMaterial(13, "Copper", 1, 1, 180, 500, 2, 1.15F, 0, 0f, "\u00A7c", "");
TConstructRegistry.addToolMaterial(14, "Bronze", 1, 2, 350, 700, 2, 1.3F, 1, 0f, "\u00A76", "");
TConstructRegistry.addToolMaterial(15, "Alumite", 2, 4, 550, 800, 3, 1.3F, 2, 0f, "\u00A7d", "");
@ -657,8 +655,12 @@ public class TContent implements IFuelHandler
GameRegistry.addRecipe(new ItemStack(manualBook), "wp", 'w', new ItemStack(blankPattern, 1, 0), 'p', Item.paper);
GameRegistry.addRecipe(new ItemStack(materials, 1, 0), "pp", "pp", 'p', Item.paper); //Paper stack
GameRegistry.addRecipe(new ItemStack(materials, 1, 6), "ppp", "ppp", "ppp", 'p', Block.cobblestoneMossy); //Moss ball
GameRegistry.addRecipe(new ItemStack(materials, 1, 7), "xcx", "cbc", "xcx", 'b', Item.bucketLava, 'c', Item.coal, 'x', Block.netherrack); //Auto-smelt
OreDictionary.registerOre("mossystone", new ItemStack(Block.stoneBrick, 1, 1));
OreDictionary.registerOre("mossystone", new ItemStack(Block.cobblestoneMossy));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(materials, 1, 6), "ppp", "ppp", "ppp", 'p', "mossystone")); //Moss ball
GameRegistry.addRecipe(new ItemStack(materials, 1, 6), "ppp", "ppp", "ppp", 'p', new ItemStack(Block.stoneBrick, 1, 1)); //Moss ball
GameRegistry.addRecipe(new ItemStack(materials, 1, 7), "xcx", "cbc", "xcx", 'b', Item.bucketLava, 'c', Item.fireballCharge, 'x', Item.blazeRod); //Auto-smelt
GameRegistry.addRecipe(new ItemStack(materials, 1, 7), "xcx", "cbc", "xcx", 'b', Item.bucketLava, 'x', Item.fireballCharge, 'c', Item.blazeRod); //Auto-smelt
//GameRegistry.addShapelessRecipe(new ItemStack(materials, 1, 8), Item.bone, Item.rottenFlesh, Item.chickenRaw, Item.beefRaw, Item.porkRaw, Item.fishRaw); //Necrotic bone
GameRegistry.addShapelessRecipe(new ItemStack(craftedSoil, 1, 0), Item.slimeBall, Item.slimeBall, Item.slimeBall, Item.slimeBall, Block.sand, Block.dirt); //Slimy sand
GameRegistry.addShapelessRecipe(new ItemStack(craftedSoil, 1, 2), strangeFood, strangeFood, strangeFood, strangeFood, Block.sand, Block.dirt); //Slimy sand

@ -1,25 +1,10 @@
package mods.tinker.tconstruct;
import java.util.WeakHashMap;
import mods.tinker.common.InventoryLogic;
import mods.tinker.tconstruct.client.TProxyClient;
import mods.tinker.tconstruct.client.gui.FrypanGui;
import mods.tinker.tconstruct.client.gui.GuiManual;
import mods.tinker.tconstruct.client.gui.PartCrafterGui;
import mods.tinker.tconstruct.client.gui.PatternChestGui;
import mods.tinker.tconstruct.client.gui.PatternShaperGui;
import mods.tinker.tconstruct.client.gui.SmelteryGui;
import mods.tinker.tconstruct.client.gui.ToolStationGui;
import mods.tinker.tconstruct.container.SmelteryContainer;
import mods.tinker.tconstruct.logic.FrypanLogic;
import mods.tinker.tconstruct.logic.PartCrafterLogic;
import mods.tinker.tconstruct.logic.PatternChestLogic;
import mods.tinker.tconstruct.logic.PatternShaperLogic;
import mods.tinker.tconstruct.logic.SmelteryLogic;
import mods.tinker.tconstruct.logic.ToolStationLogic;
import mods.tinker.tconstruct.client.*;
import mods.tinker.tconstruct.client.gui.*;
import mods.tinker.tconstruct.logic.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
@ -27,57 +12,50 @@ import cpw.mods.fml.common.network.IGuiHandler;
public class TGuiHandler implements IGuiHandler
{
public static int stationID = 0;
public static int partID = 1;
public static int pchestID = 2;
public static int pshaperID = 3;
public static int frypanID = 4;
public static int stationID = 0;
public static int partID = 1;
public static int pchestID = 2;
public static int pshaperID = 3;
public static int frypanID = 4;
public static int smeltery = 7;
public static int manualGui = -1;
public static WeakHashMap<String, Container> openContainers = new WeakHashMap<String, Container>();
public static int smeltery = 7;
public static int manualGui = -1;
@Override
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
{
if (ID < 0)
return null;
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile != null && tile instanceof InventoryLogic)
{
Object o = ((InventoryLogic) tile).getGuiContainer(player.inventory, world, x, y, z);
if (o instanceof SmelteryContainer)
{
openContainers.put(player.username, (Container) o);
}
return o;
}
return null;
}
@Override
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
{
if (ID < 0)
return null;
@Override
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
{
if (ID == stationID)
return new ToolStationGui(player.inventory, (ToolStationLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == partID)
return new PartCrafterGui(player.inventory, (PartCrafterLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == pchestID)
return new PatternChestGui(player.inventory, (PatternChestLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == frypanID)
return new FrypanGui(player.inventory, (FrypanLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == smeltery)
return new SmelteryGui(player.inventory, (SmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == pshaperID)
return new PatternShaperGui(player.inventory, (PatternShaperLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == manualGui)
{
ItemStack stack = player.getCurrentEquippedItem();
return new GuiManual(stack, TProxyClient.getManualFromStack(stack));
}
return null;
}
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile != null && tile instanceof InventoryLogic)
{
return ((InventoryLogic) tile).getGuiContainer(player.inventory, world, x, y, z);
}
return null;
}
@Override
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
{
if (ID == stationID)
return new ToolStationGui(player.inventory, (ToolStationLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == partID)
return new PartCrafterGui(player.inventory, (PartCrafterLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == pchestID)
return new PatternChestGui(player.inventory, (PatternChestLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == frypanID)
return new FrypanGui(player.inventory, (FrypanLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == smeltery)
return new SmelteryGui(player.inventory, (SmelteryLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == pshaperID)
return new PatternShaperGui(player.inventory, (PatternShaperLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == manualGui)
{
ItemStack stack = player.getCurrentEquippedItem();
return new GuiManual(stack, TProxyClient.getManualFromStack(stack));
}
return null;
}
}

@ -29,7 +29,6 @@ public class TPacketHandler implements IPacketHandler
if (packet.channel.equals("TConstruct"))
{
//System.out.println("Recieved a packet for TConstruct");
if (side == Side.SERVER)
handleServerPacket(packet);
else
@ -39,7 +38,6 @@ public class TPacketHandler implements IPacketHandler
void handleClientPacket (Packet250CustomPayload packet)
{
//System.out.println("Handling client packet");
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
byte packetType;
@ -63,11 +61,8 @@ public class TPacketHandler implements IPacketHandler
void handleServerPacket (Packet250CustomPayload packet)
{
//System.out.println("Handling server packet");
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
//byte packetType;
//int dimension;
byte packetID;
try
@ -105,19 +100,10 @@ public class TPacketHandler implements IPacketHandler
((InventoryLogic) te).setInventorySlotContents(1, new ItemStack(itemID, 1, itemDamage));
}
}
else if (packetID == 3) //Smeltery
{
int rowPos = inputStream.readInt();
String user = inputStream.readUTF();
SmelteryContainer container = (SmelteryContainer) TGuiHandler.openContainers.get(user);
//System.out.println("Recieved a scroll packet for row "+rowPos);
container.updateRows(rowPos);
}
else if (packetID == 10) //Double jump
{
String user = inputStream.readUTF();
//EntityPlayer player = FMLCommonHandler.instance().getSidedDelegate().getServer().getConfigurationManager().getPlayerForUsername(user);
EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user);
player.fallDistance = 0;
}

@ -24,215 +24,215 @@ import net.minecraftforge.liquids.LiquidStack;
public class LavaTankBlock extends BlockContainer
{
public Icon[] icons;
public Icon[] icons;
public LavaTankBlock(int id)
{
super(id, Material.rock);
setHardness(12);
setCreativeTab(TConstructRegistry.blockTab);
setUnlocalizedName("TConstruct.LavaTank");
setStepSound(Block.soundGlassFootstep);
}
public LavaTankBlock(int id)
{
super(id, Material.rock);
setHardness(12);
setCreativeTab(TConstructRegistry.blockTab);
setUnlocalizedName("TConstruct.LavaTank");
setStepSound(Block.soundGlassFootstep);
}
public String[] getTextureNames ()
{
String[] textureNames = { "lavatank_side", "lavatank_top", "searedgague_top", "searedgague_side", "searedgague_bottom", "searedwindow_top", "searedwindow_side", "searedwindow_bottom" };
public String[] getTextureNames ()
{
String[] textureNames = { "lavatank_side", "lavatank_top", "searedgague_top", "searedgague_side", "searedgague_bottom", "searedwindow_top", "searedwindow_side", "searedwindow_bottom" };
return textureNames;
}
return textureNames;
}
public void registerIcons (IconRegister iconRegister)
{
String[] textureNames = getTextureNames();
this.icons = new Icon[textureNames.length];
public void registerIcons (IconRegister iconRegister)
{
String[] textureNames = getTextureNames();
this.icons = new Icon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
{
//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 boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
{
//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 int getLightValue (IBlockAccess world, int x, int y, int z)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic != null && logic instanceof LavaTankLogic)
return ((LavaTankLogic) logic).getBrightness();
return 0;
}
@Override
public int getLightValue (IBlockAccess world, int x, int y, int z)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic != null && logic instanceof LavaTankLogic)
return ((LavaTankLogic) logic).getBrightness();
return 0;
}
/*@Override
public int getRenderBlockPass()
{
return 1;
}*/
/*@Override
public int getRenderBlockPass()
{
return 1;
}*/
@Override
public int getRenderType ()
{
return TankRender.tankModelID;
}
@Override
public int getRenderType ()
{
return TankRender.tankModelID;
}
public Icon getBlockTextureFromSideAndMetadata (int side, int meta)
{
if (meta == 0)
{
if (side == 0 || side == 1)
{
return icons[1];
}
else
{
return icons[0];
}
}
else
{
return icons[meta * 3 + getTextureIndex(side) - 1];
}
}
public Icon getBlockTextureFromSideAndMetadata (int side, int meta)
{
if (meta == 0)
{
if (side == 0 || side == 1)
{
return icons[1];
}
else
{
return icons[0];
}
}
else
{
return icons[meta * 3 + getTextureIndex(side) - 1];
}
}
public int getTextureIndex (int side)
{
if (side == 0)
return 2;
if (side == 1)
return 0;
public int getTextureIndex (int side)
{
if (side == 0)
return 2;
if (side == 1)
return 0;
return 1;
}
return 1;
}
@Override
public TileEntity createTileEntity (World world, int metadata)
{
return new LavaTankLogic();
}
@Override
public TileEntity createTileEntity (World world, int metadata)
{
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)
{
ItemStack heldItem = player.inventory.getCurrentItem();
if (heldItem != null)
{
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(player.getCurrentEquippedItem());
LavaTankLogic logic = (LavaTankLogic) world.getBlockTileEntity(x, y, z);
if (liquid != null)
{
int amount = logic.fill(0, liquid, false);
if (amount == liquid.amount)
{
logic.fill(ForgeDirection.UNKNOWN, liquid, true);
if (!player.capabilities.isCreativeMode)
player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(heldItem));
return true;
}
else
return true;
}
else if (LiquidContainerRegistry.isBucket(heldItem))
{
ILiquidTank[] tanks = logic.getTanks(ForgeDirection.UNKNOWN);
LiquidStack fillLiquid = tanks[0].getLiquid();
ItemStack fillStack = LiquidContainerRegistry.fillLiquidContainer(fillLiquid, heldItem);
if (fillStack != null)
{
logic.drain(ForgeDirection.UNKNOWN, LiquidContainerRegistry.getLiquidForFilledItem(fillStack).amount, true);
if (!player.capabilities.isCreativeMode)
{
if (heldItem.stackSize == 1)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, fillStack);
}
else
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(heldItem));
@Override
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
{
ItemStack heldItem = player.inventory.getCurrentItem();
if (heldItem != null)
{
LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(player.getCurrentEquippedItem());
LavaTankLogic logic = (LavaTankLogic) world.getBlockTileEntity(x, y, z);
if (liquid != null)
{
int amount = logic.fill(0, liquid, false);
if (amount == liquid.amount)
{
logic.fill(ForgeDirection.UNKNOWN, liquid, true);
if (!player.capabilities.isCreativeMode)
player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(heldItem));
return true;
}
else
return true;
}
else if (LiquidContainerRegistry.isBucket(heldItem))
{
ILiquidTank[] tanks = logic.getTanks(ForgeDirection.UNKNOWN);
LiquidStack fillLiquid = tanks[0].getLiquid();
ItemStack fillStack = LiquidContainerRegistry.fillLiquidContainer(fillLiquid, heldItem);
if (fillStack != null)
{
logic.drain(ForgeDirection.UNKNOWN, LiquidContainerRegistry.getLiquidForFilledItem(fillStack).amount, true);
if (!player.capabilities.isCreativeMode)
{
if (heldItem.stackSize == 1)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, fillStack);
}
else
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(heldItem));
if (!player.inventory.addItemStackToInventory(fillStack))
{
player.dropPlayerItem(fillStack);
}
}
}
return true;
}
else
{
return true;
}
}
}
if (!player.inventory.addItemStackToInventory(fillStack))
{
player.dropPlayerItem(fillStack);
}
}
}
return true;
}
else
{
return true;
}
}
}
return true;
}
return true;
}
public static ItemStack consumeItem (ItemStack stack)
{
if (stack.stackSize == 1)
{
if (stack.getItem().hasContainerItem())
return stack.getItem().getContainerItemStack(stack);
else
return null;
}
else
{
stack.splitStack(1);
public static ItemStack consumeItem (ItemStack stack)
{
if (stack.stackSize == 1)
{
if (stack.getItem().hasContainerItem())
return stack.getItem().getContainerItemStack(stack);
else
return null;
}
else
{
stack.splitStack(1);
return stack;
}
}
return stack;
}
}
@Override
public TileEntity createNewTileEntity (World world)
{
return createTileEntity(world, 0);
}
@Override
public TileEntity createNewTileEntity (World world)
{
return createTileEntity(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));
}
}
@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;
}
/* Data */
public int damageDropped (int meta)
{
return meta;
}
/* Updates */
public void onNeighborBlockChange (World world, int x, int y, int z, int nBlockID)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic instanceof IServantLogic)
{
((IServantLogic) logic).notifyMasterOfChange();
}
}
/* Updates */
public void onNeighborBlockChange (World world, int x, int y, int z, int nBlockID)
{
TileEntity logic = world.getBlockTileEntity(x, y, z);
if (logic instanceof IServantLogic)
{
((IServantLogic) logic).notifyMasterOfChange();
}
}
}

@ -93,6 +93,7 @@ public class TProxyClient extends TProxyCommon
/* Registers any rendering code. */
public void registerRenderer ()
{
//TickRegistry.registerTickHandler(new TTickHandler(), Side.CLIENT);
Minecraft mc = Minecraft.getMinecraft();
smallFontRenderer = new SmallFontRenderer(mc.gameSettings, "/font/default.png", mc.renderEngine, false);
RenderingRegistry.registerBlockHandler(new TableRender());
@ -264,19 +265,21 @@ public class TProxyClient extends TProxyCommon
ItemStack paper = new ItemStack(Item.paper);
ItemStack slimeball = new ItemStack(Item.slimeBall);
ItemStack slimyMud = new ItemStack(TContent.craftedSoil);
ItemStack blazerod = new ItemStack(Item.blazeRod);
ItemStack firecharge = new ItemStack(Item.fireballCharge);
//TConstruct recipes
TConstructClientRegistry.registerManualSmallRecipe("blankpattern", pattern, plank, stick, stick, plank);
TConstructClientRegistry.registerManualSmallRecipe("toolstation", new ItemStack(TContent.toolStationWood, 1, 0), null, pattern, null, workbench);
TConstructClientRegistry.registerManualSmallRecipe("partcrafter", new ItemStack(TContent.toolStationWood, 1, 1), null, pattern, null, plank);
TConstructClientRegistry.registerManualSmallRecipe("partcrafter", new ItemStack(TContent.toolStationWood, 1, 1), null, pattern, null, log);
TConstructClientRegistry.registerManualSmallRecipe("patternchest", new ItemStack(TContent.toolStationWood, 1, 5), null, pattern, null, chest);
TConstructClientRegistry.registerManualSmallRecipe("stenciltable", new ItemStack(TContent.toolStationWood, 1, 10), null, pattern, null, log);
TConstructClientRegistry.registerManualSmallRecipe("stenciltable", new ItemStack(TContent.toolStationWood, 1, 10), null, pattern, null, plank);
TConstructClientRegistry.registerManualLargeRecipe("slimymud", slimyMud, null, slimeball, slimeball, null, slimeball, slimeball, null, dirt, sand);
TConstructClientRegistry.registerManualFurnaceRecipe("slimecrystal", new ItemStack(TContent.materials, 1, 1), slimyMud);
TConstructClientRegistry.registerManualSmallRecipe("paperstack", new ItemStack(TContent.materials, 1, 0), paper, paper, paper, paper);
TConstructClientRegistry.registerManualLargeRecipe("mossball", new ItemStack(TContent.materials, 1, 6), mossycobble, mossycobble, mossycobble, mossycobble, mossycobble, mossycobble, mossycobble, mossycobble, mossycobble);
TConstructClientRegistry.registerManualLargeRecipe("lavacrystal", new ItemStack(TContent.materials, 1, 7), netherrack, coal, netherrack, coal, new ItemStack(Item.bucketLava), coal, netherrack, coal, netherrack);
TConstructClientRegistry.registerManualLargeRecipe("lavacrystal", new ItemStack(TContent.materials, 1, 7), blazerod, firecharge, blazerod, firecharge, new ItemStack(Item.bucketLava), firecharge, blazerod, firecharge, blazerod);
TConstructClientRegistry.registerManualSmallRecipe("grout", grout, sand, gravel, null, clay);
TConstructClientRegistry.registerManualFurnaceRecipe("searedbrick", searedbrick, grout);

@ -0,0 +1,102 @@
package mods.tinker.tconstruct.client;
import java.util.EnumSet;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
public class TTickHandler implements ITickHandler
{
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player;
int zLevel = 0;
@Override
public void tickStart (EnumSet<TickType> type, Object... tickData) { }
@Override
public void tickEnd (EnumSet<TickType> type, Object... tickData)
{
player = mc.thePlayer;
if (player == null || player.capabilities.isCreativeMode)
return;
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/newhearts.png");
int hp = player.getHealth();
for (int iter = 0; iter < hp / 20; iter++)
{
int renderHearts = (hp - 20*(iter+1)) / 2;
if (renderHearts > 10)
renderHearts = 10;
for (int i = 0; i < renderHearts; i++)
{
this.drawTexturedModalRect(122 + 8*i, 201, 0 + 18*iter, 0, 8, 8);
}
if (hp % 2 == 1 && renderHearts < 10)
{
this.drawTexturedModalRect(122 + 8*renderHearts, 201, 9 + 18*iter, 0, 8, 8);
}
}
/*int renderHearts = (hp - 20) / 2;
if (renderHearts > 10)
renderHearts = 10;
for (int i = 0; i < renderHearts; i++)
{
this.drawTexturedModalRect(122 + 8*i, 201, 0, 0, 8, 8);
}
renderHearts = (hp - 40) / 2;
if (renderHearts > 10)
renderHearts = 10;
for (int i = 0; i < renderHearts; i++)
{
this.drawTexturedModalRect(122 + 8*i, 201, 18, 0, 8, 8);
}
renderHearts = (hp - 60) / 2;
if (renderHearts > 10)
renderHearts = 10;
for (int i = 0; i < renderHearts; i++)
{
this.drawTexturedModalRect(122 + 8*i, 201, 36, 0, 8, 8);
}
renderHearts = (hp - 80) / 2;
if (renderHearts > 10)
renderHearts = 10;
for (int i = 0; i < renderHearts; i++)
{
this.drawTexturedModalRect(122 + 8*i, 201, 54, 0, 8, 8);
}*/
//this.drawTexturedModalRect(178, 201, 9, 0, 8, 8);
}
@Override
public EnumSet<TickType> ticks ()
{
return EnumSet.of(TickType.RENDER);
//return EnumSet.of(TickType.PLAYER);
}
@Override
public String getLabel ()
{
return "Gui Overlay";
}
public void drawTexturedModalRect(int par1, int par2, int par3, int par4, int par5, int par6)
{
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + par6), (double)this.zLevel, (double)((float)(par3 + 0) * f), (double)((float)(par4 + par6) * f1));
tessellator.addVertexWithUV((double)(par1 + par5), (double)(par2 + par6), (double)this.zLevel, (double)((float)(par3 + par5) * f), (double)((float)(par4 + par6) * f1));
tessellator.addVertexWithUV((double)(par1 + par5), (double)(par2 + 0), (double)this.zLevel, (double)((float)(par3 + par5) * f), (double)((float)(par4 + 0) * f1));
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.zLevel, (double)((float)(par3 + 0) * f), (double)((float)(par4 + 0) * f1));
tessellator.draw();
}
}

@ -98,8 +98,17 @@ public class GuiManual extends GuiScreen
void updateText () //TODO: OOP this, see BookPage
{
if (currentPage >= maxPages)
currentPage = maxPages - 2;
System.out.println("maxPages: "+maxPages);
if (maxPages % 2 == 1)
{
if (currentPage > maxPages)
currentPage = maxPages;
}
else
{
if (currentPage >= maxPages)
currentPage = maxPages - 2;
}
if (currentPage % 2 == 1)
currentPage--;
if (currentPage < 0)
@ -628,6 +637,7 @@ public class GuiManual extends GuiScreen
this.fontRenderer.drawString("\u00a7n" + info, localWidth + 25 + fontRenderer.getStringWidth(info) / 2, localHeight + 4, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
renderitem.zLevel = 100;
for (int i = 0; i < icons.length; i++)
{
renderitem.renderItemIntoGUI(fontRenderer, mc.renderEngine, icons[i], localWidth + 16, localHeight + 18 * i + 18);
@ -636,6 +646,7 @@ public class GuiManual extends GuiScreen
yOffset = 13;
this.fontRenderer.drawString(multiText[i], localWidth + 38, localHeight + 18 * i + yOffset, 0);
}
renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
@ -645,6 +656,7 @@ public class GuiManual extends GuiScreen
this.fontRenderer.drawSplitString(info, localWidth, localHeight, 178, 0);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
renderitem.zLevel = 100;
for (int i = 0; i < icons.length; i++)
{
renderitem.renderItemIntoGUI(fontRenderer, mc.renderEngine, icons[i], localWidth + 8, localHeight + 18 * i + 36);
@ -653,6 +665,7 @@ public class GuiManual extends GuiScreen
yOffset = 34;
this.fontRenderer.drawSplitString(multiText[i], localWidth + 30, localHeight + 18 * i + yOffset, 140, 0);
}
renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
@ -685,6 +698,7 @@ public class GuiManual extends GuiScreen
GL11.glScalef(2f, 2f, 2f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
renderitem.zLevel = 100;
if (recipeSize == 2)
{
@ -710,6 +724,7 @@ public class GuiManual extends GuiScreen
}
}
renderitem.zLevel = 0;
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
@ -729,6 +744,7 @@ public class GuiManual extends GuiScreen
GL11.glScalef(2f, 2f, 2f);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
renderitem.zLevel = 100;
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, TConstructClientRegistry.getManualIcon("coal"), (localWidth + 38) / 2, (localHeight + 110) / 2);
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, icons[0], (localWidth + 106) / 2, (localHeight + 74) / 2);
@ -737,6 +753,7 @@ public class GuiManual extends GuiScreen
if (icons[0].stackSize > 1)
renderitem.renderItemStack(fontRenderer, mc.renderEngine, icons[0], (localWidth + 106) / 2, (localHeight + 74) / 2, String.valueOf(icons[0].stackSize));
renderitem.zLevel = 0;
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
@ -759,12 +776,14 @@ public class GuiManual extends GuiScreen
if (type.equals("weapon"))
toolstack = TConstructClientRegistry.getManualIcon("ironlongsword");
renderitem.zLevel = 100;
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, toolstack, (localWidth + 54) / 2, (localHeight + 54) / 2);
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, icons[0], (localWidth + 130) / 2, (localHeight + 54) / 2);
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, icons[1], (localWidth + 18) / 2, (localHeight + 36) / 2);
if (icons[2] != null)
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, icons[2], (localWidth + 18) / 2, (localHeight + 74) / 2);
renderitem.zLevel = 0;
GL11.glScalef(0.5F, 0.5F, 0.5F);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
@ -781,10 +800,12 @@ public class GuiManual extends GuiScreen
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
renderitem.zLevel = 100;
//renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, icons[0], localWidth + 50, localHeight + 0);
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, icons[1], localWidth + 108, localHeight + 50);
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, icons[2], localWidth + 108, localHeight + 82);
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, icons[3], localWidth + 108, localHeight + 114);
renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
@ -825,12 +846,12 @@ public class GuiManual extends GuiScreen
if (material.shoddy() > 0)
{
this.fontRenderer.drawString("Shoddy level: " + material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
this.fontRenderer.drawString("Mining Aspect level: " + material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
}
else if (material.shoddy() < 0)
{
this.fontRenderer.drawString("Spiny level: " + -material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
this.fontRenderer.drawString("Splintering level: " + -material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
offset++;
}
}
@ -846,12 +867,14 @@ public class GuiManual extends GuiScreen
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
renderitem.zLevel = 100;
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, icons[0], localWidth + 50, localHeight + 0);
for (int i = 1; i < icons.length; i++)
{
renderitem.renderItemAndEffectIntoGUI(fontRenderer, mc.renderEngine, icons[i], localWidth + 120, localHeight + 20 + 10 * size + 18 * i);
this.fontRenderer.drawSplitString(multiText[i + 1], localWidth + 140, localHeight + 24 + 10 * size + 18 * i, 42, 0);
}
renderitem.zLevel = 0;
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}

@ -1,179 +1,285 @@
package mods.tinker.tconstruct.client.gui;
import mods.tinker.tconstruct.container.ActiveContainer;
import mods.tinker.tconstruct.container.PartCrafterChestContainer;
import mods.tinker.tconstruct.crafting.PatternBuilder;
import mods.tinker.tconstruct.library.TConstructRegistry;
import mods.tinker.tconstruct.library.ToolMaterial;
import mods.tinker.tconstruct.logic.PartCrafterLogic;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
public class PartCrafterGui extends GuiContainer
public class PartCrafterGui extends NewContainerGui
{
PartCrafterLogic logic;
String title, otherTitle = "";
boolean drawChestPart;
boolean hasTop, hasBottom;
ItemStack topMaterial, bottomMaterial;
ToolMaterial topEnum, bottomEnum;
public PartCrafterGui(InventoryPlayer inventoryplayer, PartCrafterLogic partlogic, World world, int x, int y, int z)
{
super(partlogic.getGuiContainer(inventoryplayer, world, x, y, z));
logic = partlogic;
drawChestPart = inventorySlots instanceof PartCrafterChestContainer;
title = "\u00A7nTool Part Crafting";
}
PartCrafterLogic logic;
String title, otherTitle = "";
boolean drawChestPart;
boolean hasTop, hasBottom;
ItemStack topMaterial, bottomMaterial;
ToolMaterial topEnum, bottomEnum;
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
this.fontRenderer.drawString(StatCollector.translateToLocal("crafters.PartBuilder"), 6, 6, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
if (drawChestPart)
this.fontRenderer.drawString(StatCollector.translateToLocal("inventory.PatternChest"), -108, this.ySize - 148, 4210752);
drawMaterialInformation();
}
void drawDefaultInformation()
{
title = "\u00A7nTool Part Building";
this.drawCenteredString(fontRenderer, title, xSize + 63, 8, 16777215);
fontRenderer.drawSplitString("Place a pattern and a material on the left to get started.", xSize + 8, 24, 115, 16777215);
}
void drawMaterialInformation ()
{
ItemStack top = logic.getStackInSlot(2);
ItemStack bottom = logic.getStackInSlot(3);
if (topMaterial != top)
{
topMaterial = top;
int topID = PatternBuilder.instance.getPartID(top);
if (topID != Short.MAX_VALUE)
{
topEnum = TConstructRegistry.getMaterial(topID);
hasTop = true;
title = "\u00A7n"+topEnum.name();
}
else
hasTop = false;
}
if (bottomMaterial != bottom)
{
bottomMaterial = bottom;
int bottomID = PatternBuilder.instance.getPartID(bottom);
if (bottomID != Short.MAX_VALUE)
{
bottomEnum = TConstructRegistry.getMaterial(bottomID);
hasBottom = true;
otherTitle = "\u00A7n"+bottomEnum.name();
}
else
hasBottom = false;
}
int offset = 8;
if (hasTop)
{
this.drawCenteredString(fontRenderer, title, xSize + 63, offset, 16777215);
this.fontRenderer.drawString("Base Durability: "+topEnum.durability(), xSize + 8, offset+16, 16777215);
this.fontRenderer.drawString("Handle Modifier: "+topEnum.handleDurability()+"x", xSize + 8, offset+27, 16777215);
this.fontRenderer.drawString("Mining Speed: "+topEnum.toolSpeed()/100f, xSize + 8, offset+38, 16777215);
this.fontRenderer.drawString("Mining Level: "+getHarvestLevelName(topEnum.harvestLevel()), xSize + 8, offset+49, 16777215);
this.fontRenderer.drawString("Base Attack: "+topEnum.attack(), xSize + 8, offset+60, 16777215);
}
offset = 90;
if (hasBottom)
{
this.drawCenteredString(fontRenderer, otherTitle, xSize + 63, offset, 16777215);
this.fontRenderer.drawString("Base Durability: "+bottomEnum.durability(), xSize + 8, offset+16, 16777215);
this.fontRenderer.drawString("Handle Modifier: "+bottomEnum.handleDurability()+"x", xSize + 8, offset+27, 16777215);
this.fontRenderer.drawString("Mining Speed: "+bottomEnum.toolSpeed()/100f, xSize + 8, offset+38, 16777215);
this.fontRenderer.drawString("Mining Level: "+getHarvestLevelName(bottomEnum.harvestLevel()), xSize + 8, offset+49, 16777215);
this.fontRenderer.drawString("Base Attack: "+bottomEnum.attack(), xSize + 8, offset+60, 16777215);
}
if (!hasTop && !hasBottom)
drawDefaultInformation();
}
public static String getHarvestLevelName (int num)
{
switch (num)
{
case 0:
return "Stone";
case 1:
return "Iron";
case 2:
return "Redstone";
case 3:
return "Obsidian";
case 4:
return "Cobalt";
case 5:
return "Manyullyn";
default:
return String.valueOf(num);
}
}
public PartCrafterGui(InventoryPlayer inventoryplayer, PartCrafterLogic partlogic, World world, int x, int y, int z)
{
super((ActiveContainer) partlogic.getGuiContainer(inventoryplayer, world, x, y, z));
logic = partlogic;
drawChestPart = container instanceof PartCrafterChestContainer;
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
{
// Draw the background
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/toolparts.png");
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
title = "\u00A7nTool Part Crafting";
}
// Draw Slots
this.drawTexturedModalRect(cornerX + 39, cornerY + 26, 0, 166, 98, 36);
if (!logic.isStackInSlot(0))
{
this.drawTexturedModalRect(cornerX + 39, cornerY + 26, 176, 0, 18, 18);
}
if (!logic.isStackInSlot(2))
{
this.drawTexturedModalRect(cornerX + 57, cornerY + 26, 176, 18, 18, 18);
}
if (!logic.isStackInSlot(1))
{
this.drawTexturedModalRect(cornerX + 39, cornerY + 44, 176, 0, 18, 18);
}
if (!logic.isStackInSlot(3))
{
this.drawTexturedModalRect(cornerX + 57, cornerY + 44, 176, 36, 18, 18);
}
// Draw chest
if (drawChestPart)
{
//texID = this.mc.renderEngine.getTexture("/mods/tinker/textures/gui/patternchestmini.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
//his.mc.renderEngine.bindTexture(texID);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/patternchestmini.png");
this.drawTexturedModalRect(cornerX-116, cornerY+11, 0, 0, this.xSize, this.ySize);
}
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
this.fontRenderer.drawString(StatCollector.translateToLocal("crafters.PartBuilder"), 6, 6, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
if (drawChestPart)
this.fontRenderer.drawString(StatCollector.translateToLocal("inventory.PatternChest"), -108, this.ySize - 148, 4210752);
// Draw description
//texID = this.mc.renderEngine.getTexture("/mods/tinker/textures/gui/description.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
//this.mc.renderEngine.bindTexture(texID);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/description.png");
cornerX = (this.width + this.xSize) / 2;
cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 126, 0, 126, this.ySize);
}
drawMaterialInformation();
}
void drawDefaultInformation ()
{
title = "\u00A7nTool Part Building";
this.drawCenteredString(fontRenderer, title, xSize + 63, 8, 16777215);
fontRenderer.drawSplitString("Place a pattern and a material on the left to get started.", xSize + 8, 24, 115, 16777215);
}
void drawMaterialInformation ()
{
ItemStack top = logic.getStackInSlot(2);
ItemStack bottom = logic.getStackInSlot(3);
if (topMaterial != top)
{
topMaterial = top;
int topID = PatternBuilder.instance.getPartID(top);
if (topID != Short.MAX_VALUE)
{
topEnum = TConstructRegistry.getMaterial(topID);
hasTop = true;
title = "\u00A7n" + topEnum.name();
}
else
hasTop = false;
}
if (bottomMaterial != bottom)
{
bottomMaterial = bottom;
int bottomID = PatternBuilder.instance.getPartID(bottom);
if (bottomID != Short.MAX_VALUE)
{
bottomEnum = TConstructRegistry.getMaterial(bottomID);
hasBottom = true;
otherTitle = "\u00A7n" + bottomEnum.name();
}
else
hasBottom = false;
}
int offset = 8;
if (hasTop)
{
this.drawCenteredString(fontRenderer, title, xSize + 63, offset, 16777215);
this.fontRenderer.drawString("Base Durability: " + topEnum.durability(), xSize + 8, offset + 16, 16777215);
this.fontRenderer.drawString("Handle Modifier: " + topEnum.handleDurability() + "x", xSize + 8, offset + 27, 16777215);
this.fontRenderer.drawString("Mining Speed: " + topEnum.toolSpeed() / 100f, xSize + 8, offset + 38, 16777215);
this.fontRenderer.drawString("Mining Level: " + getHarvestLevelName(topEnum.harvestLevel()), xSize + 8, offset + 49, 16777215);
this.fontRenderer.drawString("Base Attack: " + topEnum.attack(), xSize + 8, offset + 60, 16777215);
}
offset = 90;
if (hasBottom)
{
this.drawCenteredString(fontRenderer, otherTitle, xSize + 63, offset, 16777215);
this.fontRenderer.drawString("Base Durability: " + bottomEnum.durability(), xSize + 8, offset + 16, 16777215);
this.fontRenderer.drawString("Handle Modifier: " + bottomEnum.handleDurability() + "x", xSize + 8, offset + 27, 16777215);
this.fontRenderer.drawString("Mining Speed: " + bottomEnum.toolSpeed() / 100f, xSize + 8, offset + 38, 16777215);
this.fontRenderer.drawString("Mining Level: " + getHarvestLevelName(bottomEnum.harvestLevel()), xSize + 8, offset + 49, 16777215);
this.fontRenderer.drawString("Base Attack: " + bottomEnum.attack(), xSize + 8, offset + 60, 16777215);
}
if (!hasTop && !hasBottom)
drawDefaultInformation();
}
public static String getHarvestLevelName (int num)
{
switch (num)
{
case 0:
return "Stone";
case 1:
return "Iron";
case 2:
return "Redstone";
case 3:
return "Obsidian";
case 4:
return "Cobalt";
case 5:
return "Manyullyn";
default:
return String.valueOf(num);
}
}
protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3)
{
// Draw the background
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/toolparts.png");
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
// Draw Slots
this.drawTexturedModalRect(cornerX + 39, cornerY + 26, 0, 166, 98, 36);
if (!logic.isStackInSlot(0))
{
this.drawTexturedModalRect(cornerX + 39, cornerY + 26, 176, 0, 18, 18);
}
if (!logic.isStackInSlot(2))
{
this.drawTexturedModalRect(cornerX + 57, cornerY + 26, 176, 18, 18, 18);
}
if (!logic.isStackInSlot(1))
{
this.drawTexturedModalRect(cornerX + 39, cornerY + 44, 176, 0, 18, 18);
}
if (!logic.isStackInSlot(3))
{
this.drawTexturedModalRect(cornerX + 57, cornerY + 44, 176, 36, 18, 18);
}
// Draw chest
if (drawChestPart)
{
//texID = this.mc.renderEngine.getTexture("/mods/tinker/textures/gui/patternchestmini.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
//his.mc.renderEngine.bindTexture(texID);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/patternchestmini.png");
this.drawTexturedModalRect(cornerX - 116, cornerY + 11, 0, 0, this.xSize, this.ySize);
}
// Draw description
//texID = this.mc.renderEngine.getTexture("/mods/tinker/textures/gui/description.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
//this.mc.renderEngine.bindTexture(texID);
this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/description.png");
cornerX = (this.width + this.xSize) / 2;
cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 126, 0, 126, this.ySize);
}
@Override
protected void mouseClicked (int mouseX, int mouseY, int clickNum)
{
boolean flag = clickNum == this.mc.gameSettings.keyBindPickBlock.keyCode + 100;
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
long l = Minecraft.getSystemTime();
this.field_94074_J = this.field_94072_H == slot && l - this.field_94070_G < 250L && this.field_94073_I == clickNum;
this.field_94068_E = false;
int offsetLeft = drawChestPart ? 108 : 0;
if (clickNum == 0 || clickNum == 1 || flag)
{
int i1 = this.guiLeft;
int j1 = this.guiTop;
boolean flag1 = mouseX < i1 - offsetLeft || mouseY < j1 || mouseX >= i1 + this.xSize || mouseY >= j1 + this.ySize;
int k1 = -1;
if (slot != null)
{
k1 = slot.slotNumber;
}
if (flag1)
{
k1 = -999;
}
if (this.mc.gameSettings.touchscreen && flag1 && this.mc.thePlayer.inventory.getItemStack() == null)
{
this.mc.displayGuiScreen((GuiScreen) null);
return;
}
if (k1 != -1)
{
if (this.mc.gameSettings.touchscreen)
{
if (slot != null && slot.getHasStack())
{
this.clickedSlot = slot;
this.draggedStack = null;
this.isRightMouseClick = clickNum == 1;
}
else
{
this.clickedSlot = null;
}
}
else if (!this.field_94076_q)
{
if (this.mc.thePlayer.inventory.getItemStack() == null)
{
if (clickNum == this.mc.gameSettings.keyBindPickBlock.keyCode + 100)
{
this.handleMouseClick(slot, k1, clickNum, 3);
}
else
{
boolean flag2 = k1 != -999 && (Keyboard.isKeyDown(42) || Keyboard.isKeyDown(54));
byte b0 = 0;
if (flag2)
{
this.field_94075_K = slot != null && slot.getHasStack() ? slot.getStack() : null;
b0 = 1;
}
else if (k1 == -999)
{
b0 = 4;
}
this.handleMouseClick(slot, k1, clickNum, b0);
}
this.field_94068_E = true;
}
else
{
this.field_94076_q = true;
this.field_94067_D = clickNum;
this.field_94077_p.clear();
if (clickNum == 0)
{
this.field_94071_C = 0;
}
else if (clickNum == 1)
{
this.field_94071_C = 1;
}
}
}
}
}
this.field_94072_H = slot;
this.field_94070_G = l;
this.field_94073_I = clickNum;
}
}

@ -11,6 +11,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
@ -39,21 +40,9 @@ public class SmelteryGui extends NewContainerGui
int slotPos = 0;
int prevSlotPos = 0;
/*private Slot theSlot;
private Slot clickedSlot = null;
private ItemStack draggedStack = null;
private boolean isRightMouseClick = false;
private int field_94069_F;
private long returningStackTime = 0L;
private ItemStack returningStack = null;
private Slot returningStackDestSlot = null;
private int field_85049_r = 0;
private int field_85048_s = 0;*/
public SmelteryGui(InventoryPlayer inventoryplayer, SmelteryLogic smeltery, World world, int x, int y, int z)
{
super((ActiveContainer) smeltery.getGuiContainer(inventoryplayer, world, x, y, z));
//container = (SmelteryContainer) inventorySlots;
logic = smeltery;
username = inventoryplayer.player.username;
xSize = 248;
@ -224,8 +213,19 @@ public class SmelteryGui extends NewContainerGui
}
}
//fontRenderer.drawString("Time: "+logic.useTime, 140, 2, 0xFFFFFF);
//fontRenderer.drawString("slotPos: "+slotPos, 140, 2, 0xFFFFFF);
/*fontRenderer.drawString("Scrolling: "+isScrolling, 140, 12, 0xFFFFFF);
fontRenderer.drawString("Scroll: "+currentScroll, 140, 22, 0xFFFFFF);*/
}
public void drawLiquidRect(int par1, int par2, Icon par3Icon, int par4, int par5)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMaxV());
tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.getMaxU(), (double)par3Icon.getMaxV());
tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + 0), (double)this.zLevel, (double)par3Icon.getMaxU(), (double)par3Icon.getMinV());
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMinV());
tessellator.draw();
}
}

@ -1,14 +1,14 @@
package mods.tinker.tconstruct.container;
import mods.tinker.common.IPattern;
import mods.tinker.tconstruct.logic.PartCrafterLogic;
import mods.tinker.tconstruct.logic.PatternChestLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class PartCrafterChestContainer extends Container
public class PartCrafterChestContainer extends ActiveContainer
{
protected PatternChestLogic patternLogic;
protected InventoryPlayer invPlayer;
@ -77,9 +77,15 @@ public class PartCrafterChestContainer extends Container
return null;
}
}
else if (!this.mergeItemStack(slotStack, 2, 4, false))
else
{
return null;
if (slotStack.getItem() instanceof IPattern)
{
if (!this.mergeItemStack(slotStack, 0, 2, false) && ! this.mergeItemStack(slotStack, 8, 38, false))
return null;
}
else if (!this.mergeItemStack(slotStack, 2, 4, false))
return null;
}
if (slotStack.stackSize == 0)

@ -1,5 +1,6 @@
package mods.tinker.tconstruct.container;
import mods.tinker.common.IPattern;
import mods.tinker.tconstruct.logic.PartCrafterLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@ -7,7 +8,7 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class PartCrafterContainer extends Container
public class PartCrafterContainer extends ActiveContainer
{
protected InventoryPlayer invPlayer;
protected PartCrafterLogic logic;
@ -66,9 +67,15 @@ public class PartCrafterContainer extends Container
return null;
}
}
else if (!this.mergeItemStack(slotStack, 2, 4, false))
else
{
return null;
if (slotStack.getItem() instanceof IPattern)
{
if (!this.mergeItemStack(slotStack, 0, 2, false))
return null;
}
else if (!this.mergeItemStack(slotStack, 2, 4, false))
return null;
}
if (slotStack.stackSize == 0)

@ -71,6 +71,7 @@ public class SmelteryContainer extends ActiveContainer
slot.xDisplayPosition = 2 + 22 * xPos;
slot.yDisplayPosition = 8 + 18 * yPos;
}
return slotRow;
}
return -1;
}
@ -181,8 +182,9 @@ public class SmelteryContainer extends ActiveContainer
Slot slot;
ItemStack slotStack;
if (inputStack.isStackable())
/*if (inputStack.isStackable() && startSlot >= logic.getSizeInventory())
{
System.out.println("Rawr!");
while (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag && slotPos >= startSlot))
{
slot = (Slot) this.inventorySlots.get(slotPos);
@ -208,6 +210,44 @@ public class SmelteryContainer extends ActiveContainer
}
}
if (flag)
{
--slotPos;
}
else
{
++slotPos;
}
}
}*/
if (inputStack.isStackable() && startSlot >= logic.getSizeInventory())
{
while (inputStack.stackSize > 0 && (!flag && slotPos < endSlot || flag && slotPos >= startSlot))
{
slot = (Slot)this.inventorySlots.get(slotPos);
slotStack = slot.getStack();
if (slotStack != null && slotStack.itemID == inputStack.itemID && (!inputStack.getHasSubtypes() || inputStack.getItemDamage() == slotStack.getItemDamage()) && ItemStack.areItemStackTagsEqual(inputStack, slotStack))
{
int l = slotStack.stackSize + inputStack.stackSize;
if (l <= inputStack.getMaxStackSize())
{
inputStack.stackSize = 0;
slotStack.stackSize = l;
slot.onSlotChanged();
merged = true;
}
else if (slotStack.stackSize < inputStack.getMaxStackSize())
{
inputStack.stackSize -= inputStack.getMaxStackSize() - slotStack.stackSize;
slotStack.stackSize = inputStack.getMaxStackSize();
slot.onSlotChanged();
merged = true;
}
}
if (flag)
{
--slotPos;

@ -1,20 +1,20 @@
package mods.tinker.tconstruct.entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
public class Skyla extends EntityPlayer
public class Skyla extends EntityCreeper
{
public Skyla(World par1World)
{
super(par1World);
username = "Skyla";
texture = "/tinkertextures/mob/skyla.png";
//username = "Skyla";
texture = "/mods/tinker/textures/mob/skyla.png";
}
@Override
/*@Override
public void sendChatToPlayer (String var1) {}
@Override
@ -27,6 +27,6 @@ public class Skyla extends EntityPlayer
public ChunkCoordinates getPlayerCoordinates ()
{
return null;
}
}*/
}

@ -189,10 +189,11 @@ public abstract class ToolCore extends Item implements ICustomElectricItem, IBox
@Override
public Icon getIcon (ItemStack stack, int renderPass)
{
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
NBTTagCompound tags = stack.getTagCompound();
if (tags != null)
{
tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (renderPass < getPartAmount())
{
if (renderPass == 0) // Handle

@ -22,6 +22,13 @@ public class ToolStationLogic extends InventoryLogic
super(5);
toolName = "";
}
public boolean canDropInventorySlot(int slot)
{
if (slot == 0)
return false;
return true;
}
@Override
public ItemStack getStackInSlotOnClosing (int var1)

Binary file not shown.

After

(image error) Size: 1.6 KiB

@ -1,7 +1,6 @@
package test;
import mods.tinker.tconstruct.entity.BlueSlime;
import mods.tinker.tconstruct.entity.NitroCreeper;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
@ -9,6 +8,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
/*
@ -23,34 +23,31 @@ public class XinStick extends Item
super(id);
setCreativeTab(CreativeTabs.tabMisc);
}
public Icon getIconFromDamage(int par1)
{
return Item.arrow.getIconFromDamage(par1);
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
//spawnItem(player.posX, player.posY, player.posZ, tool, world);
//CartEntity cart = new CartEntity(world, 1);
//cart.cartType = 1;
spawnEntity(player.posX, player.posY+1, player.posZ, new NitroCreeper(world), world, player);
spawnEntity(player.posX, player.posY+1, player.posZ, new BlueSlime(world), world, player);
System.out.println("Health! "+player.getHealth());
//healPlayer(player);
return stack;
}
/*public boolean onItemUse (ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
public static void healPlayer(EntityPlayer player)
{
if (!par3World.isRemote)
{
par3World.spawnEntityInWorld(new CartEntity(par3World, (double) ((float) par4 + 0.5F), (double) ((float) par5 + 1.5F), (double) ((float) par6 + 0.5F), 0));
}
//--par1ItemStack.stackSize;
return true;
}*/
player.setEntityHealth(200);
}
public static void spawnItem (double x, double y, double z, ItemStack stack, World world)
{
if (!world.isRemote)
{
EntityItem entityitem = new EntityItem(world, x + 0.5D, y + 0.5D, z + 0.5D, stack);
//entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
}