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

Conflicts:
	src/main/java/li/cil/oc/common/asm/SimpleComponentTickHandler.java
This commit is contained in:
Florian Nücke 2014-07-24 16:19:49 +02:00
commit b651a24362
2 changed files with 12 additions and 1 deletions

View File

@ -5,12 +5,16 @@ import cpw.mods.fml.common.gameevent.TickEvent;
import li.cil.oc.api.Network;
import li.cil.oc.util.SideTracker;
import net.minecraft.tileentity.TileEntity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
// This class is used for adding simple components to the component network.
// It is triggered from a validate call, and executed in the next update tick.
public final class SimpleComponentTickHandler {
private static final Logger log = LogManager.getLogger("OpenComputers");
public static final ArrayList<Runnable> pending = new java.util.ArrayList<Runnable>();
public static final SimpleComponentTickHandler Instance = new SimpleComponentTickHandler();
@ -40,7 +44,11 @@ public final class SimpleComponentTickHandler {
pending.clear();
}
for (Runnable runnable : adds) {
try {
runnable.run();
} catch (Throwable t) {
log.warn("Error in scheduled tick action.", t);
}
}
}
}

View File

@ -71,6 +71,9 @@ abstract class GraphicsCard extends component.ManagedComponent {
}
}
@Callback(doc = """function():string -- Get the address of the screen the GPU is currently bound to.""")
def getScreen(context: Context, args: Arguments): Array[AnyRef] = screen(s => result(s.node.address))
@Callback(direct = true, doc = """function():number, boolean -- Get the current background color and whether it's from the palette or not.""")
def getBackground(context: Context, args: Arguments): Array[AnyRef] =
screen(s => result(s.getBackgroundColor, s.isBackgroundFromPalette))