Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void update()
- {
- //Handle check block nearby
- if(world.getBlockState(pos).getValue(FACING) != null) {
- //Check block neighbourPos
- EnumFacing face = (EnumFacing)world.getBlockState(pos).getValue(FACING);
- if( face.equals( EnumFacing.NORTH ) ) {
- neighbourPos = pos.offset(EnumFacing.NORTH);
- neighbourState = world.getBlockState(neighbourPos);
- neighbourBlock = neighbourState.getBlock();
- if ( neighbourBlock == ModBlocks.FLUX_GENERATOR_BLOCK ) {
- if( neighbourState.getValue(FACING).equals( EnumFacing.EAST ) || neighbourState.getValue(FACING).equals( EnumFacing.WEST ) ) {
- }
- }
- } else if( face.equals( EnumFacing.SOUTH ) ) {
- neighbourPos = pos.offset(EnumFacing.SOUTH);
- neighbourState = world.getBlockState(neighbourPos);
- neighbourBlock = neighbourState.getBlock();
- if ( neighbourBlock == ModBlocks.FLUX_GENERATOR_BLOCK ) {
- if( neighbourState.getValue(FACING).equals( EnumFacing.EAST ) || neighbourState.getValue(FACING).equals( EnumFacing.WEST ) ) {
- }
- }
- } else if( face.equals( EnumFacing.EAST ) ) {
- neighbourPos = pos.offset(EnumFacing.EAST);
- neighbourState = world.getBlockState(neighbourPos);
- neighbourBlock = neighbourState.getBlock();
- if ( neighbourBlock == ModBlocks.FLUX_GENERATOR_BLOCK ) {
- if( neighbourState.getValue(FACING).equals( EnumFacing.NORTH ) || neighbourState.getValue(FACING).equals( EnumFacing.SOUTH ) ) {
- TileEntity tile = world.getTileEntity(neighbourPos);
- if(tile != null) {
- if(tile.hasCapability(CapabilityEnergy.ENERGY, EnumFacing.EAST) && energy < 100) {
- if(world.getTileEntity(pos).hasCapability(CapabilityEnergy.ENERGY, EnumFacing.EAST)) {
- IEnergyStorage tilestorage = tile.getCapability(CapabilityEnergy.ENERGY, EnumFacing.EAST);
- int maxOut = tilestorage.extractEnergy(100 - energy, true);
- int maxAccept = this.storage.receiveEnergy(maxOut, false);
- energy += tilestorage.extractEnergy(maxAccept, false);
- System.out.println("MaxOut: " + maxOut + " MaxAccept: " + maxAccept);
- }
- }
- }
- }
- }
- } else if( face.equals( EnumFacing.WEST ) ) {
- neighbourPos = pos.offset(EnumFacing.WEST);
- neighbourState = world.getBlockState(neighbourPos);
- neighbourBlock = neighbourState.getBlock();
- if ( neighbourBlock == ModBlocks.FLUX_GENERATOR_BLOCK ) {
- if( neighbourState.getValue(FACING).equals( EnumFacing.NORTH ) || neighbourState.getValue(FACING).equals( EnumFacing.SOUTH ) ) {
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement