This commit is contained in:
mDiyo 2013-01-22 00:14:19 -08:00
parent a87babcf0b
commit a6fa0576ab
29 changed files with 506 additions and 117 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -48,6 +48,7 @@ public class PHConstruct {
craftedSoil = config.getBlock("Special Soil", 1476).getInt(1476);
searedBrick = config.getBlock("Seared Brick", 1477).getInt(1477);
blankPattern = config.getItem("Patterns and Misc", "Blank Patterns", 14019).getInt(14019);
materials = config.getItem("Patterns and Misc", "Materials", 14020).getInt(14020);
toolRod = config.getItem("Patterns and Misc", "Tool Rod", 14021).getInt(14021);
toolShard = config.getItem("Patterns and Misc", "Tool Shard", 14022).getInt(14022);
@ -91,6 +92,7 @@ public class PHConstruct {
}
//Blocks
public static int blankPattern;
public static int woodCrafter;
public static int stoneCrafter;
public static int netherCrafter;

View File

@ -23,7 +23,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
* @author: mDiyo
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "A18")
@Mod(modid = "TConstruct", name = "TConstruct", version = "Beta 1")
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels={"TConstruct"}, packetHandler = tinker.tconstruct.TConstructPacketHandler.class)
public class TConstruct
{
@ -34,7 +34,7 @@ public class TConstruct
@SidedProxy(clientSide = "tinker.tconstruct.client.TProxyClient", serverSide = "tinker.tconstruct.TProxyCommon")
public static TProxyCommon proxy;
public static ArrayList<ToolGuiElement> toolButtons = new ArrayList<ToolGuiElement>(30);
public static ArrayList<ToolGuiElement> toolButtons = new ArrayList<ToolGuiElement>(20);
@PreInit
public void preInit(FMLPreInitializationEvent evt)
@ -74,7 +74,7 @@ public class TConstruct
new int[] {2, 5, 0}, //Shovel
new int[] {2, 6, 0}, //Axe
//new int[] {2, 9, 0}, //Lumber Axe
new int[] {1, 7, 0}, //Ice Axe
//new int[] {1, 7, 0}, //Ice Axe
new int[] {3, 8, 0}, //Mattock
new int[] {1, 0, 1}, //Broadsword
new int[] {1, 1, 1}, //Longsword
@ -89,7 +89,7 @@ public class TConstruct
new int[] { 3, 0, 13 }, new int[] { 2, 3, 13 }, //Shovel
new int[] { 2, 0, 13 }, new int[] { 2, 3, 13 }, //Axe
//new int[] { 6, 0, 13 }, new int[] { 2, 3, 13 }, //Lumber Axe
new int[] { 0, 0, 5 }, new int[] { 2, 3, 3 }, //Ice Axe
//new int[] { 0, 0, 5 }, new int[] { 2, 3, 3 }, //Ice Axe
new int[] { 2, 0, 3 }, new int[] { 2, 3, 2 }, //Mattock
new int[] { 1, 0, 2 }, new int[] { 2, 3, 3 }, //Broadsword
new int[] { 1, 0, 3 }, new int[] { 2, 3, 3 }, //Longsword
@ -104,7 +104,7 @@ public class TConstruct
"Shovel",
"Axe",
//"Lumber Axe",
"Ice Axe",
//"Ice Axe",
"Mattock",
"Broadsword",
"Longsword",
@ -119,13 +119,14 @@ public class TConstruct
"The Shovel is a basic digging tool. It is effective on dirt and sand.\n\nRequired parts:\n- Shovel Head\n- Handle",
"The Axe is a basic chopping tool. It is effective on wood and leaves.\n\nRequired parts:\n- Axe Head\n- Handle",
//"The Lumber Axe is a broad chopping tool. It harvests wood in a wide range and can fell entire trees.\n\nRequired parts:\n- Broad Axe Head\n- Handle",
"The Ice Axe is a tool for harvesting ice, mining, and attacking foes.\n\nSpecial Ability:\n- Wall Climb\nNatural Ability:\n- Ice Harvest\nDamage: Moderate\n\nRequired parts:\n- Pickaxe Head\n- Spike\n- Handle",
//"The Ice Axe is a tool for harvesting ice, mining, and attacking foes.\n\nSpecial Ability:\n- Wall Climb\nNatural Ability:\n- Ice Harvest\nDamage: Moderate\n\nRequired parts:\n- Pickaxe Head\n- Spike\n- Handle",
"The Cutter Mattock is a multi-use tool. It is effective on wood, leaves, dirt, and sand.\n\nSpecial Ability: Hoe\n\nRequired parts:\n- Axe Head\n- Shovel Head\n- Handle",
"The Broadsword is a defensive weapon. Blocking cuts damage in half.\n\nSpecial Ability: Block\nDamage: Moderate\nDurability: High\n\nRequired parts:\n- Sword Blade\n- Wide Guard\n- Handle",
"The Longsword is a balanced weapon. It is useful for knocking enemies away or getting in and out of battle quickly.\n\nSpecial Ability: Lunge\nDamage: Moderate\nDurability: Moderate\n\nRequired parts:\n- Sword Blade\n- Hand Guard\n- Handle",
"The Rapier is an offensive weapon that relies on quick strikes to defeat foes.\n\nNatural Abilities:\n- Armor Pierce\n- Quick Strike\nDamage: High\nDurability: Low\n\nRequired parts:\n- Sword Blade\n- Crossbar\n- Handle",
"The Frying is a heavy weapon that uses sheer weight to stun foes.\n\nSpecial Ability: Block\nNatural Ability: Bash\nShift+rClick: Place Frying Pan\nDamage: High\nDurability: High\n\nRequired parts:\n- Pan\n- Handle",
"The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nShift-rClick: Place sign\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Board\n- Handle"
//"The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nShift-rClick: Place sign\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Board\n- Handle"
"The Battlesign is an advance in weapon technology worthy of Zombie Pigmen everywhere.\n\nSpecial Ability: Block\nDamage: Low\nDurability: Average\n\nRequired parts:\n- Sign Board\n- Handle"
};
void addToolButtons()

