From 51ae09aa3b5855772d9250deec8f66c62afe9f45 Mon Sep 17 00:00:00 2001 From: Calclavia Date: Sat, 11 Jan 2014 17:56:26 +0800 Subject: [PATCH] Refactored crafting table and imprinter --- ...ngDesk.java => BlockEngineeringTable.java} | 6 ++--- ...ngTable.java => TileEngineeringTable.java} | 2 +- ...ckEngineering.java => BlockImprinter.java} | 14 ++++++------ .../engineering/ContainerEngineering.java | 22 +++++++++---------- ...ileEngineering.java => TileImprinter.java} | 10 ++++----- .../electrical/Electrical.java | 7 ++++++ 6 files changed, 34 insertions(+), 27 deletions(-) rename src/main/java/resonantinduction/archaic/crafting/{BlockCraftingDesk.java => BlockEngineeringTable.java} (96%) rename src/main/java/resonantinduction/archaic/crafting/{TileEntityCraftingTable.java => TileEngineeringTable.java} (64%) rename src/main/java/resonantinduction/archaic/engineering/{BlockEngineering.java => BlockImprinter.java} (91%) rename src/main/java/resonantinduction/archaic/engineering/{TileEngineering.java => TileImprinter.java} (97%) diff --git a/src/main/java/resonantinduction/archaic/crafting/BlockCraftingDesk.java b/src/main/java/resonantinduction/archaic/crafting/BlockEngineeringTable.java similarity index 96% rename from src/main/java/resonantinduction/archaic/crafting/BlockCraftingDesk.java rename to src/main/java/resonantinduction/archaic/crafting/BlockEngineeringTable.java index 20fe525b5..3c031c8b0 100644 --- a/src/main/java/resonantinduction/archaic/crafting/BlockCraftingDesk.java +++ b/src/main/java/resonantinduction/archaic/crafting/BlockEngineeringTable.java @@ -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 diff --git a/src/main/java/resonantinduction/archaic/crafting/TileEntityCraftingTable.java b/src/main/java/resonantinduction/archaic/crafting/TileEngineeringTable.java similarity index 64% rename from src/main/java/resonantinduction/archaic/crafting/TileEntityCraftingTable.java rename to src/main/java/resonantinduction/archaic/crafting/TileEngineeringTable.java index 9a5d2acac..b62c148db 100644 --- a/src/main/java/resonantinduction/archaic/crafting/TileEntityCraftingTable.java +++ b/src/main/java/resonantinduction/archaic/crafting/TileEngineeringTable.java @@ -2,7 +2,7 @@ package resonantinduction.archaic.crafting; import resonantinduction.core.prefab.tile.TileEntityInv; -public class TileEntityCraftingTable extends TileEntityInv +public class TileEngineeringTable extends TileEntityInv { } diff --git a/src/main/java/resonantinduction/archaic/engineering/BlockEngineering.java b/src/main/java/resonantinduction/archaic/engineering/BlockImprinter.java similarity index 91% rename from src/main/java/resonantinduction/archaic/engineering/BlockEngineering.java rename to src/main/java/resonantinduction/archaic/engineering/BlockImprinter.java index aa4743359..07ef5f608 100644 --- a/src/main/java/resonantinduction/archaic/engineering/BlockEngineering.java +++ b/src/main/java/resonantinduction/archaic/engineering/BlockImprinter.java @@ -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(); } } diff --git a/src/main/java/resonantinduction/archaic/engineering/ContainerEngineering.java b/src/main/java/resonantinduction/archaic/engineering/ContainerEngineering.java index 5e54baa49..b86227029 100644 --- a/src/main/java/resonantinduction/archaic/engineering/ContainerEngineering.java +++ b/src/main/java/resonantinduction/archaic/engineering/ContainerEngineering.java @@ -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; } diff --git a/src/main/java/resonantinduction/archaic/engineering/TileEngineering.java b/src/main/java/resonantinduction/archaic/engineering/TileImprinter.java similarity index 97% rename from src/main/java/resonantinduction/archaic/engineering/TileEngineering.java rename to src/main/java/resonantinduction/archaic/engineering/TileImprinter.java index 7cf835363..99f7718ea 100644 --- a/src/main/java/resonantinduction/archaic/engineering/TileEngineering.java +++ b/src/main/java/resonantinduction/archaic/engineering/TileImprinter.java @@ -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; } } diff --git a/src/main/java/resonantinduction/electrical/Electrical.java b/src/main/java/resonantinduction/electrical/Electrical.java index fcf373248..e41deb5d7 100644 --- a/src/main/java/resonantinduction/electrical/Electrical.java +++ b/src/main/java/resonantinduction/electrical/Electrical.java @@ -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();