Merge branch 'master' of github.com:MightyPirates/OpenComputers into MC1.7

Conflicts:
	build.properties
This commit is contained in:
Florian Nücke 2014-06-24 17:37:10 +02:00
commit 2982889f4b
4 changed files with 27 additions and 16 deletions

View File

@ -1,7 +1,7 @@
minecraft.version=1.7.2
forge.version=10.12.2.1121
oc.version=1.3.0
oc.subversion=beta.1
oc.subversion=rc.1
ccl.version=1.1.1.80
fmp.version=1.1.0.282
maven.url=file:///var/www/users/fnuecke/maven.cil.li

View File

@ -33,13 +33,15 @@ public final class SimpleComponentTickHandler {
@SubscribeEvent
public void onTick(TickEvent.ServerTickEvent e) {
final Runnable[] adds;
synchronized (pending) {
adds = pending.toArray(new Runnable[pending.size()]);
pending.clear();
}
for (Runnable runnable : adds) {
runnable.run();
if (e.phase == TickEvent.Phase.START) {
final Runnable[] adds;
synchronized (pending) {
adds = pending.toArray(new Runnable[pending.size()]);
pending.clear();
}
for (Runnable runnable : adds) {
runnable.run();
}
}
}
}

View File

@ -3,6 +3,7 @@ package li.cil.oc.common
import codechicken.multipart.TMultiPart
import cpw.mods.fml.common.eventhandler.SubscribeEvent
import cpw.mods.fml.common.gameevent.PlayerEvent._
import cpw.mods.fml.common.gameevent.TickEvent
import cpw.mods.fml.common.gameevent.TickEvent.ServerTickEvent
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientConnectedToServerEvent
import cpw.mods.fml.common.{FMLCommonHandler, Optional}
@ -56,7 +57,7 @@ object EventHandler {
}
@SubscribeEvent
def onTick(e: ServerTickEvent) = {
def onTick(e: ServerTickEvent) = if (e.phase == TickEvent.Phase.START) {
pending.synchronized {
val adds = pending.toArray
pending.clear()

View File

@ -531,43 +531,51 @@ object TextBuffer {
}
class ServerProxy(val owner: TextBuffer) extends Proxy {
// TODO This is a to prevent a NPE reported in #350.
// It is a workaround at best, as this is treating the symptons, and not
// the cause - which seems to be that the TickHandler used for adding nodes
// to the network may fail to run before the tile entities' update is
// performed -- even though it is marked to run at the start of the tick.
// I have no idea why that would be, however, so this has to do for now.
private def isValid = owner.node != null && owner.node.address != null
override def onScreenColorChange() {
owner.owner.markChanged()
ServerPacketSender.sendTextBufferColorChange(owner.node.address, owner.data.foreground, owner.data.background, owner.owner)
if (isValid) ServerPacketSender.sendTextBufferColorChange(owner.node.address, owner.data.foreground, owner.data.background, owner.owner)
}
override def onScreenCopy(col: Int, row: Int, w: Int, h: Int, tx: Int, ty: Int) {
super.onScreenCopy(col, row, w, h, tx, ty)
owner.owner.markChanged()
ServerPacketSender.sendTextBufferCopy(owner.node.address, col, row, w, h, tx, ty, owner.owner)
if (isValid) ServerPacketSender.sendTextBufferCopy(owner.node.address, col, row, w, h, tx, ty, owner.owner)
}
override def onScreenDepthChange(depth: ColorDepth) {
owner.owner.markChanged()
ServerPacketSender.sendTextBufferDepthChange(owner.node.address, depth, owner.owner)
if (isValid) ServerPacketSender.sendTextBufferDepthChange(owner.node.address, depth, owner.owner)
}
override def onScreenFill(col: Int, row: Int, w: Int, h: Int, c: Char) {
super.onScreenFill(col, row, w, h, c)
owner.owner.markChanged()
ServerPacketSender.sendTextBufferFill(owner.node.address, col, row, w, h, c, owner.owner)
if (isValid) ServerPacketSender.sendTextBufferFill(owner.node.address, col, row, w, h, c, owner.owner)
}
override def onScreenPaletteChange(index: Int) {
owner.owner.markChanged()
ServerPacketSender.sendTextBufferPaletteChange(owner.node.address, index, owner.getPaletteColor(index), owner.owner)
if (isValid) ServerPacketSender.sendTextBufferPaletteChange(owner.node.address, index, owner.getPaletteColor(index), owner.owner)
}
override def onScreenResolutionChange(w: Int, h: Int) {
super.onScreenResolutionChange(w, h)
owner.owner.markChanged()
ServerPacketSender.sendTextBufferResolutionChange(owner.node.address, w, h, owner.owner)
if (isValid) ServerPacketSender.sendTextBufferResolutionChange(owner.node.address, w, h, owner.owner)
}
override def onScreenSet(col: Int, row: Int, s: String, vertical: Boolean) {
super.onScreenSet(col, row, s, vertical)
owner.owner.markChanged()
ServerPacketSender.sendTextBufferSet(owner.node.address, col, row, s, vertical, owner.owner)
if (isValid) ServerPacketSender.sendTextBufferSet(owner.node.address, col, row, s, vertical, owner.owner)
}
override def keyDown(character: Char, code: Int, player: EntityPlayer) {