Skip to content

Commit

Permalink
Initial draft of assemblyadvancedworkbench
Browse files Browse the repository at this point in the history
  • Loading branch information
cpw committed Oct 14, 2012
1 parent 39a6cbd commit d5491c5
Show file tree
Hide file tree
Showing 16 changed files with 420 additions and 19 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions buildcraft_resources/lang/buildcraft/en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ tile.refineryBlock=Refinery
tile.libraryBlock=Blueprint Library
tile.laserBlock=Laser
tile.assemblyTableBlock=Assembly Table
tile.assemblyWorkbenchBlock=Assembly Workbench
tile.pathMarkerBlock=Path Marker
tile.blockHopper=Hopper
tile.pumpBlock=Pump
Expand Down
17 changes: 14 additions & 3 deletions common/buildcraft/BuildCraftSilicon.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import buildcraft.silicon.BlockAssemblyTable;
import buildcraft.silicon.BlockLaser;
import buildcraft.silicon.GuiHandler;
import buildcraft.silicon.ItemAssemblyTable;
import buildcraft.silicon.SiliconProxy;
import buildcraft.silicon.TileAssemblyAdvancedWorkbench;
import buildcraft.silicon.TileAssemblyTable;
import buildcraft.silicon.TileLaser;
import buildcraft.silicon.network.PacketHandlerSilicon;
Expand All @@ -35,6 +37,8 @@
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(name="BuildCraft Silicon", version=Version.VERSION, useMetadata = false, modid = "BuildCraft|Silicon", dependencies = DefaultProps.DEPENDENCY_TRANSPORT)
@NetworkMod(channels = {DefaultProps.NET_CHANNEL_NAME}, packetHandler = PacketHandlerSilicon.class, clientSideRequired = true, serverSideRequired = true)
Expand All @@ -51,6 +55,7 @@ public void load(FMLInitializationEvent evt) {
NetworkRegistry.instance().registerGuiHandler(instance, new GuiHandler());
CoreProxy.proxy.registerTileEntity(TileLaser.class, "net.minecraft.src.buildcraft.factory.TileLaser");
CoreProxy.proxy.registerTileEntity(TileAssemblyTable.class, "net.minecraft.src.buildcraft.factory.TileAssemblyTable");
CoreProxy.proxy.registerTileEntity(TileAssemblyAdvancedWorkbench.class, "net.minecraft.src.buildcraft.factory.TileAssemblyAdvancedWorkbench");

new BptBlockRotateMeta(laserBlock.blockID, new int[] { 2, 5, 3, 4 }, true);
new BptBlockInventory(assemblyTableBlock.blockID);
Expand All @@ -76,8 +81,10 @@ public void initialize(FMLPreInitializationEvent evt) {
CoreProxy.proxy.registerBlock(laserBlock);

assemblyTableBlock = new BlockAssemblyTable(Integer.parseInt(assemblyTableId.value));
CoreProxy.proxy.addName(assemblyTableBlock.setBlockName("assemblyTableBlock"), "Assembly Table");
CoreProxy.proxy.registerBlock(assemblyTableBlock);
GameRegistry.registerBlock(assemblyTableBlock, ItemAssemblyTable.class);

LanguageRegistry.addName(new ItemStack(assemblyTableBlock,0,0),"Assembly Table");
LanguageRegistry.addName(new ItemStack(assemblyTableBlock,0,1),"Advanced Crafting Table");

redstoneChipset = new ItemRedstoneChipset(Integer.parseInt(redstoneChipsetId.value));
redstoneChipset.setItemName("redstoneChipset");
Expand All @@ -89,11 +96,15 @@ public static void loadRecipes() {
CoreProxy.proxy.addCraftingRecipe(new ItemStack(laserBlock), new Object[] { "ORR", "DDR", "ORR", Character.valueOf('O'),
Block.obsidian, Character.valueOf('R'), Item.redstone, Character.valueOf('D'), Item.diamond, });

CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock),
CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 0),
new Object[] { "ORO", "ODO", "OGO", Character.valueOf('O'), Block.obsidian, Character.valueOf('R'),
Item.redstone, Character.valueOf('D'), Item.diamond, Character.valueOf('G'),
BuildCraftCore.diamondGearItem, });

CoreProxy.proxy.addCraftingRecipe(new ItemStack(assemblyTableBlock, 1, 1),
new Object[] { "OWO", "OCO", "ORO", Character.valueOf('O'), Block.obsidian, Character.valueOf('W'),
Block.workbench, Character.valueOf('C'), Block.chest, Character.valueOf('R'),
new ItemStack(redstoneChipset, 1, 0), });
//Add reverse recipies for all gates

//Iron
Expand Down
2 changes: 1 addition & 1 deletion common/buildcraft/core/ItemBlockBuildCraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int getMetadata(int i) {
return i;
}

// @Override Client side only
@Override
public String getItemDisplayName(ItemStack itemstack) {
return StringUtil.localize(getItemNameIS(itemstack));
}
Expand Down
1 change: 0 additions & 1 deletion common/buildcraft/core/ItemRedstoneChipset.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public String getItemNameIS(ItemStack itemstack) {
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List itemList) {
super.getSubItems(par1, par2CreativeTabs, itemList);
for (int i = 0; i < 5; i++) {
itemList.add(new ItemStack(this, 1, i));
}
Expand Down
4 changes: 4 additions & 0 deletions common/buildcraft/core/network/PacketIds.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ public class PacketIds {
public static final int LIBRARY_SELECT = 62;

public static final int STATE_UPDATE = 100;

public static final int SELECTION_ADVANCED_WORKBENCH_GET = 70;
public static final int SELECTION_ADVANCED_WORKBENCH = 71;
public static final int SELECTION_ADVANCED_WORKBENCH_SEND = 72;
}
25 changes: 18 additions & 7 deletions common/buildcraft/silicon/BlockAssemblyTable.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package buildcraft.silicon;

import java.util.ArrayList;
import java.util.List;

import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;

import net.minecraft.src.BlockContainer;
import net.minecraft.src.CreativeTabs;
Expand Down Expand Up @@ -48,8 +52,10 @@ public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer e
if (entityplayer.isSneaking())
return false;

if (!CoreProxy.proxy.isRenderWorld(world))
entityplayer.openGui(BuildCraftSilicon.instance, GuiIds.ASSEMBLY_TABLE, world, i, j, k);
if (!CoreProxy.proxy.isRenderWorld(world)) {
int meta = world.getBlockMetadata(i, j, k);
entityplayer.openGui(BuildCraftSilicon.instance, meta, world, i, j, k);
}
return true;
}

Expand All @@ -66,23 +72,28 @@ public int getBlockTextureFromSideAndMetadata(int i, int j) {
} else if (i == 0) {
return 16 * 2 + 15;
} else {
return 16 * 6 + 11;
return j == 0 ? 16 * 6 + 11 : 2 * 16 + 12;
}
}

@Override
public TileEntity createNewTileEntity(World world, int metadata) {
return metadata == 0 ? new TileAssemblyTable() : new TileAssemblyAdvancedWorkbench();
}
@Override
public TileEntity createNewTileEntity(World var1) {
return new TileAssemblyTable();
return null;
}

@Override
public String getTextureFile() {
return DefaultProps.TEXTURE_BLOCKS;
}

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void addCreativeItems(ArrayList itemList) {
itemList.add(new ItemStack(this));
@SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
par3List.add(new ItemStack(this,0,0));
par3List.add(new ItemStack(this,0,1));
}
}
14 changes: 12 additions & 2 deletions common/buildcraft/silicon/GuiHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import cpw.mods.fml.common.network.IGuiHandler;
import buildcraft.core.GuiIds;
import buildcraft.silicon.gui.ContainerAssemblyAdvancedWorkbench;
import buildcraft.silicon.gui.ContainerAssemblyTable;
import buildcraft.silicon.gui.GuiAssemblyAdvancedWorkbench;
import buildcraft.silicon.gui.GuiAssemblyTable;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.TileEntity;
Expand All @@ -20,11 +22,15 @@ public Object getClientGuiElement(int ID, EntityPlayer player, World world, int

switch (ID) {

case GuiIds.ASSEMBLY_TABLE:
case 0:
if (!(tile instanceof TileAssemblyTable))
return null;
return new GuiAssemblyTable(player.inventory, (TileAssemblyTable) tile);

case 1:
if (!(tile instanceof TileAssemblyAdvancedWorkbench))
return null;
return new GuiAssemblyAdvancedWorkbench(player.inventory, (TileAssemblyAdvancedWorkbench)tile);
default:
return null;
}
Expand All @@ -40,11 +46,15 @@ public Object getServerGuiElement(int ID, EntityPlayer player, World world, int

switch (ID) {

case GuiIds.ASSEMBLY_TABLE:
case 0:
if (!(tile instanceof TileAssemblyTable))
return null;
return new ContainerAssemblyTable(player.inventory, (TileAssemblyTable) tile);

case 1:
if (!(tile instanceof TileAssemblyAdvancedWorkbench))
return null;
return new ContainerAssemblyAdvancedWorkbench(player.inventory, (TileAssemblyAdvancedWorkbench) tile);
default:
return null;
}
Expand Down
22 changes: 22 additions & 0 deletions common/buildcraft/silicon/ItemAssemblyTable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package buildcraft.silicon;

import buildcraft.core.proxy.CoreProxy;
import net.minecraft.src.ItemBlock;
import net.minecraft.src.ItemStack;

public class ItemAssemblyTable extends ItemBlock {
public ItemAssemblyTable(int par1) {
super(par1);
setHasSubtypes(true);
}

@Override
public String getItemNameIS(ItemStack par1ItemStack) {
return par1ItemStack.getItemDamage() == 0 ? "block.assemblyTableBlock" : "block.assemblyWorkbenchBlock";
}

@Override
public int getMetadata(int par1) {
return par1 > 0 && par1 < 2 ? par1 : 0;
}
}
92 changes: 92 additions & 0 deletions common/buildcraft/silicon/TileAssemblyAdvancedWorkbench.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package buildcraft.silicon;

import buildcraft.core.network.PacketSlotChange;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IInventory;
import net.minecraft.src.ItemStack;
import net.minecraft.src.TileEntity;

public class TileAssemblyAdvancedWorkbench extends TileEntity implements IInventory {

private ItemStack[] craftingSlots;
private ItemStack[] storageSlots;
private ItemStack outputSlot;
@Override
public int getSizeInventory() {
return 16;
}

@Override
public ItemStack getStackInSlot(int var1) {
// TODO Auto-generated method stub
return null;
}

@Override
public ItemStack decrStackSize(int var1, int var2) {
// TODO Auto-generated method stub
return null;
}

@Override
public ItemStack getStackInSlotOnClosing(int var1) {
// TODO Auto-generated method stub
return null;
}

@Override
public void setInventorySlotContents(int var1, ItemStack var2) {
// TODO Auto-generated method stub

}

@Override
public String getInvName() {
// TODO Auto-generated method stub
return null;
}

@Override
public int getInventoryStackLimit() {
// TODO Auto-generated method stub
return 0;
}

@Override
public boolean isUseableByPlayer(EntityPlayer var1) {
return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) == this;
}

@Override
public void openChest() {
// TODO Auto-generated method stub

}

@Override
public void closeChest() {
// TODO Auto-generated method stub

}

public float getRecentEnergyAverage() {
// TODO Auto-generated method stub
return 0;
}

public float getStoredEnergy() {
// TODO Auto-generated method stub
return 0f;
}

public float getRequiredEnergy() {
// TODO Auto-generated method stub
return 0f;
}

public void handleSlotChange(PacketSlotChange packet1) {
// TODO Auto-generated method stub

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package buildcraft.silicon.gui;

import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IInventory;
import net.minecraft.src.InventoryPlayer;
import net.minecraft.src.Slot;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.factory.gui.ContainerAutoWorkbench.SlotAutoCrafting;
import buildcraft.silicon.TileAssemblyAdvancedWorkbench;
import buildcraft.silicon.TileAssemblyTable;

public class ContainerAssemblyAdvancedWorkbench extends BuildCraftContainer {
private InventoryPlayer player;
private TileAssemblyAdvancedWorkbench workbench;

public ContainerAssemblyAdvancedWorkbench(InventoryPlayer playerInventory, TileAssemblyAdvancedWorkbench table) {
super(table.getSizeInventory());
this.player = playerInventory;
this.workbench = table;
// addSlotToContainer(new SlotAutoCrafting(inventoryplayer.player, tile, craftResult, 0, 124, 35));
// for (int k = 0; k < 3; k++) {
// for (int j1 = 0; j1 < 3; j1++) {
// addSlotToContainer(new Slot(workbench, j1 + k * 3, 31 + j1 * 18, 16 + k * 18));
// }
// }

for (int k = 0; k < 3; k++) {
for (int j1 = 0; j1 < 9; j1++) {
addSlotToContainer(new Slot(workbench, j1 + k * 9, 8 + j1 * 18, 85 + k * 18));
}
}

for (int l = 0; l < 3; l++) {
for (int k1 = 0; k1 < 9; k1++) {
addSlotToContainer(new Slot(playerInventory, k1 + l * 9 + 9, 8 + k1 * 18, 153 + l * 18));
}

}

for (int i1 = 0; i1 < 9; i1++) {
addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 211));
}
}

@Override
public boolean canInteractWith(EntityPlayer var1) {
return workbench.isUseableByPlayer(var1);
}

}
2 changes: 0 additions & 2 deletions common/buildcraft/silicon/gui/ContainerAssemblyTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
import net.minecraft.src.Slot;

public class ContainerAssemblyTable extends BuildCraftContainer {

IInventory playerIInventory;
TileAssemblyTable table;

int x = Integer.MAX_VALUE, y = Integer.MAX_VALUE, z = Integer.MAX_VALUE;
boolean networkSynchronized = false;

public ContainerAssemblyTable(IInventory playerInventory, TileAssemblyTable table) {
Expand Down
Loading

0 comments on commit d5491c5

Please sign in to comment.