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

Conflicts:
	build.properties
	src/main/scala/li/cil/oc/common/event/RobotCommonHandler.scala
	src/main/scala/li/cil/oc/common/tileentity/traits/PowerInformation.scala
This commit is contained in:
Florian Nücke 2015-02-23 17:17:56 +01:00
commit d4e084e0d0
8 changed files with 27 additions and 8 deletions

View File

@ -1,7 +1,7 @@
minecraft.version=1.8
forge.version=11.14.1.1313
oc.version=1.5.0
oc.version=1.5.1
oc.subversion=beta
ae2.version=rv1-stable-1

View File

@ -195,7 +195,7 @@ oc:tooltip.Cable=Ein billiger Weg, verschiedene Blöcke miteinander zu verbinden
oc:tooltip.Capacitor=Speichert Energie für spätere Verwendung. Kann extrem schnell befüllt und entleert werden.
oc:tooltip.CardBase=Wie der Name schon sagt, werden alle Erweiterungskarten hieraus hergestellt.
oc:tooltip.Case=Das Computergehäuse ist der essentielle Grundbaustein für einen Computer. §fErweiterungskarten§7, §fRAM§7 und §fFestplatten§7 können in einem Gehäuse installiert werden.[nl] Slots: §f%s§7
oc:tooltip.Charger=Lädt Roboter mit Energie aus Kondensatoren auf. Die Ladegeschwindigkeit hängt vom eingehenden §fRedstonesignal§7 ab, wobei kein Signal "nicht laden" und ein Signal mit maximaler Stärke "schnellstmöglich laden" heißt.
oc:tooltip.Charger=Lädt Roboter mit Energie aus Kondensatoren auf. Die Ladegeschwindigkeit hängt vom eingehenden §fRedstonesignal§7 ab, wobei kein Signal "nicht laden" und ein Signal mit maximaler Stärke "schnellstmöglich laden" heißt. Erlaubt es auch Tablets zu laden, und ermöglicht Zugriff auf Festplatten in Tablets.
oc:tooltip.CircuitBoard=Mühsam ernährt sich das Eichhörnchen. Wenn es groß wird, wird es mal eine gedruckte Leiterplatte.
oc:tooltip.ControlUnit=Klingt wichtig, ist es auch. Man baut daraus immerhin CPUs. Wie könnte es da nicht wichtig sein.
oc:tooltip.ComponentBus=Diese Erweiterung erlaubt es es Servern, mit noch mehr Komponenten gleichzeitig zu kommunizieren, ähnlich wie CPUs.[nl] Supported components: §f%s§7

View File

@ -219,7 +219,7 @@ oc:tooltip.Cable=A cheap way of connecting blocks.
oc:tooltip.Capacitor=Stores energy for later use. Can be filled and emptied very quickly.
oc:tooltip.CardBase=As the name indicates, this is the basic building block for all expansion cards.
oc:tooltip.Case=The Computer Case is the basic building block for computers and houses the computer's §fextension cards§7, §fRAM§7 and §fhard disks§7.[nl] Slots: §f%s§7
oc:tooltip.Charger=Transfers energy from capacitors into adjacent robots and drones. The transfer rate depends on the incoming §fredstone signal§7, where no signal means don't charge devices, and maximum strength means charge at full speed.
oc:tooltip.Charger=Transfers energy from capacitors into adjacent robots and drones. The transfer rate depends on the incoming §fredstone signal§7, where no signal means don't charge devices, and maximum strength means charge at full speed. Can also be used to charge tablets and access hard drives in tablets.
oc:tooltip.CircuitBoard=Now we're getting somewhere. Can be etched to obtain a printed circuit board.
oc:tooltip.ControlUnit=This is the unit that... controls... stuff. You need it to build a CPU. So yeah, totally important.
oc:tooltip.ComponentBus=This expansion allows servers to communicate with more components at the same time, similar to how CPUs do.[nl] Supported components: §f%s§7

View File

@ -5,7 +5,7 @@ SYNOPSIS
df [FILE]...
DESCRIPTION
`cp` allows copying single files on a filesystem and across filesystems.
`df` outputs disk space information for the file systems containing the specified files. If no file names are given it returns the information for all currently mounted file systems.
EXAMPLES
df

View File

@ -6,7 +6,7 @@ SYNOPSIS
primary TYPE ADDRESS
DESCRIPTION
This program allows reading the address of the current primary component of the specified type. It also allows chaning the current primary component for a specified type by providing the (abbreviated) address of the new primary component.
This program allows reading the address of the current primary component of the specified type. It also allows changing the current primary component for a specified type by providing the (abbreviated) address of the new primary component.
EXAMPLES
primary gpu

View File

@ -83,11 +83,16 @@ object SaveHandler {
def loadNBT(nbt: NBTTagCompound, name: String): NBTTagCompound = {
val data = load(nbt, name)
if (data.length > 0) {
if (data.length > 0) try {
val bais = new ByteArrayInputStream(data)
val dis = new DataInputStream(bais)
CompressedStreamTools.read(dis)
}
catch {
case t: Throwable =>
OpenComputers.log.warn("There was an error trying to restore a block's state from external data. This indicates that data was somehow corrupted.", t)
new NBTTagCompound()
}
else new NBTTagCompound()
}

View File

@ -1,5 +1,6 @@
package li.cil.oc.common.tileentity.traits
import li.cil.oc.Settings
import li.cil.oc.server.{PacketSender => ServerPacketSender}
import net.minecraft.nbt.NBTTagCompound
import net.minecraftforge.fml.relauncher.Side
@ -8,6 +9,8 @@ import net.minecraftforge.fml.relauncher.SideOnly
trait PowerInformation extends TileEntity {
private var lastSentRatio = -1.0
private var ticksUntilSync = 0
def globalBuffer: Double
def globalBuffer_=(value: Double): Unit
@ -18,12 +21,23 @@ trait PowerInformation extends TileEntity {
protected def updatePowerInformation() {
val ratio = if (globalBufferSize > 0) globalBuffer / globalBufferSize else 0
if (lastSentRatio < 0 || math.abs(lastSentRatio - ratio) > (5.0 / 100.0)) {
if (shouldSync(ratio) || hasChangedSignificantly(ratio)) {
lastSentRatio = ratio
ServerPacketSender.sendPowerState(this)
}
}
private def hasChangedSignificantly(ratio: Double) = lastSentRatio < 0 || math.abs(lastSentRatio - ratio) > (5.0 / 100.0)
private def shouldSync(ratio: Double) = {
ticksUntilSync -= 1
if (ticksUntilSync <= 0) {
ticksUntilSync = (100 / Settings.get.tickFrequency).toInt max 1
lastSentRatio != ratio
}
else false
}
@SideOnly(Side.CLIENT)
override def readFromNBTForClient(nbt: NBTTagCompound) {
super.readFromNBTForClient(nbt)

View File

@ -212,7 +212,7 @@ object PacketSender {
val pb = new SimplePacketBuilder(PacketType.PowerState)
pb.writeTileEntity(t)
pb.writeDouble(t.globalBuffer)
pb.writeDouble(math.round(t.globalBuffer))
pb.writeDouble(t.globalBufferSize)
pb.sendToPlayersNearTileEntity(t)