View File

@ -18,6 +18,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class TConstructContent
{
//Patterns and other materials
public static Item blankPattern;
public static Item materials;
public static Item toolRod;
public static Item toolShard;
@ -110,6 +111,7 @@ public class TConstructContent
GameRegistry.registerBlock(searedBrick, tinker.tconstruct.blocks.SearedBrickItemBlock.class, "SearedBrick");
MinecraftForge.setBlockHarvestLevel(searedBrick, 0, "pickaxe", 2);
blankPattern = new CraftingItem(PHConstruct.blankPattern, 96, craftingTexture).setItemName("tconstruct.BlankPattern");
materials = new Materials(PHConstruct.materials, 128, craftingTexture).setItemName("tconstruct.Materials");
toolRod = new ToolPart(PHConstruct.toolRod, 0, craftingTexture).setItemName("tconstruct.ToolRod");
toolShard = new ToolPart(PHConstruct.toolShard, 64, craftingTexture).setItemName("tconstruct.ToolShard");
@ -145,6 +147,8 @@ public class TConstructContent
//lumberHead = new ToolPart(PHConstruct.lumberHead, 0, broadheads).setItemName("tconstruct.LumberHead");
}
public static Item[] patternOutputs = { toolRod, pickaxeHead, shovelHead, axeHead, swordBlade, largeGuard, medGuard, crossbar, binding, frypanHead, signHead };
void registerMaterials ()
{
PatternBuilder pb = PatternBuilder.instance;
@ -160,10 +164,10 @@ public class TConstructContent
pb.registerFullMaterial(new ItemStack(materials, 1, 1), 2, "slime", new ItemStack(toolShard, 1, 8), new ItemStack(toolRod, 1, 8), 8);
pb.registerFullMaterial(new ItemStack(materials, 1, 0), 2, "paper", new ItemStack(Item.paper), new ItemStack(toolRod, 1, 9), 9);
Item[] items = { toolRod, pickaxeHead, shovelHead, axeHead, swordBlade, largeGuard, medGuard, crossbar, binding, frypanHead, signHead };
for (int iter = 0; iter < items.length; iter++)
for (int iter = 0; iter < patternOutputs.length; iter++)
{
pb.addToolPattern(new ItemStack(woodPattern, 1, iter+1), items[iter]);
pb.addToolPattern(new ItemStack(woodPattern, 1, iter+1), patternOutputs[iter]);
//pb.addToolPattern(new ItemStack(stonePattern, 1, iter+1), items[iter]);
//pb.addToolPattern(new ItemStack(netherPattern, 1, iter+1), items[iter]);
}
@ -191,12 +195,12 @@ public class TConstructContent
tb.registerToolMod(modE);
tb.registerToolMod(new ModRedstone(new ItemStack[] {new ItemStack(Item.redstone)}, 2, 1));
tb.registerToolMod(new ModRedstone(new ItemStack[] { new ItemStack(Item.redstone), new ItemStack(Item.redstone) }, 2, 2));
tb.registerToolMod(new ModLapisBase(new ItemStack[] {new ItemStack(Block.blockLapis), new ItemStack(Block.blockLapis)}, 10));
tb.registerToolMod(new ModLapisIncrease(new ItemStack[] {new ItemStack(Item.dyePowder, 1, 4)}, 10, 1));
tb.registerToolMod(new ModLapisIncrease(new ItemStack[] {new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Item.dyePowder, 1, 4)}, 10, 2));
tb.registerToolMod(new ModLapisIncrease(new ItemStack[] {new ItemStack(Block.blockLapis)}, 10, 9));
tb.registerToolMod(new ModLapisIncrease(new ItemStack[] {new ItemStack(Item.dyePowder, 1, 4), new ItemStack(Block.blockLapis)}, 10, 10));
tb.registerToolMod(new ModLapisIncrease(new ItemStack[] {new ItemStack(Block.blockLapis), new ItemStack(Block.blockLapis)}, 10, 18));
tb.registerToolMod(new ModLapisBase(new ItemStack[] {new ItemStack(Block.blockLapis), new ItemStack(Block.blockLapis)}, 10));
tb.registerToolMod(new ModInteger(new ItemStack[] {new ItemStack(materials, 1, 6)}, 4, "Moss", 3, "\u00a72", "Auto-Repair"));
tb.registerToolMod(new ModBlaze(new ItemStack[] {new ItemStack(Item.blazePowder)}, 7, 1));
tb.registerToolMod(new ModBlaze(new ItemStack[] {new ItemStack(Item.blazePowder), new ItemStack(Item.blazePowder)}, 7, 2));
@ -218,16 +222,16 @@ public class TConstructContent
{
/*GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 0), "c", 'c', Block.workbench);
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 1), "cc", 'c', Block.workbench);*/
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 0), "p", "w", 'p', new ItemStack(woodPattern, 1, 0), 'w', Block.workbench);
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 1), "p", "w", 'p', new ItemStack(woodPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 0));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 2), "p", "w", 'p', new ItemStack(woodPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 1));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 3), "p", "w", 'p', new ItemStack(woodPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 2));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 4), "p", "w", 'p', new ItemStack(woodPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 3));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 5), "p", "w", 'p', new ItemStack(woodPattern, 1, 0), 'w', Block.chest);
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 10), "p", "w", 'p', new ItemStack(woodPattern, 1, 0), 'w', Block.planks);
GameRegistry.addRecipe( new ShapedOreRecipe(new ItemStack(woodCrafter, 1, 1), "p", "w", 'p', new ItemStack(woodPattern, 1, 0), 'w', "logWood"));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 0), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', Block.workbench);
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 1), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 0));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 2), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 1));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 3), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 2));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 4), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', new ItemStack(Block.wood, 1, 3));
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 5), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', Block.chest);
GameRegistry.addRecipe(new ItemStack(woodCrafter, 1, 10), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', Block.planks);
GameRegistry.addRecipe( new ShapedOreRecipe(new ItemStack(woodCrafter, 1, 1), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "logWood"));
GameRegistry.addRecipe( new ShapedOreRecipe(new ItemStack(woodPattern, 1, 0), "ps", "sp", 'p', "plankWood", 's', Item.stick));
GameRegistry.addRecipe( new ShapedOreRecipe(new ItemStack(blankPattern, 1, 0), "ps", "sp", 'p', "plankWood", 's', Item.stick));
/*GameRegistry.addRecipe(new ItemStack(stonePattern, 1, 0), "ps", "sp", 'p', Block.cobblestone, 's', new ItemStack(toolRod, 1, 1));
GameRegistry.addRecipe(new ItemStack(stonePattern, 1, 0), "ps", "sp", 'p', Block.stone, 's', new ItemStack(toolRod, 1, 1));
GameRegistry.addRecipe(new ItemStack(netherPattern, 1, 0), "ps", "sp", 'p', Block.netherrack, 's', new ItemStack(toolRod, 1, 7));*/
@ -235,7 +239,7 @@ public class TConstructContent
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), " c ", "cbc", " c ", 'b', Item.bucketLava, 'c', Item.coal); //Auto-smelt
GameRegistry.addShapelessRecipe(new ItemStack(materials, 1, 8), Item.bone, Item.rottenFlesh, Item.chickenRaw, Item.beefRaw, Item.porkRaw); //Necrotic bone
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, 1), Item.clay, Block.sand, Block.gravel); //Grout, Add stone dust?
@ -267,10 +271,6 @@ public class TConstructContent
TConstruct.toolTab.init(tool);
}
ItemStack[] materialArray = { new ItemStack(Block.planks), new ItemStack(Block.cobblestone), new ItemStack(Item.ingotIron), new ItemStack(Item.flint),
new ItemStack(Block.cactus), new ItemStack(Item.bone), new ItemStack(Block.obsidian), new ItemStack(Block.netherrack), new ItemStack(Item.slimeBall),
new ItemStack(Item.paper) };
public static String blockTexture = "/tinkertextures/ConstructBlocks.png";
public static String craftingTexture = "/tinkertextures/materials.png";

