bugfix
This commit is contained in:
@@ -27,6 +27,7 @@ import org.neoflock.neocomputers.gui.menu.RelayMenu
|
||||
import org.neoflock.neocomputers.item.RelayUpgrade
|
||||
import org.neoflock.neocomputers.network.ConventionalNetworkDevice
|
||||
import org.neoflock.neocomputers.network.DeviceNode
|
||||
import org.neoflock.neocomputers.network.NNComponent
|
||||
import org.neoflock.neocomputers.network.Networking
|
||||
import org.neoflock.neocomputers.network.NodeSynchronizer
|
||||
import org.neoflock.neocomputers.utils.GenericContainer
|
||||
@@ -91,6 +92,8 @@ class RelayEntity(blockPos: BlockPos, blockState: BlockState): SingleDeviceBlock
|
||||
super.processCommit(buf)
|
||||
activityTickLeft = buf.readVarInt()
|
||||
}
|
||||
|
||||
override fun getComponent() = NNComponent("relay")
|
||||
}
|
||||
|
||||
fun sendQueuedPacket() {
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.neoflock.neocomputers.block.SingleDeviceBlockEntity
|
||||
import org.neoflock.neocomputers.gui.menu.CaseMenu
|
||||
import org.neoflock.neocomputers.item.ComponentItem
|
||||
import org.neoflock.neocomputers.network.DeviceNode
|
||||
import org.neoflock.neocomputers.network.NNComponent
|
||||
import org.neoflock.neocomputers.network.Networking
|
||||
import org.neoflock.neocomputers.network.PowerRole
|
||||
import org.neoflock.neocomputers.sounds.ComputerRunningSoundInstance
|
||||
@@ -113,6 +114,8 @@ class CaseBlockEntity(blockPos: BlockPos, blockState: BlockState): SingleDeviceB
|
||||
NeoComputers.LOGGER.info("machine $address got $message from ${message.sender.address}")
|
||||
}
|
||||
}
|
||||
|
||||
override fun getComponent() = NNComponent("computer")
|
||||
}
|
||||
|
||||
val redstoneIn = Array(Direction.entries.size) {0}
|
||||
@@ -260,7 +263,7 @@ class CaseBlockEntity(blockPos: BlockPos, blockState: BlockState): SingleDeviceB
|
||||
|
||||
override fun getMachineMemoryTotal(): Long = stacks.mapNotNull { (it.item as? ComponentItem)?.getMemoryCapacity(it) }.sum().toLong()
|
||||
override fun getMachineMemoryUsed(): Long = 0
|
||||
override fun getMachineComponentsUsed(): Long = deviceNode.getReachable().size.toLong()
|
||||
override fun getMachineComponentsUsed(): Long = deviceNode.getReachable().count { it.getComponent() != null }.toLong()
|
||||
override fun getMachineComponentsTotal(): Long = stacks.mapNotNull { (it.item as? ComponentItem)?.getComponentCapacity(it) }.sum().toLong()
|
||||
override fun getMachineArchitecture() = arch
|
||||
override fun getMachineArchitectures() = stacks.mapNotNull { (it.item as? ComponentItem)?.getArchitecturesProvided(it) }.flatten().toSet()
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.neoflock.neocomputers.NeoComputers
|
||||
import org.neoflock.neocomputers.block.SingleDeviceBlockEntity
|
||||
import org.neoflock.neocomputers.gui.buffer.BufferRenderer
|
||||
import org.neoflock.neocomputers.network.DeviceNode
|
||||
import org.neoflock.neocomputers.network.NNComponent
|
||||
import org.neoflock.neocomputers.network.Networking
|
||||
import org.neoflock.neocomputers.utils.GPUChar
|
||||
import org.neoflock.neocomputers.utils.TextBuffer
|
||||
@@ -64,6 +65,8 @@ class ScreenEntity(blockPos: BlockPos, blockState: BlockState) :
|
||||
lastError = buf.readUtf().ifEmpty { null }
|
||||
textBuf.decodeContents(buf)
|
||||
}
|
||||
|
||||
override fun getComponent() = NNComponent("screen")
|
||||
}
|
||||
var bound = "screen/unbound"
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ import org.neoflock.neocomputers.network.Networking.maxHopCount
|
||||
import java.util.UUID
|
||||
import kotlin.math.min
|
||||
|
||||
// tmp class until JNI bindings work
|
||||
data class NNComponent(val type: String)
|
||||
|
||||
open class DeviceNode(_address: UUID? = null) {
|
||||
val connections = HashSet<DeviceNode>()
|
||||
private var reachableCache: Set<DeviceNode>? = null
|
||||
@@ -235,6 +238,8 @@ open class DeviceNode(_address: UUID? = null) {
|
||||
|
||||
// client-side, meant to bring state forward
|
||||
open fun processCommit(buf: FriendlyByteBuf) {}
|
||||
|
||||
open fun getComponent(): NNComponent? = null
|
||||
}
|
||||
|
||||
// Used by the relay
|
||||
|
||||
Reference in New Issue
Block a user