diff --git a/src/main/java/storagecraft/StorageCraft.java b/src/main/java/storagecraft/StorageCraft.java index 20086e439..6a6cb350b 100644 --- a/src/main/java/storagecraft/StorageCraft.java +++ b/src/main/java/storagecraft/StorageCraft.java @@ -28,6 +28,7 @@ public class StorageCraft public static final int EXPORTER = 5; public static final int DETECTOR = 6; public static final int SOLDERER = 7; + public static final int WIRELESS_TRANSMITTER = 8; } public static final String ID = "storagecraft"; diff --git a/src/main/java/storagecraft/StorageCraftBlocks.java b/src/main/java/storagecraft/StorageCraftBlocks.java index 2cc782023..e21ed179d 100644 --- a/src/main/java/storagecraft/StorageCraftBlocks.java +++ b/src/main/java/storagecraft/StorageCraftBlocks.java @@ -10,6 +10,7 @@ import storagecraft.block.BlockImporter; import storagecraft.block.BlockMachineCasing; import storagecraft.block.BlockSolderer; import storagecraft.block.BlockExternalStorage; +import storagecraft.block.BlockWirelessTransmitter; public class StorageCraftBlocks { @@ -23,4 +24,5 @@ public class StorageCraftBlocks public static final BlockDetector DETECTOR = new BlockDetector(); public static final BlockMachineCasing MACHINE_CASING = new BlockMachineCasing(); public static final BlockSolderer SOLDERER = new BlockSolderer(); + public static final BlockWirelessTransmitter WIRELESS_TRANSMITTER = new BlockWirelessTransmitter(); } diff --git a/src/main/java/storagecraft/StorageCraftItems.java b/src/main/java/storagecraft/StorageCraftItems.java index d045fe472..83f96228f 100644 --- a/src/main/java/storagecraft/StorageCraftItems.java +++ b/src/main/java/storagecraft/StorageCraftItems.java @@ -7,11 +7,13 @@ import storagecraft.item.ItemStorageCell; import storagecraft.item.ItemQuartzEnrichedIron; import storagecraft.item.ItemStoragePart; import storagecraft.item.ItemWirelessGrid; +import storagecraft.item.ItemWirelessGridPlate; public class StorageCraftItems { public static final ItemStorageCell STORAGE_CELL = new ItemStorageCell(); public static final ItemWirelessGrid WIRELESS_GRID = new ItemWirelessGrid(); + public static final ItemWirelessGridPlate WIRELESS_GRID_PLATE = new ItemWirelessGridPlate(); public static final ItemQuartzEnrichedIron QUARTZ_ENRICHED_IRON = new ItemQuartzEnrichedIron(); public static final ItemCore CORE = new ItemCore(); public static final ItemSilicon SILICON = new ItemSilicon(); diff --git a/src/main/java/storagecraft/block/BlockWirelessTransmitter.java b/src/main/java/storagecraft/block/BlockWirelessTransmitter.java new file mode 100644 index 000000000..df2625bf8 --- /dev/null +++ b/src/main/java/storagecraft/block/BlockWirelessTransmitter.java @@ -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.TileWirelessTransmitter; + +public class BlockWirelessTransmitter extends BlockBase implements ITileEntityProvider +{ + public BlockWirelessTransmitter() + { + super("wirelessTransmitter"); + } + + @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.WIRELESS_TRANSMITTER, world, x, y, z); + } + + return true; + } + + @Override + public TileEntity createNewTileEntity(World world, int meta) + { + return new TileWirelessTransmitter(); + } +} diff --git a/src/main/java/storagecraft/container/ContainerWirelessTransmitter.java b/src/main/java/storagecraft/container/ContainerWirelessTransmitter.java new file mode 100644 index 000000000..3b33b7ca3 --- /dev/null +++ b/src/main/java/storagecraft/container/ContainerWirelessTransmitter.java @@ -0,0 +1,22 @@ +package storagecraft.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import storagecraft.StorageCraftItems; +import storagecraft.container.slot.SlotItemFilter; +import storagecraft.container.slot.SlotOutput; +import storagecraft.tile.TileWirelessTransmitter; + +public class ContainerWirelessTransmitter extends ContainerBase +{ + public ContainerWirelessTransmitter(EntityPlayer player, TileWirelessTransmitter wirelessTransmitter) + { + super(player); + + addPlayerInventory(8, 55); + + addSlotToContainer(new SlotItemFilter(wirelessTransmitter, 0, 8, 20, Items.ender_pearl)); + addSlotToContainer(new SlotItemFilter(wirelessTransmitter, 1, 101, 20, StorageCraftItems.WIRELESS_GRID)); + addSlotToContainer(new SlotOutput(wirelessTransmitter, 2, 152, 20)); + } +} diff --git a/src/main/java/storagecraft/gui/GuiHandler.java b/src/main/java/storagecraft/gui/GuiHandler.java index 238974f5f..19fa43427 100644 --- a/src/main/java/storagecraft/gui/GuiHandler.java +++ b/src/main/java/storagecraft/gui/GuiHandler.java @@ -14,6 +14,7 @@ import storagecraft.container.ContainerGrid; import storagecraft.container.ContainerImporter; import storagecraft.container.ContainerSolderer; import storagecraft.container.ContainerExternalStorage; +import storagecraft.container.ContainerWirelessTransmitter; import storagecraft.tile.TileController; import storagecraft.tile.TileDetector; import storagecraft.tile.TileDrive; @@ -22,6 +23,7 @@ import storagecraft.tile.TileGrid; import storagecraft.tile.TileImporter; import storagecraft.tile.TileSolderer; import storagecraft.tile.TileExternalStorage; +import storagecraft.tile.TileWirelessTransmitter; public class GuiHandler implements IGuiHandler { @@ -45,6 +47,8 @@ public class GuiHandler implements IGuiHandler return new ContainerDetector(player, (TileDetector) tile); case StorageCraft.GUI.SOLDERER: return new ContainerSolderer(player, (TileSolderer) tile); + case StorageCraft.GUI.WIRELESS_TRANSMITTER: + return new ContainerWirelessTransmitter(player, (TileWirelessTransmitter) tile); default: return null; } @@ -79,6 +83,8 @@ public class GuiHandler implements IGuiHandler return new GuiDetector((ContainerDetector) getContainer(ID, player, tile), (TileDetector) tile); case StorageCraft.GUI.SOLDERER: return new GuiSolderer((ContainerSolderer) getContainer(ID, player, tile), (TileSolderer) tile); + case StorageCraft.GUI.WIRELESS_TRANSMITTER: + return new GuiWirelessTransmitter((ContainerWirelessTransmitter) getContainer(ID, player, tile), (TileWirelessTransmitter) tile); default: return null; } diff --git a/src/main/java/storagecraft/gui/GuiWirelessTransmitter.java b/src/main/java/storagecraft/gui/GuiWirelessTransmitter.java new file mode 100644 index 000000000..f8f4fe36a --- /dev/null +++ b/src/main/java/storagecraft/gui/GuiWirelessTransmitter.java @@ -0,0 +1,50 @@ +package storagecraft.gui; + +import net.minecraft.inventory.Container; +import storagecraft.gui.sidebutton.SideButtonRedstoneMode; +import storagecraft.tile.TileWirelessTransmitter; + +public class GuiWirelessTransmitter extends GuiBase +{ + private TileWirelessTransmitter wirelessTransmitter; + + public GuiWirelessTransmitter(Container container, TileWirelessTransmitter wirelessTransmitter) + { + super(container, 176, 137); + + this.wirelessTransmitter = wirelessTransmitter; + } + + @Override + public void init(int x, int y) + { + addSideButton(new SideButtonRedstoneMode(wirelessTransmitter)); + } + + @Override + public void update(int x, int y) + { + } + + @Override + public void drawBackground(int x, int y, int mouseX, int mouseY) + { + bindTexture("gui/wirelessTransmitter.png"); + + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + + if (wirelessTransmitter.isWorking()) + { + int progress = (int) ((float) wirelessTransmitter.getProgress() / (float) TileWirelessTransmitter.TOTAL_PROGRESS * 14f); + + drawTexturedModalRect(x + 36 - 1, y + 21 - 1 + progress, 178, 0 + progress, 14, 14); + } + } + + @Override + public void drawForeground(int mouseX, int mouseY) + { + drawString(7, 7, t("gui.storagecraft:wirelessTransmitter")); + drawString(7, 43, t("container.inventory")); + } +} diff --git a/src/main/java/storagecraft/item/ItemWirelessGrid.java b/src/main/java/storagecraft/item/ItemWirelessGrid.java index 4ef8d422f..29d8ae43c 100644 --- a/src/main/java/storagecraft/item/ItemWirelessGrid.java +++ b/src/main/java/storagecraft/item/ItemWirelessGrid.java @@ -1,9 +1,11 @@ package storagecraft.item; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IIcon; @@ -11,12 +13,13 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; import storagecraft.StorageCraft; import storagecraft.tile.TileGrid; +import storagecraft.tile.TileWirelessTransmitter; public class ItemWirelessGrid extends ItemBase { - public static final String NBT_GRID_X = "GridX"; - public static final String NBT_GRID_Y = "GridY"; - public static final String NBT_GRID_Z = "GridZ"; + public static final String NBT_WIRELESS_TRANSMITTER_X = "WirelessTransmitterX"; + public static final String NBT_WIRELESS_TRANSMITTER_Y = "WirelessTransmitterY"; + public static final String NBT_WIRELESS_TRANSMITTER_Z = "WirelessTransmitterZ"; private IIcon iconConnected; private IIcon iconDisconnected; @@ -26,36 +29,26 @@ public class ItemWirelessGrid extends ItemBase super("wirelessGrid"); setMaxStackSize(1); + setHasSubtypes(true); + setMaxDamage(0); } @Override - public void registerIcons(IIconRegister register) + public void getSubItems(Item item, CreativeTabs tab, List list) { - iconConnected = register.registerIcon("storagecraft:wirelessGridConnected"); - iconDisconnected = register.registerIcon("storagecraft:wirelessGridDisconnected"); - } - - @Override - public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) - { - if (!world.isRemote) + for (int i = 0; i < 2; ++i) { - TileEntity tile = world.getTileEntity(x, y, z); - - if (tile instanceof TileGrid) - { - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setInteger(NBT_GRID_X, x); - stack.stackTagCompound.setInteger(NBT_GRID_Y, y); - stack.stackTagCompound.setInteger(NBT_GRID_Z, z); - - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocalFormatted("misc.storagecraft:wirelessGrid.set", x, y, z))); - - return true; - } + list.add(new ItemStack(item, 1, i)); } + } - return super.onItemUseFirst(stack, player, world, x, y, z, side, hitX, hitY, hitZ); + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean b) + { + if (isValid(stack)) + { + list.add(StatCollector.translateToLocalFormatted("misc.storagecraft:wirelessGrid.tooltip", getX(stack), getY(stack), getZ(stack))); + } } @Override @@ -73,9 +66,27 @@ public class ItemWirelessGrid extends ItemBase TileEntity tile = world.getTileEntity(x, y, z); - if (tile instanceof TileGrid) + if (tile instanceof TileWirelessTransmitter) { - player.openGui(StorageCraft.INSTANCE, StorageCraft.GUI.GRID, world, x, y, z); + TileWirelessTransmitter wirelessTransmitter = (TileWirelessTransmitter) tile; + + if (wirelessTransmitter.isWorking()) + { + TileGrid grid = wirelessTransmitter.getGrid(stack.getItemDamage()); + + if (grid == null) + { + player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("misc.storagecraft:wirelessGrid.noGrid." + stack.getItemDamage()))); + } + else + { + player.openGui(StorageCraft.INSTANCE, StorageCraft.GUI.GRID, world, grid.xCoord, grid.yCoord, grid.zCoord); + } + } + else + { + player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("misc.storagecraft:wirelessGrid.notWorking"))); + } } else { @@ -89,26 +100,31 @@ public class ItemWirelessGrid extends ItemBase } else { - player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("misc.storagecraft:wirelessGrid.notSet"))); + player.addChatComponentMessage(new ChatComponentText(StatCollector.translateToLocal("misc.storagecraft:wirelessGrid.notSet." + stack.getItemDamage()))); } } return stack; } + public boolean isCrafting(ItemStack stack) + { + return stack.getItemDamage() == 1; + } + public int getX(ItemStack stack) { - return stack.stackTagCompound.getInteger(NBT_GRID_X); + return stack.stackTagCompound.getInteger(NBT_WIRELESS_TRANSMITTER_X); } public int getY(ItemStack stack) { - return stack.stackTagCompound.getInteger(NBT_GRID_Y); + return stack.stackTagCompound.getInteger(NBT_WIRELESS_TRANSMITTER_Y); } public int getZ(ItemStack stack) { - return stack.stackTagCompound.getInteger(NBT_GRID_Z); + return stack.stackTagCompound.getInteger(NBT_WIRELESS_TRANSMITTER_Z); } public boolean isInRange(ItemStack stack, EntityPlayer player) @@ -118,7 +134,14 @@ public class ItemWirelessGrid extends ItemBase public boolean isValid(ItemStack stack) { - return stack.stackTagCompound != null && stack.stackTagCompound.hasKey(NBT_GRID_X) && stack.stackTagCompound.hasKey(NBT_GRID_Y) && stack.stackTagCompound.hasKey(NBT_GRID_Z); + return stack.stackTagCompound != null && stack.stackTagCompound.hasKey(NBT_WIRELESS_TRANSMITTER_X) && stack.stackTagCompound.hasKey(NBT_WIRELESS_TRANSMITTER_Y) && stack.stackTagCompound.hasKey(NBT_WIRELESS_TRANSMITTER_Z); + } + + @Override + public void registerIcons(IIconRegister register) + { + iconConnected = register.registerIcon("storagecraft:wirelessGridConnected"); + iconDisconnected = register.registerIcon("storagecraft:wirelessGridDisconnected"); } @Override diff --git a/src/main/java/storagecraft/item/ItemWirelessGridPlate.java b/src/main/java/storagecraft/item/ItemWirelessGridPlate.java new file mode 100644 index 000000000..da7e2e6b8 --- /dev/null +++ b/src/main/java/storagecraft/item/ItemWirelessGridPlate.java @@ -0,0 +1,11 @@ +package storagecraft.item; + +public class ItemWirelessGridPlate extends ItemBase +{ + public ItemWirelessGridPlate() + { + super("wirelessGridPlate"); + + setMaxStackSize(1); + } +} diff --git a/src/main/java/storagecraft/proxy/CommonProxy.java b/src/main/java/storagecraft/proxy/CommonProxy.java index 5e38ac97d..5e882696c 100644 --- a/src/main/java/storagecraft/proxy/CommonProxy.java +++ b/src/main/java/storagecraft/proxy/CommonProxy.java @@ -38,10 +38,12 @@ import storagecraft.tile.TileGrid; import storagecraft.tile.TileImporter; import storagecraft.tile.TileSolderer; import storagecraft.tile.TileExternalStorage; +import storagecraft.tile.TileWirelessTransmitter; import storagecraft.tile.solderer.SoldererRecipeCraftingGrid; import storagecraft.tile.solderer.SoldererRecipeDrive; import storagecraft.tile.solderer.SoldererRecipePrintedProcessor; import storagecraft.tile.solderer.SoldererRecipeProcessor; +import storagecraft.tile.solderer.SoldererRecipeWirelessGrid; import storagecraft.tile.solderer.SoldererRegistry; public class CommonProxy @@ -70,6 +72,7 @@ public class CommonProxy GameRegistry.registerTileEntity(TileExporter.class, "exporter"); GameRegistry.registerTileEntity(TileDetector.class, "detector"); GameRegistry.registerTileEntity(TileSolderer.class, "solderer"); + GameRegistry.registerTileEntity(TileWirelessTransmitter.class, "wirelessTransmitter"); GameRegistry.registerBlock(StorageCraftBlocks.CONTROLLER, "controller"); GameRegistry.registerBlock(StorageCraftBlocks.CABLE, ItemBlockCable.class, "cable"); @@ -81,6 +84,7 @@ public class CommonProxy GameRegistry.registerBlock(StorageCraftBlocks.DETECTOR, "detector"); GameRegistry.registerBlock(StorageCraftBlocks.MACHINE_CASING, "machineCasing"); GameRegistry.registerBlock(StorageCraftBlocks.SOLDERER, "solderer"); + GameRegistry.registerBlock(StorageCraftBlocks.WIRELESS_TRANSMITTER, "wirelessTransmitter"); GameRegistry.registerItem(StorageCraftItems.STORAGE_CELL, "storageCell"); GameRegistry.registerItem(StorageCraftItems.WIRELESS_GRID, "wirelessGrid"); @@ -89,6 +93,7 @@ public class CommonProxy GameRegistry.registerItem(StorageCraftItems.SILICON, "silicon"); GameRegistry.registerItem(StorageCraftItems.PROCESSOR, "processor"); GameRegistry.registerItem(StorageCraftItems.STORAGE_PART, "storagePart"); + GameRegistry.registerItem(StorageCraftItems.WIRELESS_GRID_PLATE, "wirelessGridPlate"); // Processors SoldererRegistry.addRecipe(new SoldererRecipePrintedProcessor(ItemProcessor.TYPE_PRINTED_BASIC)); @@ -187,17 +192,21 @@ public class CommonProxy // Crafting Grid SoldererRegistry.addRecipe(new SoldererRecipeCraftingGrid()); - // Wireless Grid - GameRegistry.addRecipe(new ItemStack(StorageCraftItems.WIRELESS_GRID), - "PCP", - "PAP", - "PDP", + // Wireless Grid Plate + GameRegistry.addRecipe(new ItemStack(StorageCraftItems.WIRELESS_GRID_PLATE), + " P ", + "ERE", + "EEE", 'P', new ItemStack(Items.ender_pearl), - 'C', new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION), - 'D', new ItemStack(StorageCraftItems.CORE, 1, ItemCore.TYPE_DESTRUCTION), - 'A', new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED) + 'R', new ItemStack(Items.redstone), + 'E', new ItemStack(StorageCraftItems.QUARTZ_ENRICHED_IRON) ); + // @TODO: Wireless Transmitter + // Wireless Grid + SoldererRegistry.addRecipe(new SoldererRecipeWirelessGrid(0)); + SoldererRegistry.addRecipe(new SoldererRecipeWirelessGrid(1)); + // External Storage GameRegistry.addRecipe(new ItemStack(StorageCraftBlocks.EXTERNAL_STORAGE), "CED", diff --git a/src/main/java/storagecraft/tile/TileWirelessTransmitter.java b/src/main/java/storagecraft/tile/TileWirelessTransmitter.java new file mode 100644 index 000000000..e222ec8d9 --- /dev/null +++ b/src/main/java/storagecraft/tile/TileWirelessTransmitter.java @@ -0,0 +1,227 @@ +package storagecraft.tile; + +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.item.ItemWirelessGrid; +import storagecraft.util.InventoryUtils; + +public class TileWirelessTransmitter extends TileMachine implements IInventory +{ + public static final int TOTAL_PROGRESS = 10000; + + public static final String NBT_WORKING = "Working"; + public static final String NBT_PROGRESS = "Progress"; + + private InventorySimple inventory = new InventorySimple("wirelessTransmitter", 3); + + private boolean working; + private int progress = 0; + + @Override + public int getEnergyUsage() + { + return 4; + } + + @Override + public void updateMachine() + { + if (working) + { + progress++; + + if (progress == TOTAL_PROGRESS) + { + reset(); + } + } + else if (inventory.getStackInSlot(0) != null) + { + inventory.decrStackSize(0, 1); + + progress = 0; + working = true; + } + + if (inventory.getStackInSlot(1) != null) + { + ItemStack slot = inventory.getStackInSlot(1); + + slot.stackTagCompound = new NBTTagCompound(); + slot.stackTagCompound.setInteger(ItemWirelessGrid.NBT_WIRELESS_TRANSMITTER_X, xCoord); + slot.stackTagCompound.setInteger(ItemWirelessGrid.NBT_WIRELESS_TRANSMITTER_Y, yCoord); + slot.stackTagCompound.setInteger(ItemWirelessGrid.NBT_WIRELESS_TRANSMITTER_Z, zCoord); + + inventory.setInventorySlotContents(2, slot); + inventory.setInventorySlotContents(1, null); + } + } + + public void reset() + { + progress = 0; + working = false; + } + + @Override + public void onDisconnected() + { + super.onDisconnected(); + + reset(); + } + + public boolean isWorking() + { + return working; + } + + public int getProgress() + { + return progress; + } + + public TileGrid getGrid(int type) + { + for (TileMachine machine : getController().getMachines()) + { + if (worldObj.getTileEntity(machine.xCoord, machine.yCoord, machine.zCoord) != null) + { + if (machine instanceof TileGrid) + { + TileGrid grid = (TileGrid) machine; + + if (grid.getType() == type) + { + return grid; + } + } + } + } + + return 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); + + if (nbt.hasKey(NBT_WORKING)) + { + working = nbt.getBoolean(NBT_WORKING); + } + + if (nbt.hasKey(NBT_PROGRESS)) + { + progress = nbt.getInteger(NBT_PROGRESS); + } + } + + @Override + public void writeToNBT(NBTTagCompound nbt) + { + super.writeToNBT(nbt); + + InventoryUtils.saveInventory(this, nbt); + + nbt.setBoolean(NBT_WORKING, working); + nbt.setInteger(NBT_PROGRESS, progress); + } + + @Override + public void fromBytes(ByteBuf buf) + { + super.fromBytes(buf); + + working = buf.readBoolean(); + progress = buf.readInt(); + } + + @Override + public void toBytes(ByteBuf buf) + { + super.toBytes(buf); + + buf.writeBoolean(working); + buf.writeInt(progress); + } +} diff --git a/src/main/java/storagecraft/tile/solderer/SoldererRecipeWirelessGrid.java b/src/main/java/storagecraft/tile/solderer/SoldererRecipeWirelessGrid.java new file mode 100644 index 000000000..85028601a --- /dev/null +++ b/src/main/java/storagecraft/tile/solderer/SoldererRecipeWirelessGrid.java @@ -0,0 +1,47 @@ +package storagecraft.tile.solderer; + +import net.minecraft.item.ItemStack; +import storagecraft.StorageCraftBlocks; +import storagecraft.StorageCraftItems; +import storagecraft.item.ItemProcessor; + +public class SoldererRecipeWirelessGrid implements ISoldererRecipe +{ + private int type; + + public SoldererRecipeWirelessGrid(int type) + { + this.type = type; + } + + @Override + public ItemStack getRow(int row) + { + if (row == 0) + { + return new ItemStack(StorageCraftItems.WIRELESS_GRID_PLATE); + } + else if (row == 1) + { + return new ItemStack(StorageCraftBlocks.GRID, 1, type); + } + else if (row == 2) + { + return new ItemStack(StorageCraftItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED); + } + + return null; + } + + @Override + public ItemStack getResult() + { + return new ItemStack(StorageCraftItems.WIRELESS_GRID, 1, type); + } + + @Override + public int getDuration() + { + return 1000; + } +} diff --git a/src/main/resources/assets/storagecraft/lang/en_US.lang b/src/main/resources/assets/storagecraft/lang/en_US.lang index 79a145b01..e6e78cd71 100644 --- a/src/main/resources/assets/storagecraft/lang/en_US.lang +++ b/src/main/resources/assets/storagecraft/lang/en_US.lang @@ -8,6 +8,7 @@ gui.storagecraft:importer=Importer gui.storagecraft:exporter=Exporter gui.storagecraft:detector=Detector gui.storagecraft:solderer=Solderer +gui.storagecraft:wirelessTransmitter=Wireless Transmitter misc.storagecraft:energyStored=%d / %d RF misc.storagecraft:energyUsage=Usage: %d RF/t @@ -15,11 +16,17 @@ misc.storagecraft:energyUsage=Usage: %d RF/t misc.storagecraft:storageCellStored=Stored: %d misc.storagecraft:storageCellStoredWithCapacity=Stored: %d / %d -misc.storagecraft:wirelessGrid.set=Grid set at %d, %d, %d. -misc.storagecraft:wirelessGrid.notFound=Grid not found. -misc.storagecraft:wirelessGrid.notSet=Grid not set yet. -misc.storagecraft:wirelessGrid.outOfRange=Grid is out of range. +misc.storagecraft:wirelessGrid.tooltip=Bound to %d, %d, %d. +misc.storagecraft:wirelessGrid.notWorking=The Wireless Grid is out of fuel or disabled. +misc.storagecraft:wirelessGrid.notFound=The Wireless Transmitter is not found. +misc.storagecraft:wirelessGrid.notSet.0=This Wireless Grid is not bound to a Wireless Transmitter yet. +misc.storagecraft:wirelessGrid.notSet.1=This Wireless Crafting Grid is not bound to a Wireless Transmitter yet. +misc.storagecraft:wirelessGrid.outOfRange=The Wireless Transmitter is out of range. +misc.storagecraft:wirelessGrid.noGrid.0=There is no Grid found in the network. You need to place a Grid before you can use the Wireless Grid! +misc.storagecraft:wirelessGrid.noGrid.1=There is no Crafting Grid found in the network. You need to place a Crafting Grid before you can use the Wireless Crafting Grid! +misc.storagecraft:yes=Yes +misc.storagecraft:no=No misc.storagecraft:clear=Clear sidebutton.storagecraft:compare.1=Compare Damage @@ -47,9 +54,6 @@ sidebutton.storagecraft:detector.mode.0=Under the amount sidebutton.storagecraft:detector.mode.1=On the amount sidebutton.storagecraft:detector.mode.2=Above the amount -misc.storagecraft:yes=Yes -misc.storagecraft:no=No - block.storagecraft:controller.name=Controller block.storagecraft:cable.0.name=Cable block.storagecraft:cable.1.name=Sensitive Cable @@ -62,13 +66,16 @@ block.storagecraft:exporter.name=Exporter block.storagecraft:detector.name=Detector block.storagecraft:machineCasing.name=Machine Casing block.storagecraft:solderer.name=Solderer +block.storagecraft:wirelessTransmitter.name=Wireless Transmitter item.storagecraft:storageCell.0.name=1k Storage Cell item.storagecraft:storageCell.1.name=4k Storage Cell 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:wirelessGrid.0.name=Wireless Grid +item.storagecraft:wirelessGrid.1.name=Wireless Crafting Grid +item.storagecraft:wirelessGridPlate.name=Wireless Grid Plate item.storagecraft:quartzEnrichedIron.name=Quartz Enriched Iron item.storagecraft:core.0.name=Construction Core item.storagecraft:core.1.name=Destruction Core diff --git a/src/main/resources/assets/storagecraft/textures/gui/wirelessTransmitter.png b/src/main/resources/assets/storagecraft/textures/gui/wirelessTransmitter.png new file mode 100644 index 000000000..bc0d15b6d Binary files /dev/null and b/src/main/resources/assets/storagecraft/textures/gui/wirelessTransmitter.png differ diff --git a/src/main/resources/assets/storagecraft/textures/items/wirelessGridPlate.png b/src/main/resources/assets/storagecraft/textures/items/wirelessGridPlate.png new file mode 100644 index 000000000..07d939dcf Binary files /dev/null and b/src/main/resources/assets/storagecraft/textures/items/wirelessGridPlate.png differ