View File

@ -4,8 +4,18 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import tinker.common.InventoryLogic;
import tinker.tconstruct.client.gui.*;
import tinker.tconstruct.logic.*;
import tinker.tconstruct.client.gui.FrypanGui;
import tinker.tconstruct.client.gui.PartCrafterGui;
import tinker.tconstruct.client.gui.PatternChestGui;
import tinker.tconstruct.client.gui.PatternShaperGui;
import tinker.tconstruct.client.gui.SmelteryGui;
import tinker.tconstruct.client.gui.ToolStationGui;
import tinker.tconstruct.logic.FrypanLogic;
import tinker.tconstruct.logic.PartCrafterLogic;
import tinker.tconstruct.logic.PatternChestLogic;
import tinker.tconstruct.logic.PatternShaperLogic;
import tinker.tconstruct.logic.SmelteryLogic;
import tinker.tconstruct.logic.ToolStationLogic;
import cpw.mods.fml.common.network.IGuiHandler;
public class TConstructGuiHandler implements IGuiHandler
@ -21,6 +31,7 @@ public class TConstructGuiHandler implements IGuiHandler
@Override
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile != null && tile instanceof InventoryLogic)
return ((InventoryLogic) tile).getGuiContainer(player.inventory, world, x, y, z);
@ -40,6 +51,8 @@ public class TConstructGuiHandler implements IGuiHandler
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);
return null;
}

View File

@ -4,11 +4,13 @@ import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import net.minecraft.item.ItemStack;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import tinker.common.InventoryLogic;
import tinker.tconstruct.logic.ToolStationLogic;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IPacketHandler;
@ -32,34 +34,51 @@ public class TConstructPacketHandler implements IPacketHandler
{
DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
byte packetID;
int dimension;
int x;
int y;
int z;
String toolName;
try
{
packetID = inputStream.readByte();
dimension = inputStream.readInt();
x = inputStream.readInt();
y = inputStream.readInt();
z = inputStream.readInt();
toolName = inputStream.readUTF();
WorldServer world = DimensionManager.getWorld(dimension);
TileEntity te = world.getBlockTileEntity(x, y, z);
if (packetID == 1)
{
String toolName = inputStream.readUTF();
if (te instanceof ToolStationLogic)
{
((ToolStationLogic)te).setToolname(toolName);
}
}
else if (packetID == 2)
{
Short itemID = inputStream.readShort();
Short itemDamage = inputStream.readShort();
if (te instanceof InventoryLogic)
{
((InventoryLogic)te).setInventorySlotContents(1, new ItemStack(itemID, 1, itemDamage));
}
}
}
catch (IOException e)
{
System.out.println("Failed at reading packet");
System.out.println("Failed at reading packet for TConstruct. Blarrrrrrrrrgh");
e.printStackTrace();
return;
}
WorldServer world = DimensionManager.getWorld(dimension);
TileEntity te = world.getBlockTileEntity(x, y, z);
if (te instanceof ToolStationLogic)
{
((ToolStationLogic)te).setToolname(toolName);
System.out.println("Successfully processed packet");
}
}
}

View File

