Advertisement
Guest User

Untitled

a guest
Feb 11th, 2019
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. @Override
  2. public void update()
  3. {
  4. //Handle check block nearby
  5. if(world.getBlockState(pos).getValue(FACING) != null) {
  6. //Check block neighbourPos
  7. EnumFacing face = (EnumFacing)world.getBlockState(pos).getValue(FACING);
  8. if( face.equals( EnumFacing.NORTH ) ) {
  9. neighbourPos = pos.offset(EnumFacing.NORTH);
  10.  
  11. neighbourState = world.getBlockState(neighbourPos);
  12.  
  13. neighbourBlock = neighbourState.getBlock();
  14.  
  15. if ( neighbourBlock == ModBlocks.FLUX_GENERATOR_BLOCK ) {
  16.  
  17. if( neighbourState.getValue(FACING).equals( EnumFacing.EAST ) || neighbourState.getValue(FACING).equals( EnumFacing.WEST ) ) {
  18.  
  19. }
  20. }
  21. } else if( face.equals( EnumFacing.SOUTH ) ) {
  22. neighbourPos = pos.offset(EnumFacing.SOUTH);
  23.  
  24. neighbourState = world.getBlockState(neighbourPos);
  25.  
  26. neighbourBlock = neighbourState.getBlock();
  27.  
  28. if ( neighbourBlock == ModBlocks.FLUX_GENERATOR_BLOCK ) {
  29.  
  30. if( neighbourState.getValue(FACING).equals( EnumFacing.EAST ) || neighbourState.getValue(FACING).equals( EnumFacing.WEST ) ) {
  31.  
  32. }
  33. }
  34. } else if( face.equals( EnumFacing.EAST ) ) {
  35. neighbourPos = pos.offset(EnumFacing.EAST);
  36.  
  37. neighbourState = world.getBlockState(neighbourPos);
  38.  
  39. neighbourBlock = neighbourState.getBlock();
  40.  
  41. if ( neighbourBlock == ModBlocks.FLUX_GENERATOR_BLOCK ) {
  42.  
  43. if( neighbourState.getValue(FACING).equals( EnumFacing.NORTH ) || neighbourState.getValue(FACING).equals( EnumFacing.SOUTH ) ) {
  44. TileEntity tile = world.getTileEntity(neighbourPos);
  45. if(tile != null) {
  46. if(tile.hasCapability(CapabilityEnergy.ENERGY, EnumFacing.EAST) && energy < 100) {
  47. if(world.getTileEntity(pos).hasCapability(CapabilityEnergy.ENERGY, EnumFacing.EAST)) {
  48. IEnergyStorage tilestorage = tile.getCapability(CapabilityEnergy.ENERGY, EnumFacing.EAST);
  49. int maxOut = tilestorage.extractEnergy(100 - energy, true);
  50. int maxAccept = this.storage.receiveEnergy(maxOut, false);
  51. energy += tilestorage.extractEnergy(maxAccept, false);
  52. System.out.println("MaxOut: " + maxOut + " MaxAccept: " + maxAccept);
  53. }
  54. }
  55. }
  56. }
  57. }
  58. } else if( face.equals( EnumFacing.WEST ) ) {
  59. neighbourPos = pos.offset(EnumFacing.WEST);
  60.  
  61. neighbourState = world.getBlockState(neighbourPos);
  62.  
  63. neighbourBlock = neighbourState.getBlock();
  64.  
  65. if ( neighbourBlock == ModBlocks.FLUX_GENERATOR_BLOCK ) {
  66.  
  67. if( neighbourState.getValue(FACING).equals( EnumFacing.NORTH ) || neighbourState.getValue(FACING).equals( EnumFacing.SOUTH ) ) {
  68.  
  69. }
  70. }
  71. }
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement