Refactored crafting table and imprinter

This commit is contained in:
Calclavia 2014-01-11 17:56:26 +08:00
parent f4d88b0efc
commit 51ae09aa3b
6 changed files with 34 additions and 27 deletions

View file

@ -15,14 +15,14 @@ import cpw.mods.fml.relauncher.SideOnly;
*
* @author DarkGuardsman
*/
public class BlockCraftingDesk extends BlockRI
public class BlockEngineeringTable extends BlockRI
{
@SideOnly(Side.CLIENT)
private Icon workbenchIconTop;
@SideOnly(Side.CLIENT)
private Icon workbenchIconFront;
public BlockCraftingDesk()
public BlockEngineeringTable()
{
super("craftingDesk");
}
@ -46,7 +46,7 @@ public class BlockCraftingDesk extends BlockRI
@Override
public TileEntity createNewTileEntity(World world)
{
return new TileEntityCraftingTable();
return new TileEngineeringTable();
}
@Override

View file

@ -2,7 +2,7 @@ package resonantinduction.archaic.crafting;
import resonantinduction.core.prefab.tile.TileEntityInv;
public class TileEntityCraftingTable extends TileEntityInv
public class TileEngineeringTable extends TileEntityInv
{
}

View file

@ -18,13 +18,13 @@ import resonantinduction.core.prefab.block.BlockRI;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockEngineering extends BlockRI
public class BlockImprinter extends BlockRI
{
Icon imprinter_side;
Icon imprinter_top;
Icon imprinter_bottom;
public BlockEngineering()
public BlockImprinter()
{
super("engineeringTable", Material.wood);
}
@ -84,9 +84,9 @@ public class BlockEngineering extends BlockRI
if (tileEntity != null)
{
if (tileEntity instanceof TileEngineering)
if (tileEntity instanceof TileImprinter)
{
TileEngineering inventory = (TileEngineering) tileEntity;
TileImprinter inventory = (TileImprinter) tileEntity;
for (int i = 0; i < inventory.getSizeInventory(); ++i)
{
@ -137,9 +137,9 @@ public class BlockEngineering extends BlockRI
{
TileEntity tileEntity = par1World.getBlockTileEntity(x, y, z);
if (tileEntity instanceof TileEngineering)
if (tileEntity instanceof TileImprinter)
{
((TileEngineering) tileEntity).searchInventories = !((TileEngineering) tileEntity).searchInventories;
((TileImprinter) tileEntity).searchInventories = !((TileImprinter) tileEntity).searchInventories;
par1World.markBlockForUpdate(x, y, z);
return true;
}
@ -150,6 +150,6 @@ public class BlockEngineering extends BlockRI
@Override
public TileEntity createNewTileEntity(World var1)
{
return new TileEngineering();
return new TileImprinter();
}
}

View file

@ -13,9 +13,9 @@ import calclavia.lib.prefab.slot.SlotWatched;
public class ContainerEngineering extends Container implements ISlotWatcher
{
public InventoryPlayer inventoryPlayer;
public TileEngineering tileEntity;
public TileImprinter tileEntity;
public ContainerEngineering(InventoryPlayer inventoryPlayer, TileEngineering tileEntity)
public ContainerEngineering(InventoryPlayer inventoryPlayer, TileImprinter tileEntity)
{
this.tileEntity = tileEntity;
this.tileEntity.container = this;
@ -31,18 +31,18 @@ public class ContainerEngineering extends Container implements ISlotWatcher
}
// Imprint Input for Imprinting
this.addSlotToContainer(new SlotSpecific(this.tileEntity, TileEngineering.IMPRINTER_MATRIX_START, 68, 34, ItemBlockFilter.class));
this.addSlotToContainer(new SlotSpecific(this.tileEntity, TileImprinter.IMPRINTER_MATRIX_START, 68, 34, ItemBlockFilter.class));
// Item to be imprinted
this.addSlotToContainer(new SlotWatched(this.tileEntity, TileEngineering.IMPRINTER_MATRIX_START + 1, 92, 34, this));
this.addSlotToContainer(new SlotWatched(this.tileEntity, TileImprinter.IMPRINTER_MATRIX_START + 1, 92, 34, this));
// Result of Crafting/Imprinting
this.addSlotToContainer(new SlotCraftingResult(this.tileEntity, this, this.tileEntity, TileEngineering.IMPRINTER_MATRIX_START + 2, 148, 34));
this.addSlotToContainer(new SlotCraftingResult(this.tileEntity, this, this.tileEntity, TileImprinter.IMPRINTER_MATRIX_START + 2, 148, 34));
// Imprinter Inventory
for (int ii = 0; ii < 2; ii++)
{
for (int i = 0; i < 9; i++)
{
this.addSlotToContainer(new SlotWatched(this.tileEntity, (i + ii * 9) + TileEngineering.INVENTORY_START, 8 + i * 18, 80 + ii * 18, this));
this.addSlotToContainer(new SlotWatched(this.tileEntity, (i + ii * 9) + TileImprinter.INVENTORY_START, 8 + i * 18, 80 + ii * 18, this));
}
}
@ -90,22 +90,22 @@ public class ContainerEngineering extends Container implements ISlotWatcher
ItemStack slotStack = slotObj.getStack();
copyStack = slotStack.copy();
if (slot == TileEngineering.INVENTORY_START - 1)
if (slot == TileImprinter.INVENTORY_START - 1)
{
// Prevents filter from being duplicated
this.tileEntity.setInventorySlotContents(TileEngineering.INVENTORY_START - 1, null);
this.tileEntity.setInventorySlotContents(TileImprinter.INVENTORY_START - 1, null);
}
if (slot > this.tileEntity.getSizeInventory() - 1)
{
if (this.getSlot(TileEngineering.IMPRINTER_MATRIX_START).isItemValid(slotStack))
if (this.getSlot(TileImprinter.IMPRINTER_MATRIX_START).isItemValid(slotStack))
{
if (!this.mergeItemStack(slotStack, TileEngineering.IMPRINTER_MATRIX_START, TileEngineering.IMPRINTER_MATRIX_START + 1, true))
if (!this.mergeItemStack(slotStack, TileImprinter.IMPRINTER_MATRIX_START, TileImprinter.IMPRINTER_MATRIX_START + 1, true))
{
return null;
}
}
else if (!this.mergeItemStack(slotStack, TileEngineering.INVENTORY_START, this.tileEntity.getSizeInventory(), false))
else if (!this.mergeItemStack(slotStack, TileImprinter.INVENTORY_START, this.tileEntity.getSizeInventory(), false))
{
return null;
}

View file

@ -23,7 +23,7 @@ import calclavia.lib.utility.LanguageUtility;
import com.builtbroken.common.Pair;
public class TileEngineering extends TileAdvanced implements ISidedInventory, IArmbotUseable, ISlotPickResult, IAutoCrafter
public class TileImprinter extends TileAdvanced implements ISidedInventory, IArmbotUseable, ISlotPickResult, IAutoCrafter
{
public static final int IMPRINTER_MATRIX_START = 9;
public static final int INVENTORY_START = IMPRINTER_MATRIX_START + 3;
@ -469,14 +469,14 @@ public class TileEngineering extends TileAdvanced implements ISidedInventory, IA
@Override
public int[] getCraftingInv()
{
if (TileEngineering.inventorySlots == null)
if (TileImprinter.inventorySlots == null)
{
TileEngineering.inventorySlots = new int[18];
TileImprinter.inventorySlots = new int[18];
for (int i = 0; i < inventorySlots.length; i++)
{
inventorySlots[i] = TileEngineering.INVENTORY_START + i;
inventorySlots[i] = TileImprinter.INVENTORY_START + i;
}
}
return TileEngineering.inventorySlots;
return TileImprinter.inventorySlots;
}
}

View file

@ -16,6 +16,8 @@ import resonantinduction.core.ResonantInduction;
import resonantinduction.core.ResonantInductionTabs;
import resonantinduction.core.Settings;
import resonantinduction.core.part.BlockMachinePart;
import resonantinduction.electrical.armbot.BlockArmbot;
import resonantinduction.electrical.armbot.TileArmbot;
import resonantinduction.electrical.battery.BlockBattery;
import resonantinduction.electrical.battery.ItemBlockBattery;
import resonantinduction.electrical.battery.TileBattery;
@ -36,6 +38,7 @@ import resonantinduction.electrical.wire.ItemWire;
import resonantinduction.mechanical.grinder.BlockGrinderWheel;
import resonantinduction.mechanical.grinder.TileGrinderWheel;
import resonantinduction.mechanical.grinder.TilePurifier;
import calclavia.lib.content.ContentRegistry;
import calclavia.lib.network.PacketHandler;
import calclavia.lib.recipe.UniversalRecipe;
import cpw.mods.fml.common.Loader;
@ -75,6 +78,8 @@ public class Electrical
@Mod.Metadata(ID)
public static ModMetadata metadata;
public static final ContentRegistry contentRegistry = new ContentRegistry(Settings.CONFIGURATION, ID);
// Energy
private static Item itemPartWire;
public static Item itemMultimeter;
@ -90,6 +95,7 @@ public class Electrical
// Transport
public static Block blockEMContractor;
public static Block blockArmbot;
public static Item itemDisk;
@EventHandler
@ -108,6 +114,7 @@ public class Electrical
// Transport
blockEMContractor = new BlockLevitator();
blockArmbot = contentRegistry.createTile(BlockArmbot.class, TileArmbot.class);
// Machines
blockMachinePart = new BlockMachinePart();