@ -5,10 +5,12 @@ import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import tinker.common.InventoryBlock;
import tinker.tconstruct.TConstructGuiHandler;
import tinker.tconstruct.TConstruct;
import tinker.tconstruct.TConstructGuiHandler;
import tinker.tconstruct.client.FrypanRender;
import tinker.tconstruct.logic.FrypanLogic;
public class EquipBlock extends InventoryBlock
@ -17,7 +19,7 @@ public class EquipBlock extends InventoryBlock
public EquipBlock(int id, Material material)
{
super(id, material);
this.setHardness(2f);
this.setHardness(0.3f);
this.setBlockBounds(0, 0, 0, 1, 0.25f, 1);
//this.setCreativeTab(ToolConstruct.materialTab);
}
@ -32,6 +34,24 @@ public class EquipBlock extends InventoryBlock
//return 22 + meta*6 + side;
return 22;
}
@Override
public boolean renderAsNormalBlock ()
{
return false;
}
@Override
public boolean isOpaqueCube ()
{
return false;
}
@Override
public int getRenderType ()
{
return FrypanRender.frypanModelID;
}
@Override
public int idDropped (int par1, Random par2Random, int par3)
@ -43,55 +63,28 @@ public class EquipBlock extends InventoryBlock
{
return new FrypanLogic();
}
/*@Override
public void breakBlock (World par1World, int x, int y, int z, int par5, int par6)
public void randomDisplayTick (World world, int x, int y, int z, Random random)
{
EquipLogic logic = (EquipLogic) par1World.getBlockTileEntity(x, y, z);
if (logic != null)
if (isActive(world, x, y, z))
{
ItemStack equip = logic.getEquipmentItem();
if (equip != null)
{
float jumpX = ToolConstruct.tRand.nextFloat() * 0.8F + 0.1F;
float jumpY = ToolConstruct.tRand.nextFloat() * 0.8F + 0.1F;
float jumpZ = ToolConstruct.tRand.nextFloat() * 0.8F + 0.1F;
while (equip.stackSize > 0)
{
int itemSize = ToolConstruct.tRand.nextInt(21) + 10;
if (itemSize > equip.stackSize)
{
itemSize = equip.stackSize;
}
equip.stackSize -= itemSize;
EntityItem entityitem = new EntityItem(par1World, (double) ((float) x + jumpX), (double) ((float) y + jumpY), (double) ((float) z + jumpZ), new ItemStack(equip.itemID, itemSize, equip.getItemDamage()));
if (equip.hasTagCompound())
{
entityitem.func_92014_d().setTagCompound((NBTTagCompound) equip.getTagCompound().copy());
}
float offset = 0.05F;
entityitem.motionX = (double) ((float) ToolConstruct.tRand.nextGaussian() * offset);
entityitem.motionY = (double) ((float) ToolConstruct.tRand.nextGaussian() * offset + 0.2F);
entityitem.motionZ = (double) ((float) ToolConstruct.tRand.nextGaussian() * offset);
par1World.spawnEntityInWorld(entityitem);
}
}
float f = (float) x + 0.5F;
float f1 = (float) y + 0.25F + (random.nextFloat() * 6F) / 16F;
float f2 = (float) z + 0.5F;
float f4 = random.nextFloat() * 0.6F - 0.3F;
world.spawnParticle("smoke", f, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", f, f1, f2 + f4, 0.0D, 0.0D, 0.0D);
}
super.breakBlock(par1World, x, y, z, par5, par6);
}*/
}
public int getLightValue (IBlockAccess world, int x, int y, int z)
{
return !isActive(world, x, y, z) ? 0 : 9;
}
@Override
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
{
//int md = world.getBlockMetadata(x, y, z);
return TConstructGuiHandler.frypanID;
}

View File

@ -143,7 +143,7 @@ public class SmelteryBlock extends InventoryBlock
public int getLightValue (IBlockAccess world, int x, int y, int z)
{
return !isActive(world, x, y, z) ? 0 : 7;
return !isActive(world, x, y, z) ? 0 : 9;
}
//@Override

View File

@ -16,6 +16,7 @@ import tinker.tconstruct.TConstructContent;
import tinker.tconstruct.client.TableRender;
import tinker.tconstruct.logic.PartCrafterLogic;
import tinker.tconstruct.logic.PatternChestLogic;
import tinker.tconstruct.logic.PatternShaperLogic;
import tinker.tconstruct.logic.ToolStationLogic;
public class ToolStationBlock extends InventoryBlock
@ -56,7 +57,7 @@ public class ToolStationBlock extends InventoryBlock
}
else
{
return -14 + meta * 3 + getBlockTextureFromSide(side);
return -10 + meta * 3 + getBlockTextureFromSide(side);
}
}
@ -113,7 +114,7 @@ public class ToolStationBlock extends InventoryBlock
case 7: return new PatternChestLogic();
case 8: return new PatternChestLogic();
case 9: return new PatternChestLogic();
case 10: return new PatternChestLogic();
case 10: return new PatternShaperLogic();
default: return null;
}
}
@ -128,8 +129,10 @@ public class ToolStationBlock extends InventoryBlock
return 1;
else if (md < 10)
return 2;
else
return 3;
return -1;
//return -1;
}
@Override

View File

@ -0,0 +1,50 @@
package tinker.tconstruct.client;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class FrypanRender implements ISimpleBlockRenderingHandler
{
public static int frypanModelID = RenderingRegistry.getNextAvailableRenderId();
@Override
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
{
//Inventory should be an item. This is not here!
}
@Override
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
{
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.125F, 0.0F, 0.125F, 0.25F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.125F, 0.125F, 0.875F, 0.875F, 0.25F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.875F, 0.125F, 0.0F, 1.0F, 0.25F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.125F, 0.125F, 0.0F, 0.875F, 0.25F, 0.125F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(1F, 0.0F, 0.4375F, 2F, 0.125F, 0.5625F);
renderer.renderStandardBlock(block, x, y, z);
return false;
}
@Override
public boolean shouldRender3DInInventory ()
{
return true;
}
@Override
public int getRenderId ()
{
return frypanModelID;
}
}

View File

