diff --git a/.travis.yml b/.travis.yml index 93484365c..f0d1ac70e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,16 @@ sudo: false language: scala scala: 2.11.1 -jdk: openjdk7 +jdk: + - openjdk7 + - openjdk8 + - oraclejdk7 + - oraclejdk8 notifications: email: false env: global: TERM=dumb -install: ./gradlew setupCIWorkspace -script: ./gradlew build \ No newline at end of file +install: gradle setupCIWorkspace +script: gradle build diff --git a/src/main/java/li/cil/oc/api/internal/ServerRack.java b/src/main/java/li/cil/oc/api/internal/ServerRack.java index 46447ed45..9f8d2cd0c 100644 --- a/src/main/java/li/cil/oc/api/internal/ServerRack.java +++ b/src/main/java/li/cil/oc/api/internal/ServerRack.java @@ -22,12 +22,12 @@ import net.minecraft.inventory.IInventory; */ public interface ServerRack extends Environment, SidedEnvironment, Rotatable, IInventory { /** - * The machine currently hosted by the server in the specified slot. + * The server in the specified slot. *

- * This can be null, for example when there is no CPU installed - * in the server in that slot, or there is no server in that slot. + * This can be null, for example when there is no server installed + * in that slot. * - * @return the machine currently hosted in the specified slot. + * @return the server currently hosted in the specified slot. */ Server server(int slot); diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index cf5abbfc6..6dace2db1 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -1172,6 +1172,13 @@ opencomputers { # Time in seconds to pause a calling machine when the soft limit for a data # card callback is exceeded. dataCardTimeout: 1.0 + + # The general upgrade tier of the switch built into server racks, i.e. how + # upgraded server racks' switching logic is. Prior to the introduction of + # this setting (1.5.15) this was always none. This applies to all + # properties, i.e. througput, frequency and buffer size. + # Valid values are: 0 = none, 1 = tier 1, 2 = tier 2, 3 = tier 3. + serverRackSwitchTier: 1 } # Settings for mod integration (the mod previously known as OpenComponents). diff --git a/src/main/scala/li/cil/oc/Settings.scala b/src/main/scala/li/cil/oc/Settings.scala index 4856e2a72..f6048f21d 100644 --- a/src/main/scala/li/cil/oc/Settings.scala +++ b/src/main/scala/li/cil/oc/Settings.scala @@ -9,6 +9,7 @@ import com.google.common.net.InetAddresses import com.mojang.authlib.GameProfile import com.typesafe.config._ import li.cil.oc.api.component.TextBuffer.ColorDepth +import li.cil.oc.common.Tier import li.cil.oc.integration.Mods import net.minecraftforge.fml.common.Loader import net.minecraftforge.fml.common.versioning.DefaultArtifactVersion @@ -325,6 +326,7 @@ class Settings(val config: Config) { val dataCardSoftLimit = config.getInt("misc.dataCardSoftLimit") max 0 val dataCardHardLimit = config.getInt("misc.dataCardHardLimit") max 0 val dataCardTimeout = config.getDouble("misc.dataCardTimeout") max 0 + val serverRackSwitchTier = (config.getInt("misc.serverRackSwitchTier") - 1) max Tier.None min Tier.Three // ----------------------------------------------------------------------- // // printer diff --git a/src/main/scala/li/cil/oc/common/EventHandler.scala b/src/main/scala/li/cil/oc/common/EventHandler.scala index 3d5d2222e..5b66afe45 100644 --- a/src/main/scala/li/cil/oc/common/EventHandler.scala +++ b/src/main/scala/li/cil/oc/common/EventHandler.scala @@ -5,6 +5,7 @@ import java.util.Calendar import li.cil.oc._ import li.cil.oc.api.Network import li.cil.oc.api.detail.ItemInfo +import li.cil.oc.api.internal.ServerRack import li.cil.oc.api.machine.MachineHost import li.cil.oc.client.renderer.PetRenderer import li.cil.oc.common.asm.ClassTransformer @@ -322,7 +323,15 @@ object EventHandler { e.getChunk.getEntityLists.foreach(_.collect { case host: MachineHost => host.machine match { case machine: Machine => scheduleClose(machine) + case _ => // Dafuq? } + case rack: ServerRack => + (0 until rack.getSizeInventory). + map(rack.server). + filter(_ != null). + map(_.machine()). + filter(_ != null). + foreach(_.stop()) }) } } diff --git a/src/main/scala/li/cil/oc/common/tileentity/ServerRack.scala b/src/main/scala/li/cil/oc/common/tileentity/ServerRack.scala index 0c30bd3b8..3286af6db 100644 --- a/src/main/scala/li/cil/oc/common/tileentity/ServerRack.scala +++ b/src/main/scala/li/cil/oc/common/tileentity/ServerRack.scala @@ -51,6 +51,11 @@ class ServerRack extends traits.PowerAcceptor with traits.Hub with traits.PowerB // Used on client side to check whether to render disk activity indicators. var lastAccess = Array.fill(4)(0L) + val builtInSwitchTier = Settings.get.serverRackSwitchTier + relayDelay = math.max(1, relayBaseDelay - (builtInSwitchTier + 1) * relayDelayPerUpgrade) + relayAmount = math.max(1, relayBaseAmount + (builtInSwitchTier + 1) * relayAmountPerUpgrade) + maxQueueSize = math.max(1, queueBaseSize + (builtInSwitchTier + 1) * queueSizePerUpgrade) + override def server(slot: Int) = servers(slot).orNull @SideOnly(Side.CLIENT)