Skip to content

Commit

Permalink
Crafting Station Prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
mDiyo committed Dec 6, 2013
1 parent 179f9df commit 85aaa05
Show file tree
Hide file tree
Showing 54 changed files with 583 additions and 129 deletions.
3 changes: 3 additions & 0 deletions resources/assets/tinker/lang/en_US.lang
Expand Up @@ -4,8 +4,10 @@ itemGroup.TConstructBlocks=TConstruct Blocks

crafters.ToolStation=Tool Station
crafters.ToolForge=Tool Forge
crafters.TinkerTable=Tinker Table
crafters.PartBuilder=Part Builder
crafters.PatternShaper=Stencil Table
crafters.CraftingStation=Crafting Station
inventory.PatternChest=Pattern Chest
crafters.Smeltery=Smeltery
crafters.Frypan=Frying Pan
Expand All @@ -19,6 +21,7 @@ ToolStation.CastingTable.name=Casting Table
tile.FurnaceSlab.name=Slab Furnace

tile.ToolForge.name=Tool Forge
tile.TinkerTable.name=Tinker Table
tile.Armor.DryingRack.name=Drying Rack
CraftedSoil.Slime.name=Slimy Mud
CraftedSoil.Grout.name=Grout
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions src/main/java/tconstruct/TConstruct.java
Expand Up @@ -61,13 +61,12 @@ public TConstruct()
logger.setParent(FMLCommonHandler.instance().getFMLLogger());
if (Loader.isModLoaded("Natura"))
{
TConstruct.logger.info("[TConstruct] Natura, what are we going to do tomorrow night?");
TConstruct.logger.info("[Natura] TConstruct, we're going to take over the world!");
System.out.println("[TConstruct] Natura, what are we going to do tomorrow night?");
System.out.println("[Natura] TConstruct, we're going to take over the world!");
}
else
{

TConstruct.logger.info("[TConstruct] Preparing to take over the world");
System.out.println("[TConstruct] Preparing to take over the world");
}

EnvironmentChecks.verifyEnvironmentSanity();
Expand Down
17 changes: 7 additions & 10 deletions src/main/java/tconstruct/blocks/ToolForgeBlock.java
Expand Up @@ -2,12 +2,6 @@

import java.util.List;

import tconstruct.TConstruct;
import tconstruct.blocks.logic.ToolForgeLogic;
import tconstruct.client.block.TableForgeRender;
import tconstruct.common.TProxyCommon;
import tconstruct.common.TRepo;
import tconstruct.library.TConstructRegistry;
import mantle.blocks.abstracts.InventoryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
Expand All @@ -20,9 +14,16 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import tconstruct.TConstruct;
import tconstruct.blocks.logic.ToolForgeLogic;
import tconstruct.client.block.TableForgeRender;
import tconstruct.common.TProxyCommon;
import tconstruct.common.TRepo;
import tconstruct.library.TConstructRegistry;

public class ToolForgeBlock extends InventoryBlock
{

public ToolForgeBlock(int id, Material material)
{
super(id, material);
Expand All @@ -31,8 +32,6 @@ public ToolForgeBlock(int id, Material material)
this.setStepSound(Block.soundWoodFootstep);
}

//Block.hasComparatorInputOverride and Block.getComparatorInputOverride

String[] textureNames = { "toolforge_iron", "toolforge_gold", "toolforge_diamond", "toolforge_emerald", "toolforge_cobalt", "toolforge_ardite", "toolforge_manyullyn", "toolforge_copper",
"toolforge_bronze", "toolforge_tin", "toolforge_aluminum", "toolforge_alubrass", "toolforge_alumite", "toolforge_steel" };

Expand Down Expand Up @@ -112,7 +111,6 @@ public boolean shouldSideBeRendered (IBlockAccess par1IBlockAccess, int par2, in
@Override
public TileEntity createTileEntity (World world, int metadata)
{

return new ToolForgeLogic();
}

Expand All @@ -121,7 +119,6 @@ public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplay
{
int md = world.getBlockMetadata(x, y, z);
return TProxyCommon.toolForgeID;
//return -1;
}

@Override
Expand Down
73 changes: 65 additions & 8 deletions src/main/java/tconstruct/blocks/logic/CraftingStationLogic.java
@@ -1,32 +1,89 @@
package tconstruct.blocks.logic;

import net.minecraft.item.ItemStack;

import net.minecraft.inventory.ISidedInventory;
import java.lang.ref.WeakReference;

import mantle.blocks.abstracts.InventoryLogic;
import mantle.world.CoordTuple;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.World;
import tconstruct.inventory.CraftingStationContainer;
import mantle.blocks.abstracts.InventoryLogic;

public class CraftingStationLogic extends InventoryLogic implements ISidedInventory
{
/*public boolean chest;
public boolean doubleChest;
public boolean patternChest;
public boolean nearbyFurnace;*/

public WeakReference<IInventory> chest;
public WeakReference<IInventory> doubleChest;
public WeakReference<IInventory> patternChest;
public WeakReference<IInventory> furnace;
public boolean tinkerTable;
public boolean stencilTable;

public CraftingStationLogic()
{
super(11); //9 for crafting, 1 for output, 1 for plans
super(17); //9 for crafting, 1 for output, 6 for extensions, 1 for plans
}

@Override
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
{
//System.out.println("Getting container on side: "+FMLCommonHandler.instance().getEffectiveSide());
chest = null;
doubleChest = null;
patternChest = null;
furnace = null;
tinkerTable = false;
for (int yPos = y - 1; yPos <= y + 1; yPos++)
{
for (int xPos = x - 1; xPos <= x + 1; xPos++)
{
for (int zPos = z - 1; zPos <= x + 1; zPos++)
{
TileEntity tile = world.getBlockTileEntity(xPos, yPos, zPos);
if (chest == null && tile instanceof TileEntityChest)
{
chest = new WeakReference(tile);
checkForChest(world, xPos + 1, yPos, zPos);
checkForChest(world, xPos - 1, yPos, zPos);
checkForChest(world, xPos, yPos, zPos + 1);
checkForChest(world, xPos, yPos, zPos - 1);
}
else if (patternChest == null && tile instanceof PatternChestLogic)
patternChest = new WeakReference(tile);
else if (furnace == null && (tile instanceof TileEntityFurnace || tile instanceof FurnaceLogic))
furnace = new WeakReference(tile);
else if (tinkerTable == false && tile instanceof ToolStationLogic)
tinkerTable = true;
}
}
}
return new CraftingStationContainer(inventoryplayer, this, x, y, z);
}

void checkForChest (World world, int x, int y, int z)
{
if (doubleChest != null)
return;

TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileEntityChest)
doubleChest = new WeakReference(tile);
}

@Override
protected String getDefaultName ()
{
return "crafters.craftingstation";
return "crafters.CraftingStation";
}

public boolean canDropInventorySlot (int slot)
Expand All @@ -39,7 +96,7 @@ public boolean canDropInventorySlot (int slot)
@Override
public int[] getAccessibleSlotsFromSide (int var1)
{
return new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
return new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
}

@Override
Expand All @@ -51,6 +108,6 @@ public boolean canInsertItem (int i, ItemStack itemstack, int j)
@Override
public boolean canExtractItem (int i, ItemStack itemstack, int j)
{
return i != 0;
return true;
}
}
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/blocks/logic/ToolForgeLogic.java
Expand Up @@ -12,7 +12,7 @@
/* Simple class for storing items in the block
*/

public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory
public class ToolForgeLogic extends ToolStationLogic
{
ItemStack previousTool;
String toolName;
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/tconstruct/client/TProxyClient.java
Expand Up @@ -81,11 +81,10 @@ public Object getClientGuiElement (int ID, EntityPlayer player, World world, int
return new StencilTableGui(player.inventory, (StencilTableLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);
if (ID == toolForgeID)
return new ToolForgeGui(player.inventory, (ToolForgeLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);

if (ID == landmineID)
return new GuiLandmine(new ContainerLandmine(player, (TileEntityLandmine) world.getBlockTileEntity(x, y, z)));
if (ID == craftingStationID)
return new CraftingStationGui(player.inventory, (CraftingStationLogic) world.getBlockTileEntity(x, y, z), x, y, z);
return new CraftingStationGui(player.inventory, (CraftingStationLogic) world.getBlockTileEntity(x, y, z), world, x, y, z);

if (ID == furnaceID)
return new FurnaceGui(player.inventory, (FurnaceLogic) world.getBlockTileEntity(x, y, z));
Expand Down

0 comments on commit 85aaa05

Please sign in to comment.