Advertisement
lLuffy

Untitled

Sep 29th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. package com.zabqer.opencb;
  2.  
  3. import cpw.mods.fml.common.Optional.Interface;
  4. import java.io.PrintStream;
  5. import li.cil.oc.api.machine.Arguments;
  6. import li.cil.oc.api.machine.Callback;
  7. import li.cil.oc.api.machine.Context;
  8. import li.cil.oc.api.network.EnvironmentHost;
  9. import li.cil.oc.api.network.SimpleComponent;
  10. import li.cil.oc.server.component.DebugCard;
  11. import net.minecraft.tileentity.TileEntity;
  12. import net.minecraft.world.World;
  13.  
  14. @Optional.Interface(iface="li.cil.oc.api.network.SimpleComponent", modid="OpenComputers")
  15. public class DebugBlockTileEntity
  16. extends TileEntity
  17. implements SimpleComponent
  18. {
  19. DebugCard bindedDebugCard;
  20.  
  21. public class EnvHostSup
  22. implements EnvironmentHost
  23. {
  24. DebugBlockTileEntity bindedDBTE;
  25.  
  26. public EnvHostSup(DebugBlockTileEntity bindedDBTE)
  27. {
  28. this.bindedDBTE = bindedDBTE;
  29. }
  30.  
  31. public World world()
  32. {
  33. return this.bindedDBTE.field_145850_b;
  34. }
  35.  
  36. public double xPosition()
  37. {
  38. return this.bindedDBTE.field_145851_c;
  39. }
  40.  
  41. public double yPosition()
  42. {
  43. return this.bindedDBTE.field_145848_d;
  44. }
  45.  
  46. public double zPosition()
  47. {
  48. return this.bindedDBTE.field_145849_e;
  49. }
  50.  
  51. public void markChanged()
  52. {
  53. System.out.println("MARK CHANGED");
  54. }
  55. }
  56.  
  57. public DebugBlockTileEntity()
  58. {
  59. this.bindedDebugCard = new DebugCard(new EnvHostSup(this));
  60. }
  61.  
  62. public String getComponentName()
  63. {
  64. return "debug_block";
  65. }
  66.  
  67. @Callback(doc="function(value:number):number -- Changes the component network's energy buffer by the specified delta.")
  68. public Object[] changeBuffer(Context cntxt, Arguments a)
  69. {
  70. return this.bindedDebugCard.changeBuffer(cntxt, a);
  71. }
  72.  
  73. @Callback(doc="function():number -- Get the container's X position in the world.")
  74. public Object[] getX(Context cntxt, Arguments a)
  75. {
  76. return this.bindedDebugCard.getX(cntxt, a);
  77. }
  78.  
  79. @Callback(doc="function():number -- Get the container's Y position in the world.")
  80. public Object[] getY(Context cntxt, Arguments a)
  81. {
  82. return this.bindedDebugCard.getY(cntxt, a);
  83. }
  84.  
  85. @Callback(doc="function():number -- Get the container's Z position in the world.")
  86. public Object[] getZ(Context cntxt, Arguments a)
  87. {
  88. return this.bindedDebugCard.getZ(cntxt, a);
  89. }
  90.  
  91. @Callback(doc="function([id:number]):userdata -- Get the world object for the specified dimension ID, or the container's.")
  92. public Object[] getWorld(Context cntxt, Arguments a)
  93. {
  94. return this.bindedDebugCard.getWorld(cntxt, a);
  95. }
  96.  
  97. @Callback(doc="function():table -- Get a list of all world IDs, loaded and unloaded.")
  98. public Object[] getWorlds(Context cntxt, Arguments a)
  99. {
  100. return this.bindedDebugCard.getWorlds(cntxt, a);
  101. }
  102.  
  103. @Callback(doc="function(name:string):userdata -- Get the entity of a player.")
  104. public Object[] getPlayer(Context cntxt, Arguments a)
  105. {
  106. return this.bindedDebugCard.getPlayer(cntxt, a);
  107. }
  108.  
  109. @Callback(doc="function():table -- Get a list of currently logged-in players.")
  110. public Object[] getPlayers(Context cntxt, Arguments a)
  111. {
  112. return this.bindedDebugCard.getPlayers(cntxt, a);
  113. }
  114.  
  115. @Callback(doc="function(name:string):boolean -- Get whether a mod or API is loaded.")
  116. public Object[] isModLoaded(Context cntxt, Arguments a)
  117. {
  118. return this.bindedDebugCard.isModLoaded(cntxt, a);
  119. }
  120.  
  121. @Callback(doc="function(command:string):number -- Runs an arbitrary command using a fake player.")
  122. public Object[] runCommand(Context cntxt, Arguments a)
  123. {
  124. return this.bindedDebugCard.runCommand(cntxt, a);
  125. }
  126.  
  127. @Callback(doc="function(x:number, y:number, z:number):boolean -- Connect the debug card to the block at the specified coordinates.")
  128. public Object[] connectToBlock(Context cntxt, Arguments a)
  129. {
  130. return this.bindedDebugCard.connectToBlock(cntxt, a);
  131. }
  132.  
  133. @Callback(doc="function():userdata -- Test method for user-data and general value conversion.")
  134. public Object[] test(Context cntxt, Arguments a)
  135. {
  136. return this.bindedDebugCard.test(cntxt, a);
  137. }
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement