add solderer, processors, silicon, quartz enriched iron

This commit is contained in:
Raoul Van den Berge
2015-12-23 14:12:23 +01:00
parent d0fbc2f540
commit 06fa4555cb
32 changed files with 785 additions and 58 deletions

View File

@@ -25,6 +25,7 @@ public class StorageCraft
public static final int IMPORTER = 4;
public static final int EXPORTER = 5;
public static final int DETECTOR = 6;
public static final int SOLDERER = 7;
}
public static final String ID = "storagecraft";

View File

@@ -8,6 +8,7 @@ import storagecraft.block.BlockExporter;
import storagecraft.block.BlockGrid;
import storagecraft.block.BlockImporter;
import storagecraft.block.BlockMachineCasing;
import storagecraft.block.BlockSolderer;
import storagecraft.block.BlockStorageProxy;
public class StorageCraftBlocks
@@ -21,4 +22,5 @@ public class StorageCraftBlocks
public static final BlockExporter EXPORTER = new BlockExporter();
public static final BlockDetector DETECTOR = new BlockDetector();
public static final BlockMachineCasing MACHINE_CASING = new BlockMachineCasing();
public static final BlockSolderer SOLDERER = new BlockSolderer();
}

View File

@@ -1,14 +1,18 @@
package storagecraft;
import storagecraft.item.ItemCore;
import storagecraft.item.ItemProcessor;
import storagecraft.item.ItemSilicon;
import storagecraft.item.ItemStorageCell;
import storagecraft.item.ItemStorigiumIngot;
import storagecraft.item.ItemQuartzEnrichedIron;
import storagecraft.item.ItemWirelessGrid;
public class StorageCraftItems
{
public static final ItemStorageCell STORAGE_CELL = new ItemStorageCell();
public static final ItemWirelessGrid WIRELESS_GRID = new ItemWirelessGrid();
public static final ItemStorigiumIngot STORIGIUM_INGOT = new ItemStorigiumIngot();
public static final ItemQuartzEnrichedIron QUARTZ_ENRICHED_IRON = new ItemQuartzEnrichedIron();
public static final ItemCore CORE = new ItemCore();
public static final ItemSilicon SILICON = new ItemSilicon();
public static final ItemProcessor PROCESSOR = new ItemProcessor();
}

View File

@@ -0,0 +1,33 @@
package storagecraft.block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import storagecraft.StorageCraft;
import storagecraft.tile.TileSolderer;
public class BlockSolderer extends BlockBase implements ITileEntityProvider
{
public BlockSolderer()
{
super("solderer");
}
@Override
public TileEntity createNewTileEntity(World world, int meta)
{
return new TileSolderer();
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (!world.isRemote)
{
player.openGui(StorageCraft.INSTANCE, StorageCraft.GUI.SOLDERER, world, x, y, z);
}
return true;
}
}

View File

@@ -0,0 +1,28 @@
package storagecraft.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import storagecraft.container.slot.SlotOutput;
import storagecraft.tile.TileSolderer;
public class ContainerSolderer extends ContainerBase
{
public ContainerSolderer(EntityPlayer player, TileSolderer solderer)
{
super(player);
addPlayerInventory(8, 95);
int x = 44;
int y = 20;
for (int i = 0; i < 3; ++i)
{
addSlotToContainer(new Slot(solderer, i, x, y));
y += 18;
}
addSlotToContainer(new SlotOutput(solderer, 3, 134, 38));
}
}

View File

@@ -0,0 +1,19 @@
package storagecraft.container.slot;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class SlotOutput extends Slot
{
public SlotOutput(IInventory inventory, int id, int x, int y)
{
super(inventory, id, x, y);
}
@Override
public boolean isItemValid(ItemStack stack)
{
return false;
}
}

View File

@@ -12,6 +12,7 @@ import storagecraft.container.ContainerDrive;
import storagecraft.container.ContainerExporter;
import storagecraft.container.ContainerGrid;
import storagecraft.container.ContainerImporter;
import storagecraft.container.ContainerSolderer;
import storagecraft.container.ContainerStorageProxy;
import storagecraft.tile.TileController;
import storagecraft.tile.TileDetector;
@@ -19,6 +20,7 @@ import storagecraft.tile.TileDrive;
import storagecraft.tile.TileExporter;
import storagecraft.tile.TileGrid;
import storagecraft.tile.TileImporter;
import storagecraft.tile.TileSolderer;
import storagecraft.tile.TileStorageProxy;
public class GuiHandler implements IGuiHandler
@@ -41,6 +43,8 @@ public class GuiHandler implements IGuiHandler
return new ContainerExporter(player, (TileExporter) tile);
case StorageCraft.GUI.DETECTOR:
return new ContainerDetector(player, (TileDetector) tile);
case StorageCraft.GUI.SOLDERER:
return new ContainerSolderer(player, (TileSolderer) tile);
default:
return null;
}
@@ -73,6 +77,8 @@ public class GuiHandler implements IGuiHandler
return new GuiExporter((ContainerExporter) getContainer(ID, player, tile), (TileExporter) tile);
case StorageCraft.GUI.DETECTOR:
return new GuiDetector((ContainerDetector) getContainer(ID, player, tile), (TileDetector) tile);
case StorageCraft.GUI.SOLDERER:
return new GuiSolderer((ContainerSolderer) getContainer(ID, player, tile), (TileSolderer) tile);
default:
return null;
}

View File

@@ -0,0 +1,48 @@
package storagecraft.gui;
import net.minecraft.inventory.Container;
import storagecraft.gui.sidebutton.SideButtonRedstoneMode;
import storagecraft.tile.TileSolderer;
public class GuiSolderer extends GuiBase
{
private TileSolderer solderer;
public GuiSolderer(Container container, TileSolderer solderer)
{
super(container, 176, 177);
this.solderer = solderer;
}
@Override
public void init(int x, int y)
{
addSideButton(new SideButtonRedstoneMode(solderer));
}
@Override
public void update(int x, int y)
{
}
@Override
public void drawBackground(int x, int y, int mouseX, int mouseY)
{
bindTexture("gui/solderer.png");
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
if (solderer.isWorking())
{
drawTexturedModalRect(x + 83, y + 40 - 1, 177, 0, solderer.getProgressScaled(21), 14);
}
}
@Override
public void drawForeground(int mouseX, int mouseY)
{
drawString(7, 7, t("gui.storagecraft:solderer"));
drawString(7, 82, t("container.inventory"));
}
}

View File

@@ -0,0 +1,53 @@
package storagecraft.item;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
public class ItemProcessor extends ItemBase
{
public static final int TYPE_PRINTED_BASIC = 0;
public static final int TYPE_PRINTED_IMPROVED = 1;
public static final int TYPE_PRINTED_ADVANCED = 2;
public static final int TYPE_BASIC = 3;
public static final int TYPE_IMPROVED = 4;
public static final int TYPE_ADVANCED = 5;
public static final int TYPE_PRINTED_SILICON = 6;
private IIcon[] icons = new IIcon[7];
public ItemProcessor()
{
super("processor");
setHasSubtypes(true);
setMaxDamage(0);
}
@Override
public void getSubItems(Item item, CreativeTabs tab, List list)
{
for (int i = 0; i <= 6; ++i)
{
list.add(new ItemStack(item, 1, i));
}
}
@Override
public void registerIcons(IIconRegister register)
{
for (int i = 0; i <= 6; ++i)
{
icons[i] = register.registerIcon("storagecraft:processor" + i);
}
}
@Override
public IIcon getIconFromDamage(int damage)
{
return icons[damage];
}
}

View File

@@ -0,0 +1,9 @@
package storagecraft.item;
public class ItemQuartzEnrichedIron extends ItemBase
{
public ItemQuartzEnrichedIron()
{
super("quartzEnrichedIron");
}
}

View File

@@ -0,0 +1,9 @@
package storagecraft.item;
public class ItemSilicon extends ItemBase
{
public ItemSilicon()
{
super("silicon");
}
}

View File

@@ -1,9 +0,0 @@
package storagecraft.item;
public class ItemStorigiumIngot extends ItemBase
{
public ItemStorigiumIngot()
{
super("storigiumIngot");
}
}

View File

@@ -16,6 +16,7 @@ import storagecraft.gui.GuiHandler;
import storagecraft.item.ItemBlockCable;
import storagecraft.item.ItemBlockGrid;
import storagecraft.item.ItemCore;
import storagecraft.item.ItemProcessor;
import storagecraft.network.MessageCompareUpdate;
import storagecraft.network.MessageDetectorAmountUpdate;
import storagecraft.network.MessageDetectorModeUpdate;
@@ -33,7 +34,13 @@ import storagecraft.tile.TileDrive;
import storagecraft.tile.TileExporter;
import storagecraft.tile.TileGrid;
import storagecraft.tile.TileImporter;
import storagecraft.tile.TileSolderer;
import storagecraft.tile.TileStorageProxy;
import storagecraft.tile.solderer.SoldererRecipeCraftingGrid;
import storagecraft.tile.solderer.SoldererRecipeDrive;
import storagecraft.tile.solderer.SoldererRecipePrintedProcessor;
import storagecraft.tile.solderer.SoldererRecipeProcessor;
import storagecraft.tile.solderer.SoldererRegistry;
public class CommonProxy
{
@@ -60,6 +67,7 @@ public class CommonProxy
GameRegistry.registerTileEntity(TileImporter.class, "importer");
GameRegistry.registerTileEntity(TileExporter.class, "exporter");
GameRegistry.registerTileEntity(TileDetector.class, "detector");
GameRegistry.registerTileEntity(TileSolderer.class, "solderer");
GameRegistry.registerBlock(StorageCraftBlocks.CONTROLLER, "controller");
GameRegistry.registerBlock(StorageCraftBlocks.CABLE, ItemBlockCable.class, "cable");
@@ -70,120 +78,160 @@ public class CommonProxy
GameRegistry.registerBlock(StorageCraftBlocks.EXPORTER, "exporter");
GameRegistry.registerBlock(StorageCraftBlocks.DETECTOR, "detector");
GameRegistry.registerBlock(StorageCraftBlocks.MACHINE_CASING, "machineCasing");
GameRegistry.registerBlock(StorageCraftBlocks.SOLDERER, "solderer");
GameRegistry.registerItem(StorageCraftItems.STORAGE_CELL, "storageCell");
GameRegistry.registerItem(StorageCraftItems.WIRELESS_GRID, "wirelessGrid");
GameRegistry.registerItem(StorageCraftItems.STORIGIUM_INGOT, "storigiumIngot");
GameRegistry.registerItem(StorageCraftItems.QUARTZ_ENRICHED_IRON, "storigiumIngot");
GameRegistry.registerItem(StorageCraftItems.CORE, "core");
GameRegistry.registerItem(StorageCraftItems.SILICON, "silicon");
GameRegistry.registerItem(StorageCraftItems.PROCESSOR, "processor");
GameRegistry.addRecipe(new ItemStack(StorageCraftItems.STORIGIUM_INGOT, 4),
// Processors
SoldererRegistry.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_BASIC));
SoldererRegistry.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_IMPROVED));
SoldererRegistry.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_ADVANCED));
SoldererRegistry.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_SILICON));
SoldererRegistry.addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_BASIC));
SoldererRegistry.addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_IMPROVED));
SoldererRegistry.addRecipe(new SoldererRecipeProcessor(ItemProcessor.TYPE_ADVANCED));
// Silicon
GameRegistry.addSmelting(Items.quartz, new ItemStack(StorageCraftItems.SILICON), 0.5f);
// Quartz Enriched Iron
GameRegistry.addRecipe(new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON, 4),
"II",
"IQ",
'I', new ItemStack(Items.iron_ingot),
'Q', new ItemStack(Items.quartz)
);
// Machine Casing
GameRegistry.addRecipe(new ItemStack(StorageCraftBlocks.MACHINE_CASING),
"SSS",
"S S",
"SSS",
'S', new ItemStack(StorageCraftItems.STORIGIUM_INGOT)
"EEE",
"E E",
"EEE",
'E', new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON)
);
// Construction Core
GameRegistry.addShapelessRecipe(new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
new ItemStack(StorageCraftItems.STORIGIUM_INGOT),
new ItemStack(Items.gold_ingot),
new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON),
new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
new ItemStack(Items.glowstone_dust)
);
// Destruction Core
GameRegistry.addShapelessRecipe(new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
new ItemStack(StorageCraftItems.STORIGIUM_INGOT),
new ItemStack(Items.quartz),
new ItemStack(Items.glowstone_dust)
new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON),
new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
new ItemStack(Items.quartz)
);
// Constroller
GameRegistry.addRecipe(new ItemStack(StorageCraftBlocks.CONTROLLER),
"SDS",
"DRD",
"SDS",
"EDE",
"SRS",
"ESE",
'D', new ItemStack(Items.diamond),
'S', new ItemStack(StorageCraftItems.STORIGIUM_INGOT),
'R', new ItemStack(Blocks.redstone_block)
'E', new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON),
'R', new ItemStack(Items.redstone),
'S', new ItemStack(StorageCraftItems.SILICON)
);
GameRegistry.addShapelessRecipe(new ItemStack(StorageCraftBlocks.DRIVE),
new ItemStack(StorageCraftBlocks.MACHINE_CASING),
new ItemStack(Blocks.chest)
// Solderer
GameRegistry.addRecipe(new ItemStack(StorageCraftBlocks.SOLDERER),
"ESE",
"E E",
"ESE",
'E', new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON),
'S', new ItemStack(Blocks.sticky_piston)
);
// Drive
SoldererRegistry.addRecipe(new SoldererRecipeDrive());
// Cable
GameRegistry.addRecipe(new ItemStack(StorageCraftBlocks.CABLE, 6, 0),
"SSS",
"GGG",
"SSS",
'S', new ItemStack(StorageCraftItems.STORIGIUM_INGOT),
'G', new ItemStack(Blocks.glass)
"EEE",
"GRG",
"EEE",
'E', new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON),
'G', new ItemStack(Blocks.glass),
'R', new ItemStack(Items.redstone)
);
// Sensitive Cable
GameRegistry.addShapelessRecipe(new ItemStack(StorageCraftBlocks.CABLE, 1, 1),
new ItemStack(StorageCraftBlocks.CABLE, 1, 0),
new ItemStack(Items.redstone)
);
// Grid
GameRegistry.addRecipe(new ItemStack(StorageCraftBlocks.GRID, 1, 0),
"SCS",
"GMG",
"SDS",
'S', new ItemStack(StorageCraftItems.STORIGIUM_INGOT),
'G', new ItemStack(Blocks.glass),
"ECE",
"PMP",
"EDE",
'E', new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON),
'P', new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
'C', new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'D', new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
'M', new ItemStack(StorageCraftBlocks.MACHINE_CASING)
);
GameRegistry.addShapelessRecipe(new ItemStack(StorageCraftBlocks.GRID, 1, 1),
new ItemStack(StorageCraftBlocks.GRID, 1, 0),
new ItemStack(Blocks.crafting_table)
);
// Crafting Grid
SoldererRegistry.addRecipe(new SoldererRecipeCraftingGrid());
// Wireless Grid
GameRegistry.addRecipe(new ItemStack(StorageCraftItems.WIRELESS_GRID),
"PCP",
"PGP",
"PAP",
"PDP",
'P', new ItemStack(Items.ender_pearl),
'C', new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'D', new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
'G', new ItemStack(Blocks.glass)
'A', new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
);
// Storage Proxy
GameRegistry.addRecipe(new ItemStack(StorageCraftBlocks.STORAGE_PROXY),
"SCS",
"CED",
"HMH",
"SDS",
'S', new ItemStack(StorageCraftItems.STORIGIUM_INGOT),
"EPE",
'E', new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON),
'H', new ItemStack(Blocks.chest),
'C', new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
'D', new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
'M', new ItemStack(StorageCraftBlocks.MACHINE_CASING)
'M', new ItemStack(StorageCraftBlocks.MACHINE_CASING),
'P', new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
);
// Importer
GameRegistry.addShapelessRecipe(new ItemStack(StorageCraftBlocks.IMPORTER),
new ItemStack(StorageCraftBlocks.MACHINE_CASING),
new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION)
new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC)
);
// Exporter
GameRegistry.addShapelessRecipe(new ItemStack(StorageCraftBlocks.EXPORTER),
new ItemStack(StorageCraftBlocks.MACHINE_CASING),
new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_DESTRUCTION)
new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC)
);
// Detector
GameRegistry.addRecipe(new ItemStack(StorageCraftBlocks.DETECTOR),
"SCS",
"ECE",
"RMR",
"SRS",
'S', new ItemStack(StorageCraftItems.STORIGIUM_INGOT),
"EPE",
'E', new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON),
'R', new ItemStack(Items.redstone),
'C', new ItemStack(Items.comparator),
'M', new ItemStack(StorageCraftBlocks.MACHINE_CASING)
'M', new ItemStack(StorageCraftBlocks.MACHINE_CASING),
'P', new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
);
// @TODO: Recipe for storage cells

View File

@@ -0,0 +1,211 @@
package storagecraft.tile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import storagecraft.inventory.InventorySimple;
import storagecraft.tile.solderer.ISoldererRecipe;
import storagecraft.tile.solderer.SoldererRegistry;
import storagecraft.util.InventoryUtils;
// @TODO: Write working and progress to NBT
public class TileSolderer extends TileMachine implements IInventory
{
private InventorySimple inventory = new InventorySimple("solderer", 4);
private ISoldererRecipe recipe;
private boolean working = false;
private int progress;
@SideOnly(Side.CLIENT)
private int duration;
@Override
public int getEnergyUsage()
{
return 3;
}
@Override
public void updateMachine()
{
ISoldererRecipe newRecipe = SoldererRegistry.getRecipe(inventory);
if (newRecipe == null)
{
reset();
}
else if (newRecipe != recipe && inventory.getStackInSlot(3) == null)
{
recipe = newRecipe;
progress = 0;
working = true;
}
else if (working)
{
progress++;
if (progress == recipe.getDuration())
{
inventory.setInventorySlotContents(3, recipe.getResult());
for (int i = 0; i < 3; ++i)
{
if (recipe.getRow(i) != null)
{
inventory.decrStackSize(i, recipe.getRow(i).stackSize);
}
}
reset();
}
}
}
@Override
public void onDisconnected()
{
super.onDisconnected();
reset();
}
public void reset()
{
progress = 0;
working = false;
recipe = null;
}
@Override
public int getSizeInventory()
{
return inventory.getSizeInventory();
}
@Override
public ItemStack getStackInSlot(int slot)
{
return inventory.getStackInSlot(slot);
}
@Override
public ItemStack decrStackSize(int slot, int amount)
{
return inventory.decrStackSize(slot, amount);
}
@Override
public ItemStack getStackInSlotOnClosing(int slot)
{
return inventory.getStackInSlotOnClosing(slot);
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
inventory.setInventorySlotContents(slot, stack);
}
@Override
public String getInventoryName()
{
return inventory.getInventoryName();
}
@Override
public boolean hasCustomInventoryName()
{
return inventory.hasCustomInventoryName();
}
@Override
public int getInventoryStackLimit()
{
return inventory.getInventoryStackLimit();
}
@Override
public boolean isUseableByPlayer(EntityPlayer player)
{
return inventory.isUseableByPlayer(player);
}
@Override
public void openInventory()
{
inventory.openInventory();
}
@Override
public void closeInventory()
{
inventory.closeInventory();
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack)
{
return inventory.isItemValidForSlot(slot, stack);
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
InventoryUtils.restoreInventory(this, nbt);
}
@Override
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
InventoryUtils.saveInventory(this, nbt);
}
@Override
public void fromBytes(ByteBuf buf)
{
super.fromBytes(buf);
working = buf.readBoolean();
progress = buf.readInt();
duration = buf.readInt();
}
@Override
public void toBytes(ByteBuf buf)
{
super.toBytes(buf);
buf.writeBoolean(working);
buf.writeInt(progress);
buf.writeInt(recipe != null ? recipe.getDuration() : 0);
}
public boolean isWorking()
{
return working;
}
public int getProgress()
{
return progress;
}
@SideOnly(Side.CLIENT)
public int getProgressScaled(int i)
{
return (int) ((float) progress / (float) duration * (float) i);
}
@SideOnly(Side.CLIENT)
public int getDuration()
{
return duration;
}
}

View File

@@ -0,0 +1,12 @@
package storagecraft.tile.solderer;
import net.minecraft.item.ItemStack;
public interface ISoldererRecipe
{
public ItemStack getRow(int row);
public ItemStack getResult();
public int getDuration();
}

View File

@@ -0,0 +1,41 @@
package storagecraft.tile.solderer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import storagecraft.StorageCraftBlocks;
import storagecraft.StorageCraftItems;
import storagecraft.item.ItemProcessor;
public class SoldererRecipeCraftingGrid implements ISoldererRecipe
{
@Override
public ItemStack getRow(int row)
{
if (row == 0)
{
return new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED);
}
else if (row == 1)
{
return new ItemStack(StorageCraftBlocks.GRID, 1, 0);
}
else if (row == 2)
{
return new ItemStack(Blocks.crafting_table);
}
return null;
}
@Override
public ItemStack getResult()
{
return new ItemStack(StorageCraftBlocks.GRID, 1, 1);
}
@Override
public int getDuration()
{
return 500;
}
}

View File

@@ -0,0 +1,41 @@
package storagecraft.tile.solderer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import storagecraft.StorageCraftBlocks;
import storagecraft.StorageCraftItems;
import storagecraft.item.ItemProcessor;
public class SoldererRecipeDrive implements ISoldererRecipe
{
@Override
public ItemStack getRow(int row)
{
if (row == 0)
{
return new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED);
}
else if (row == 1)
{
return new ItemStack(StorageCraftBlocks.MACHINE_CASING);
}
else if (row == 2)
{
return new ItemStack(Blocks.chest);
}
return null;
}
@Override
public ItemStack getResult()
{
return new ItemStack(StorageCraftBlocks.DRIVE);
}
@Override
public int getDuration()
{
return 400;
}
}

View File

@@ -0,0 +1,49 @@
package storagecraft.tile.solderer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import storagecraft.StorageCraftItems;
import storagecraft.item.ItemProcessor;
public class SoldererRecipePrintedProcessor implements ISoldererRecipe
{
private int type;
public SoldererRecipePrintedProcessor(int type)
{
this.type = type;
}
@Override
public ItemStack getRow(int row)
{
if (row == 1)
{
switch (type)
{
case ItemProcessor.TYPE_PRINTED_BASIC:
return new ItemStack(Items.iron_ingot);
case ItemProcessor.TYPE_PRINTED_IMPROVED:
return new ItemStack(Items.gold_ingot);
case ItemProcessor.TYPE_PRINTED_ADVANCED:
return new ItemStack(Items.diamond);
case ItemProcessor.TYPE_PRINTED_SILICON:
return new ItemStack(StorageCraftItems.SILICON);
}
}
return null;
}
@Override
public ItemStack getResult()
{
return new ItemStack(StorageCraftItems.PROCESSOR, 1, type);
}
@Override
public int getDuration()
{
return 100;
}
}

View File

@@ -0,0 +1,55 @@
package storagecraft.tile.solderer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import storagecraft.StorageCraftItems;
import storagecraft.item.ItemProcessor;
public class SoldererRecipeProcessor implements ISoldererRecipe
{
private int type;
public SoldererRecipeProcessor(int type)
{
this.type = type;
}
@Override
public ItemStack getRow(int row)
{
if (row == 0)
{
switch (type)
{
case ItemProcessor.TYPE_BASIC:
return new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_BASIC);
case ItemProcessor.TYPE_IMPROVED:
return new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_IMPROVED);
case ItemProcessor.TYPE_ADVANCED:
return new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_ADVANCED);
}
}
else if (row == 1)
{
return new ItemStack(Items.redstone);
}
else if (row == 2)
{
return new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_PRINTED_SILICON);
}
return null;
}
@Override
public ItemStack getResult()
{
return new ItemStack(StorageCraftItems.PROCESSOR, 1, type);
}
@Override
public int getDuration()
{
return 200;
}
}

View File

@@ -0,0 +1,47 @@
package storagecraft.tile.solderer;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.inventory.IInventory;
import storagecraft.util.InventoryUtils;
public class SoldererRegistry
{
public static List<ISoldererRecipe> recipes = new ArrayList<ISoldererRecipe>();
public static void addRecipe(ISoldererRecipe recipe)
{
recipes.add(recipe);
}
public static ISoldererRecipe getRecipe(IInventory inventory)
{
for (ISoldererRecipe recipe : recipes)
{
boolean ok = true;
for (int i = 0; i < 3; ++i)
{
if (!InventoryUtils.compareStackNoQuantity(recipe.getRow(i), inventory.getStackInSlot(i)))
{
ok = false;
}
if (inventory.getStackInSlot(i) != null && recipe.getRow(i) != null)
{
if (inventory.getStackInSlot(i).stackSize < recipe.getRow(i).stackSize)
{
ok = false;
}
}
}
if (ok)
{
return recipe;
}
}
return null;
}
}

View File

@@ -207,6 +207,16 @@ public class InventoryUtils
public static boolean compareStack(ItemStack first, ItemStack second, int flags)
{
if (first == null && second == null)
{
return true;
}
if ((first == null && second != null) || (first != null && second == null))
{
return false;
}
if ((flags & COMPARE_DAMAGE) == COMPARE_DAMAGE)
{
if (first.getItemDamage() != second.getItemDamage())

View File

@@ -7,6 +7,7 @@ gui.storagecraft:storageProxy=Storage Proxy
gui.storagecraft:importer=Importer
gui.storagecraft:exporter=Exporter
gui.storagecraft:detector=Detector
gui.storagecraft:solderer=Solderer
misc.storagecraft:energyStored=%d / %d RF
misc.storagecraft:energyUsage=Usage: %d RF/t
@@ -60,6 +61,7 @@ block.storagecraft:importer.name=Importer
block.storagecraft:exporter.name=Exporter
block.storagecraft:detector.name=Detector
block.storagecraft:machineCasing.name=Machine Casing
block.storagecraft:solderer.name=Solderer
item.storagecraft:storageCell.0.name=1k Storage Cell
item.storagecraft:storageCell.1.name=4k Storage Cell
@@ -67,6 +69,14 @@ item.storagecraft:storageCell.2.name=16k Storage Cell
item.storagecraft:storageCell.3.name=64k Storage Cell
item.storagecraft:storageCell.4.name=Creative Storage Cell
item.storagecraft:wirelessGrid.name=Wireless Grid
item.storagecraft:storigiumIngot.name=Storigium Ingot
item.storagecraft:quartzEnrichedIron.name=Quartz Enriched Iron
item.storagecraft:core.0.name=Construction Core
item.storagecraft:core.1.name=Destruction Core
item.storagecraft:silicon.name=Silicon
item.storagecraft:processor.0.name=Printed Basic Processor
item.storagecraft:processor.1.name=Printed Improved Processor
item.storagecraft:processor.2.name=Printed Advanced Processor
item.storagecraft:processor.3.name=Basic Processor
item.storagecraft:processor.4.name=Improved Processor
item.storagecraft:processor.5.name=Advanced Processor
item.storagecraft:processor.6.name=Printed Silicon

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B