diff --git a/assets/items.psd b/assets/items.psd index 2df42515f..3605a73bf 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 105a17061..4c65409d2 100644 --- a/src/main/resources/assets/opencomputers/lang/en_US.lang +++ b/src/main/resources/assets/opencomputers/lang/en_US.lang @@ -117,6 +117,7 @@ item.oc.TabletCase0.name=Tablet Case (Tier 1) item.oc.TabletCase1.name=Tablet Case (Tier 2) item.oc.TabletCase3.name=Tablet Case (Creative) item.oc.Terminal.name=Remote Terminal +item.oc.TerminalServer.name=Terminal Server item.oc.TexturePicker.name=Texture Picker item.oc.Transistor.name=Transistor item.oc.UpgradeAngel.name=Angel Upgrade @@ -345,6 +346,7 @@ oc:tooltip.Switch=Allows connecting different networks to each other. Only netwo oc:tooltip.Tablet=A tablet computer, for fresh Lua on the go. Can be forced to shut down by sneak-activating it. oc:tooltip.TabletCase=Basic case for tablets. Place it into the assembler to add in components and create a tablet computer. oc:tooltip.Terminal=Allows controlling a server remotely, as long as you are in range of it. Acts like a portable screen and keyboard. Shift-right-click a server in a server rack to bind the terminal to it. +oc:tooltip.TerminalServer=Backend to which Remote Terminals can be connected to provide remote control. Houses a virtual screen and keyboard. oc:tooltip.TexturePicker=This tool allows showing a string describing a block's surface, for use in 3D printer shape definitions. Totally not texture names, nope. No sir. oc:tooltip.Tier=ยง8Tier %s oc:tooltip.NetSplitter=Acts as a dynamic connector. Connectivity of each side can be toggled by hitting it with a wrench. Connectivity of all sides can be inverted by applying a redstone signal. diff --git a/src/main/resources/assets/opencomputers/recipes/default.recipes b/src/main/resources/assets/opencomputers/recipes/default.recipes index d84332a82..2c2bd6dd6 100644 --- a/src/main/resources/assets/opencomputers/recipes/default.recipes +++ b/src/main/resources/assets/opencomputers/recipes/default.recipes @@ -98,6 +98,11 @@ server3 { ["oc:circuitChip3", "oc:circuitChip3", "oc:circuitChip3"] [obsidian, "oc:materialCircuitBoardPrinted", obsidian]] } +terminalServer { + input: [[obsidian, "oc:wlanCard", obsidian] + ["oc:wlanCard", "oc:circuitChip2", "oc:wlanCard"] + [obsidian, "oc:materialCircuitBoardPrinted", obsidian]] +} ram1 { input: [["oc:circuitChip1", nuggetIron, "oc:circuitChip1"] diff --git a/src/main/resources/assets/opencomputers/textures/items/TerminalServer.png b/src/main/resources/assets/opencomputers/textures/items/TerminalServer.png new file mode 100644 index 000000000..820e060f7 Binary files /dev/null and b/src/main/resources/assets/opencomputers/textures/items/TerminalServer.png differ diff --git a/src/main/resources/assets/opencomputers/textures/items/TerminalServer.png.mcmeta b/src/main/resources/assets/opencomputers/textures/items/TerminalServer.png.mcmeta new file mode 100644 index 000000000..f6730e30a --- /dev/null +++ b/src/main/resources/assets/opencomputers/textures/items/TerminalServer.png.mcmeta @@ -0,0 +1,5 @@ +{ + "animation": { + "frametime": 4 + } +} \ No newline at end of file diff --git a/src/main/scala/li/cil/oc/client/renderer/block/Rack.scala b/src/main/scala/li/cil/oc/client/renderer/block/Rack.scala index 058de57c3..2de68cbd2 100644 --- a/src/main/scala/li/cil/oc/client/renderer/block/Rack.scala +++ b/src/main/scala/li/cil/oc/client/renderer/block/Rack.scala @@ -30,13 +30,13 @@ object Rack { for (i <- 0 until 4 if rack.getStackInSlot(i) != null) { side match { case ForgeDirection.WEST => - renderer.setRenderBounds(lx, v2 - (i + 1) * fs, lz + u1, u2, v2 - i * fs, hz - u1) + renderer.setRenderBounds(lx + 1 / 16f, v2 - (i + 1) * fs, lz + u1, u2, v2 - i * fs, hz - u1) case ForgeDirection.EAST => - renderer.setRenderBounds(u1, v2 - (i + 1) * fs, lz + u1, hx, v2 - i * fs, hz - u1) + renderer.setRenderBounds(u1, v2 - (i + 1) * fs, lz + u1, hx - 1 / 16f, v2 - i * fs, hz - u1) case ForgeDirection.NORTH => - renderer.setRenderBounds(lx + u1, v2 - (i + 1) * fs, lz, hx - u1, v2 - i * fs, u2) + renderer.setRenderBounds(lx + u1, v2 - (i + 1) * fs, lz + 1 / 16f, hx - u1, v2 - i * fs, u2) case ForgeDirection.SOUTH => - renderer.setRenderBounds(lx + u1, v2 - (i + 1) * fs, u1, hx - u1, v2 - i * fs, hz) + renderer.setRenderBounds(lx + u1, v2 - (i + 1) * fs, u1, hx - u1, v2 - i * fs, hz - 1 / 16f) case _ => } diff --git a/src/main/scala/li/cil/oc/client/renderer/tileentity/RackRenderer.scala b/src/main/scala/li/cil/oc/client/renderer/tileentity/RackRenderer.scala index 218534fe0..372f680a8 100644 --- a/src/main/scala/li/cil/oc/client/renderer/tileentity/RackRenderer.scala +++ b/src/main/scala/li/cil/oc/client/renderer/tileentity/RackRenderer.scala @@ -30,7 +30,7 @@ object RackRenderer extends TileEntitySpecialRenderer { case _ => // No yaw. } - GL11.glTranslated(-0.5, 0.5, 0.505) + GL11.glTranslated(-0.5, 0.5, 0.505 - 1 / 16f) GL11.glScalef(1, -1, 1) // Note: we manually sync the rack inventory for this to work. diff --git a/src/main/scala/li/cil/oc/common/EventHandler.scala b/src/main/scala/li/cil/oc/common/EventHandler.scala index b0a427a80..2cffbe8a7 100644 --- a/src/main/scala/li/cil/oc/common/EventHandler.scala +++ b/src/main/scala/li/cil/oc/common/EventHandler.scala @@ -17,6 +17,7 @@ import li.cil.oc.api.internal.Server import li.cil.oc.api.machine.MachineHost import li.cil.oc.client.renderer.PetRenderer import li.cil.oc.common.asm.ClassTransformer +import li.cil.oc.common.component.TerminalServer import li.cil.oc.common.item.data.MicrocontrollerData import li.cil.oc.common.item.data.RobotData import li.cil.oc.common.item.data.TabletData @@ -373,6 +374,9 @@ object EventHandler { Callbacks.clear() } + else { + TerminalServer.loaded.clear() + } } @SubscribeEvent @@ -384,7 +388,6 @@ object EventHandler { case _ => // Dafuq? } case rack: Rack => - // TODO (0 until rack.getSizeInventory). map(rack.getMountable). collect { case server: Server if server.machine != null => server.machine.stop() } diff --git a/src/main/scala/li/cil/oc/common/component/TerminalServer.scala b/src/main/scala/li/cil/oc/common/component/TerminalServer.scala index 6da953284..3466644f7 100644 --- a/src/main/scala/li/cil/oc/common/component/TerminalServer.scala +++ b/src/main/scala/li/cil/oc/common/component/TerminalServer.scala @@ -94,9 +94,9 @@ class TerminalServer(val rack: tileentity.Rack, val slot: Int) extends Environme override def world = rack.world - override def yPosition = rack.xPosition + override def xPosition = rack.xPosition - override def xPosition = rack.yPosition + override def yPosition = rack.yPosition override def zPosition = rack.zPosition @@ -148,6 +148,9 @@ class TerminalServer(val rack: tileentity.Rack, val slot: Int) extends Environme // Persistable override def load(nbt: NBTTagCompound): Unit = { + if (rack.isServer) { + node.load(nbt) + } buffer.load(nbt.getCompoundTag(Settings.namespace + "buffer")) keyboard.load(nbt.getCompoundTag(Settings.namespace + "keyboard")) keys.clear() @@ -155,6 +158,7 @@ class TerminalServer(val rack: tileentity.Rack, val slot: Int) extends Environme } override def save(nbt: NBTTagCompound): Unit = { + node.save(nbt) nbt.setNewCompoundTag(Settings.namespace + "buffer", buffer.save) nbt.setNewCompoundTag(Settings.namespace + "keyboard", keyboard.save) nbt.setNewTagList(Settings.namespace + "keys", keys) @@ -187,8 +191,10 @@ class TerminalServer(val rack: tileentity.Rack, val slot: Int) extends Environme // LifeCycle override def onLifecycleStateChange(state: Lifecycle.LifecycleState): Unit = if (rack.isClient) state match { - case Lifecycle.LifecycleState.Initialized => TerminalServer.loaded += this - case Lifecycle.LifecycleState.Disposed => TerminalServer.loaded -= this + case Lifecycle.LifecycleState.Initialized => + TerminalServer.loaded += this + case Lifecycle.LifecycleState.Disposed => + TerminalServer.loaded -= this case _ => // Ignore. } } diff --git a/src/main/scala/li/cil/oc/common/component/TextBuffer.scala b/src/main/scala/li/cil/oc/common/component/TextBuffer.scala index 2753998e0..fbccd5813 100644 --- a/src/main/scala/li/cil/oc/common/component/TextBuffer.scala +++ b/src/main/scala/li/cil/oc/common/component/TextBuffer.scala @@ -92,7 +92,10 @@ class TextBuffer(val host: EnvironmentHost) extends prefab.ManagedEnvironment wi val data = new util.TextBuffer(maxResolution, PackedColor.Depth.format(maxDepth)) - def markInitialized(): Unit = syncCooldown = -1 // Stop polling for init state. + def markInitialized(): Unit = { + syncCooldown = -1 // Stop polling for init state. + relativeLitArea = -1 // Recompute lit area, avoid screens blanking out until something changes. + } // ----------------------------------------------------------------------- // diff --git a/src/main/scala/li/cil/oc/common/tileentity/Rack.scala b/src/main/scala/li/cil/oc/common/tileentity/Rack.scala index 4d1c2e1d5..926c32306 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/Rack.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/Rack.scala @@ -165,6 +165,11 @@ class Rack extends traits.PowerAcceptor with traits.Hub with traits.PowerBalance // ----------------------------------------------------------------------- // // Environment + override def dispose(): Unit = { + super.dispose() + disconnectComponents() + } + override def onMessage(message: Message): Unit = { super.onMessage(message) if (message.name == "network.message") message.data match {