Advertisement
MrScautHD

Untitled

Mar 25th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.29 KB | None | 0 0
  1. if (((new Object() {
  2. public int getEnergyStored(IWorld world, BlockPos pos) {
  3. AtomicInteger _retval = new AtomicInteger(0);
  4. TileEntity _ent = world.getTileEntity(pos);
  5. if (_ent != null)
  6. _ent.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(capability -> _retval.set(capability.getEnergyStored()));
  7. return _retval.get();
  8. }
  9. }.getEnergyStored(world, new BlockPos((int) x, (int) y, (int) z))) >= (new Object() {
  10. public double getValue(IWorld world, BlockPos pos, String tag) {
  11. TileEntity tileEntity = world.getTileEntity(pos);
  12. if (tileEntity != null)
  13. return tileEntity.getTileData().getDouble(tag);
  14. return -1;
  15. }
  16. }.getValue(world, new BlockPos((int) x, (int) y, (int) z), "energyall")))) {
  17. if ((new Object() {
  18. public boolean canReceiveEnergy(IWorld world, BlockPos pos) {
  19. AtomicBoolean _retval = new AtomicBoolean(false);
  20. TileEntity _ent = world.getTileEntity(pos);
  21. if (_ent != null)
  22. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.UP).ifPresent(capability -> _retval.set(capability.canReceive()));
  23. return _retval.get();
  24. }
  25. }.canReceiveEnergy(world, new BlockPos((int) x, (int) (y + 1), (int) z)))) {
  26. energy = (double) (new Object() {
  27. public int extractEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  28. AtomicInteger _retval = new AtomicInteger(0);
  29. TileEntity _ent = world.getTileEntity(pos);
  30. if (_ent != null)
  31. _ent.getCapability(CapabilityEnergy.ENERGY, null)
  32. .ifPresent(capability -> _retval.set(capability.extractEnergy(_amount, true)));
  33. return _retval.get();
  34. }
  35. }.extractEnergySimulate(world, new BlockPos((int) x, (int) y, (int) z), (int) 1));
  36. energy = (double) (new Object() {
  37. public int receiveEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  38. AtomicInteger _retval = new AtomicInteger(0);
  39. TileEntity _ent = world.getTileEntity(pos);
  40. if (_ent != null)
  41. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.UP)
  42. .ifPresent(capability -> _retval.set(capability.receiveEnergy(_amount, true)));
  43. return _retval.get();
  44. }
  45. }.receiveEnergySimulate(world, new BlockPos((int) x, (int) (y + 1), (int) z), (int) (energy)));
  46. {
  47. TileEntity _ent = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
  48. int _amount = (int) (energy);
  49. if (_ent != null)
  50. _ent.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(capability -> capability.extractEnergy(_amount, false));
  51. }
  52. {
  53. TileEntity _ent = world.getTileEntity(new BlockPos((int) x, (int) (y + 1), (int) z));
  54. int _amount = (int) (energy);
  55. if (_ent != null)
  56. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.UP).ifPresent(capability -> capability.receiveEnergy(_amount, false));
  57. }
  58. }
  59. if ((new Object() {
  60. public boolean canReceiveEnergy(IWorld world, BlockPos pos) {
  61. AtomicBoolean _retval = new AtomicBoolean(false);
  62. TileEntity _ent = world.getTileEntity(pos);
  63. if (_ent != null)
  64. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.DOWN).ifPresent(capability -> _retval.set(capability.canReceive()));
  65. return _retval.get();
  66. }
  67. }.canReceiveEnergy(world, new BlockPos((int) x, (int) (y - 1), (int) z)))) {
  68. Energy2 = (double) (new Object() {
  69. public int extractEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  70. AtomicInteger _retval = new AtomicInteger(0);
  71. TileEntity _ent = world.getTileEntity(pos);
  72. if (_ent != null)
  73. _ent.getCapability(CapabilityEnergy.ENERGY, null)
  74. .ifPresent(capability -> _retval.set(capability.extractEnergy(_amount, true)));
  75. return _retval.get();
  76. }
  77. }.extractEnergySimulate(world, new BlockPos((int) x, (int) y, (int) z), (int) 1));
  78. Energy2 = (double) (new Object() {
  79. public int receiveEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  80. AtomicInteger _retval = new AtomicInteger(0);
  81. TileEntity _ent = world.getTileEntity(pos);
  82. if (_ent != null)
  83. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.DOWN)
  84. .ifPresent(capability -> _retval.set(capability.receiveEnergy(_amount, true)));
  85. return _retval.get();
  86. }
  87. }.receiveEnergySimulate(world, new BlockPos((int) x, (int) (y - 1), (int) z), (int) (Energy2)));
  88. {
  89. TileEntity _ent = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
  90. int _amount = (int) (Energy2);
  91. if (_ent != null)
  92. _ent.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(capability -> capability.extractEnergy(_amount, false));
  93. }
  94. {
  95. TileEntity _ent = world.getTileEntity(new BlockPos((int) x, (int) (y - 1), (int) z));
  96. int _amount = (int) (Energy2);
  97. if (_ent != null)
  98. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.DOWN).ifPresent(capability -> capability.receiveEnergy(_amount, false));
  99. }
  100. } // side
  101. if ((new Object() {
  102. public boolean canReceiveEnergy(IWorld world, BlockPos pos) {
  103. AtomicBoolean _retval = new AtomicBoolean(false);
  104. TileEntity _ent = world.getTileEntity(pos);
  105. if (_ent != null)
  106. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.SOUTH).ifPresent(capability -> _retval.set(capability.canReceive()));
  107. return _retval.get();
  108. }
  109. }.canReceiveEnergy(world, new BlockPos((int) (x + 1), (int) y, (int) z)))) {
  110. Energy3 = (double) (new Object() {
  111. public int extractEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  112. AtomicInteger _retval = new AtomicInteger(0);
  113. TileEntity _ent = world.getTileEntity(pos);
  114. if (_ent != null)
  115. _ent.getCapability(CapabilityEnergy.ENERGY, null)
  116. .ifPresent(capability -> _retval.set(capability.extractEnergy(_amount, true)));
  117. return _retval.get();
  118. }
  119. }.extractEnergySimulate(world, new BlockPos((int) x, (int) y, (int) z), (int) 1));
  120. Energy3 = (double) (new Object() {
  121. public int receiveEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  122. AtomicInteger _retval = new AtomicInteger(0);
  123. TileEntity _ent = world.getTileEntity(pos);
  124. if (_ent != null)
  125. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.SOUTH)
  126. .ifPresent(capability -> _retval.set(capability.receiveEnergy(_amount, true)));
  127. return _retval.get();
  128. }
  129. }.receiveEnergySimulate(world, new BlockPos((int) (x + 1), (int) y, (int) z), (int) (Energy3)));
  130. {
  131. TileEntity _ent = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
  132. int _amount = (int) (Energy3);
  133. if (_ent != null)
  134. _ent.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(capability -> capability.extractEnergy(_amount, false));
  135. }
  136. {
  137. TileEntity _ent = world.getTileEntity(new BlockPos((int) (x + 1), (int) y, (int) z));
  138. int _amount = (int) (Energy3);
  139. if (_ent != null)
  140. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.SOUTH)
  141. .ifPresent(capability -> capability.receiveEnergy(_amount, false));
  142. }
  143. }
  144. if ((new Object() {
  145. public boolean canReceiveEnergy(IWorld world, BlockPos pos) {
  146. AtomicBoolean _retval = new AtomicBoolean(false);
  147. TileEntity _ent = world.getTileEntity(pos);
  148. if (_ent != null)
  149. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.SOUTH).ifPresent(capability -> _retval.set(capability.canReceive()));
  150. return _retval.get();
  151. }
  152. }.canReceiveEnergy(world, new BlockPos((int) (x - 1), (int) y, (int) z)))) {
  153. Energy4 = (double) (new Object() {
  154. public int extractEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  155. AtomicInteger _retval = new AtomicInteger(0);
  156. TileEntity _ent = world.getTileEntity(pos);
  157. if (_ent != null)
  158. _ent.getCapability(CapabilityEnergy.ENERGY, null)
  159. .ifPresent(capability -> _retval.set(capability.extractEnergy(_amount, true)));
  160. return _retval.get();
  161. }
  162. }.extractEnergySimulate(world, new BlockPos((int) x, (int) y, (int) z), (int) 1));
  163. Energy4 = (double) (new Object() {
  164. public int receiveEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  165. AtomicInteger _retval = new AtomicInteger(0);
  166. TileEntity _ent = world.getTileEntity(pos);
  167. if (_ent != null)
  168. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.SOUTH)
  169. .ifPresent(capability -> _retval.set(capability.receiveEnergy(_amount, true)));
  170. return _retval.get();
  171. }
  172. }.receiveEnergySimulate(world, new BlockPos((int) (x - 1), (int) y, (int) z), (int) (Energy4)));
  173. {
  174. TileEntity _ent = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
  175. int _amount = (int) (Energy4);
  176. if (_ent != null)
  177. _ent.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(capability -> capability.extractEnergy(_amount, false));
  178. }
  179. {
  180. TileEntity _ent = world.getTileEntity(new BlockPos((int) (x - 1), (int) y, (int) z));
  181. int _amount = (int) (Energy4);
  182. if (_ent != null)
  183. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.SOUTH)
  184. .ifPresent(capability -> capability.receiveEnergy(_amount, false));
  185. }
  186. } // side
  187. if ((new Object() {
  188. public boolean canReceiveEnergy(IWorld world, BlockPos pos) {
  189. AtomicBoolean _retval = new AtomicBoolean(false);
  190. TileEntity _ent = world.getTileEntity(pos);
  191. if (_ent != null)
  192. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.NORTH).ifPresent(capability -> _retval.set(capability.canReceive()));
  193. return _retval.get();
  194. }
  195. }.canReceiveEnergy(world, new BlockPos((int) x, (int) y, (int) (z + 1))))) {
  196. Energy5 = (double) (new Object() {
  197. public int extractEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  198. AtomicInteger _retval = new AtomicInteger(0);
  199. TileEntity _ent = world.getTileEntity(pos);
  200. if (_ent != null)
  201. _ent.getCapability(CapabilityEnergy.ENERGY, null)
  202. .ifPresent(capability -> _retval.set(capability.extractEnergy(_amount, true)));
  203. return _retval.get();
  204. }
  205. }.extractEnergySimulate(world, new BlockPos((int) x, (int) y, (int) z), (int) 1));
  206. Energy5 = (double) (new Object() {
  207. public int receiveEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  208. AtomicInteger _retval = new AtomicInteger(0);
  209. TileEntity _ent = world.getTileEntity(pos);
  210. if (_ent != null)
  211. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.NORTH)
  212. .ifPresent(capability -> _retval.set(capability.receiveEnergy(_amount, true)));
  213. return _retval.get();
  214. }
  215. }.receiveEnergySimulate(world, new BlockPos((int) x, (int) y, (int) (z + 1)), (int) (Energy5)));
  216. {
  217. TileEntity _ent = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
  218. int _amount = (int) (Energy5);
  219. if (_ent != null)
  220. _ent.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(capability -> capability.extractEnergy(_amount, false));
  221. }
  222. {
  223. TileEntity _ent = world.getTileEntity(new BlockPos((int) x, (int) y, (int) (z + 1)));
  224. int _amount = (int) (Energy5);
  225. if (_ent != null)
  226. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.NORTH)
  227. .ifPresent(capability -> capability.receiveEnergy(_amount, false));
  228. }
  229. }
  230. if ((new Object() {
  231. public boolean canReceiveEnergy(IWorld world, BlockPos pos) {
  232. AtomicBoolean _retval = new AtomicBoolean(false);
  233. TileEntity _ent = world.getTileEntity(pos);
  234. if (_ent != null)
  235. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.NORTH).ifPresent(capability -> _retval.set(capability.canReceive()));
  236. return _retval.get();
  237. }
  238. }.canReceiveEnergy(world, new BlockPos((int) x, (int) y, (int) (z - 1))))) {
  239. Energy6 = (double) (new Object() {
  240. public int extractEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  241. AtomicInteger _retval = new AtomicInteger(0);
  242. TileEntity _ent = world.getTileEntity(pos);
  243. if (_ent != null)
  244. _ent.getCapability(CapabilityEnergy.ENERGY, null)
  245. .ifPresent(capability -> _retval.set(capability.extractEnergy(_amount, true)));
  246. return _retval.get();
  247. }
  248. }.extractEnergySimulate(world, new BlockPos((int) x, (int) y, (int) z), (int) 1));
  249. Energy6 = (double) (new Object() {
  250. public int receiveEnergySimulate(IWorld world, BlockPos pos, int _amount) {
  251. AtomicInteger _retval = new AtomicInteger(0);
  252. TileEntity _ent = world.getTileEntity(pos);
  253. if (_ent != null)
  254. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.NORTH)
  255. .ifPresent(capability -> _retval.set(capability.receiveEnergy(_amount, true)));
  256. return _retval.get();
  257. }
  258. }.receiveEnergySimulate(world, new BlockPos((int) x, (int) y, (int) (z - 1)), (int) (Energy6)));
  259. {
  260. TileEntity _ent = world.getTileEntity(new BlockPos((int) x, (int) y, (int) z));
  261. int _amount = (int) (Energy6);
  262. if (_ent != null)
  263. _ent.getCapability(CapabilityEnergy.ENERGY, null).ifPresent(capability -> capability.extractEnergy(_amount, false));
  264. }
  265. {
  266. TileEntity _ent = world.getTileEntity(new BlockPos((int) x, (int) y, (int) (z - 1)));
  267. int _amount = (int) (Energy6);
  268. if (_ent != null)
  269. _ent.getCapability(CapabilityEnergy.ENERGY, Direction.NORTH)
  270. .ifPresent(capability -> capability.receiveEnergy(_amount, false));
  271. }
  272. }
  273. }
  274. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement