Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.8

This commit is contained in:
Florian Nücke 2015-07-26 12:40:07 +02:00
commit 3a5b8047e8
6 changed files with 34 additions and 7 deletions

View File

@ -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
install: gradle setupCIWorkspace
script: gradle build

View File

@ -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.
* <p/>
* This can be <tt>null</tt>, 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 <tt>null</tt>, 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);

View File

@ -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).

View File

@ -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

View File

@ -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())
})
}
}

View File

@ -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)