From 694e30a9017c74aec8138da690d4ccf3bc8bacba Mon Sep 17 00:00:00 2001 From: Amanda Cameron Date: Tue, 25 Aug 2026 17:45:34 -0400 Subject: [PATCH 1/2] tablet: Re-initialize the TextBuffer on client initialization. For some reason, when taking the tablet out of a charger it will not re-initialize the TextBuffer, causing the display to not update. --- src/main/scala/li/cil/oc/common/item/Tablet.scala | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/scala/li/cil/oc/common/item/Tablet.scala b/src/main/scala/li/cil/oc/common/item/Tablet.scala index 36f52bda53..baf92d2c1c 100644 --- a/src/main/scala/li/cil/oc/common/item/Tablet.scala +++ b/src/main/scala/li/cil/oc/common/item/Tablet.scala @@ -422,6 +422,13 @@ class TabletWrapper(var stack: ItemStack, var player: Player) extends ComponentI case Some(buffer: api.internal.TextBuffer) => buffer.setMaximumColorDepth(colorDepth) buffer.setMaximumResolution(80, 25) + buffer match { + case concrete: li.cil.oc.common.component.TextBuffer => { + // For some reason the TextBuffer needs re-initilization here, might be an X/Y Problem though. + concrete.markInitialized() + } + case _ => + } } client.PacketSender.sendMachineItemStateRequest(stack, level.registryAccess()) From a115184309ad8fadec3cba2dc20f4b5b0d559382 Mon Sep 17 00:00:00 2001 From: Amanda Cameron Date: Wed, 26 Aug 2026 08:50:32 -0400 Subject: [PATCH 2/2] tablet: Rearrange 594822f987d24572f4795f0e27f9bad975605a90 The code was unnessarially calling tablet.writeDataNBT twice, so I rearranged the code to get rid of the duplicate call. --- src/main/scala/li/cil/oc/common/item/Tablet.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/scala/li/cil/oc/common/item/Tablet.scala b/src/main/scala/li/cil/oc/common/item/Tablet.scala index baf92d2c1c..51fe3dc613 100644 --- a/src/main/scala/li/cil/oc/common/item/Tablet.scala +++ b/src/main/scala/li/cil/oc/common/item/Tablet.scala @@ -586,16 +586,17 @@ object Tablet { val tablet = e.getValue if (tablet.node != null) { // Server. - if (tablet.autoSave) tablet.writeToNBT(tablet.player.registryAccess()) tablet.machine.stop() - for (node <- tablet.machine.node.network.nodes) { - node.remove() - } + // Cache eviction tears down the live machine. Persist that stopped // state as well, otherwise a tablet that was just turned off may // retain its previous running flag while it is in a charger. tablet.data.isRunning = tablet.machine.isRunning if (tablet.autoSave) tablet.writeToNBT(tablet.player.registryAccess()) + + for (node <- tablet.machine.node.network.nodes) { + node.remove() + } tablet.setChanged() } }