@ -17,6 +17,7 @@ public class TProxyClient extends TProxyCommon
{
RenderingRegistry.registerBlockHandler(new TableRender());
RenderingRegistry.registerBlockHandler(new TankRender());
RenderingRegistry.registerBlockHandler(new FrypanRender());
MinecraftForgeClient.preloadTexture(TConstructContent.craftingTexture);
MinecraftForgeClient.preloadTexture(TConstructContent.baseHeads);
@ -87,7 +88,7 @@ public class TProxyClient extends TProxyCommon
}
//LanguageRegistry.addName(TConstructContent.smeltery, "Smeltery");
LanguageRegistry.addName(TConstructContent.blankPattern, "Blank Pattern");
LanguageRegistry.addName(TConstructContent.pickaxe, "Pickaxe");
LanguageRegistry.addName(TConstructContent.shovel, "Shovel");
LanguageRegistry.addName(TConstructContent.axe, "Axe");

View File

@ -1,6 +1,123 @@
package tinker.tconstruct.client.gui;
public class PatternShaperContainer
{
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;
import tinker.tconstruct.logic.PatternChestLogic;
import tinker.tconstruct.logic.PatternShaperLogic;
public class PatternShaperContainer extends Container
{
public PatternShaperLogic logic;
public PatternShaperContainer(InventoryPlayer inventoryplayer, PatternShaperLogic shaper)
{
logic = shaper;
this.addSlotToContainer(new Slot(shaper, 0, 48, 35));
this.addSlotToContainer(new SlotOnlyTake(shaper, 1, 106, 35));
/*for (int i = 0; i < 3; i++)
{
for (int l = 0; l < 3; l++)
{
this.addSlotToContainer(new Slot(craftMatrix, l + i * 3, 30 + l * 18, 17 + i * 18));
}
}*/
/* Player inventory */
for (int column = 0; column < 3; column++)
{
for (int row = 0; row < 9; row++)
{
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
}
}
for (int column = 0; column < 9; column++)
{
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142));
}
}
/*public void onCraftMatrixChanged(IInventory iinventory)
{
craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
}*/
@Override
public void onCraftGuiClosed(EntityPlayer entityplayer)
{
super.onCraftGuiClosed(entityplayer);
if (logic.worldObj.isRemote)
{
return;
}
ItemStack itemstack = logic.getStackInSlot(0);
if (itemstack != null)
{
entityplayer.dropPlayerItem(itemstack);
}
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer)
{
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer entityplayer, int slot)
{
return null;
/*ItemStack itemstack = null;
Slot slot = (Slot)inventorySlots.get(i);
if (slot != null && slot.getHasStack())
{
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (i == 0)
{
if (!mergeItemStack(itemstack1, 10, 46, true))
{
return null;
}
}
else if (i >= 10 && i < 37)
{
if (!mergeItemStack(itemstack1, 37, 46, false))
{
return null;
}
}
else if (i >= 37 && i < 46)
{
if (!mergeItemStack(itemstack1, 10, 37, false))
{
return null;
}
}
else if (!mergeItemStack(itemstack1, 10, 46, false))
{
return null;
}
if (itemstack1.stackSize == 0)
{
slot.putStack(null);
}
else
{
slot.onSlotChanged();
}
if (itemstack1.stackSize != itemstack.stackSize)
{
slot.onPickupFromSlot(entityplayer, itemstack1);
}
else
{
return null;
}
}
return itemstack;*/
}
}

View File

