Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.zabqer.opencb;
- import cpw.mods.fml.common.Optional.Interface;
- import java.io.PrintStream;
- import li.cil.oc.api.machine.Arguments;
- import li.cil.oc.api.machine.Callback;
- import li.cil.oc.api.machine.Context;
- import li.cil.oc.api.network.EnvironmentHost;
- import li.cil.oc.api.network.SimpleComponent;
- import li.cil.oc.server.component.DebugCard;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.world.World;
- @Optional.Interface(iface="li.cil.oc.api.network.SimpleComponent", modid="OpenComputers")
- public class DebugBlockTileEntity
- extends TileEntity
- implements SimpleComponent
- {
- DebugCard bindedDebugCard;
- public class EnvHostSup
- implements EnvironmentHost
- {
- DebugBlockTileEntity bindedDBTE;
- public EnvHostSup(DebugBlockTileEntity bindedDBTE)
- {
- this.bindedDBTE = bindedDBTE;
- }
- public World world()
- {
- return this.bindedDBTE.field_145850_b;
- }
- public double xPosition()
- {
- return this.bindedDBTE.field_145851_c;
- }
- public double yPosition()
- {
- return this.bindedDBTE.field_145848_d;
- }
- public double zPosition()
- {
- return this.bindedDBTE.field_145849_e;
- }
- public void markChanged()
- {
- System.out.println("MARK CHANGED");
- }
- }
- public DebugBlockTileEntity()
- {
- this.bindedDebugCard = new DebugCard(new EnvHostSup(this));
- }
- public String getComponentName()
- {
- return "debug_block";
- }
- @Callback(doc="function(value:number):number -- Changes the component network's energy buffer by the specified delta.")
- public Object[] changeBuffer(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.changeBuffer(cntxt, a);
- }
- @Callback(doc="function():number -- Get the container's X position in the world.")
- public Object[] getX(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.getX(cntxt, a);
- }
- @Callback(doc="function():number -- Get the container's Y position in the world.")
- public Object[] getY(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.getY(cntxt, a);
- }
- @Callback(doc="function():number -- Get the container's Z position in the world.")
- public Object[] getZ(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.getZ(cntxt, a);
- }
- @Callback(doc="function([id:number]):userdata -- Get the world object for the specified dimension ID, or the container's.")
- public Object[] getWorld(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.getWorld(cntxt, a);
- }
- @Callback(doc="function():table -- Get a list of all world IDs, loaded and unloaded.")
- public Object[] getWorlds(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.getWorlds(cntxt, a);
- }
- @Callback(doc="function(name:string):userdata -- Get the entity of a player.")
- public Object[] getPlayer(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.getPlayer(cntxt, a);
- }
- @Callback(doc="function():table -- Get a list of currently logged-in players.")
- public Object[] getPlayers(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.getPlayers(cntxt, a);
- }
- @Callback(doc="function(name:string):boolean -- Get whether a mod or API is loaded.")
- public Object[] isModLoaded(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.isModLoaded(cntxt, a);
- }
- @Callback(doc="function(command:string):number -- Runs an arbitrary command using a fake player.")
- public Object[] runCommand(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.runCommand(cntxt, a);
- }
- @Callback(doc="function(x:number, y:number, z:number):boolean -- Connect the debug card to the block at the specified coordinates.")
- public Object[] connectToBlock(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.connectToBlock(cntxt, a);
- }
- @Callback(doc="function():userdata -- Test method for user-data and general value conversion.")
- public Object[] test(Context cntxt, Arguments a)
- {
- return this.bindedDebugCard.test(cntxt, a);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement