diff --git a/assets/items.psd b/assets/items.psd index 9eaa421ec..3ac63c947 100644 Binary files a/assets/items.psd and b/assets/items.psd differ diff --git a/src/main/resources/assets/opencomputers/lang/en_US.lang b/src/main/resources/assets/opencomputers/lang/en_US.lang index 629e1551e..324d66a05 100644 --- a/src/main/resources/assets/opencomputers/lang/en_US.lang +++ b/src/main/resources/assets/opencomputers/lang/en_US.lang @@ -44,6 +44,7 @@ item.oc.appengTunnel.name=P2P Tunnel - OpenComputers item.oc.ArrowKeys.name=Arrow Keys item.oc.ButtonGroup.name=Button Group item.oc.CardBase.name=Card Base +item.oc.Chamelium.name=Chamelium item.oc.CircuitBoard.name=Circuit Board item.oc.ControlUnit.name=Control Unit (CU) item.oc.ComponentBus0.name=Component Bus (Tier 1) @@ -88,7 +89,6 @@ item.oc.MicrocontrollerCase1.name=Microcontroller Case (Tier 2) item.oc.MicrocontrollerCase3.name=Microcontroller Case (Creative) item.oc.NetworkCard.name=Network Card item.oc.NumPad.name=Numeric Keypad -item.oc.Plastic.name=Plastic item.oc.Present.name=A little something... item.oc.PrintedCircuitBoard.name=Printed Circuit Board (PCB) item.oc.RawCircuitBoard.name=Raw Circuit Board @@ -225,6 +225,7 @@ oc:tooltip.Cable=A cheap way of connecting blocks. oc:tooltip.Capacitor=Stores energy for later use. Can be filled and emptied very quickly. oc:tooltip.CardBase=As the name indicates, this is the basic building block for all expansion cards. oc:tooltip.Case=The Computer Case is the basic building block for computers and houses the computer's §fextension cards§7, §fRAM§7 and §fhard disks§7.[nl] Slots: §f%s§7 +oc:tooltip.Chamelium=Raw material for 3D prints. Do not swallow. Not that you could even if you wanted to. oc:tooltip.Charger=Transfers energy from capacitors into adjacent robots and drones. The transfer rate depends on the incoming §fredstone signal§7, where no signal means don't charge devices, and maximum strength means charge at full speed. Can also be used to charge tablets and access hard drives in tablets. oc:tooltip.CircuitBoard=Now we're getting somewhere. Can be etched to obtain a printed circuit board. oc:tooltip.ControlUnit=This is the unit that... controls... stuff. You need it to build a CPU. So yeah, totally important. @@ -261,7 +262,6 @@ oc:tooltip.Microcontroller=Microcontrollers are computers boiled down to the ess oc:tooltip.MicrocontrollerCase=Base component for building microcontrollers. Place it into an assembler to add further components and assemble a microcontroller. oc:tooltip.MotionSensor=Can detect movement of nearby living beings. Requires clear line-of-sight. oc:tooltip.NetworkCard=Allows distant computers connected by other blocks (such as cable) to communicate by sending messages to each other. -oc:tooltip.Plastic=Raw material for 3D prints. Do not swallow. Not that you could even if you wanted to. oc:tooltip.PowerAcceptor=Energy conversion speed: §f%s/t§7 oc:tooltip.PowerConverter.BuildCraft=§fBuildCraft MJ§7: §a%s:%s§7 oc:tooltip.PowerConverter.Factorization=§fFactorization Charge§7: §a%s:%s§7 @@ -271,7 +271,7 @@ oc:tooltip.PowerConverter.ThermalExpansion=§fThermal Expansion RF§7: §a%s:%s oc:tooltip.PowerConverter.ResonantEngine=§fResonant Engine Coulombs§7: §a%s:%s§7 oc:tooltip.PowerConverter=Converts power from other mods to the internal energy type. Conversion rates: oc:tooltip.PowerDistributor=Distributes energy among different networks. This is useful for sharing power fed into your system from one converter among different sub-networks that should remain separate. -oc:tooltip.Printer=Allows printing blocks of user-defined shapes using plastic and ink cartridges. Must be configured using a computer. Keep away from small children. Because reasons. +oc:tooltip.Printer=Allows printing blocks of user-defined shapes using Chamelium and Ink Cartridges. Must be configured using a computer. Keep away from small children. Because reasons. oc:tooltip.PrintedCircuitBoard=The basic building block for expansion cards and memory and such. oc:tooltip.Present=... for your troubles. Open this present for a chance to receive some §kphat lewt§7![nl]§8Craft OpenComputers items when the time is right for a chance to receive a present.§7 oc:tooltip.Raid=Allows combining three hard drives into one larger file system that can be used by all connected computers. diff --git a/src/main/resources/assets/opencomputers/recipes/default.recipes b/src/main/resources/assets/opencomputers/recipes/default.recipes index e65e75f70..37d1b4dc9 100644 --- a/src/main/resources/assets/opencomputers/recipes/default.recipes +++ b/src/main/resources/assets/opencomputers/recipes/default.recipes @@ -318,7 +318,7 @@ disk { [nuggetIron, "", nuggetIron] ["", nuggetIron, ""]] } -plastic { +chamelium { input: [[gravel, redstone, gravel], [redstone, {item=coal, subID=1}, redstone], [gravel, water_bucket, gravel]] diff --git a/src/main/resources/assets/opencomputers/textures/gui/printer_plastic.png b/src/main/resources/assets/opencomputers/textures/gui/printer_material.png similarity index 100% rename from src/main/resources/assets/opencomputers/textures/gui/printer_plastic.png rename to src/main/resources/assets/opencomputers/textures/gui/printer_material.png diff --git a/src/main/resources/assets/opencomputers/textures/items/Chamelium.png b/src/main/resources/assets/opencomputers/textures/items/Chamelium.png new file mode 100644 index 000000000..eeb2e9552 Binary files /dev/null and b/src/main/resources/assets/opencomputers/textures/items/Chamelium.png differ diff --git a/src/main/resources/assets/opencomputers/textures/items/Plastic.png b/src/main/resources/assets/opencomputers/textures/items/Plastic.png deleted file mode 100644 index 914588f6b..000000000 Binary files a/src/main/resources/assets/opencomputers/textures/items/Plastic.png and /dev/null differ diff --git a/src/main/scala/li/cil/oc/client/Textures.scala b/src/main/scala/li/cil/oc/client/Textures.scala index 19e3ce67d..888a66207 100644 --- a/src/main/scala/li/cil/oc/client/Textures.scala +++ b/src/main/scala/li/cil/oc/client/Textures.scala @@ -27,7 +27,7 @@ object Textures { val guiKeyboardMissing = new ResourceLocation(Settings.resourceDomain, "textures/gui/keyboard_missing.png") val guiPrinter = new ResourceLocation(Settings.resourceDomain, "textures/gui/printer.png") val guiPrinterInk = new ResourceLocation(Settings.resourceDomain, "textures/gui/printer_ink.png") - val guiPrinterPlastic = new ResourceLocation(Settings.resourceDomain, "textures/gui/printer_plastic.png") + val guiPrinterMaterial = new ResourceLocation(Settings.resourceDomain, "textures/gui/printer_material.png") val guiPrinterProgress = new ResourceLocation(Settings.resourceDomain, "textures/gui/printer_progress.png") val guiRaid = new ResourceLocation(Settings.resourceDomain, "textures/gui/raid.png") val guiRange = new ResourceLocation(Settings.resourceDomain, "textures/gui/range.png") diff --git a/src/main/scala/li/cil/oc/client/gui/Printer.scala b/src/main/scala/li/cil/oc/client/gui/Printer.scala index d5217af59..a3ca975bc 100644 --- a/src/main/scala/li/cil/oc/client/gui/Printer.scala +++ b/src/main/scala/li/cil/oc/client/gui/Printer.scala @@ -13,12 +13,12 @@ class Printer(playerInventory: InventoryPlayer, val printer: tileentity.Printer) xSize = 176 ySize = 166 - private val plasticBar = addWidget(new ProgressBar(40, 21) { + private val materialBar = addWidget(new ProgressBar(40, 21) { override def width = 62 override def height = 12 - override def barTexture = Textures.guiPrinterPlastic + override def barTexture = Textures.guiPrinterMaterial }) private val inkBar = addWidget(new ProgressBar(40, 53) { override def width = 62 @@ -47,9 +47,9 @@ class Printer(playerInventory: InventoryPlayer, val printer: tileentity.Printer) Localization.localizeImmediately(printer.getInventoryName), 8, 6, 0x404040) GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS) // Me lazy... prevents NEI render glitch. - if (func_146978_c(plasticBar.x, plasticBar.y, plasticBar.width, plasticBar.height, mouseX, mouseY)) { + if (func_146978_c(materialBar.x, materialBar.y, materialBar.width, materialBar.height, mouseX, mouseY)) { val tooltip = new java.util.ArrayList[String] - tooltip.add(printerContainer.amountPlastic + "/" + printer.maxAmountPlastic) + tooltip.add(printerContainer.amountMaterial + "/" + printer.maxAmountMaterial) copiedDrawHoveringText(tooltip, mouseX - guiLeft, mouseY - guiTop, fontRendererObj) } if (func_146978_c(inkBar.x, inkBar.y, inkBar.width, inkBar.height, mouseX, mouseY)) { @@ -64,7 +64,7 @@ class Printer(playerInventory: InventoryPlayer, val printer: tileentity.Printer) GL11.glColor3f(1, 1, 1) // Required under Linux. mc.renderEngine.bindTexture(Textures.guiPrinter) drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize) - plasticBar.level = printerContainer.amountPlastic / printer.maxAmountPlastic.toDouble + materialBar.level = printerContainer.amountMaterial / printer.maxAmountMaterial.toDouble inkBar.level = printerContainer.amountInk / printer.maxAmountInk.toDouble if (printerContainer.isPrinting) progressBar.level = (System.currentTimeMillis() % 3000) / 3000.0 else progressBar.level = 0 diff --git a/src/main/scala/li/cil/oc/common/container/Printer.scala b/src/main/scala/li/cil/oc/common/container/Printer.scala index b9172c9d1..ce9ecf205 100644 --- a/src/main/scala/li/cil/oc/common/container/Printer.scala +++ b/src/main/scala/li/cil/oc/common/container/Printer.scala @@ -16,7 +16,7 @@ class Printer(playerInventory: InventoryPlayer, val printer: tileentity.Printer) addPlayerInventorySlots(8, 84) var isPrinting = false - var amountPlastic = 0 + var amountMaterial = 0 var amountInk = 0 @SideOnly(Side.CLIENT) @@ -27,7 +27,7 @@ class Printer(playerInventory: InventoryPlayer, val printer: tileentity.Printer) } if (id == 1) { - amountPlastic = value + amountMaterial = value } if (id == 2) { @@ -42,9 +42,9 @@ class Printer(playerInventory: InventoryPlayer, val printer: tileentity.Printer) isPrinting = printer.isPrinting sendProgressBarUpdate(0, if (isPrinting) 1 else 0) } - if (amountPlastic != printer.amountPlastic) { - amountPlastic = printer.amountPlastic - sendProgressBarUpdate(1, amountPlastic) + if (amountMaterial != printer.amountMaterial) { + amountMaterial = printer.amountMaterial + sendProgressBarUpdate(1, amountMaterial) } if (amountInk != printer.amountInk) { amountInk = printer.amountInk diff --git a/src/main/scala/li/cil/oc/common/init/Items.scala b/src/main/scala/li/cil/oc/common/init/Items.scala index 960dac1ce..e7d94eede 100644 --- a/src/main/scala/li/cil/oc/common/init/Items.scala +++ b/src/main/scala/li/cil/oc/common/init/Items.scala @@ -474,6 +474,6 @@ object Items extends ItemAPI { // 1.5.4 Recipes.addMultiItem(new item.InkCartridgeEmpty(multi), "inkCartridgeEmpty", "oc:inkCartridgeEmpty") Recipes.addMultiItem(new item.InkCartridge(multi), "inkCartridge", "oc:inkCartridge") - Recipes.addMultiItem(new item.Plastic(multi), "plastic", "oc:plastic") + Recipes.addMultiItem(new item.Chamelium(multi), "chamelium", "oc:chamelium") } } diff --git a/src/main/scala/li/cil/oc/common/item/Chamelium.scala b/src/main/scala/li/cil/oc/common/item/Chamelium.scala new file mode 100644 index 000000000..0bcb54cbc --- /dev/null +++ b/src/main/scala/li/cil/oc/common/item/Chamelium.scala @@ -0,0 +1,3 @@ +package li.cil.oc.common.item + +class Chamelium(val parent: Delegator) extends Delegate diff --git a/src/main/scala/li/cil/oc/common/item/Plastic.scala b/src/main/scala/li/cil/oc/common/item/Plastic.scala deleted file mode 100644 index ead7618ac..000000000 --- a/src/main/scala/li/cil/oc/common/item/Plastic.scala +++ /dev/null @@ -1,3 +0,0 @@ -package li.cil.oc.common.item - -class Plastic(val parent: Delegator) extends Delegate diff --git a/src/main/scala/li/cil/oc/common/tileentity/Printer.scala b/src/main/scala/li/cil/oc/common/tileentity/Printer.scala index 883da7a0f..9fb6ddd60 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/Printer.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/Printer.scala @@ -26,8 +26,8 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat withConnector(Settings.get.bufferConverter). create() - val maxAmountPlastic = 256000 - var amountPlastic = 0 + val maxAmountMaterial = 256000 + var amountMaterial = 0 val maxAmountInk = 100000 var amountInk = 0 @@ -37,10 +37,10 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat var totalRequiredEnergy = 0.0 var requiredEnergy = 0.0 - val plasticPerItem = 2000 + val materialPerItem = 2000 val inkPerCartridge = 50000 - val slotPlastic = 0 + val slotMaterial = 0 val slotInk = 1 val slotOutput = 2 @@ -63,7 +63,7 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat def isPrinting = (requiredEnergy > 0 || isActive) && Option(getStackInSlot(slotOutput)).fold(true)(stack => { stack.stackSize < stack.getMaxStackSize && output.fold(true)(ItemStack.areItemStackTagsEqual(stack, _)) - }) + }) && (output.isDefined || (amountMaterial > 0 && amountInk > 0)) def progress = (1 - requiredEnergy / totalRequiredEnergy) * 100 @@ -190,23 +190,24 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat override def updateEntity() { super.updateEntity() - if (isActive && output.isEmpty) { + if (isActive && output.isEmpty && Option(getStackInSlot(slotOutput)).fold(true)(stack => stack.stackSize < stack.getMaxStackSize)) { val totalVolume = data.stateOn.foldLeft(0)((acc, shape) => acc + shape.bounds.volume) + data.stateOff.foldLeft(0)((acc, shape) => acc + shape.bounds.volume) val totalSurface = data.stateOn.foldLeft(0)((acc, shape) => acc + shape.bounds.surface) + data.stateOff.foldLeft(0)((acc, shape) => acc + shape.bounds.surface) val totalShapes = data.stateOn.size + data.stateOff.size if (totalVolume == 0) { isActive = false + data = new PrintData() } else { - val plasticRequired = totalVolume + val materialRequired = totalVolume val inkRequired = (totalSurface / 6) max 1 totalRequiredEnergy = totalShapes * Settings.get.printShapeCost requiredEnergy = totalRequiredEnergy - if (amountPlastic >= plasticRequired && amountInk >= inkRequired) { - amountPlastic -= plasticRequired + if (amountMaterial >= materialRequired && amountInk >= inkRequired) { + amountMaterial -= materialRequired amountInk -= inkRequired output = Option(data.createItemStack()) ServerPacketSender.sendPrinting(this, printing = true) @@ -238,10 +239,10 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat ServerPacketSender.sendPrinting(this, success && output.isDefined) } - if (maxAmountPlastic - amountPlastic >= plasticPerItem) { - val plastic = decrStackSize(slotPlastic, 1) - if (plastic != null) { - amountPlastic += plasticPerItem + if (maxAmountMaterial - amountMaterial >= materialPerItem) { + val material = decrStackSize(slotMaterial, 1) + if (material != null) { + amountMaterial += materialPerItem } } @@ -255,7 +256,7 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat override def readFromNBTForServer(nbt: NBTTagCompound) { super.readFromNBTForServer(nbt) - amountPlastic = nbt.getInteger(Settings.namespace + "amountPlastic") + amountMaterial = nbt.getInteger(Settings.namespace + "amountMaterial") amountInk = nbt.getInteger(Settings.namespace + "amountInk") data.load(nbt.getCompoundTag(Settings.namespace + "data")) isActive = nbt.getBoolean(Settings.namespace + "active") @@ -268,7 +269,7 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat override def writeToNBTForServer(nbt: NBTTagCompound) { super.writeToNBTForServer(nbt) - nbt.setInteger(Settings.namespace + "amountPlastic", amountPlastic) + nbt.setInteger(Settings.namespace + "amountMaterial", amountMaterial) nbt.setInteger(Settings.namespace + "amountInk", amountInk) nbt.setNewCompoundTag(Settings.namespace + "data", data.save) nbt.setBoolean(Settings.namespace + "active", isActive) @@ -296,7 +297,7 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat override def isItemValidForSlot(slot: Int, stack: ItemStack) = if (slot == 0) - api.Items.get(stack) == api.Items.get("plastic") + api.Items.get(stack) == api.Items.get("chamelium") else if (slot == 1) api.Items.get(stack) == api.Items.get("inkCartridge") else false