Program: 63657
Project: 63657
Buggy source:
@Override public IBlockState getActualState(IBlockState state,IBlockAccess world,BlockPos pos){
  TileEntity tile=world.getTileEntity(pos);
  if (tile instanceof TileAlveary) {
    if (tile instanceof TileAlvearyClimatiser) {
      TileAlvearyClimatiser alveary=(TileAlvearyClimatiser)tile;
      if (alveary.isActive()) {
        state=state.withProperty(STATE,State.ON);
      }
 else {
        state=state.withProperty(STATE,State.OFF);
      }
    }
 else     if (tile instanceof TileAlvearySwarmer) {
      TileAlvearySwarmer alveary=(TileAlvearySwarmer)tile;
      if (alveary.isActive()) {
        state=state.withProperty(STATE,State.ON);
      }
 else {
        state=state.withProperty(STATE,State.OFF);
      }
    }
  }
  int meta=((Type)state.getValue(TYPE)).ordinal();
  Block blockXP=world.getBlockState(new BlockPos(pos.getX() + 1,pos.getY(),pos.getZ())).getBlock();
  Block blockXM=world.getBlockState(new BlockPos(pos.getX() - 1,pos.getY(),pos.getZ())).getBlock();
  state=state.withProperty(LEVEL,Level.BOTTOM);
  if (blockXP == this && blockXM != this) {
    IBlockState stateNeighbor=world.getBlockState(new BlockPos(pos.getX() + 1,pos.getY(),pos.getZ()));
    if (stateNeighbor.getBlock().getMetaFromState(stateNeighbor) == 1) {
      if (world.getBlockState(new BlockPos(pos.getX(),pos.getY(),pos.getZ() + 1)).getBlock() != this) {
        switchForSide(state,world,pos);
      }
 else {
        switchForSide(state,world,pos);
      }
    }
  }
 else   if (blockXP != this && blockXM == this) {
    IBlockState stateNeighbor=world.getBlockState(new BlockPos(pos.getX() - 1,pos.getY(),pos.getZ()));
    if (stateNeighbor.getBlock().getMetaFromState(stateNeighbor) == 1) {
      if (world.getBlockState(new BlockPos(pos.getX(),pos.getY(),pos.getZ() + 1)).getBlock() != this) {
        switchForSide(state,world,pos);
      }
 else {
        switchForSide(state,world,pos);
      }
    }
  }
  return super.getActualState(state,world,pos);
}

Fixed version (ground truth):
@Override public IBlockState getActualState(IBlockState state,IBlockAccess world,BlockPos pos){
  TileEntity tile=world.getTileEntity(pos);
  if (tile instanceof TileAlveary) {
    if (tile instanceof TileAlvearyClimatiser) {
      TileAlvearyClimatiser alveary=(TileAlvearyClimatiser)tile;
      if (alveary.isActive()) {
        state=state.withProperty(STATE,State.ON);
      }
 else {
        state=state.withProperty(STATE,State.OFF);
      }
    }
 else     if (tile instanceof TileAlvearySwarmer) {
      TileAlvearySwarmer alveary=(TileAlvearySwarmer)tile;
      if (alveary.isActive()) {
        state=state.withProperty(STATE,State.ON);
      }
 else {
        state=state.withProperty(STATE,State.OFF);
      }
    }
  }
  IBlockState stateXP=world.getBlockState(new BlockPos(pos.getX() + 1,pos.getY(),pos.getZ()));
  IBlockState stateXM=world.getBlockState(new BlockPos(pos.getX() - 1,pos.getY(),pos.getZ()));
  Block blockXP=stateXP.getBlock();
  Block blockXM=stateXM.getBlock();
  state=state.withProperty(LEVEL,AlvearyLevel.MIDDLE);
  if (blockXP == this && blockXM != this) {
    if (stateXP.getValue(TYPE) == AlvearyType.ENTRANCE) {
      if (world.getBlockState(new BlockPos(pos.getX(),pos.getY(),pos.getZ() + 1)).getBlock() != this) {
        state=state.withProperty(LEVEL,AlvearyLevel.RIGHT);
      }
 else {
        state=state.withProperty(LEVEL,AlvearyLevel.LEFT);
      }
    }
  }
 else   if (blockXP != this && blockXM == this) {
    if (stateXM.getValue(TYPE) == AlvearyType.ENTRANCE) {
      if (world.getBlockState(new BlockPos(pos.getX(),pos.getY(),pos.getZ() + 1)).getBlock() != this) {
        state=state.withProperty(LEVEL,AlvearyLevel.LEFT);
      }
 else {
        state=state.withProperty(LEVEL,AlvearyLevel.RIGHT);
      }
    }
  }
  return super.getActualState(state,world,pos);
}