@ -0,0 +1,132 @@
package tinker.tconstruct.client.gui;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.network.PacketDispatcher;
import tinker.tconstruct.TConstructContent;
import tinker.tconstruct.logic.PatternShaperLogic;
public class PatternShaperGui extends GuiContainer
{
PatternShaperLogic logic;
int patternIndex;
public PatternShaperGui(InventoryPlayer inventoryplayer, PatternShaperLogic shaper, World world, int x, int y, int z)
{
super(new PatternShaperContainer(inventoryplayer, shaper));
logic = shaper;
patternIndex = 0;
}
public void onGuiClosed()
{
super.onGuiClosed();
}
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2)
{
fontRenderer.drawString(StatCollector.translateToLocal("crafters.PatternShaper"), 50, 6, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
{
int texID = mc.renderEngine.getTexture("/tinkertextures/gui/patternshaper.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(texID);
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(cornerX, cornerY, 0, 0, this.xSize, this.ySize);
if (!logic.isStackInSlot(0))
{
this.drawTexturedModalRect(cornerX + 47, cornerY + 34, 176, 0, 18, 18);
}
}
public void initGui ()
{
super.initGui();
int cornerX = (this.width - this.xSize) / 2;
int cornerY = (this.height - this.ySize) / 2;
this.controlList.clear();
/*ToolGuiElement repair = TConstruct.toolButtons.get(0);
GuiButtonTool repairButton = new GuiButtonTool(0, cornerX - 110, cornerY, repair.buttonIconX, repair.buttonIconY, repair.texture); // Repair
repairButton.enabled = false;
this.controlList.add(repairButton);*/
this.controlList.add(new GuiButton(0, cornerX-120, cornerY, 120, 20, "Next Pattern"));
this.controlList.add(new GuiButton(1, cornerX-120, cornerY+20, 120, 20, "Previous Pattern"));
//for (int iter = 0; iter < TConstructContent.patternOutputs.length; iter++)
//{
/*ToolGuiElement element = TConstruct.toolButtons.get(iter);
GuiButtonTool button = new GuiButtonTool(iter, cornerX - 110 + 22 * (iter % 5), cornerY + 22 * (iter / 5), element.buttonIconX, element.buttonIconY, element.texture); // Repair
this.controlList.add(button);*/
//}
}
protected void actionPerformed (GuiButton button)
{
if (button.id == 0)
{
patternIndex++;
if (patternIndex > TConstructContent.patternOutputs.length)
patternIndex = 0;
}
else if (button.id == 1)
{
patternIndex--;
if (patternIndex < 0)
patternIndex = TConstructContent.patternOutputs.length - 1;
}
ItemStack pattern = logic.getStackInSlot(0);
if (pattern != null && pattern.getItem() == TConstructContent.blankPattern)
{
ItemStack stack = new ItemStack(TConstructContent.woodPattern, 1, patternIndex + 1);
logic.setInventorySlotContents(1, stack);
updateServer(stack);
}
}
void updateServer (ItemStack stack)
{
ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(2);
outputStream.writeInt(logic.worldObj.getWorldInfo().getDimension());
outputStream.writeInt(logic.xCoord);
outputStream.writeInt(logic.yCoord);
outputStream.writeInt(logic.zCoord);
outputStream.writeShort(stack.itemID);
outputStream.writeShort(stack.getItemDamage());
//outputStream.writeUTF(toolName);
}
catch (Exception ex)
{
ex.printStackTrace();
}
Packet250CustomPayload packet = new Packet250CustomPayload();
packet.channel = "TConstruct";
packet.data = bos.toByteArray();
packet.length = bos.size();
PacketDispatcher.sendPacketToServer(packet);
}
}

View File

@ -43,8 +43,8 @@ public class PatternShaperInventory implements IInventory
{
ItemStack stack = this.inventory[slot];
this.inventory[slot] = null;
if (slot == 1)
decrStackSize(0, 1);
//if (slot == 1)
//decrStackSize(0, 1);
return stack;
}
else
@ -52,6 +52,11 @@ public class PatternShaperInventory implements IInventory
return null;
}
}
public boolean isStackInSlot(int slot)
{
return inventory[slot] != null;
}
/**
* When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem -
@ -59,10 +64,10 @@ public class PatternShaperInventory implements IInventory
*/
public ItemStack getStackInSlotOnClosing(int slot)
{
if (this.inventory[slot] != null)
if (this.inventory[0] != null)
{
ItemStack stack = this.inventory[slot];
this.inventory[slot] = null;
ItemStack stack = this.inventory[0];
this.inventory[0] = null;
return stack;
}
else

View File

@ -136,9 +136,9 @@ public class ToolStationGui extends GuiContainer
*/
protected void drawGuiContainerForegroundLayer (int par1, int par2)
{
this.fontRenderer.drawString(StatCollector.translateToLocal("crafters.ToolStation"), 6, 6, 0x000000);
this.fontRenderer.drawString(StatCollector.translateToLocal("crafters.ToolStation"), 6, 8, 0x000000);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 0x000000);
this.fontRenderer.drawString(toolName + "_", this.xSize / 2 - 5, 8, 0);
this.fontRenderer.drawString(toolName + "_", this.xSize / 2 - 18, 8, 0xffffff);
if (logic.isStackInSlot(0))
drawToolStats();
@ -341,6 +341,7 @@ public class ToolStationGui extends GuiContainer
DataOutputStream outputStream = new DataOutputStream(bos);
try
{
outputStream.writeByte(1);
outputStream.writeInt(logic.worldObj.getWorldInfo().getDimension());
outputStream.writeInt(logic.xCoord);
outputStream.writeInt(logic.yCoord);

View File

@ -1,9 +1,13 @@
package tinker.tconstruct.items;
import java.util.List;
import tinker.tconstruct.TConstruct;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class CraftingItem extends Item
{
@ -13,6 +17,8 @@ public class CraftingItem extends Item
this.setCreativeTab(TConstruct.materialTab);
this.iconIndex = icon;
this.setTextureFile(tex);
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
@SideOnly(Side.CLIENT)

View File

@ -18,6 +18,8 @@ public class Materials extends Item
this.setCreativeTab(TConstruct.materialTab);
this.iconIndex = icon;
this.setTextureFile(tex);
this.setHasSubtypes(true);
this.setMaxDamage(0);
}
@SideOnly(Side.CLIENT)

View File

@ -33,14 +33,12 @@ public class Pattern extends CraftingItem
public void getSubItems (int id, CreativeTabs tab, List list)
{
for (int i = 0; i < patternName.length; i++)
for (int i = 1; i < patternName.length; i++)
list.add(new ItemStack(id, 1, i));
}
public ItemStack getContainerItemStack (ItemStack stack)
{
if (stack.getItemDamage() == 0)
stack.stackSize--;
return stack;
}

View File

@ -55,6 +55,7 @@ public class FrypanLogic extends EquipLogic
public void setActive (boolean flag)
{
active = flag;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
/* Fuel gauge */
@ -83,7 +84,7 @@ public class FrypanLogic extends EquipLogic
boolean updateInventory = false;
if (fuel <= 0 && canCook())
{
fuel = fuelGague = getItemBurnTime(inventory[1]) * 10;
fuel = fuelGague = (int) (getItemBurnTime(inventory[1]) * 2.5);
if (fuel > 0)
{
if (inventory[1].getItem().hasContainerItem()) //Fuel slot
@ -233,14 +234,19 @@ public class FrypanLogic extends EquipLogic
if (stack.getItem() instanceof ItemBlock && Block.blocksList[itemID] != null)
{
Block var3 = Block.blocksList[itemID];
Block block = Block.blocksList[itemID];
if (var3 == Block.woodSingleSlab)
if (block == Block.woodSingleSlab)
{
return 150;
}
if (block == Block.wood)
{
return 2400;
}
if (var3.blockMaterial == Material.wood)
if (block.blockMaterial == Material.wood)
{
return 300;
}
@ -254,7 +260,7 @@ public class FrypanLogic extends EquipLogic
if (itemID == Item.stick.itemID)
return 100;
if (itemID == Item.coal.itemID)
return 1600;
return 800;
if (itemID == Item.bucketLava.itemID)
return 20000;
if (itemID == Block.sapling.blockID)

View File

@ -0,0 +1,36 @@
package tinker.tconstruct.logic;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import tinker.common.InventoryLogic;
import tinker.tconstruct.client.gui.PatternShaperContainer;
public class PatternShaperLogic extends InventoryLogic
{
public PatternShaperLogic()
{
super(2);
}
@Override
public String getInvName ()
{
return "toolstation.PatternShaper";
}
@Override
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
{
return new PatternShaperContainer(inventoryplayer, this);
}
@Override
public ItemStack decrStackSize(int slot, int quantity)
{
if (slot == 1)
super.decrStackSize(0, 1);
return super.decrStackSize(slot, quantity);
}
}

View File

@ -23,19 +23,19 @@ public class BattleSign extends Weapon
this.setItemName("InfiTool.Battlesign");
}
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
/*public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (!player.isSneaking())
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
return stack;
}
}*/
public String getToolName ()
{
return "Battle Sign";
}
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
/*public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer player, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
{
if (par7 == 0 || !player.isSneaking())
{
@ -103,7 +103,7 @@ public class BattleSign extends Weapon
return true;
}
}
}
}*/
@Override
protected Item getHeadItem ()

View File

@ -28,4 +28,9 @@ public class Broadsword extends Weapon
{
return TConstructContent.largeGuard;
}
public float getDurabilityModifier ()
{
return 1.3f;
}
}

View File

@ -41,9 +41,7 @@ public abstract class DualHarvestTool extends HarvestTool
{
if (tags.getBoolean("Lava") && block.quantityDropped(meta, 0, random) != 0)
{
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(bID, 1, meta));
if (result == null)
result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
if (result != null)
{
System.out.println("Woo~");

View File

@ -34,9 +34,7 @@ public abstract class HarvestTool extends ToolCore
{
if (tags.getBoolean("Lava") && block.quantityDropped(meta, 0, random) != 0)
{
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(bID, 1, meta));
if (result == null)
result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
if (result != null)
{
System.out.println("Woo~");

View File

@ -43,7 +43,7 @@ public class LumberAxe extends HarvestTool
public float getDurabilityModifier ()
{
return 2.0f;
return 2.5f;
}
public String getToolName ()

View File

@ -47,6 +47,11 @@ public class Mattock extends DualHarvestTool
static Material[] axeMaterials = { Material.wood, Material.circuits, Material.cactus, Material.pumpkin, Material.leaves };
static Material[] shovelMaterials = { Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay };
public float getDurabilityModifier ()
{
return 1.2f;
}
/* Mattock specific */
@Override

View File

@ -382,9 +382,7 @@ public abstract class ToolCore extends Item
if (tags.getBoolean("Lava") && block.quantityDropped(meta, 0, random) != 0)
{
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(bID, 1, meta));
if (result == null)
result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block.idDropped(bID, random, 0), 1, block.damageDropped(meta)));
if (result != null)
{
System.out.println("Woo~");